Binary Image Edge Linking
이 질문을 팔로우합니다.
- 팔로우하는 게시물 피드에서 업데이트를 확인할 수 있습니다.
- 정보 수신 기본 설정에 따라 이메일을 받을 수 있습니다.
오류 발생
페이지가 변경되었기 때문에 동작을 완료할 수 없습니다. 업데이트된 상태를 보려면 페이지를 다시 불러오십시오.
이전 댓글 표시
0 개 추천
I have a binary image of 200 rows and 200 columns. I need to find the distance between two white (255) pixel along the row and column. If the distance is 3 , i need to fill the gap along row and column with ones. I tried something but it doesnt work well. Can anyone please help me ?
vess is the binary output.
[M N]=size(vess);
[x y]=find(vess);
points = [ x y];
[~,ii] = sort(points(:,1));
out = points(ii,:);
% for i=1:M
[M1 N1]=size(points);
% u=2;
for i=1:M1-1
C=[out(i,1),out(i,2);out(i+1,1),out(i+1,2)];
d = round(pdist(C,'euclidean'))
if d==3
p1=[out(i,1),out(i,2)];
p2=[out(i+1,1),out(i+1,2)];
if p1(1)==p2(1)
vess(p1(1),p1(2)+1:p2(2)+1)=1;
end
if p2(2)==p1(2)
vess(p1(1)+1,p1(1):p2(1)+1)=1;
end
end
end
채택된 답변
Image Analyst
2015년 5월 28일
0 개 추천
Yes, I can tell it wouldn't.
- First of all you need to find the endpoints of your lines/curves segments with bwmorph.
- Then you need to label the segments and get a list of all the points in the segment.
- Then you need to get a list of the distances from each endpoint to all other endpoints that are not in the same segment, and pick the endpoint with the smallest distance.
- If the distance is less than some specified allowable distance, you need to use imline() to burn a line into the binary image connecting those two endpoints.
- Repeat for every endpoint.
So that's the algorithm, though it could be made more sophisticated if you were to add criteria like saying the angle of the ends needs to be about the same angle, etc.. So, try to code it up and if you run into trouble, be SURE to attach your binary image of your skeletonized line/curve segments.
댓글 수: 13
Image Analyst
2015년 5월 28일
The top image looks like an edge detection image, and the bottom image looks like the original binary image. Did you use bwmorph(binaryImage, 'skel', inf) to skeletonize the binary image, and bwmorph(binaryImage, 'endpoints') to generate the endpoints image? Did you use bwlabel to label each skeleton segment? Where is your code? You could help me help you if you at least did some of it for me, rather than me writing all of it for you.
Jes
2015년 5월 28일
편집: Image Analyst
2015년 5월 28일
Bottom image is the edge detected image from the original image. Here, I have connect the pixels which are unconnected by using some local processing(based on the distance between white pixels) to improve the accuracy.
%vess -bottom image
vess1=bwmorph(vess, 'skel', inf);
vess2 = bwmorph(vess,'endpoints');
L = bwlabel(vess1);
Image Analyst
2015년 5월 28일
Where is the rest of the code? I think it somehow got cutoff or didn't make it. Where are steps 3, 4, and 5 in the algorithm I gave you?
Jes
2015년 5월 29일
I have little knowledge in MATLAB. I tried the following code: vess4=bwmorph(vess, 'skel', inf); vess3 = bwmorph(vess,'endpoints'); [L num] = bwlabel(vess4); [M N]=size(L);k=1;sum=0;r=1; while k<50 for i=1:M for j=1:N if L(i,j)==k sum=sum+1; x(r)=i; y(r)=j;r=r+1; end end end R(k)=sum;sum=0;k=k+1; end S=vertcat(x,y);S=S'; Please help me further to find the distance from each endpoint to all others.
Image Analyst
2015년 5월 29일
Here's some help: http://www.mathworks.com/matlabcentral/answers/13205-tutorial-how-to-format-your-question-with-markup
Nevermind - I'll work on it and do it. I think it might make a good demo since people often ask about edge linking. Maybe by tomorrow afternoon or the next day I'll have something. Be patient if you want me to do it, but by all means keep working on it yourself.
Jes
2015년 5월 29일
ok. Thanks a lot. I am also keep working.
Jes
2015년 6월 1일
Did you finalize the results ?
Image Analyst
2015년 6월 1일
I'm still working on it. A few things to clean up and perfect. Here is a copy but I'm still going to make changes on it.
Jes
2015년 6월 2일
Thank you very much. have you finalized the code?
Image Analyst
2015년 6월 2일
No, not yet, maybe this weekend. But it would be just things to make it look fancier - most of the code would be the same.
Jes
2015년 6월 2일
Thank you
Could you please help me how to obtain the binary edge linked image (variable) in the above code? Thanks in Advance.
Image Analyst
2015년 6월 3일
That's the part I have not finished yet. But I'll tell you how to do it. You need to use imline() to burn a line into an image and then "OR" that into the main binary image. I'm attaching a demo for doing that, which you can incorporate into the demo I already gave you.
추가 답변 (0개)
카테고리
도움말 센터 및 File Exchange에서 Image Segmentation에 대해 자세히 알아보기
제품
참고 항목
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!웹사이트 선택
번역된 콘텐츠를 보고 지역별 이벤트와 혜택을 살펴보려면 웹사이트를 선택하십시오. 현재 계신 지역에 따라 다음 웹사이트를 권장합니다:
또한 다음 목록에서 웹사이트를 선택하실 수도 있습니다.
사이트 성능 최적화 방법
최고의 사이트 성능을 위해 중국 사이트(중국어 또는 영어)를 선택하십시오. 현재 계신 지역에서는 다른 국가의 MathWorks 사이트 방문이 최적화되지 않았습니다.
미주
- América Latina (Español)
- Canada (English)
- United States (English)
유럽
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)
