from Image Zoomin by Ahmed Samieh
Digital Image Zoomin (gray and color images)

test()
function test()
  RGB = imread('peppers.png');
  figure,imshow(RGB),title('RGB (Input)');

  figure,imshow(RGB(:,:,1)),title('R Of Input Image');
  figure,imshow(RGB(:,:,2)),title('G Of Input Image');
  figure,imshow(RGB(:,:,3)),title('B Of Input Image');

  GRAY = rgb2gray(RGB);
  SIZE = uint32(uint32(size(GRAY)/2)*2-1);
  GRAY = GRAY(1:SIZE(1),1:SIZE(2));
  figure,imshow(GRAY),title('Gray (Bin2Gray)');
  GRAYZO = zoomout(GRAY);
  figure,imshow(GRAYZO), title('Zoom Out Gray');
  GRAYZI = zoomin(GRAYZO);

  OC = xcorr2(GRAY, GRAY);
  figure, mesh(double(OC)); title('Auto-Correlation');
  XC = xcorr2(GRAYZI, GRAY);
  figure, mesh(double(XC)); title('Cross-Correlation');
  max(max(XC))/max(max(OC))
  max(max(OC))/max(max(OC))
  figure,imshow(GRAYZI),title('Zoom In Gray');

  RGBZ(:,:,1) = zoomin(RGB(:,:,1));
  RGBZ(:,:,2) = zoomin(RGB(:,:,2));
  RGBZ(:,:,3) = zoomin(RGB(:,:,3));
  figure, imshow(RGBZ), title('RGB Zoomed Image');
  figure, imshow(RGBZ(:,:,1)), title('R Of Zoomed Image');
  figure, imshow(RGBZ(:,:,2)), title('G Of Zoomed Image');
  figure, imshow(RGBZ(:,:,3)), title('B Of Zoomed Image');
  YUV = rgb2yuv(RGB);
  figure, imshow(YUV(:,:,1)), title('Y Of Input Image');
  figure, imshow(YUV(:,:,2)), title('U Of Input Image');
  figure, imshow(YUV(:,:,3)), title('V Of Input Image');
  YUVZ(:,:,1) = zoomin(YUV(:,:,1));
  YUVZ(:,:,2) = zoomin(YUV(:,:,2));
  YUVZ(:,:,3) = zoomin(YUV(:,:,3));
  figure, imshow(YUVZ(:,:,1)), title('Y Of Zoomed Image');
  figure, imshow(YUVZ(:,:,2)), title('U Of Zoomed Image');
  figure, imshow(YUVZ(:,:,3)), title('V Of Zoomed Image');
  BRGBZ = yuv2rgb(YUVZ);
  figure, imshow(RGBZ), title('YUV Zoomed Image');
return

Contact us at files@mathworks.com