DIYBookScanner / spreads

Modular workflow assistant for book digitization
GNU Affero General Public License v3.0
127 stars 53 forks source link

Can`t get cameras to work #150

Open knjigor opened 10 years ago

knjigor commented 10 years ago

Hi, I'm realy new in Spreads and i would like to ask for help. I have finaly managed to make spreds work on Lubuntu 14.04 using this tutorial https://github.com/OliPelz/spreads-ubuntu-trusty, every thing works fine except cammeras, i have Canon A590IS and A1100IS with chdk installed on sd cards. I cant (dont know how actualy) to identify setup cameras to work with spread. Cammeras support remote trigering (tested on windows), but spreads just don`t recognise them. Is there some steps to be done on cameras or sistem for them to work.

When I look in terminal while configuring cameras on guiconfiguration I get this errors:

(.spreads)igor@bsu:~$ spread guiconfigure
guiconfig: No template found for gui
root: Adding setting content from scantailor
root: Adding setting detection from scantailor
root: Adding setting rotate from scantailor
root: Adding setting deskew from scantailor
root: Adding setting split_pages from scantailor
root: Adding setting autopilot from scantailor
root: Adding setting auto_margins from scantailor
root: Adding setting margins from scantailor
root: Adding setting language from tesseract
root: Adding setting mode from web
root: Adding setting standalone_device from web
root: Adding setting debug from web
root: Adding setting postprocessing_server from web
root: Adding setting project_dir from web
root: Adding setting port from web
spreads.plugin: Finding devices for driver "CHDKCameraDevice"
Exception in Tkinter callback
Traceback (most recent call last):
  File "/usr/lib/python2.7/lib-tk/Tkinter.py", line 1489, in __call__
    return self.func(*args)
  File "/home/igor/.spreads/local/lib/python2.7/site-packages/spreads/tkconfigure.py", line 268, in configure_focus
    force_reload=True)
  File "/home/igor/.spreads/local/lib/python2.7/site-packages/spreads/plugin.py", line 474, in get_devices
    devices = list(driver.yield_devices(config['device']))
  File "/home/igor/.spreads/local/lib/python2.7/site-packages/spreadsplug/dev/chdkcamera.py", line 135, in yield_devices
    yield cls(config, dev)
  File "/home/igor/.spreads/local/lib/python2.7/site-packages/spreadsplug/dev/chdkcamera.py", line 152, in __init__
    .format(self._serial_number))
UnicodeEncodeError: 'ascii' codec can't encode character u'\u0409' in position 0: ordinal not in range(128)

Thanx for help

jbaiter commented 10 years ago

Can you upload the output of lsusb -s BUS:DEVNUM -v somewhere, with BUS/DEVNUM being the USB bus and device number of your camera (you can find out what it is by running lsusb without any arguments)? It seems that there are some weird characters in your camera's serial number.

knjigor commented 10 years ago

This is the output:

(.spreads)igor@bsu:~$ lsusb
Bus 001 Device 004: ID 04a9:31c3 Canon, Inc. 
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 005 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 004 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 003 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 002 Device 002: ID 046d:c019 Logitech, Inc. Optical Tilt Wheel Mouse
Bus 002 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
(.spreads)igor@bsu:~$ lsusb -s 04a9:31c3 -V
lsusb (usbutils) 007
knjigor commented 10 years ago

Do I have to do some extra settings on camera, i think i read sometnig about own.txt file on camera with content of odd and even? I have chdk 1.3.0 dev on booth of them installed on sd cards. I have tested chdkptp gui with cameras in linux and it work.

jbaiter commented 10 years ago

The numbers you entered are the vendor and product ID, you need the Bus and Device numbers. Also, it should be -v, not -V. It should be lsusb -s 001:004 -v to get the information for your camera.

own.txt files are currently needed, but you can have spreads generate them for you by running spread configure. This will only work once we get that serial number error sorted out, though :-)

knjigor commented 10 years ago

Sorry, here it is:

(.spreads)igor@bsu:~$ sudo lsusb -v -s 001:004 -v

