フィルターのクリア

First i need to divide a binary image into 8x8 block.Second, in all blocks,check if number of 1s is larger than 0s,if larger number of 1s,then i need to convert all 0s to 1s,else convert all 1s to 0s.

1 回表示 (過去 30 日間)
using blockprocess,a binary image is divided into 8x8 blocks,then check all blocks that whether number of 1s is larger than number of 0s,if so then convert all 1s to 0s otherwise 0s to 1s in all blocks

採用された回答

Image Analyst
Image Analyst 2015 年 8 月 3 日
It will be trivial for you to adapt one of my attached demos to do that.
  5 件のコメント
kaavya subramani
kaavya subramani 2015 年 8 月 4 日
編集済み: Walter Roberson 2015 年 8 月 4 日
Please correct my function sir:
function [nb nw]=count(block_struct)
block = block_struct.data;
nb=sum(block(:));
nw=numel(block(:,:))-nb;
if nb > 32
nw==0;
else
nw==1;
end
end
Walter Roberson
Walter Roberson 2015 年 8 月 4 日
nw==0; is not an assignment statement.
Your function count needs to return a single variable, not two variables.
According to your initial requirements, the single variable needs to be the same size as the original block. Consider using zeros() and ones()

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

その他の回答 (0 件)

Community Treasure Hunt

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

Start Hunting!

Translated by