Any help with bwtraceboundary??
조회 수: 4 (최근 30일)
이전 댓글 표시
rot = imrotate(image2,90);
h = imshow(rot,[]);
hp = impixelinfo;
set(hp,'Position',[5 1 300 20]);
% these lines display the pixel info at any point on the grid. I need to
% manually hover over a random point at the edge of a solid region, acquire
% the row and column point, and then use this in the boundary-trace
% function
r = 152;
c = 104;
trace = bwtraceboundary(rot,[r c],'W',8,Inf,'clockwise');
hold on;
plot(trace(:,2),trace(:,1),'g','LineWidth',2);
end
Hi folks, I am trying to write a script using bwtraceboundary. My image processing is correct in that I have a binary logic matrix. The real confusing part of this is down at the bottom of the code where I am trying to use the bwtraceboundary function. I keep getting an error stating index exceeds matrix dimensions because the trace variables ends up resulting as an open vector []. Any thoughts??
댓글 수: 0
답변 (1개)
Walter Roberson
2016년 10월 27일
Try
[r, c] = find(rot, 1, 'first');
You will probably need to use 'E' or 'NE' rather than 'W' as there will definitely not be anything 'W' of the point it finds this way (it will be the west-most point)
댓글 수: 0
참고 항목
카테고리
Help Center 및 File Exchange에서 Contour Plots에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!