MATLAB Answers

Why my plot doesn't seem correct?

3 ビュー (過去 30 日間)
Stelios Fanourakis
Stelios Fanourakis 2019 年 10 月 10 日
コメント済み: Stelios Fanourakis 2019 年 10 月 12 日
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 件のコメント
Stelios Fanourakis
Stelios Fanourakis 2019 年 10 月 12 日
Yeah sorry for the inconveniece but at the end I think it's correct. The white area of the image begins just underneath the title "Global Region -Based Segmentation". So the plot should like an horizontal line but it looks like a vertical one. However, if you notice the vertical line of the axes in the plot you'll see that this sharp vertical transition is only a pixel from 30-31 and it may belong to those little discrepancies of one pixel that are apparent a bit left of the real image. So I assume the plot is eventually correct. Thanks for your time

サインインしてコメントする。

回答 (0 件)

Community Treasure Hunt

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

Start Hunting!

Translated by