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).
Solved! Go to Solution.
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.
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.