Filter löschen
Filter löschen

Computing the sum of each column in an image

14 Ansichten (letzte 30 Tage)
Niranjan
Niranjan am 22 Jan. 2011
Kommentiert: Sampath Kumar am 17 Okt. 2017
Hi i want to find out the sum of individual columns in an image and draw a plot indicating the number of pixels in each column(A density chart).Here is my code. Please help me further.
CODE:
clc;clear all,close all;
newimage=imread('NEW1.jpg');
count=find(newimage<1);
disp(count);
sum1=sum(newimage');
display(sum1);
OUTPUT:
sum1 =
Columns 1 through 5
69646 69446 18233 68154 57611
Columns 6 through 10
45726 36549 54894 20902 3878
Columns 11 through 15
45726 .......
BUT I WANT MY OUTPUT TO BE AS
4512(say)[sum for the first column] 4561[for the second column] and so on....
HOW TO GET IT??? PLEASE HELP
  6 Kommentare
Walter Roberson
Walter Roberson am 13 Mai 2011
duplicates http://www.mathworks.com/matlabcentral/answers/255-creating-a-plot-of-intensity-of-pixels-across-an-image-using-matlab
Sampath Kumar
Sampath Kumar am 17 Okt. 2017
bar(mean(~im))

Melden Sie sich an, um zu kommentieren.

Akzeptierte Antwort

Walter Roberson
Walter Roberson am 22 Jan. 2011
The number of pixels in each column of an image is a constant. If you only want to count the number of pixels below a certain value, then:
bar(mean(newimage<TheValue)))
  7 Kommentare
Walter Roberson
Walter Roberson am 24 Jan. 2011
You don't need to plot to find that.
t = sum(newimage<TheValue);
[ts, tidx] = sort(t);
min2dist = abs(tidx(2) - tidx(1));
Niranjan
Niranjan am 25 Jan. 2011
Thanks a lot :)

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (2)

Paulo Silva
Paulo Silva am 22 Jan. 2011
[X,map] = imread('trees.tif'); %example of an image
col=1:numel(X(1,:)); %create a column vector for the next code line
Count(col)=sum(X(:,col)); %is this what you want?
  1 Kommentar
Niranjan
Niranjan am 23 Jan. 2011
bar(avg(newimage<1)) when I use the above code I get a bar . But I need a bar with the number of black pixels on the y axis. Can you help?
This is what I am exactly in need of. Please have a look.
http://picasaweb.google.com/lh/photo/uzVPD9_OcmXMtPGw4m0jyJOzMXS1UfqXPDW9N1lFu0w?feat=directlink

Melden Sie sich an, um zu kommentieren.


JEBA CHRISTILDA
JEBA CHRISTILDA am 26 Aug. 2016
Hi i want to create a graph for each blocks of binned image. it was an medical image can anybody please help me.
  1 Kommentar
Walter Roberson
Walter Roberson am 27 Aug. 2016
Please create a new Question for that.
In the new Question, describe what kind of graph you want to create, and indicate whether you need assistance with the dividing into blocks or only with the graphing.

Melden Sie sich an, um zu kommentieren.

Kategorien

Mehr zu Specifying Target for Graphics Output finden Sie in Help Center und File Exchange

Produkte

Community Treasure Hunt

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

Start Hunting!

Translated by