Search All of the Math Forum:

Views expressed in these public forums are not endorsed by NCTM or The Math Forum.

Notice: We are no longer accepting new posts, but the forums will continue to be readable.

Topic: Including an area into a circle
Replies: 20   Last Post: Jan 19, 2011 9:43 PM

 Messages: [ Previous | Next ]
 Forrest Posts: 19 Registered: 8/25/08
Re: Including an area into a circle
Posted: Jan 3, 2011 6:47 PM

"Spulber " <remove.this@yahoo.com> wrote in message <ier8kh\$t0u\$1@fred.mathworks.com>...
> > Re-reading back over your old posts, I think you can just take your
> > gray stuff and erode it by 5 pixels to get pixels where a circle of
> > radius 5 could be placed without touching any other regions. Look
> > into imerode(). Now, explain why you want to do that in the first
> > place.
> >
> > Can you give the code to go from your original picture to the
> > segmented picture?

> ----------------------------------------------------------------------------------------------------------
> What I want to do for this project is to place an object which will creat a mark, like a circle of 5 mm diameter, into an area where there are no errors. The errors are the blobs inside the main circle that I posted here (4 in the actual picture). For that I need to calculate an area where it is ok to place that object which will create the circle. The teacher asked me to make the algorithm in such a manner that creates some extra circles (let's say a maximum of 5 extra circles), although the ideal would be to draw all the areas where a future circle can be placed.
> But before I start to research how to command a robotic arm to place the object into the center of the future circle, I must find the coordinates of the circles, which I did with your help and to draw the circles on top of the picture that I have.
>
> BW = im2bw(I, graythresh(I));
> BW = medfilt2(BW, [5 5]);
> EDT_image = bwdist(BW);
> fartherThan5Away = EDT_image >= 5;
> [rows cols] = find(fartherThan5Away);
> rc = [rows cols]
> imshow(BW)
> axis on
>
> This is the code that I am working with after you replyed to me and I have a bounch of other m files related with this one, trying what I have found before and with what you have suggested me to try.
> The code that I got to before I asked for help here is
>
> I = imread('proba41.jpg'); % se citeste o imagine
> BW = im2bw(I, graythresh(I)); %folosind
> BW = medfilt2(BW, [5 5]); %se calculeaza o medie cu pixelii vecini
> imshow(BW)
> L = bwlabel(BW,4);
> [r,c] = find(L==0);
> rc = [r c]
> [B,L] = bwboundaries(BW,'noholes');
> imshow(label2rgb(L, @jet, [.5 .5 .5]))
> grid on
> hold on
> for k = 1:length(B)
> boundary = B{k};
> plot(boundary(:,2), boundary(:,1), 'w', 'LineWidth', 2)
> end
> imshow(BW)
> axis on
>
> The rc array that I got using your algorithm, the first one posted here, I tried to find a way to split it in smaller arrays, and to make somehow to group pixels so the circles I draw wouldn't touch other circles. I am working on this for 2 months already, and it is very hard because I only was told what to do, and nothing about how to do it, or any hints. What you told me to do probably saved me few extra weeks of attempts.
> Thank you!

Date Subject Author
12/16/10 Forrest
12/16/10 Sean
12/16/10 Forrest
12/16/10 Forrest
12/16/10 ImageAnalyst
12/16/10 ImageAnalyst
12/16/10 Forrest
12/19/10 Forrest
12/19/10 ImageAnalyst
12/19/10 Forrest
12/19/10 ImageAnalyst
12/20/10 Forrest
12/20/10 Forrest
12/20/10 ImageAnalyst
12/20/10 ImageAnalyst
12/21/10 Forrest
1/3/11 Forrest
1/19/11 Forrest
1/19/11 ImageAnalyst
1/19/11 Forrest
1/19/11 ImageAnalyst