Machine Vision

cancel
Showing results for 
Search instead for 
Did you mean: 

Rectangular ROI defined by two points

Solved!
Go to solution

Hello,

 

I'm trying to create a rectangular ROI based on two points A(x1,y1) and B(x2,y2). A and B change between frames so I need the rectangle to move along with them. Is there a non-convoluted way of accomplishing this? As of now it seems I would need to calculate the angle between them and continously update that along with the 'left', 'right', 'top' and 'bottom' coordinates. Any suggestions?

 

Just to clarify, the idea is that A and B are the midpoints of the short sides of the rectangle (respectively).

 

Thank you,

0 Kudos
Message 1 of 3
(3,936 Views)

Hi Tkassis,

 

Based on your mentioning of the angle between the midpoints you talked about, it seems like you're also describing a rotated rectangle.  I think the way you are already doing it is the best way to accomplish this - with the IMAQ Convert Rectangle to ROI VI.  

Julian R.
Applications Engineer
National Instruments
Message 2 of 3
(3,919 Views)
Solution
Accepted by topic author TKassis

Thank you but the rotated rectangle didn't actually work form me. I ended up using some trigonometry to do it. It works well now. I basically calculated the 4 corners of my rectangle and how they move with my moving ROI then then used the Extract Tetragon VI to get my ROI.

0 Kudos
Message 3 of 3
(3,906 Views)