Machine Vision

cancel
Showing results for 
Search instead for 
Did you mean: 

Extract a Circular ROI

I am trying to extract a circular region of a part.  What I need to do is find the circular region, set XY=0 at center and extract just the circle to continue processing (black background).
0 Kudos
Message 1 of 23
(11,116 Views)

If you set the input parameters right, the count objects might be able to find the circular object...if it does,...it provides the center x,y coordinates...it also can provide a complete ROI.  You can use the IMAQ Convert ROI to Annulus to convert the xy center and radii to an annulus...from this point I am as lost as you are.  I am trying to do the same thing and don't know were to go from here.

 

If you can set the threshold, and make a mask of the round part of the image...then use the mask to extract only the round part...that might work.  The problem I have been having with that is the images I am working with are grayscale single precision and the mask wants U8...who knew?

 

Please help me too.

 

Thanks.

0 Kudos
Message 2 of 23
(11,102 Views)

Hi, Colleagues,

 

Not fully understand your troubles, but may be following code will be helpful for you:

 

 

 

best regards,

Andrey.

Message Edited by Andrey Dmitriev on 10-21-2008 05:10 PM
Download All
Message 3 of 23
(11,098 Views)

It sounds to me like there are two distinct steps here.

 

First, you need to locate the center and radius of your circular area.  If you know the approximate location, you could use radial edge detection (find circle).  If not, you might use pattern detection or some other method to locate it.

 

Second, after you have your circle, you need to mask it.  The simplest method is to convert a circular ROI to a mask (ROI to Mask), then apply the mask to your image.

 

If you need more help, posting an example image would help us help you.

 

Bruce

Bruce Ammons
Ammons Engineering
Message 4 of 23
(11,096 Views)

What about the conversion of the Grayscale Single Percision to U8 to be able to use the mask...how would that work?

 

SUPER posts and perfect solutions.

0 Kudos
Message 5 of 23
(11,094 Views)

Its will be OK for Grayscale Single as well. The only Mask should be U8. Try to change types of Source and Destination to Grayscale(SGL) and see how it works.

 

Andrey.

 

0 Kudos
Message 6 of 23
(11,090 Views)

Hey guys,

 I am also facing some problem in extracting circular region. In my case I have a coloured image and after conversion to gray scale and finding the circular edge I was trying to extract the circular region based on given xy cordinates and radius(found out by circular edge detection block). I tried to integarte this part of the block diagram with the diagram provided in the snapshots here. I am linking the output of my color plane extraction to the output of the 'Imaq read file block' and have deleted this block as well as the Imaq creat block. I am getting error in Imaq ROIToMask block. The message is-> Imaq Vision:(Hex 0xBFF605B8) Invalid ROI.

0 Kudos
Message 7 of 23
(10,618 Views)

Hi Vineet,

 

Can you post your code so we can see what you are working with?

Stephen Meserve
National Instruments
0 Kudos
Message 8 of 23
(10,592 Views)

 


Invalid ROI

 

This will occur If you have not declared proper buffer. Connect an imaq create to the image destination of roi extractor. Infact connect imaq create to all the img dst.

0 Kudos
Message 9 of 23
(10,565 Views)

Hi,

I have initialized the buffer for each destination as said by you. But the condition is same.... 

0 Kudos
Message 10 of 23
(10,562 Views)