Good evening! I need to develop a python application and I'm not able to get the program to get an image of a sector of the scanner, only the entire area that the scanner can scan (approximately an A4 sheet). I'm still a beginner in language.
My need is to monitor an area of the scanner, taking for example 2 images per minute. Only I don't need all the A4 sheet the scanner is capable of. I need a sector, a 10cm x 10cm square.
As soon as the software detects any change from the previous image to the current one, I would like it to play a warning sound and stop monitoring.
My problem is that using the Twain 1.0.5 and Image Scanner libs I can't define an area. In all the tests I've done, the result is always the "A4 sheet".
I am totally open to suggestions, including programming language changes. My fear (and guess) is that these aforementioned libraries don't do what I need and I haven't found any other ones to test.
The closest I got to what I needed was when I changed the value in the "simple_base.py" file from the Twain 1.0.5 library:
self.SD.RequestAcquire(0, 0) # 1.1 to show scanner user interface
Setting the value from (0, 0) to (1, 1) the program opens a scanner driver window, where I can set it so that the scanner only reads an area. The problem is that this is done manually. I wanted to leave an area as a default because it is always the one that should be monitored.
Thank you very much!
Take the A4 sheet scanned by the program, see its pixel resolution (width, height), choose the area you want to use and write something like this using it, replace the values with the functions of the lib you use (it's just a guess, no I know the lib you use, but it has a good chance of working):
if ImageChange in ResoluçãoAreaQueDesejaUtilizar: script
or try using the lib method arguments, ImageChange(ResolutionAreaYouWant to Use)