04-07-2012 08:05 PM
Hi everybody,
Let me start with I'm sorry for my English.
I have an image which is displayed in Front Panel. The user needs to define a ROI in the image with ROI tools for example rectangle or ellipse. After that the program runs and extracts the spatial coordinates (x, y) of each pixel in the whole ROI and write data into a 2 dimensional array. So I need the spatial coordinates of pixels (not the intensity or color values) along the ROI boundary and inside the ROI too, not just the spatial coordinates along the ROI boundary which we can obtain easily with the pixel coordinates output of IMAQ ROIProfile VI. Can someone help me?
Thanks,
Werty
04-18-2012 12:53 PM
Hello Werty.
One way to do it is to represent your mask (mask is image-content of this image is defined by ROI) as an 2D array of numbers. Useful function for this operation is IMAQ ImageToArray function. Useful example for understanig masks is Mask Example.vi. Useful example for understanding how to transfer image to array is ImageToArray example.vi.Ypu can find those examples in example finder.
After you present mask as array of numbers, compare this image to true value.With this you will get image that will contain true values only in region of intereset.
With this image, you can determine exact coocrdinates of pixels in mask thatcontain your ROI. Look at next two printscreens how to determine those coordinates:
After you determine exact coordinates of ROI in mask, then you can add to those values X and Y offsets of mask (see Mask example to figure out what are those ofsets).
Just in case, I am adding pictures in attachments (thiose pictures represent same block diagram, but with true and false states of case structures).
Hope this will help.
Sofija