필터 지우기
필터 지우기

Why imread makes 3D array from simple png?

조회 수: 25 (최근 30일)
Marcin Zyskowski
Marcin Zyskowski 2016년 10월 23일
댓글: Image Analyst 2016년 10월 23일
I want to count squares and circles on the following png picture:
I begun my adventure with writing:
obrazek=imread('trial.png');
I can see it created an array, but I have no idea why does it have three dimensions. How to interpret this last dimension (155x298 x3)? I guess that first two (155x298) are the size of a picture (in pixels).

채택된 답변

Image Analyst
Image Analyst 2016년 10월 23일
Because it's a color image. The only two colors in it are black and white, but it's still color (with 2 colors). If you want a gray scale image, simply extract one of the color channels:
obrazek = obrazek(:, :, 2); % Extract green channel. Resulting image will be grayscale.
  댓글 수: 2
Marcin Zyskowski
Marcin Zyskowski 2016년 10월 23일
So third dimension represents red, blue or green? And the numbers in the array represent "amount" of those colors in one picture?
Image Analyst
Image Analyst 2016년 10월 23일
Correct.

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Modify Image Colors에 대해 자세히 알아보기

제품

Community Treasure Hunt

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

Start Hunting!

Translated by