フィルターのクリア

How do divide a image into blocks and find the maximum value of each Block?

3 ビュー (過去 30 日間)
S .p.aramesh S
S .p.aramesh S 2015 年 10 月 21 日
回答済み: Image Analyst 2015 年 10 月 21 日
Actually i am doing ODBTC encoding for a color image.I do the RGB decomposition already.now i have to do divide a image into blocks and find the maximum value of each Block.Plz help me

採用された回答

Walter Roberson
Walter Roberson 2015 年 10 月 21 日
blockproc()
  2 件のコメント
S .p.aramesh S
S .p.aramesh S 2015 年 10 月 21 日
thank u for reply,it is correct or not
I = imread(file_name); maxfun = @(block_struct) max(block_struct.data);
block_size = [50 50]; block_max = blockproc(I,block_size,maxfun); disp(block_max); figure imshow(block_max); title('Block Processing - Simplest Syntax');
Stefan Raab
Stefan Raab 2015 年 10 月 21 日
The line
max(block_struct.data);
will return a vector of maximum values if the input is a matrix. If you want only the largest element, you have to use
max(block_struct.data(:));
Then the matrix is converted to a vector before the max value is extracted.

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

その他の回答 (1 件)

Image Analyst
Image Analyst 2015 年 10 月 21 日
Walter and Stefan are correct. There is also some more complete code in the FAQ. I've also attached my two demos on blockproc(), for what it's worth. You can just modify it to take the max, like Stefan said.

Community Treasure Hunt

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

Start Hunting!

Translated by