The Math Forum

Search All of the Math Forum:

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

Math Forum » Discussions » Software » comp.soft-sys.matlab

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

Advanced Search

Back to Topic List Back to Topic List Jump to Tree View Jump to Tree View   Messages: [ Previous | Next ]

Posts: 19
Registered: 8/25/08
Re: Including an area into a circle
Posted: Jan 3, 2011 6:47 PM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply

"Spulber " <> wrote in message <ier8kh$t0u$>...
> > 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?

> ----------------------------------------------------------------------------------------------------------
> Thanks again for your fast reply.
> 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.
> I = imread('proba41.jpg');
> 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!

Point your RSS reader here for a feed of the latest messages in this topic.

[Privacy Policy] [Terms of Use]

© The Math Forum at NCTM 1994-2017. All Rights Reserved.