Borrar filtros
Borrar filtros

Why imread makes 3D array from simple png?

31 visualizaciones (últimos 30 días)
Marcin Zyskowski
Marcin Zyskowski el 23 de Oct. de 2016
Comentada: Image Analyst el 23 de Oct. de 2016
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).

Respuesta aceptada

Image Analyst
Image Analyst el 23 de Oct. de 2016
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 comentarios
Marcin Zyskowski
Marcin Zyskowski el 23 de Oct. de 2016
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 el 23 de Oct. de 2016
Correct.

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Modify Image Colors en Help Center y File Exchange.

Productos

Community Treasure Hunt

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

Start Hunting!

Translated by