필터 지우기
필터 지우기

How to get the pixel color values in one command?

조회 수: 4 (최근 30일)
saravanakumar D
saravanakumar D 2014년 1월 22일
편집: Bruno Pop-Stefanov 2014년 1월 22일
I want to get the color pixel value in one line command or syntax.
I know we have to use get below syntax Red=Image(x,y,1); Green=Image(x,y,2); Blue=(Image(x,y,3);
But it make program too long.
I have to check the color of each pixel in image. So Is there any other syntax to get the specified pixel color range in one array.
I want the output like this
= 255 242 0

채택된 답변

Bruno Pop-Stefanov
Bruno Pop-Stefanov 2014년 1월 22일
편집: Bruno Pop-Stefanov 2014년 1월 22일
Yes, the color is a vector of three values. To access the color of pixel (x,y), you can write:
color = squeeze( Image(x,y,:) );
and color will be a vector of length 3.
Thanks to Walter Roberson for suggesting using squeeze.
As Image Analyst noted in the comments, you can also use the impixel function.
  댓글 수: 3
Walter Roberson
Walter Roberson 2014년 1월 22일
squeeze(RGB(56,54,:))
Image Analyst
Image Analyst 2014년 1월 22일
For what it's worth, there's also an impixel() function.

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

추가 답변 (1개)

Walter Roberson
Walter Roberson 2014년 1월 22일
disp(reshape(Image, [], 3));
  댓글 수: 1
saravanakumar D
saravanakumar D 2014년 1월 22일
i didn't understand this syntax. how it is working?

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

카테고리

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