How i can calculate row wise avg of an image??

temp1 = double(imread('im1.JPG')); %img1.jpg is a 240*20 pixels in size;
%expected output 240 rows with single column with avg or mean ;
output= mean(temp1,240)

 Respuesta aceptada

Thorsten
Thorsten el 30 de Jun. de 2015
output = mean(temp1, 2);

4 comentarios

Jan
Jan el 30 de Jun. de 2015
Exactly. As the documentation of mean explains: The 2nd argument is the dimension to operate on, not the size of this dimension.
Sohel Ahammed
Sohel Ahammed el 30 de Jun. de 2015
I used this code: output=mean(temp1,2); it shows only 20 rows. but my image is 240*20.it should shows 240 rows.
I interpreted 240*20 as row x column; if it is x * y, you can use Stephen's code or simply
output = mean(temp1);

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Images en Centro de ayuda y File Exchange.

Etiquetas

Aún no se han introducido etiquetas.

Preguntada:

el 30 de Jun. de 2015

Comentada:

el 30 de Jun. de 2015

Community Treasure Hunt

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

Start Hunting!

Translated by