12-02-2020 01:49 PM
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!!
Solved! Go to Solution.
12-02-2020 09:47 PM
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.
Bob Schor
12-03-2020 05:55 AM
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.
12-03-2020 03:23 PM
Thanks a lot. That's what I needed! Kudos!!!
05-31-2025 11:38 PM
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
06-01-2025 10:17 AM - edited 06-01-2025 10:18 AM
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?
06-05-2025 10:45 PM
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.