scan-manager -- python app for controlling tethered cameras

General discussion about software packages and releases, new software you've found, and threads by programmers and script writers.

Re: scan-manager -- python app for controlling tethered came

Postby og200 » 13 Apr 2012, 17:58

tkr wrote:Oren,
I am unable to shoot manually with my camera, when gphoto2 is also running and in control.


OK, so there's not much we can do with that camera over USB. An EyeFi card might be the only option here (they're about $50 -- cheaper than a new camera if you just have to have some kind of tethred shooting). (See below about using the dummy API with this.)

tkr wrote:Qs 1: I just found a used Canon A590-IS, listed on my local Craiglist for $60. Will I be able to use Scanmanager to get live-view functionality as well remote control ?


Hmm...it's not supported out of the box but CHDK is available for it. I don't know if live view is available in standard CHDK builds yet or if live view or remote shooting via CHDK work with libgphoto2 at all. So the answer is maybe, with some setup, but its untested. Having said that, it would be great if someone could test gphoto (and ScanManager) with CHDK and exactly this sort of camera (i.e. one with no remote support out of the box but supported via CHDK). It would vastly increase the number of cheap compacts you could run tethered if we knew this worked.

tkr wrote:Qs 2: Am I using the 'dummy API' in the manner it which it was intended ? If I'm right, I should be able to use this method to also import some shots that I had taken earlier, and run the calibration/rotation/cropping on them


Well, not really. ScanTailor does the post-processing job brilliantly -- much better than I could do it (and there are other packages discussed here too -- e.g. BookScanWizard -- that will also do a very good job for batch processing).

