How to Extract Horizontal and Vertical pixels from color images?

조회 수: 2 (최근 30일)
Selva Karna
Selva Karna 2017년 12월 27일
댓글: Selva Karna 2017년 12월 30일
How to Extract Horizontal and Vertical pixels from color images?
  댓글 수: 1
Rik
Rik 2017년 12월 27일
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.

댓글을 달려면 로그인하십시오.

채택된 답변

Sammit Jain
Sammit Jain 2017년 12월 27일
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
Selva Karna
Selva Karna 2017년 12월 30일
Hi ,Sammit Jain ,
yourRegion = yourImage(a:b,c:d,:); a and b what its refrence????

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Image Processing Toolbox에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by