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 7
(3,522 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 7
(3,475 Views)
Solution
Accepted by topic author 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 7
(3,456 Views)

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

0 Kudos
Message 4 of 7
(3,435 Views)

Hi,

I have a similar problem. I a want to draw a ROI following an mathematical equation (for example y=[[A*sin(x)]], where (x,y) is a pixel coordinate in the image), if possivel to do that?. Because that i understand, entrances for ROI are always came from image which are manually draw.

LMQV

0 Kudos
Message 5 of 7
(1,040 Views)

luis.quispe.v@uni.pe wrote:

I have a similar problem. I a want to draw a ROI following an mathematical equation (for example y=[[A*sin(x)]], where (x,y) is a pixel coordinate in the image), if possivel to do that?. Because that i understand, entrances for ROI are always came from image which are manually draw.


 

The "line" can come from anywhere, but you probably need to do some scaling. X is typically an angle, so you need to decide how to scale befire taking the sine to define the area (xmin, xmax, xscaling to angle). Similarly, sin(x) is in the range of -1 to 1, but y pixel coordinates are always positive integers. You already have A for scaling, but you might also need an offset.

 

We can probably help you better if you would attach a simple image and draw how you think the ROI should look like. So far you only define one horizontal bound. Do the lower and side bounds coincide with the image border?

0 Kudos
Message 6 of 7
(1,014 Views)

Hi haltenbach. I work with an polarimetric interferometer for voltage sensing using crystals with electro-optic properties. In this experience i want estimated a experimental half-wave voltage (which is parameter in a Pockels cell). At the beggining, zero voltage is applied in the electrodes of the Pockels cell, so the pattern fringe is quase-static (for this experience is considered static), so i draw manually a ROI (line in green) to calculate intensity of light in real-time in each pixel along this line. Note the green-line was positioned in a darkness region (which represent a minimal intensity). After that, i applied sinusoidal voltage the pattern fringe starts to move radially outward and inward due to aplied voltage (see the video). Thus, the pixels along the green-line became another intensity because a darkness region will be replaced by a brilliant region. The voltage (amplitude for this case) that induced difference beetween minimal intensity and maximum is a half-wave voltage which i want to estimated. The program that i did works well i managed to calculate experiemental half-wave voltage, but now I wanted to be more rigorous. The region of minimal intensity can be demostrated mathemacally using light propagation in uniaxial crystals theory (and they have the shape of hyperballs aprox) but it is not my intention to divert the focus of my main question with complicated mathematics. If you can show me how to draw a ROI following and easy equation for example (y=A+A*cos(x)) or another, i can continue the programming. I take a print of part of my code that i used to maintain the lineProfile calculated the intensity in real-time while image is recorded by the webcam. I can re-draw the ROI manually anytime without problem, but for this case i want a fixed ROI generating by a math function to intimated intensity along this line. If you could help me I would be very grateful.patternfringeJPG.PNGcodeprofileLine.PNG

0 Kudos
Message 7 of 7
(411 Views)