The dummy API is really designed for something like the EyeFi card (people have used it with your camera with some success, e.g. here http://forums.eye.fi/viewtopic.php?f=8&t=1100), not for importing existing pictures. With an EyeFi card you can use something like ScanManager with any camera. Just point it (using the Dummy API) at your EyeFi network share and shoot manually. As soon as a new shot gets written to the SD card in ScanManager will see it and move it to the PC, showing you a nice zoomable view of the shot on screen so you can check it as you turn pages (you can also reorder shots by dragging the thumbnails around and delete a bad shot by right-clicking on the thumbnail so one mistake doesn't mean you have to open up scantailor in interactive mode and start fiddling with the pages).

tkr wrote:Qs 3: Most cameras have a grid superimposed on the viewfinder, which helps in lining up the edges of the book. Would that be something that your live-preview would (optionally ?) be able to incorporate - don't know what is involved or how much work it is. The advantage would be that it would also save a rotation step in software - the step is currently needed when the book edge is a bit tilted.


A grid is easly enough to do. I'll probably include one when I add the cropping code.
og200
 
Posts: 62
Joined: 26 Mar 2012, 15:38
Location: Oxford, United Kingdom

Re: scan-manager -- python app for controlling tethered came

Postby tkr » 13 Apr 2012, 20:34

A search on the internet revealed that someone else was able to succeed in using a A590-IS with CHDK to get live preview and remote capture. Seems to have worked even on one of the newer (post 2009) A590-IS's.
I'm not experienced enough to know how to actually implement it, but I thought the following links would be useful to OG and the community.

- http://chdk.setepontos.com/index.php?topic=5282.0 {a python-based photo-booth application with live preview using a A590 is mentioned }
- http://code.google.com/p/chdkphotobooth/ {a link from above which purports to have the code}
- https://github.com/mweerden/CHDKPTPRemo ... te-preview {code adding support for remote pre-view in CHDK }
- http://www.youtube.com/watch?v=Fg-1Hm2V ... re=related {and finally a youtube video of live-preview from a A-590 using chdk-ptp}

- http://chdk.wikia.com/wiki/PTP_Extensio ... torical.29 { a mention of a binary available for the A590, which will implement live-preview}
- https://trac.assembla.com/chdk/browser/ ... c?rev=1706 {example of an implementation of live-view, using C }
TKR
tkr
 
Posts: 30
Joined: 29 Jan 2012, 21:53

Re: scan-manager -- python app for controlling tethered came

Postby og200 » 14 Apr 2012, 20:27

TKR: that looks promising (some impressive googling there!) -- I don't see anything about libgphoto2/gphoto2 with CHDK. If CHDK works tethered with gphoto2 then CHDK-supporting cameras should work with ScanManager as is (i.e. no need to implement anything, just put CHDK on the camera and use the libgphoto2 backend). I couldn't find any information about CHDK's PTP and gphoto2 though (other than in the gphoto2 sources).

I've just checked in new code that includes:
  • automatic calibration: point it at a chessboard and it will correct for keystoning and some lens distortion as well as auto-calculating DPI (it will even undistort your live viewfinder video feed)
  • rotation:rotate the viewfinder and captured images as they come in
  • cropping: I'm still thinking about the best way to do this in the UI but there's a working method in there now
  • background processing and thumbnailing: these are all done in a separate thread now so you don't have to wait for them to complete before taking the next shot

If there's any interest in it I can up a new binary build for Windows. I'm holding off at the moment because I want to include a facility for generating and priniting a chessboard pattern of any required size (I suspect it may work best if you calibrate with a pattern which covers your book page and isn't much larger).

This is basically feature complete for my purposes now. I'd love to know if the ligtphoto2 backend works with CHDK's PTP though.
og200
 
Posts: 62
Joined: 26 Mar 2012, 15:38
Location: Oxford, United Kingdom

Re: scan-manager -- python app for controlling tethered came

Postby tkr » 14 Apr 2012, 21:39

OG,
- Could you please upload a new windows build binary ? Been waiting to try it.

- I believe (from googling) that it is possible to take remote captures using libgphoto2. Guess the outstanding question is whether you can also get a live preview from the cam, over the USB link. (The A590 does have a separate video output connector which displays a live feed) If libgphoto2 does work, wonder if you could do a pseudo- live-feed where you download a pic every 2 seconds or so.... ?

I'll try out Scanmanager when I go to check out the A590-IS and report back....

TKR
tkr
 
Posts: 30
Joined: 29 Jan 2012, 21:53

Re: scan-manager -- python app for controlling tethered came

Postby og200 » 15 Apr 2012, 18:06

I've just put up a new windows build (v0.4) -- it includes the features I mentioned before and it no longer needs to run as administrator. Cropping is a bit broken at the moment. I still need to think up a neat way of laying out the UI for it.

TKR: that's an interesting thought about the pseudo live feed but in practice I think using the last image as a guide is good enough if you can't get live data. I worked with my Nikon D80 (no viewfinder feed) for ages with my old version of this app and I just referenced the last photo to realign as I went along, deleting the image if it was too far off.

But if you do want live viewfinder data and your camera/CHDK doesn't support it, how about using something like this http://www.amazon.com/EasyCAP-DC60-Creator-Capture-High-quality/dp/B002H3BSCM? It's $7 on Amazon. Much cheaper than an LCD video monitor (assuming you're already shooting from a computer).
easycap.jpg
EasyCap DC60 USB Video Grabber
easycap.jpg (4.78 KiB) Viewed 417 times


You can get 2- and 4-channel versions for not much more than that if you have two cameras. Just hook up the camera's composite video to the USB stick and it should work nicely. You could use it with a video window open alongside ScanManager for now but if this sort of thing turns out to be of interest it would be trivial for me to make ScanManager grab video frames from these devices and show them on screen (well, trivial so long as OpenCV can talk to them and it can talk to quite a few video capture devices).
og200
 
Posts: 62
Joined: 26 Mar 2012, 15:38
Location: Oxford, United Kingdom

Re: scan-manager -- python app for controlling tethered came

Postby tkr » 15 Apr 2012, 18:32

OG,
No luck with that build - I can't even get the main application screen to come up.
Error message in the logfile:

Traceback (most recent call last):
File "scanmanager.py", line 1, in <module>
File "gui\main.pyc", line 2, in <module>
File "gui\shooting.pyc", line 7, in <module>
File "gui\cameraui.pyc", line 10, in <module>
File "log.pyc", line 72, in logException
File "log.pyc", line 77, in log
NameError: global name 'logger' is not defined
Traceback (most recent call last):
File "scanmanager.py", line 1, in <module>
File "gui\main.pyc", line 2, in <module>
File "gui\shooting.pyc", line 7, in <module>
File "gui\cameraui.pyc", line 10, in <module>
File "log.pyc", line 72, in logException
File "log.pyc", line 77, in log
NameError: global name 'logger' is not defined
tkr
 
Posts: 30
Joined: 29 Jan 2012, 21:53

Re: scan-manager -- python app for controlling tethered came

Postby Fab52 » 15 Apr 2012, 20:56

Hi,

I download ScanManager v0.4 built to test it with my Nikon D90... From the setting screen under "choose Api" I don't see Nikon SDK... Is it available ???
Do I have to download the SDK ???
I try WIA and GPhoto API and under "choose camera" the only choice I have is "not configured"
Do I miss something here???


Thanks for your help!!!

Fab
Fab52
 
Posts: 63
Joined: 21 Feb 2012, 21:10
Location: Montreal South Shore, Quebec, Canada

Re: scan-manager -- python app for controlling tethered came

Postby og200 » 16 Apr 2012, 03:36

Fab52 wrote:I try WIA and GPhoto API and under "choose camera" the only choice I have is "not configured"

Hi Fab, did you download libusb-win32 and install a filter driver for your D90? I've described the procedure below but before you try it could you uninstall v0.4, delete your scanmanager.settings file (under scanmanager in your user folder) and install 0.4.1? 0.4 was a bit broken!

The procedure for using the GPhoto backend (which is the best bet for most cameras) is to download the binaries from here http://sourceforge.net/projects/libusb-win32/files/ (libusb-win32-bin-1.2.6.0.zip), unzip them somewhere, then in .\bin run the inf-wizard, pick your camera, save the .inf file it produces anywhere, and then click the 'Install...' button. If this app gets used much I'll try to build in a wizard that guides you through doing this.

With the GPhoto backend it worked beautifully with my D80 so I didn't feel the need to update the Nikon SDK wrapper. If there's a call for it I may still do that but for now I think the GPhoto wrapper is the way to go.

screenshot.jpg
Installing a libusb-win32 filter driver
screenshot.jpg (31.09 KiB) Viewed 407 times


By the way, you have to remove the libusb-win32 filter driver before the camera will work with other programs. To do this just go to Control Panel -> System -> Device Manager -> libusb-win32 devices (on the device tree) -> your camera: right click here and press 'Uninstall'.

tkr wrote:No luck with that build - I can't even get the main application screen to come up.

Oops, sorry TKR, it looks like the new calibration stuff was stopping the whole app loading for you. Can you try the new build (0.4.1) I just put up -- it's smarter about not failing if it can't get the calbration to load and in any case calibration should work for you now. If it still fails, could you PM me the whole of scanmanager.log (and scanmanager.exe.stdout and scanmanager.exe.stderr if they're created)? I also forgot to say you have to delete your scanmanager.settings file before upgrading (do this for going from 0.4 to 0.4.1 as well -- I'll try to make the app more intelligent about deleting or upgrading settings files at some point).
og200
 
Posts: 62
Joined: 26 Mar 2012, 15:38
Location: Oxford, United Kingdom

Re: scan-manager -- python app for controlling tethered came

Postby og200 » 16 Apr 2012, 03:59

If anyone wants to try out calibration btw you'll need to make up a chessboard pattern. Here's a PDF I use that matches the default settings in the calibration window (if it's horizontal in the image and printed on 1:1 on A4 paper...probably). There's more on the calibration process here http://www.diybookscanner.org/forum/viewtopic.php?f=20&t=2536. The only thing to note is to make sure you get both the width/height pairs right or you'll get some odd results.
Attachments
chessboard.pdf
Calibration chessboard (25 wide by 17 high)
(8.7 KiB) Downloaded 34 times
og200
 
Posts: 62
Joined: 26 Mar 2012, 15:38
Location: Oxford, United Kingdom

Re: scan-manager -- python app for controlling tethered came

Postby tkr » 16 Apr 2012, 11:48

OG,
Some prelim. feedback for code base 0.4.1
- Now Scanmanager app does not crash when loading.
- Accepts operating mode = 'Flat', API=dummy API and continues to main screen. Crop does not work, but I think you already knew that.
- Will hang interminably when choosing operating mode = "a camera for each side of the book', and API=dummy API.

========================================
General:
- Wanted to poke around a bit in the source files. What Windows tool would you suggest I use to do a svn checkout ?

- Am a Perl guy through and through, but this project is so interesting, that I think I'm going to have to learn some Python after all - argh !! esp. since Perl does not have any image processing libraries.

TKR
tkr
 
Posts: 30
Joined: 29 Jan 2012, 21:53

PreviousNext

Return to Programs, Software releases, and more.

Who is online

Users browsing this forum: No registered users and 2 guests