LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

If mouse inside Rectangular ROI then X true

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

 

 

0 Kudos
Message 1 of 5
(2,397 Views)

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.

0 Kudos
Message 2 of 5
(2,382 Views)

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.

LabVIEW Pro Dev & Measurement Studio Pro (VS Pro) 2019 - Unfortunately now moving back to C#, .NET, Python due to forced change to subscription model by NI. 8^{
0 Kudos
Message 3 of 5
(2,376 Views)

Use the Input Device Control palette under Connectivity for the mouse position.

-----------------------------------------------------------------------------------------
Reese, (former CLAD, future CLD)

Some people call me the Space Cowboy!
Some call me the gangster of love.
Some people call me MoReese!
...I'm right here baby, right here, right here, right here at home
0 Kudos
Message 4 of 5
(2,374 Views)

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.

 

InsideROI.PNG

Matt
NI Community Team
National Instruments
0 Kudos
Message 5 of 5
(2,343 Views)