From: Vassilis on 24 Dec 2009 17:10 ImageAnalyst <imageanalyst(a)mailinator.com> wrote in message <7467001f-787b-473c-9317-adcff818b144(a)j42g2000yqd.googlegroups.com>... > OK, then follow this procedure > 1. convert to monochrome by using rgb2gray or by taking one of the > three color channels. > Then like I said before > 2. threshold > 3. imfill > Now you're done! I think - well... you didn't really say what you > want to do after this. You said only that you "need" or "want to > keep" the region inside the outer perimeter. Thresholding and imfill > will do that for you. Now, if you want to make some kinds of > measurements after that, you can do: > 4. label - either bwlabel or bwconncomp > 5. regionprops > 6. Filter blobs according to some property using ismember() to get a > "keeper" subset of blobs > It should be less than ten lines or so. Post your code if you run > into difficulties. are these directions for me (Vassilis) or for Kenneth?
From: ImageAnalyst on 24 Dec 2009 19:27 For Kenneth - he's the one who asked the question. I presume you're someone else, like me, who's offering a solution to Kenneth's situation.
From: Kenneth Galea on 26 Dec 2009 04:25 "Vassilis " <vpapa(a)ilsp.gr> wrote in message <hh0j0u$1rh$1(a)fred.mathworks.com>... > i tried this: > A=imread('keep_outer_obj.jpg'); > Ag = rgb2gray(A); > A1 = imclose(255-Ag,ones(3)); > A2=im2bw(A1); > A3=imfill(A2,'holes'); > A4= A3-imerode(A3,ones(3)); > A5=imdilate(A4,ones(3)); > [x y]=find(A5>0); > C=uint8(ones(size(A))*255); > for ii=1:length(x) > C(x(ii),y(ii),:) = A(x(ii),y(ii),:); > end > > is the image C what you want? Yes. Thanks a lot. But I have to learn and understand these functions first such as imdilate and imerode since I never used them:/ Thanks for your help
From: Kenneth Galea on 26 Dec 2009 04:32 "Vassilis " <vpapa(a)ilsp.gr> wrote in message <hh0osb$d9v$1(a)fred.mathworks.com>... > ImageAnalyst <imageanalyst(a)mailinator.com> wrote in message <7467001f-787b-473c-9317-adcff818b144(a)j42g2000yqd.googlegroups.com>... > > OK, then follow this procedure > > 1. convert to monochrome by using rgb2gray or by taking one of the > > three color channels. > > Then like I said before > > 2. threshold > > 3. imfill > > Now you're done! I think - well... you didn't really say what you > > want to do after this. You said only that you "need" or "want to > > keep" the region inside the outer perimeter. Thresholding and imfill > > will do that for you. Now, if you want to make some kinds of > > measurements after that, you can do: > > 4. label - either bwlabel or bwconncomp > > 5. regionprops > > 6. Filter blobs according to some property using ismember() to get a > > "keeper" subset of blobs > > It should be less than ten lines or so. Post your code if you run > > into difficulties. > are these directions for me (Vassilis) or for Kenneth? Thanks a lot for your help. Basically my objects will not be symmetrical but any shape. Now what I'll need to do is some research on curvature-symmetry fusion in order to implement visual feedback to control the position of the robotic ARM for the best possible final grasp of the unknown object!!
From: Kenneth Galea on 26 Dec 2009 06:10
ImageAnalyst <imageanalyst(a)mailinator.com> wrote in message <7467001f-787b-473c-9317-adcff818b144(a)j42g2000yqd.googlegroups.com>... > OK, then follow this procedure > 1. convert to monochrome by using rgb2gray or by taking one of the > three color channels. > Then like I said before > 2. threshold > 3. imfill > Now you're done! I think - well... you didn't really say what you > want to do after this. You said only that you "need" or "want to > keep" the region inside the outer perimeter. Thresholding and imfill > will do that for you. Now, if you want to make some kinds of > measurements after that, you can do: > 4. label - either bwlabel or bwconncomp > 5. regionprops > 6. Filter blobs according to some property using ismember() to get a > "keeper" subset of blobs > It should be less than ten lines or so. Post your code if you run > into difficulties. Hi. The only problem I'm having is that when I do imfill the image is becoming all white!!! This is my code: Ag = rgb2gray(A); level = graythresh(Ag); A2=im2bw(Ag,level); A3=imfill(A2,'holes'); figure imshow (A3) In this case A3 is becoming white. I tried several images but still the same result. I think that the objects are not well closed. Do I need to use imclose before filling? |