Problem with implementing RLC function...

3 ビュー (過去 30 日間)
Hamed
Hamed 2013 年 4 月 17 日
Hi every body. There is a binary image in a variable like :
img =
1 1 0 0 0 1 0
1 1 1 0 0 1 1
0 1 0 1 0 1 0
0 0 0 0 0 1 1
I need to return count changed binaries from 1 to 0 and unlike, for each row.
For example :
in each rows of 'img' variable result of counting changed binaries must be :
  • First row = 3
  • Second row = 2
  • Third row = 6
  • Fourth row = 1
At last that function must return (3 + 2 + 6 + 1) = 12
I don't know how do that !
Please help me. Tnx

採用された回答

Iman Ansari
Iman Ansari 2013 年 4 月 17 日
Hi
img =[1 1 0 0 0 1 0
1 1 1 0 0 1 1
0 1 0 1 0 1 0
0 0 0 0 0 1 1]
a=diff(img,1,2)
n=nnz(a)
  3 件のコメント
Iman Ansari
Iman Ansari 2013 年 4 月 20 日
img =[1 1 0 0 0 1 0
1 1 1 0 0 1 1
0 1 0 1 0 1 0
0 0 0 0 0 1 1]
Rows=diff(img,1,2)
Columns=diff(img,1,1)
n=nnz(Rows)+nnz(Columns)
Ehsan R
Ehsan R 2013 年 4 月 20 日
Thank you

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeMATLAB についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by