How to Extract Horizontal and Vertical pixels from color images?

2 visualizaciones (últimos 30 días)
How to Extract Horizontal and Vertical pixels from color images?
  1 comentario
Rik
Rik el 27 de Dic. de 2017
It is unclear what you mean. A color image in Matlab is a m by n by c array, so each pixel is a vector.
Have a read here and here. It will greatly improve your chances of getting an answer.

Iniciar sesión para comentar.

Respuesta aceptada

Sammit Jain
Sammit Jain el 27 de Dic. de 2017
I agree with Rik, the question is kind of unclear, but let's assume the following scenario.
yourImage = imread('yourfilepath.jpg');
%Assuming it's imported as an x by y by z matrix.
yourRegion = yourImage(a:b,c:d,:);
Now these a:b define the rows of your interest, and c:d define the columns, the numbering starts from 1 and goes to x and y respectively for rows and columns. From your question it seems you want a single line of pixels (either vertical or horizontal). So try this:
1. For vertical line:
yourRegion = yourImage(:,columnNo,:);
2. For horizontal line:
yourRegion = yourImage(rowNo,:,:);
Hope this helps.
  1 comentario
Selva Karna
Selva Karna el 30 de Dic. de 2017
Hi ,Sammit Jain ,
yourRegion = yourImage(a:b,c:d,:); a and b what its refrence????

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Image Processing Toolbox en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by