Why my plot doesn't seem correct?
显示 更早的评论
Hi
I am using a binary image of white and black pixels (see attached image). I want to plot the white area of pixels so I am using a code to count from top white pixel to the last white pixel of the pic.
heights = zeros(1, columns);
for col = 1 : size(seg,2)
thisColumn = seg(:, col);
topRow = find(thisColumn, 1, 'first');
bottomRow = find(thisColumn, 1, 'last');
heights(col) = bottomRow - topRow; % Add 1 if you want.
end
plot(heights(:))
But plot doesn't seem right (see attached image). it should had the form and shape of the white area of the image, means a rectangle with a steep bottom.
Any reason why plot doesn't seem correct?
Thanks
3 个评论
darova
2019-10-10
Where are white pixels?
Hemant Verma
2019-10-11
It would be helpful if you could provide a bit more clarification by :
- Stating clearly what do you want to plot ? By saying "I want to plot the white area of pixels", do you mean you want to plot number of white pixels in each column of image vs the indices of column?
- Providing a .png file of the image (only) you intend to work on (because the one you have attatched contains the image, your plot and background, its difficult to separate the image from background)
Stelios Fanourakis
2019-10-12
回答(0 个)
类别
在 帮助中心 和 File Exchange 中查找有关 Image Arithmetic 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!