Creating a plot of intensity of pixels across an image using MATLAB?

1 回表示 (過去 30 日間)
Niranjan
Niranjan 2011 年 1 月 21 日
コメント済み: Walter Roberson 2020 年 11 月 14 日
Hi am a newbie to MATLAB. Can anyone suggest me a code to plot a graph for number of pixels in each column of an image? any serious help would be appreciated.Thanks in advance.I need a code to get the density of black pixels in every column of an image.

採用された回答

Walter Roberson
Walter Roberson 2011 年 1 月 21 日
It is not clear to me what kind of output you want, but
bar(mean(~im))
should calculate the average density of black (== 0) down the columns and draw a bar chart of the result.
  2 件のコメント
Sumera Yamin
Sumera Yamin 2020 年 11 月 13 日
hi, how can one plot the histogram for sum of intensities on the image along x and y axis.
Walter Roberson
Walter Roberson 2020 年 11 月 14 日
Like
histogram(sum(YourImage,1))
%and
histogram(sum(YourImage,2))

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

その他の回答 (1 件)

Doug Hull
Doug Hull 2011 年 1 月 21 日
Since you want the density of black pixels in an image, I am assuming you have an image that is:
  • Intensity based (not RGB, or indexed)
  • You want only pure black pixels (value 0 for black, 255 for white)
(edit your question if these assumptions are wrong)
im = round(rand(5))*255
subplot(2,1,1)
image(im);
colormap(gray)
isBlack = (im == 0);
numBlack = sum(isBlack);
numPix = size(isBlack,1);
denBlack = numBlack/numPix;
subplot(2,1,2)
plot(denBlack)

カテゴリ

Help Center および File ExchangeLine Plots についてさらに検索

製品

Community Treasure Hunt

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

Start Hunting!

Translated by