1

I am trying to use different low resolution images for my work. Recently, I was reading the LOW RESOLUTION CONVOLUTIONAL NEURAL NETWORK FOR AUTOMATIC TARGET RECOGNITION in which they didn't mentioned the way how they made the low resolution images.

Resolution adaptation for feature computation: To show the influence of resolution on the performances of these image representations, we focus on seven specific resolutions ranging from 200 × 200 to 10 × 10 pixels

Here is the example images from the paperenter image description here.

Anyone please help me to implement this method in MATLAB?

Currently, I am using this way to make the Low resolution images:

img = im2double(imread('cameraman.tif'));
conv_mat = ones(6) / 36;
img_low = convn(img,conv_mat,'same');

figure, imshow(img), title('Original');
figure, imshow(img_low), title('Low Resolution')
Cris Luengo
  • 55,762
  • 10
  • 62
  • 120
Aadnan Farooq A
  • 626
  • 4
  • 8
  • 19

1 Answers1

3

You have a good start there. The convolution makes it so that each pixel contains the average of a 6x6 neighborhood. Now all that is left is to keep only one pixel in each 6x6 neighborhood. This pixel will have an average of the deleted information:

img = im2double(imread('cameraman.tif'));
conv_mat = ones(6) / 36;
img_low = convn(img,conv_mat,'same');
img_low = img_low(3:6:end,3:6:end)

figure, imshow(img), title('Original');
figure, imshow(img_low), title('Low Resolution')

The 3:6:end simply indicates which columns and which rows to keep. I start the subsampling at 3, to avoid the pixels that were averaged with the background.

Judging from the images you posted, they used this averaging method. Other alternatives are to take the max in the neighborhood (as is done in the max-pooling layers of a convolutional neural network), or simply subsample without any filtering (introduces aliasing, I don't recommend this method).

Cris Luengo
  • 55,762
  • 10
  • 62
  • 120
  • I have to create number of low resolution images. So 3:6:end,3:6:end will be different. How can I make it a bit general? – Aadnan Farooq A Jan 30 '18 at 04:19
  • like for 2x2 average pixel it will be `conv_mat = ones(2) / 4;` `img_low = convn(img,conv_mat,'same');` `img_low = img_low(2:2:end,2:2:end)` ? – Aadnan Farooq A Jan 30 '18 at 04:30
  • Yes, you got it right. You can use a variable there to make it general: `k=2;` `conv_mat = ones(k)/(k*k);` `img_low = img_low(ceil(k/2):k:end,ceil(k/2):2:end);` – Cris Luengo Jan 30 '18 at 04:59
  • Yes Its working fine. Just want to ask couple of thing is I have 500x500 image and i am doing 2x2 average pixels. The output is 250x250 image. So it only keeps the average value, is it right? Similarly, with the same image when i use 3x3 average pixels it gives me output of 167x167 image. Is this case how it make the image whole number. for example it should 500/3 = 166.66. Then how it round off to uper limit or lower limit when averaging pixels – Aadnan Farooq A Feb 01 '18 at 07:23
  • @AadnanFarooqA: I guess you want to take `floor(size(img)/k)` pixels? I don't think it's very important though. -- Yes, this process keeps the average of each kxk pixel patch. – Cris Luengo Feb 01 '18 at 14:24