LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

IMAQ ROI

Solved!
Go to solution

Hi everyone,

 

I am trying to implement a VI and I need to get the co-ordinates of all pixels enclosed by a ROI (Freehand). With IMAQ ROIProfile I can only extract the pixel co-ordinates of the points lying on the contour line only. It would be very helpful if anyone could tell me how can I get the all pixel co-ordinates withing the ROI.

 

Thanks in advance!! 

0 Kudos
Message 1 of 4
(289 Views)

I've not used IMAQ ROI Profile, but if it does give you the coordinates of the pixels on the ROI boundary, you can write code to find the coordinates of all the points in the ROI.  It's simple math (though there can be some minor complications).  I'm assuming the following (which might not be true, in which case, ignore all of this ...) -- if you choose any pixel anywhere, then if it is inside the ROI, moving left or right to the edge of the screen will intersect multiple pixels (and an even number of them) on the ROI boundary.

  1. Find the Boundary Pixel with the highest Y value.
  2. Start at the left edge of the screen at this Y value. 
  3. Move to the right until you hit a ROI Boundary Pixel.  Remember it.
  4. Continue moving right until you hit another Boundary Pixel or hit the right edge of the screen.
  5. If you hit another Boundary Pixel, you've found a collection of points inside the ROI.  Go back to Step 3 and see if there are other ROI Pixels at this Y.  Otherwise, you found a "singular" Pixel (think the point at the top of a triangle.
  6. When you hit the right edge of the screen, move down one Pixel and start another "scan" until you reach the bottom of the Screen or find a Y level that has no points on the ROI Boundary.

Bob Schor

0 Kudos
Message 2 of 4
(242 Views)
Solution
Accepted by Zoton

You could let IMAQ ROItoMask do the hard work for you.

 

Is there a reason you need a list of coordinates? A lot of IMAQ functions work with masks.

 

snip.png

Message 3 of 4
(223 Views)

Thanks a lot. That's what I needed! Kudos!!!

0 Kudos
Message 4 of 4
(202 Views)