Any help with bwtraceboundary??

2 Ansichten (letzte 30 Tage)
Sean Farrell
Sean Farrell am 27 Okt. 2016
Beantwortet: Walter Roberson am 27 Okt. 2016
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??

Antworten (1)

Walter Roberson
Walter Roberson am 27 Okt. 2016
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)

Kategorien

Mehr zu Images finden Sie in Help Center und File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by