Average of tiles in an image

2 ビュー (過去 30 日間)
tarun
tarun 2013 年 4 月 7 日
0 down vote favorite
I have an image which is 256X256 pixels and that image 'a' has 16 '16X16' pixels similar tiles(random noise distributed over the image). I want to take the average of each tile and replace it with the first tile and then display the result.
I used the following code
im = imread('tiles.tif')
a = blockproc(im, [16 16], @(x)mean(x.data(:)));% this
imshow(im,[]);
I thought it worked but it is displaying the same original image. can someone please tell me what is wrong or what am I missing?Thanks
  1 件のコメント
Anand
Anand 2013 年 4 月 7 日
Please clarify your question. What are you trying to achieve?
The code you have right now is going to replace each 16x16 tile in the image with a 1x1 tile containing the average intensity in the tile. So the size of a should be 16 x 16.

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

採用された回答

Image Analyst
Image Analyst 2013 年 4 月 7 日
You never display the result - the badly-named "a". Try this
subplot(1, 2, 1);
imshow(im, []);
subplot(1, 2, 2);
imshow(a, []); % Pick a better name than "a"
% Enlarge figure to full screen.
set(gcf, 'units','normalized','outerposition',[0 0 1 1]);

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeImage Processing Toolbox についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by