Bus 001 Device 004: ID 04a9:31c3 Canon, Inc. 
Device Descriptor:
  bLength                18
  bDescriptorType         1
  bcdUSB               2.00
  bDeviceClass            0 (Defined at Interface level)
  bDeviceSubClass         0 
  bDeviceProtocol         0 
  bMaxPacketSize0        64
  idVendor           0x04a9 Canon, Inc.
  idProduct          0x31c3 
  bcdDevice            0.02
  iManufacturer           1 Canon Inc.
  iProduct                2 Canon Digital Camera
  iSerial                 3 E8526C997FEB448E812B258349CC3981
  bNumConfigurations      1
  Configuration Descriptor:
    bLength                 9
    bDescriptorType         2
    wTotalLength           39
    bNumInterfaces          1
    bConfigurationValue     1
    iConfiguration          0 
    bmAttributes         0xc0
      Self Powered
    MaxPower                2mA
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        0
      bAlternateSetting       0
      bNumEndpoints           3
      bInterfaceClass         6 Imaging
      bInterfaceSubClass      1 Still Image Capture
      bInterfaceProtocol      1 Picture Transfer Protocol (PIMA 15470)
      iInterface              0 
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x81  EP 1 IN
        bmAttributes            2
          Transfer Type            Bulk
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0200  1x 512 bytes
        bInterval               0
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x02  EP 2 OUT
        bmAttributes            2
          Transfer Type            Bulk
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0200  1x 512 bytes
        bInterval               0
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x83  EP 3 IN
        bmAttributes            3
          Transfer Type            Interrupt
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0008  1x 8 bytes
        bInterval               9
Device Qualifier (for other device speed):
  bLength                10
  bDescriptorType         6
  bcdUSB               2.00
  bDeviceClass            0 (Defined at Interface level)
  bDeviceSubClass         0 
  bDeviceProtocol         0 
  bMaxPacketSize0        64
  bNumConfigurations      1
Device Status:     0x0001
  Self Powered
jbaiter commented 10 years ago

Hm, that looks all good to me, the serial number is a straight-forward string and 0x0409 is nowhere to be found. Can you try and change the line in chdkcamera.py, line 152 from this:

self.logger.debug("Device has serial number {0}"

to this:

self.logger.debug(u"Device has serial number {0}"

and see if it helps?

knjigor commented 10 years ago

This definitely helped, Spreads now see camera, but I get new error :(

(.spreads)igor@bsu:~$ spread --verbose configure
Please select a device driver from the following list:
  [0]: Keep current (chdkcamera)
  [1]: gphoto2camera
  [2]: chdkcamera
  [3]: dummy
  [4]: None
Select a driver: 
Please select your desired plugins from the following list:
  x 1: autorotate
    2: djvubind
  x 3: gui
    4: hidtrigger
    5: intervaltrigger
    6: pdfbeads
  x 7: scantailor
  x 8: tesseract
  x 9: web
Select a plugin (or hit enter to finish): 
The following postprocessing plugins were detected:
 - autorotate
 - scantailor
 - tesseract
Please enter the extensions in the order that they should be invoked, separated by commas or hit enter to keep the current order:

Do you want to configure the target_page of your devices?
(Required for shooting with two devices) [y/N]: y
Setting target page on cameras
Please connect and turn on the device labeled 'odd'
Press any key when ready.
spreads.plugin: Finding devices for driver "CHDKCameraDevice"
ChdkCamera: Device has serial number Љ
ChdkCamera: Calling chdkptp with arguments: [u'/usr/local/lib/chdkptp/chdkptp', '-c-d=007 -b=001', '-eset cli_verbose=2', '-eluar return get_buildinfo()']
ChdkCamera: Call returned:
['open_camera_dev_usb:usb_ptp_device_reset(): Device or resource busy', 'usb_ptp_get_device_status(): Device or resource busy', 'open_camera_dev_usb: ptp_opensession failed 0x2ff', 'connected: Canon PowerShot A1100 IS, max packet size 512', '1:return:table:{platform="a1100",build_date="Nov 17 2014",build_number="1.3.0",build_time="10:36:06",version="CHDK",platsub="100c",build_revision="3746",platformid=12739,os="dryos",}']
spreads encountered an error:
Traceback (most recent call last):
  File "/home/igor/.spreads/local/lib/python2.7/site-packages/spreads/main.py", line 318, in main
    run()
  File "/home/igor/.spreads/local/lib/python2.7/site-packages/spreads/main.py", line 308, in run
    args.subcommand(config)
  File "/home/igor/.spreads/local/lib/python2.7/site-packages/spreads/cli.py", line 232, in configure
    _set_device_target_page(config, target_page)
  File "/home/igor/.spreads/local/lib/python2.7/site-packages/spreads/cli.py", line 177, in _set_device_target_page
    devs = plugin.get_devices(config, force_reload=True)
  File "/home/igor/.spreads/local/lib/python2.7/site-packages/spreads/plugin.py", line 474, in get_devices
    devices = list(driver.yield_devices(config['device']))
  File "/home/igor/.spreads/local/lib/python2.7/site-packages/spreadsplug/dev/chdkcamera.py", line 135, in yield_devices
    yield cls(config, dev)
  File "/home/igor/.spreads/local/lib/python2.7/site-packages/spreadsplug/dev/chdkcamera.py", line 159, in __init__
    get_result=True)
  File "/home/igor/.spreads/local/lib/python2.7/site-packages/spreadsplug/dev/chdkcamera.py", line 378, in _execute_lua
    return self._parse_lua_output(output)
  File "/home/igor/.spreads/local/lib/python2.7/site-packages/spreadsplug/dev/chdkcamera.py", line 390, in _parse_lua_output
    ret_val = re.match(r'^\d+:return:(.*)', output).group(1)
AttributeError: 'NoneType' object has no attribute 'group'
jbaiter commented 10 years ago

Phew, you are uncovering quite the corner cases here, thank you! :-) I just pushed a fix for the two problems, can you see if it helps?

knjigor commented 10 years ago

Thank you for helping me with all this :-) This solved problems with cameras connecting with spreads, but i have another error, but i think that it hase something to do with chdkptp, spread connect with cameras, it do autofocuse but when i trie to take a picture (web interface) it switch camera to rec mode focuse and report an error (camera automaticly turn off with objective opened). In terminal I get this:

