Unrecognized function error.
4 ビュー (過去 30 日間)
古いコメントを表示
I just want to count the number of non-white pixels in an image.
I have
pix = imread('/binary_image4.png');
nonZeroPixels = nnz(pix);
But when I evaluate selection of second line, I get " Unrecognized function or variable 'pix'."
1 件のコメント
per isakson
2021 年 8 月 31 日
編集済み: per isakson
2021 年 8 月 31 日
Why the slash, "/"? Try
pix = imread('binary_image4.png');
You use LINUX, I guess.
Make sure imread() succeeds.
回答 (1 件)
Gargi Patil
2021 年 9 月 3 日
Hi,
As mentioned in the comments, the forward slash in the path is not required. Ensure the image is on the MATLAB path or pass the required file path.
The code snippet shared works successfully for MATLAB's built-in demo binary image:
I = imread('circles.png');
nonZeroPixels = nnz(I)
0 件のコメント
参考
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!