Obtain image from just one sector in a scanner (python)

3

Good afternoon! I need to develop a python application and I can not get the program to get an image of a sector of the scanner, only the whole area that the scanner can scan (approximately one A4 sheet). I'm still a beginner in language.

My need is to monitor one area of the scanner, for example 2 images per minute. Only I do not need the A4 sheet that the scanner is capable of. I need a sector, a square 10cm x 10cm.

As soon as the software detects any changes from the previous image to the current image, I would like it to reproduce an alert sound and stop monitoring.

My problem is that using lib Twain 1.0.5 and Image Scanner I can not define an area. In all the tests that I have accomplished, it is always the "A4 sheet".

I am totally open to suggestions, even for programming language exchange. My fear (and guess) is that these libraries do not account for what I need and I found no other for testing.

The closest I got to what I needed was when I modified the value in the "simple_base.py" file of the Twain 1.0.5 library:

  

self.SD.RequestAcquire (0, 0) # 1.1 to show user interface scanner

By setting the value from (0, 0) to (1, 1) the program opens a scanner driver window where I can adjust so that the scanner only reads an area. The problem is that this is done manually. I wanted to leave an area as default because it is always the one that should be monitored.

Thank you!

    
asked by anonymous 20.09.2015 / 22:48

1 answer

-2

Take A4 sheet scanned by the program, see its width resolution, choose the area you want to use and write something like this, replace the values with the lib functions you use (just one hunch, I do not know the lib you use, but it has a great chance of working):

if ImageChange in ResoluçãoAreaQueDesejaUtilizar:
    script

or try using the arguments of the lib methods, ImageChange (ResolutionAreaThat You Want to Use)

    
21.09.2015 / 20:36