ChdkCamera[odd]: Capture command failed.
spreadsplug.web: WARNING: capture_get_data error I/O error
WARNING: error waiting for shot script nil
ERROR: /usr/local/lib/chdkptp/lua/cli.lua:2274: attempt to concatenate local 'err' (a table value)
stack traceback:
    [C]: in function 'xpcall'
    /usr/local/lib/chdkptp/lua/cli.lua:244: in function 'execute'
    /usr/local/lib/chdkptp/lua/main.lua:206: in function 'do_execute_option'
    /usr/local/lib/chdkptp/lua/main.lua:239: in function 'do_no_gui_startup'
    /usr/local/lib/chdkptp/lua/main.lua:274: in main chunk
    [C]: in function 'require'
    [string "require('main')"]:1: in main chunk
attempted to close non-present device 001:006
rs_init
rs_shoot
get data 1
sending stop message
script wait time 0.0009
Traceback (most recent call last):
  File "/home/igor/.spreads/local/lib/python2.7/site-packages/flask/app.py", line 1475, in full_dispatch_request
    rv = self.dispatch_request()
  File "/home/igor/.spreads/local/lib/python2.7/site-packages/flask/app.py", line 1461, in dispatch_request
    return self.view_functions[rule.endpoint](**req.view_args)
  File "/home/igor/.spreads/local/lib/python2.7/site-packages/spreadsplug/web/endpoints.py", line 327, in view_func
    return func(*args, **kwargs)
  File "/home/igor/.spreads/local/lib/python2.7/site-packages/spreadsplug/web/endpoints.py", line 951, in trigger_capture
    workflow.capture(retake=('retake' in request.args))
  File "/home/igor/.spreads/local/lib/python2.7/site-packages/spreads/workflow.py", line 104, in wrapped_func
    func(*args, **kwargs)
  File "/home/igor/.spreads/local/lib/python2.7/site-packages/spreads/workflow.py", line 900, in capture
    util.check_futures_exceptions(futures)
  File "/home/igor/.spreads/local/lib/python2.7/site-packages/spreads/util.py", line 120, in check_futures_exceptions
    raise exc
CHDKPTPException: WARNING: capture_get_data error I/O error
WARNING: error waiting for shot script nil
ERROR: /usr/local/lib/chdkptp/lua/cli.lua:2274: attempt to concatenate local 'err' (a table value)
stack traceback:
    [C]: in function 'xpcall'
    /usr/local/lib/chdkptp/lua/cli.lua:244: in function 'execute'
    /usr/local/lib/chdkptp/lua/main.lua:206: in function 'do_execute_option'
    /usr/local/lib/chdkptp/lua/main.lua:239: in function 'do_no_gui_startup'
    /usr/local/lib/chdkptp/lua/main.lua:274: in main chunk
    [C]: in function 'require'
    [string "require('main')"]:1: in main chunk
attempted to close non-present device 001:006
rs_init
rs_shoot
get data 1
sending stop message
script wait time 0.0009
tornado.access: 500 POST /api/workflow/9bc115e1-3934-44f2-998f-08d5626b6018/capture (127.0.0.1) 1416.44ms
knjigor commented 10 years ago

