07-08-2014 05:05 AM
Hi All,
I have found the ROI of an object(irregular) using IMAQ mask to ROI. Now this ROI covers the entire area(100%) of the object.
I want to shrink the ROI ,from all sides, in such a way that only 80%(or any other %) of the area is covered.
How can I do it?
Any suggestion is welcomed.
Regards
Aveo
Solved! Go to Solution.
07-08-2014 05:16 AM
Can you post an image and explain?
07-08-2014 05:32 AM
Hi muks,
I have attached 3 images.
1) The binary object.
2) The binary object with a ROI(green overlay)-100_area.png. This image shows the overlay covering the entire area of the object.
3) The binary object with a reduced ROI (green overlay)-50_area.png. This image shows the overlay covering only 50%(approx) of area from all the sides.
Hope this explains my requirement.
07-08-2014 05:37 AM
Oh now I get it. I havent tried it but looks very interesting .Let me try and get back
07-08-2014 06:13 AM
Thanks for the interest in finding the solution 🙂
I am trying too.
Regards
Aveo
07-08-2014 06:25 AM - edited 07-08-2014 06:41 AM
Hello,
here is a possible (partial) solution to your problem:
The ROI is scaled with respect to the center point of the bounding rectangle (between the subtraction and the addition is the negate operator, followed by the multiplication with the scale constant - it is not clear on the image)...
Best regards,
K
07-08-2014 06:41 AM
Hi Klemen,
Thank you for the reply. Its amazing and works for most of the shapes.
However i shall be dealing with objects which are shaped like a curved cylinder(see attached image).
If your program is applied on the object then the center point lies approximately outside the object(as shown in the image by the black '+' sign ).
How do I tackle this problem?
Thanks.
Regards
Aveo
07-08-2014 06:48 AM
I was trying the overlay points that we can get from last mouse position from property node inside a while loop .
07-08-2014 07:55 AM
@aveo wrote:
Hi Klemen,
Thank you for the reply. Its amazing and works for most of the shapes.
However i shall be dealing with objects which are shaped like a curved cylinder(see attached image).
If your program is applied on the object then the center point lies approximately outside the object(as shown in the image by the black '+' sign ).
How do I tackle this problem?
Thanks.
Regards
Aveo
Hm, this task is more difficult. I hve no idea at the moment, but will think about it...
Best regards,
K
07-08-2014 02:06 PM
I would consider converting the ROI to a binary image (mask), and using the erode function to reduce the size. It will remove an equal number of pixels from all sides, so the shape will change, but it would work for all shapes. Maybe you could loop and remove a couple of layers at a time until the area is the percentage that you want.
Bruce