フィルターのクリア

why aren't black pixels appearing where the imfreehand contour was drawn?

1 回表示 (過去 30 日間)
Antonio
Antonio 2013 年 2 月 2 日
Consider this:
imag = imread ('pout.tif');
figure, imshow (imag);
h = imfreehand (gca, 'Closed', false);
position = int16(getPosition(h));
for i=1:size(position,1)
imag([position(i,1),position(i,2)])=0;
%attempts to mark the positions on the contour as black
end
figure, imshow(imag); %%no changes shown, why?
What I'm missing here?

採用された回答

Image Analyst
Image Analyst 2013 年 2 月 2 日
You used brackets around the row and column, which ruined it. Plus you reversed the row and columns. x is column, not row! And y is row, not column! Try it this way:
for i=1:size(position,1)
imag(position(i,2),position(i,1))=0;
%attempts to mark the positions on the contour as black
end

その他の回答 (0 件)

Community Treasure Hunt

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

Start Hunting!

Translated by