I have just tried booth cameras to connect on chdkptp on win xp machine and they work ok.

nafraf commented 10 years ago

Did you try to disable any service which try to talk with camera (gphoto, automatic mounter, etc) ? Maybe this chdk forum thread helps.

knjigor commented 10 years ago

Thanx, that solved problem with A590IS, it trigger now but wont send files to computer, with A1100 it is problem with chdkptp (spreadsplug.web: ERROR: unsupported format rs_init), but needs futher investigation.

Thank you all for helping me

knjigor commented 10 years ago

Hmmm, changed chdk on sd card of A1100 to 1.3 and get same situation as with A590:

ChdkCamera[odd]: Running default focus
ChdkCamera[odd]: Calling chdkptp with arguments: [u'/usr/local/lib/chdkptp/chdkptp', '-c-d=008 -b=001', '-eset cli_verbose=2', '-eluar set_aflock(0)']
ChdkCamera[odd]: Call returned:
['connected: Canon PowerShot A1100 IS, max packet size 512']
Workflow: Running 'prepare_capture' hooks
Workflow: Running 'start_trigger_loop' hooks

I have tried to remote shoot from terminal in chdkptp:

(.spreads)igor@bsu:~$ /usr/local/lib/chdkptp/chdkptp -i -c
connected: Canon PowerShot A1100 IS, max packet size 512
con> rs
con 22> 

and it is working

knjigor commented 10 years ago

