01-04-2012 10:09 AM
Hello everyone, I have a question.
Is it possible to take a ROI (perhaps a polyline or freehand drawn one) and subdivide this ROI into rectangular or semi-rectangular rois (with certain size parameters?) I would like to selectively add or subracted certain features in the large ROI before image acquisition.
Thanks,
D.
01-06-2012 11:30 AM
Hi dbrittain,
The only functions I have come across that might be useful for this task would be the IMAQ Group/Ungroup ROIs and IMAQ TransformROI. The Ungroup ROI would potentially let you subdivide your larger ROI so that processing could be performed on an array of smaller ROIs. I would try giving that a shot.
01-09-2012 12:16 PM
Hmm, it possible to just take the total area of the image and divide it by a scalar (ie the transform of the resolution or field of view of a camera) so that that many rois are created?
01-09-2012 12:54 PM
In LabVIEW, the points of a freehand ROI are actually available in ROI Descriptor::Contours::Coordinates. You could try filtering them manually.
Another option that might work for you is to use "IMAQ ROIToMask 2" to create a binary image, then mask your binary image into the separate rectangular regions you want, and then use "IMAQ LabelToROI" to convert back to an ROI from your masked binary image.
I think the attache LabVIEW 2010 example should explain this.
Kevin C.
01-09-2012 02:52 PM
Interesting. I will take a look. The problem is that I need precise boundaries that are not user created, rather I just want the user to select/deselect rois prior to image acquistion to save time by moving around regions which are not fruitful to capture. I am thinking of taking the imagesize and then create centroids in a grid pattern as a mask (if this is possible i have no idea) that are equally spaced in the image. I will then create smaller rois centered at each centroid (with some room to allow overlap by ~5-8%) using something similar to the blob dection software (I found a .vi called AutoROI that does that dynamically).
01-11-2012 11:37 AM
I made some progress. But I still have some questions, if anyone knows how to do this it would be a great help:
Is there a way to iterate the position (Left,Top,Right,Bottom) of a series of reactangles so that a group of rois are tiled over the entire image. I can do only the first row, would I need an addition loop? Thanks.
01-11-2012 05:42 PM
If you could post the code you have so far, that would be helpful. Are you attempting to create an array of ROI descriptors? If so, assuming you plan on having 2+ columns of ROIs, then yes you will likely need multiple loops to handle the iterations. Some code or a screenshot would help us out.
01-12-2012 02:00 PM
Here is the test for the loop, it is just put together, the math beyond subdividing the rois is not correct nor finished, it was a poor hack job. I am more interested in whether this can be done at all...
01-12-2012 06:44 PM - edited 01-12-2012 06:45 PM
I definitely think it can be done. You are already on the right track, and if you add a second loop to iterate in the Y-direction, I think you can finish it. What might be useful is the "Image Size" property to help define the way your loops iterate.
If you decide how large your ROI grid needs to be, you could create an array of booleans allowing the user to select which to actually overlay on the image. You could index elements from this array that dictate whether a section of the grid is actually converted to an ROI and overlaid. As with anything structured this way, your processing would need to happen iteratively as well.
01-13-2012 12:03 PM
Hmm, I am having trouble with this in labview, though it seems trival in Matlab or C, here is my code from matlab:
image='blah'; numberOfRois=sqrt(image(length(:,1))); %my rois will be sqaure and I can adjust the # of rois by a scalar product M=size(blah,1); %x-size of image array N=size(blah,2); %y-size of image array xLeft=0; xRight=0; yTop=0; yBottom=0; for k=0:30:M %if dimensions start at [0,0] [0,0], then create a point every 30 pixels till the max(M) x=[1 N]; y=[k k]; end for k = 0:30:N %same as the last loop but for y-dimensions (or in Labview top and bottom) x = [k k]; y = [1 M]; end
With the code above, I can create an uniformly spaced grid across the image. I am still having trouble with the way nested loops are handled in labview.