Why imread makes 3D array from simple png?
29 ビュー (過去 30 日間)
古いコメントを表示
I want to count squares and circles on the following png picture:
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/157362/image.png)
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).
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/157363/image.png)
0 件のコメント
採用された回答
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.
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Image Processing Toolbox についてさらに検索
製品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!