How can I solve this ? It doesn't work.

Hello ,
I have an image and I need to scan all pixels and need to find 65 brithness pixel how many times used ?
I setup an algorithm but it doesnt work . Can you help me how can I solve it.
The image :
im = imread('unnamed.jpg');
griformat= rgb2gray(im);
counter=0;
for i=1: 256
for j=1 : 256
if griformat==65
counter=counter+1;
fprintf('times: %f \n ', counter)
else
j=j+1;
end
end
end

 採用された回答

Walter Roberson
Walter Roberson 2020 年 5 月 10 日

0 投票

if griformat(i, j) == 65
counter = counter + 1;
end
Do not do the j=j+1 as MATLAB is doing that on your behalf because you have the for j loop.

1 件のコメント

Can Yilmaz
Can Yilmaz 2020 年 5 月 10 日
Thanks a lot ! Im beginner :(

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

ヘルプ センター および File ExchangeImages についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by