I performed an image downsampling with averaging operation(The image is divided into 2 by 2 blocks,then it is downsampled by 4 times.New pixel values od downsampled image is replaced with the mean of each block) as follows.
img = imread('cameraman.gif');
avgfilter = fspecial('average', [2 2]);
avgimg = filter2(avgfilter, img);
down1 = avgimg(1:2:end,1:2:end);
imshow(down1);
I used a graysacle image as input.
but I'm getting a complete white image as output on downsampling.
I tried with jpg image also. Why this happened?
Please help.