BinImg(i,j)== BinImg(i,j+1)

3 ビュー (過去 30 日間)
Iman Zare
Iman Zare 2020 年 12 月 21 日
コメント済み: Matt J 2020 年 12 月 22 日
How can I solve this error?
Index in position 1 is invalid. Array indices must be positive integers or logical values.
Error in Article_LicencePlate_Detecting (line 50)
if BinImg(i,j)== BinImg(i,j+1)
for i=0:194
c=0;
for j=0:258
if BinImg(i,j)== BinImg(i,j+1)
c=c+1;
count(i)=c;
end
end
if count(i)<30
for j=0:259
BinImg(i,j)=0;
LicenceImg=BinImg;
end
else
LicenceImg=BinImg;
end
end

回答 (1 件)

Matt J
Matt J 2020 年 12 月 21 日
count=sum( diff(BinImg,1,2)==0 ,2);
BinImg(count<30,:)=0;
LicenceImg=BinImg;
  2 件のコメント
Iman Zare
Iman Zare 2020 年 12 月 22 日
Hello Friend
The first line of your code counts the numebr of logical '1',but i wanna count the number of changes from '0' to '1' or from '1' to '0'.
Matt J
Matt J 2020 年 12 月 22 日
No, both your posted code and mine count the number of j for which BinImg(i,j)== BinImg(i,j+1).

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

カテゴリ

Help Center および File ExchangeCreating and Concatenating Matrices についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by