I have found a behaviour I don't understand. I have an Image control on the front panel, and am using the MouseDown event in an event loop.
I have returned the ROI coordinates from a property node wired to ctl reference provided by the event structure.
Basically, I have found that when I single click on the image, the ROI coordinates (as shown in an array indicator) do not always update (they do sometimes).
When I double click, they always do.
The image control is being updated at about 17 frames per second.
I assume that I am sometimes "missing" the image update when I am single click, and never miss it when I double click as this takes longer giving the image control time to return the ROI coordinates. In this sense, I assume that an image is deleted from the control, and any ROI becomes undefined, before the new image is updated into the control and the ROI becomes redefined.
I have posted some sample (non-executable) code. Basically, I am grabbing images in a while loop using IMAQ-1394. These are then sent to the Camera Output Image Display indicator.
I am monitoring for mouse down events on this indicator. When this happens, a property node is used to return the ROI coordinates into an array indicator called ROI Coords. Also note that every time an image is grabbed, the ROI coordinates are returned into a cluster indicator called ROI.
Here's the issue: ROI updates every time the buffer is copied into the Image Display However, I would expect ROI Coords to update every time I click on the image. It doesn't, it only happens sporadically.
Thanks for posting some code. Ive verified this behavior. The ROI returned from the event stucture is an iteration behind the ROI in the image while loop, unless the user double clicks the image. I am currently sctratching my head hard for you and as soon as I have an explanation I'll post it for you.
Best regards,
Matt Poole | Applications Engineer | National Instruments
I found an even more strange thing for you to enjoy. If you place a probe on the ctl ref provided by the event structure (i.e. returning a reference to the Camera Output indicator), the ROI coordinates in the event loop are now updated on every mouse click. Bizarre!
PS Some documentation with the ROI cluster would have been useful!
Easy fix for you. Dont use the Mouse Down event. Use Mouse Up. Works 100%. It's worth unchecking the 'Lock front panel' in the Event setup also. To be honest I don't know exactly why this is is a problem. I've highlighted this for further investigation.
But hopefully this can help fix your problem. Let me know how you get on.
Best regards,
Matt Poole | Applications Engineer | National Instruments