How to resolve error from bwtraceboundary function
显示 更早的评论
Hello! I tried using bwtraceboundary to trace the edge of object in a specific region.
im = imread('block.jpg');
im = rgb2gray(im);
BW = im2bw(im);
imshow(BW,[]);
r = 200;
c = 66;
contour = bwtraceboundary(BW,[r c],'W',8,Inf,'counterclockwise');
hold on;
plot(contour(:,2),contour(:,1),'g','LineWidth',2);
After I have computed, it return with error:
>> bwtrace
Index exceeds matrix dimensions.
Error in bwtrace (line 11)
plot(contour(:,2),contour(:,1),'g','LineWidth',2);
Please kindly help me on this issue.
采纳的回答
更多回答(0 个)
类别
在 帮助中心 和 File Exchange 中查找有关 Object Analysis 的更多信息
产品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!