08-11-2011 07:19 PM
I have a simple program that grabs images. I want to create a rectangular ROI on the image (any size, anywhere on the image). If the mouse pointer is INSIDE the rectangular ROI then X will be enabled. My question, how do i specify a rectangular ROI that will enable X if the mouse is anywhere inside it?
I cant find the proper IMAQ VI that will enable me to create a rectangular ROI anywhere on the image with a boolean state that will indicate if the mouse is inside it..
any ideas?
thanks
08-12-2011 08:32 AM
What do you mean by "enable X"? What "X"?
I think if track mouse position relative to the picture while the mouse is over the it, then compare its position to the coordinates of the ROI, you'll be able to determine whether the mouse is inside that ROI.
So mouse coordinate X is in range of ROI min X and ROI max X, AND mouse Y is in range of ROI min Y and ROI max Y. Then you know the mouse is within the ROI. Then enable whatever "X" you are talking about.
08-12-2011 09:15 AM
Or you can use an event structure. If you have a ROI control in your code, there are events that trigger on mouse enter and mouse leave.
08-12-2011 09:16 AM
Use the Input Device Control palette under Connectivity for the mouse position.
08-14-2011 03:42 PM
Hi Peter,
You can track the mouse cursor position on an image display with a property node. To create this property node right-click the image display on the block diagram and select Create»Property Node. This will give you the ability to track 'Last Mouse X Position' and 'Last Mouse Y Position' and compare them to the borders of your rectangular ROI. This is shown in the screenshot below.