Ok, i have just tried spread gui and it is working, it seems that something is wrong with web (could it be because of tutorial and not using latest version of web client, I used this tutorial https://github.com/OliPelz/spreads-ubuntu-trusty)

knjigor commented 10 years ago

Btw is there a way to set output format to be .pdf?

knjigor commented 10 years ago

I investigate a bit further and realise that situation is like this, Spread connect with camera (booth of them, but currently one of time because my batteries died) runes chdkptp take a shoot move picture to computer (/home/igor/scans/test/data/raw) and it is waiting for something

Workflow: Triggering capture.
Workflow: Sending capture command to devices
ChdkCamera[even]: Calling chdkptp with arguments: [u'/usr/local/lib/chdkptp/chdkptp', '-c-d=006 -b=001', '-eset cli_verbose=2', '-eremoteshoot -tv=0.04 -sv=52.0  "/home/igor/scans/test/data/raw/000"']
ChdkCamera[even]: Call returned:
['connected: Canon PowerShot A590 IS, max packet size 512', 'rs_init', 'rs_shoot', 'get data 1', 'rc file /home/igor/scans/test/data/raw/000.jpg 1', 'rc chunk get /home/igor/scans/test/data/raw/000.jpg 1 0', 'rc chunk size:7168 offset:nil last:false', 'rc chunk get /home/igor/scans/test/data/raw/000.jpg 1 1', 'rc chunk size:4845074 offset:nil last:true', 'script wait time 0.0053']
ChdkCamera[even]: Setting EXIF orientation on captured image
Workflow: Running 'capture' hooks

Could it be that it is waiting for other camera to shoot? At web interface i`m getting message "Please wait capture to finish"?

jbaiter commented 10 years ago

Can you check your webbrowser's JavaScript console? Ctrl+J in Chrome, F12 in Firefox. Are there any error messages/warnings?

jbaiter commented 10 years ago

Also, the scan can be made into a PDF by enabling the pdfbeads plugin and running the postprocessing and output steps. Run the web plugin in full mode to get access to that functionality from the web interface.

knjigor commented 10 years ago

Thanx, there were no errors, spread was waiting for another camera, I have just brought new batteries and it work excellent. Regarding web and pdf, I just checked, web plugin is in full mode and i have option shown for postprocessing, i have icon for generate output files but when i click on ti folder stay empty, am I missing something:

spreadsplug.web.tasks: Initiating output generation for workflow 6
Workflow: Generating output files...
Workflow: Running 'output' hooks
Workflow: Done generating output files!
huey.consumer.ConsumerThread: Executing <spreadsplug.web.tasks.queuecmd_output_workflow object at 0x7f715d633c90>
spreadsplug.web.tasks: Initiating output generation for workflow 6
Workflow: Generating output files...
Workflow: Running 'output' hooks
Workflow: Done generating output files!
huey.consumer.ConsumerThread: Executing <spreadsplug.web.tasks.queuecmd_output_workflow object at 0x7f715d633a50>
spreadsplug.web.tasks: Initiating output generation for workflow 6
Workflow: Generating output files...
Workflow: Running 'output' hooks
Workflow: Done generating output files!

I have installed pdfbeads, but don`t know if it is enabled or not :(

knjigor commented 10 years ago

One more question, how to configure scanntailor to leave images in color mode, not to convert them to black and white, and can i generate pdf from raw files?

knjigor commented 10 years ago

Ok, turned pdfbeads on, I get empty name in output:

Workflow: Triggering capture.
Workflow: Sending capture command to devices
ChdkCamera[even]: Calling chdkptp with arguments: [u'/usr/local/lib/chdkptp/chdkptp', '-c-d=003 -b=001', '-eset cli_verbose=2', '-eremoteshoot -tv=0.04 -sv=52.0  "/home/igor/scans/10/data/raw/000"']
ChdkCamera[odd]: Calling chdkptp with arguments: [u'/usr/local/lib/chdkptp/chdkptp', '-c-d=002 -b=001', '-eset cli_verbose=2', '-eremoteshoot -tv=0.04 -sv=52.0  "/home/igor/scans/10/data/raw/001"']
ChdkCamera[even]: Call returned:
['connected: Canon PowerShot A590 IS, max packet size 512', 'rs_init', 'rs_shoot', 'get data 1', 'rc file /home/igor/scans/10/data/raw/000.jpg 1', 'rc chunk get /home/igor/scans/10/data/raw/000.jpg 1 0', 'rc chunk size:9216 offset:nil last:false', 'rc chunk get /home/igor/scans/10/data/raw/000.jpg 1 1', 'rc chunk size:4992000 offset:nil last:false', 'rc chunk get /home/igor/scans/10/data/raw/000.jpg 1 2', 'rc chunk size:512232 offset:nil last:true', 'script wait time 0.0047']
ChdkCamera[even]: Setting EXIF orientation on captured image
ChdkCamera[odd]: Call returned:
['connected: Canon PowerShot A1100 IS, max packet size 512', 'rs_init', 'rs_shoot', 'get data 1', 'rc file /home/igor/scans/10/data/raw/001.jpg 1', 'rc chunk get /home/igor/scans/10/data/raw/001.jpg 1 0', 'rc chunk size:7168 offset:nil last:false', 'rc chunk get /home/igor/scans/10/data/raw/001.jpg 1 1', 'rc chunk size:2130747 offset:nil last:true', 'script wait time 1.7779']
ChdkCamera[odd]: Setting EXIF orientation on captured image
Workflow: Running 'capture' hooks
spreadsplug.web.util: Using EXIF thumbnail for /home/igor/scans/10/data/raw/000.jpg
spreadsplug.web.util: Using EXIF thumbnail for /home/igor/scans/10/data/raw/001.jpg
Workflow: Sending finish_capture command to devices
Workflow: Running 'finish_capture' hooks
Workflow: Running 'stop_trigger_loop' hooks
huey.consumer.ConsumerThread: Executing <spreadsplug.web.tasks.queuecmd_process_workflow object at 0x7f8cba294b50>
spreadsplug.web.tasks: Initiating processing for workflow 10
Workflow: Starting postprocessing...
Workflow: Running 'process' hooks
spreadsplug.autorotate: Rotating images
Workflow: Done with postprocessing!
Workflow: Sending finish_capture command to devices
Workflow: Running 'finish_capture' hooks
Workflow: Running 'stop_trigger_loop' hooks
huey.consumer.ConsumerThread: Executing <spreadsplug.web.tasks.queuecmd_output_workflow object at 0x7f8cb85776d0>
spreadsplug.web.tasks: Initiating output generation for workflow 10
Workflow: Generating output files...
Workflow: Running 'output' hooks
spreadsplug.pdfbeads: Assembling PDF.
spreadsplug.pdfbeads: Running /usr/local/bin/pdfbeads -d -M /tmp/tmpyEwoRO/metadata.txt /tmp/tmpyEwoRO/000_rotated.jpg /tmp/tmpyEwoRO/001_rotated.jpg -o /home/igor/scans/10/data/out/book.pdf
spreadsplug.pdfbeads: pdfbeads stdout:

spreadsplug.pdfbeads: pdfbeads stderr:
/usr/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in `require': iconv will be deprecated in the future, use String#encode instead.
pdfbeads: no pages to process

Workflow: Done generating output files!
jbaiter commented 10 years ago

One more question, how to configure scanntailor to leave images in color mode, not to convert them to black and white, and can i generate pdf from raw files?

Disable the autopilot option for the scantailor plugin, then adjust the output settings in the ScanTailor UI that pops up. Save and quit the UI.

Ok, turned pdfbeads on, I get empty name in output:

IIRC, pdfbeads can only deal with TIF files. So you currently have to run the images through scantailor first. This is clearly not ideal, I will probably make the pdfbeads plugin handle the conversion itself, if there are no TIF files available.

knjigor commented 10 years ago

Unfortunatley this doesn1t eork for me, no matter what I do (check uncheck for options fot scantailor in spreads) in moment spreads start ST (in manual mode) and i go to output before I can even select color/gray scale and apply to all pages it creates b/w tiff images.

I think that it would be really good if we could choose do we want to do post processing with ST or just have single pdf from raw jpg files (if we want to post process in some other app) in workflow.

jbaiter commented 10 years ago

Unfortunatley this doesn1t eork for me, no matter what I do (check uncheck for options fot scantailor in spreads) in moment spreads start ST (in manual mode) and i go to output before I can even select color/gray scale and apply to all pages it creates b/w tiff images.

Sorry, I do not understand. Can you rephrase that/be more specific?

I think that it would be really good if we could choose do we want to do post processing with ST or just have single pdf from raw jpg files (if we want to post process in some other app) in workflow.

Agreed, as I said above.

knjigor commented 10 years ago

It`s like this:

Starting postprocessing...
Rotating images
Generating ScanTailor configuration
If you are changing output settings (in the last step, you *have* to run the last step from the GUI. Due to a bug in ScanTailor, your settings would otherwise be ignored.
Opening ScanTailor GUI for manual adjustment
Generating output images from ScanTailor configuration.
Done with postprocessing!
knjigor commented 10 years ago

Sorry if this is bump, but: I`m not python programmer but I was looking at scantailor.py in spreadsplug folder and config.yaml, and I think that problem might be in line 295 of scantailor.py that say to ST to generate output files if there is non and in this case with default settings (b/w), and there is no line after that would tell it to export files again with different settings. I think that there should be a configuration in this file in autopilot part that would say ST to process images in different mode, or in some other config file like there is configuration for margins in config.yaml etc, because problem might lay in fact that st pre process images with default settings and output in default is b/w and there is no override for that setting.

jbaiter commented 10 years ago

The simplest solution in your case would probably be to just remove those black-and-white files and re-run the postprocessing step. This is all due to a bug in ScanTailor that has already been fixed (https://github.com/scantailor/scantailor/pull/101), however no release has been made since, so it hasn't trickled down to package repositories yet.

knjigor commented 9 years ago

Thanx, Ill trie when I come home. Can I add modification to ST CommandLine.cpp file to resolve this problem for future?

which I can not find unfortunately :(

knjigor commented 9 years ago

Ok, I guess I should install ST from git

knjigor commented 9 years ago

"The simplest solution in your case would probably be to just remove those black-and-white files and re-run the postprocessing step." Sorry but that wont do a trick if i delete monochrome tif files, exit ST with saving project, go step back in gui so ST post processing can be called again i get error:

Workflow: Done with postprocessing!
Gtk-Message: (for origin information, set GTK_DEBUG): failed to retrieve property `GtkRange::activate-slider' of type `gboolean' from rc file value "((GString*) 0x2499120)" of type `GString'
Workflow: Sending finish_capture command to devices
bagit: Adding path /home/igor/scans/e/pagemeta.json to payload
Workflow: Running 'finish_capture' hooks
Workflow: Running 'stop_trigger_loop' hooks
Workflow: Starting postprocessing...
Workflow: Running 'process' hooks
spreadsplug.autorotate: Rotating images
Traceback (most recent call last):
  File "/home/igor/.spreads/local/lib/python2.7/site-packages/spreadsplug/gui/gui.py", line 417, in doPostprocess
    raise future.exception()
OSError: [Errno 2] No such file or directory: '/home/igor/scans/e/data/done/000_rotated.tif'
knjigor commented 9 years ago

Installed ST Enhanced from http://sourceforge.net/projects/scantailor/files/scantailor-devel/enhanced/scantailor-enhanced-20140214.tar.bz2/download but it didn`t solved problem, still bw tiff on output no matter what method I use.

knjigor commented 9 years ago

Actually now i get one picture in color but i can`t reproduce when, sometime it is first sometime second.

jbaiter commented 9 years ago

You have to compile the most recent version from github yourself to get the fix.

knjigor commented 9 years ago

I have cloned this version https://github.com/jbaiter/scantailor.git, and installed it but I get same results.

jbaiter commented 9 years ago

This is because you probably still have the b/w TIFs in the done directory, hence the plugin will skip the last ST step. I just pushed a change to the code that will allow you to remove files from the done directory without crashing the application, please install the latest version from GitHub, remove all files from your done directory and try again.

knjigor commented 9 years ago

I have installed latest version (spreads 0.5git20141127.a7ab) and latest ST (Version: 0.9.11 from git https://github.com/jbaiter/scantailor) but things are same: If I set output in ST to color and apply to all only image that was displayed change to color all others stay bw. If i exit with save, delete tiff images from done directory go step back (to capture) and then next, spread crash with error:

Traceback (most recent call last):
  File "/home/igor/.spreads/local/lib/python2.7/site-packages/spreadsplug/gui/gui.py", line 417, in doPostprocess
    raise future.exception()
OSError: [Errno 2] No such file or directory: '/home/igor/scans/d/data/done/000_rotated.tif'

If I exit and don`t save, delete tif, go step back, then next to procesing, I get same error. Is there any way to configure ST to by default export images to color mode?

knjigor commented 9 years ago

I was looking at code in spreadsplug folder, is there a way to tell autorotate plugin to save files as tiff instead of jpg, that way st could be skipped and pdfbeads could process images and export them directly to pdf?

jbaiter commented 9 years ago

No, the autrotate plugin can only deal with JPEG files. The place for the conversion to TIF would be in the pdfbeads plugin.

Are you doing the last step from the ScanTailor UI or do you let spreads handle it? Also, you must not delete anything from the workflow directory while spreads is running.

knjigor commented 9 years ago

Just tried to set output in ScanTailor after taking pictures, save project, exit ST, exit spreads, deleting b/w tiff files, rerun spreads (project folder is same), skip taking pictures, start postprocess and it is the same thing, I end with b/w tif images.

Are you doing the last step from the ScanTailor UI or do you let spreads handle it? I really dont understand what you mean, I think I have tried every possible combination of steps, and I always end up with b/w images.
Could you please write step by step instruction what to do, I`m starting to feel bit helpless?

jbaiter commented 9 years ago
  1. Make sure you really have the latest version compiled from GitHub for ScanTailor. The same goes for spreads
  2. Forget about spreads for a second, open ScanTailor by itself, load the *_rotated.jpg files, run everything, including the last step, through ScanTailor.
  3. Check the output, everything OK? On to step 3. Only b/w? Either you made a mistake or it's a bug in ScanTailor.
  4. Remove everything in the done folder.
  5. Launch spread --verbose postprocess project-dir
  6. When ScanTailor opens, in the last step, set the mode to 'color', click 'apply to all', save and exit ScanTailor.
  7. Resulting TIFs still in black and white? Upload ~/.config/spreads/spreads.log somewhere, it's probably a problem with spreads.
knjigor commented 9 years ago
  1. I have cloned latest version os ST from your git (Version: 0.9.11 from https://github.com/jbaiter/scantailor), spreads are spreads 0.5git20141127.a7ab:
    1. Done with color images in out folder inside done folder of project
  2. Cut everything from done and paste outside of project folder
  3. Launch spread postprocess /home/igor/scans/9 (spreads are in verbose) resulting in automatic creation of b/w tif files without opening ST.
  4. ST does not open, checked config.yaml inside project folder and it is changed in moment I started spread to default values (autopilot yes)
  5. TIFs are b/w, here is a link to logs https://www.dropbox.com/sh/yf7htx7rxcu6reo/AABKSxBJlOmLEGFBA05OelSTa?dl=0
jbaiter commented 9 years ago

knjigor, please take more time with writing your posts, I'm having a really hard time figuring out what you mean.... Also, when I'm already taking the time and the effort to lay out clear instructions for you what to do to help me resolve the issue, please be so kind and follow them...

I have cloned latest version os ST from your git (Version: 0.9.11 from https://github.com/jbaiter/scantailor), spreads are spreads 0.5git20141127.a7ab: 2, 3. Done with color images in out folder inside done folder of project

Do not use my personal fork, use https://github.com/scantailor/scantailor

Launch spread postprocess /home/igor/scans/9 (spreads are in verbose) resulting in automatic creation of b/w tif files without opening ST.

What do you mean, 'spreads are in verbose'? Did you set verbose: yes in the configuration? The log files you uploaded indicate that you didn't run with verbose enabled, hence they're pretty much useless to me....

ST does not open, checked config.yaml inside project folder and it is changed in moment I started spread to default values (autopilot yes)

Obviously ST will not open if you have autopilot enabled. Run with postprocess --no-autopilot to disable it. What do you mean with 'it is changed in moment I started spread to default values'?

knjigor commented 9 years ago

Sorry for previus post, had a hard working day. I have fresh install of Ubuntu 14.04.1 LTS, installed spreads OliPelz tut. Install scantailor fom git https://github.com/scantailor/scantailor.

What do you mean, 'spreads are in verbose'? Did you set verbose: yes in the configuration? The log files you uploaded indicate that you didn't run with verbose enabled, hence they're pretty much useless to me....

I have configured spreads, in ~/.config/spreads/config.yaml there is option verbose: yes (so if i trie to set that in terminal i get error:

(.spreads)igor@igor-SATELLITE-P500:~$ spread --verbose postprocess /home/igor/scans/0001
usage: spread [-h] [-V] [--loglevel <info/critical/error/warning/debug>]
              [--logfile <str>] [--no-verbose]
              {wizard,configure,guiconfigure,capture,postprocess,output,gui,web}
              ...
spread: error: unrecognized arguments: --verbose

so I set another option loglevel: debug (think that that is what you need))

Started spreads in gui and take fiew photos so I can work with something.

Started scantailor processed images resulting in color tif files, closed st without saving. Selected all that is inside done floder and moved it outside of project folder leaving it empty.

Runed command spread postprocess --verbose --no-autopilot /home/igor/scans/2 resulting with error:

(.spreads)igor@igor-SATELLITE-P500:~$ spread postprocess --verbose --no-autopilot /home/igor/scans/2
usage: spread [-h] [-V] [--loglevel <info/critical/error/warning/debug>]
              [--logfile <str>] [--no-verbose]
              {wizard,configure,guiconfigure,capture,postprocess,output,gui,web}
              ...
spread: error: unrecognized arguments: --verbose

so i have changed command to spread postprocess --no-autopilot /home/igor/scans/2:

spread postprocess --no-autopilot /home/igor/scans/2
Workflow: Initializing workflow /home/igor/scans/2
bagit: Adding path /home/igor/scans/2/bag-info.txt to payload
bagit: Adding path /home/igor/scans/2/config.yml to payload
Workflow: Could not find processed file {0}, removing from workflow.
Workflow: Could not find processed file {0}, removing from workflow.
Workflow: Could not find processed file {0}, removing from workflow.
Workflow: Could not find processed file {0}, removing from workflow.
Workflow: Starting postprocessing...%
Workflow: Running 'process' hooks
spreadsplug.autorotate: Rotating images
spreadsplug.scantailor: Generating ScanTailor configuration
spreadsplug.scantailor: /usr/local/bin/scantailor-cli --start-filter=2 --end-filter=5 --layout=1.5 -o=/tmp/tmp4wDdvL.ScanTailor --margins-top=2.5 --margins-right=2.5 --margins-bottom=2.5 --margins-left=2.5 /home/igor/scans/2/data/done/000_rotated.jpg /home/igor/scans/2/data/done/001_rotated.jpg /tmp/st-outzUr3iW
spreadsplug.scantailor: If you are changing output settings (in the last step, you *have* to run the last step from the GUI. Due to a bug in ScanTailor, your settings would otherwise be ignored.
spreadsplug.scantailor: Opening ScanTailor GUI for manual adjustment
spreadsplug.scantailor: Generating output images from ScanTailor configuration.
spreadsplug.scantailor: Generating output...
spreadsplug.scantailor: Launching those subprocesses!
bagit: Adding path /home/igor/scans/2/data/done to payload
bagit: Adding path /home/igor/scans/2/bag-info.txt to payload
bagit: Adding path /home/igor/scans/2/pagemeta.json to payload
Workflow: Done with postprocessing!

resulting with b/w tif files.

...What do you mean with 'it is changed in moment I started spread to default values'?

With this I mean that if i run spread postprocess --no-autopilot /home/igor/scans/2 spread wil use global configure file not a local project configure file (i have set autopilot: no in local project config.yaml and it was ower written with global ~/.config/spreads/config.yaml )

here is a new log file and congig.yaml https://www.dropbox.com/sh/yf7htx7rxcu6reo/AABKSxBJlOmLEGFBA05OelSTa?dl=0