From Thursday, May 23rd (05:00 PM CDT) through Friday, April 24th (1:30 AM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

Machine Vision

cancel
Showing results for 
Search instead for 
Did you mean: 

shrink ROI

Solved!
Go to solution

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  

0 Kudos
Message 1 of 13
(7,250 Views)

Can you post an image and explain?

0 Kudos
Message 2 of 13
(7,246 Views)

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. 

Download All
0 Kudos
Message 3 of 13
(7,240 Views)

Oh now I get it. I havent tried it but looks very interesting .Let me try and get back

0 Kudos
Message 4 of 13
(7,238 Views)

Thanks for the interest in finding the solution 🙂

I am trying too.

Regards

Aveo

 

0 Kudos
Message 5 of 13
(7,233 Views)

Hello,

 

here is a possible (partial) solution to your problem:

 

Example_VI.png

 

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


https://decibel.ni.com/content/blogs/kl3m3n



"Kudos: Users may give one another Kudos on the forums for posts that they found particularly helpful or insightful."
Message 6 of 13
(7,226 Views)

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

0 Kudos
Message 7 of 13
(7,215 Views)

I was trying the overlay points that we can get from last mouse position from property node inside a while loop .

0 Kudos
Message 8 of 13
(7,211 Views)

@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


https://decibel.ni.com/content/blogs/kl3m3n



"Kudos: Users may give one another Kudos on the forums for posts that they found particularly helpful or insightful."
0 Kudos
Message 9 of 13
(7,199 Views)
Solution
Accepted by topic author aveo

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

Bruce Ammons
Ammons Engineering
Message 10 of 13
(7,188 Views)