I am looking to take snapshots of a live DigiScan image.
However, I want to do so only when a complete (or nearly so) frame has been acquired!
Attaching an event handler to a live DigiScan image does not work, as the image 'changes' with each line acquired serially.
I am hoping to monitor just the last few pixels of the live image and only capture an image when those change. Is this possible?
This answer is merely to post the alternate strategy mentioned in the comments to the answer with the original example script. Please note that the following altered version DOES NOT WORK since the attempt to register an image change listener seems to fail (the listener object is immediately released).
Edit: by BmyGuest (see comments):
The following script shows, that displaying a "sliced" memory creates a new image with a new reference:
The output of that script is something like:
Consequently, the listener script above fails and unregisters the listener because the 'lastPixelImage' does not reference the shown 1-pixel image and hence goes out of scope immediately (removing the listener in the process). The script does work, if one grabs the displayed image after showing it and using that one as reference. Accordingly, the script would also work if the sliced image variable would be held in scope.
Your suggestion is exactly what I did: Using the data_changed event as a trigger, and in the event handling method check the value of the last image pixel for if it has changed. (The initial value of the first pass is guaranteed to be zero. From then on, keep the value of a check.)
So, essentially you’ve answered your own question - what remains unclear?
You can check a single pixel using the
GetPixel()
command, or theimg[x,y]
notation.Example