You are on page 1of 3

EXPERIMENT NO.

7
Objective: Write a program for Resizing of an image using Interpolation method. Software Used: MATLAB R2010a About the Experiment: Image interpolation occurs in all images at some stage whether this be in image enlargement. It happens anytime you resize or remap (distort) your image from one pixel grid to another. Image resizing is necessary when you need to increase or decrease the total number of pixels, whereas remapping can occur under a wider variety of scenarios: correcting for lens distortion, changing perspective, and rotating an image. Theory: Interpolation works by using known data to estimate values at unknown points. For example: if you wanted to know the temperature at noon, but only measured it at 11AM and 1PM, you could estimate its value by performing a linear interpolation. If you had an additional measurement at 11:30AM, you could see that the bulk of the temperature rise occurred before noon, and could use this additional data point to perform a quadratic interpolation. The more temperature measurements you have which are close to noon, the more sophisticated (and hopefully more accurate) your interpolation algorithm can be TYPES OF INTERPOLATION ALGORITHMS Common interpolation algorithms can be grouped into two categories: adaptive and non-adaptive. Adaptive methods change depending on what they are interpolating (sharp edges vs. smooth texture), whereas non-adaptive methods treat all pixels equally. Non-adaptive algorithms include: nearest neighbor, bilinear, bicubic, spline, sinc, lanczos and others. Depending on their complexity, these use anywhere from 0 to 256 (or more) adjacent pixels when interpolating. The more adjacent pixels they include, the more accurate they can become, but this comes at the expense of much longer processing time. These algorithms can be used to both distort and resize a photo. Adaptive algorithms include many proprietary algorithms in licensed software such as: Qimage, PhotoZoom Pro, Genuine Fractals and others. Many of these apply a different version of their algorithm (on a pixel-by-pixel basis) when they detect the presence of an edge aiming to minimize unsightly interpolation artifacts in regions where they are most apparent. These algorithms are primarily designed to maximize artifact-free detail in enlarged photos, so some cannot be used to distort or rotate an image.

NEAREST NEIGHBOR INTERPOLATION Nearest neighbor is the most basic and requires the least processing time of all the interpolation algorithms because it only considers one pixel the closest one to the interpolated point. This has the effect of simply making each pixel bigger. BILINEAR INTERPOLATION Bilinear interpolation considers the closest 2x2 neighborhood of known pixel values surrounding the unknown pixel. It then takes a weighted average of these 4 pixels to arrive at its final interpolated value. This results in much smoother looking images than nearest neighbor. BICUBIC INTERPOLATION Bicubic goes one step beyond bilinear by considering the closest 4x4 neighborhood of known pixels for a total of 16 pixels. Since these are at various distances from the unknown pixel, closer pixels are given a higher weighting in the calculation. Bicubic produces noticeably sharper images than the previous two methods, and is perhaps the ideal combination of processing time and output quality. For this reason it is a standard in many image editing programs (including Adobe Photoshop), printer drivers and in-camera interpolation. Syntax B = imresize(A, scale) B = imresize(A, [mrows ncols]) [Y newmap] = imresize(X, map, scale) [...] = imresize(..., method) [...] = imresize(..., parameter, value, ...) MATLAB Program: I = imread('C:\Users\student\Desktop\image.jpg'); subplot(3,2,1);imshow(I);title('input image'); I1=rgb2gray(I); subplot(3,2,2),imshow(I1);title('gray image'); J = imresize(I1, 2); subplot(3,2,3),imshow(J);title('resized image'); Z=resizem(I1,.25,'bicubic'); subplot(3,2,4),imshow(uint8(Z));title('bicubic interpolated image'); Z1=resizem(I1,.25,'bilinear'); subplot(3,2,5),imshow(uint8(Z1));title('bilinear interpolated image'); whos;

Result:

Properties of processed Images: Name I I1 J Z Z1 Size 336x448x3 336x448 672x896 84x112 84x112 Bytes 451584 150528 602112 75264 75264 Class uint8 uint8 uint8 double double

You might also like