You are on page 1of 50

# The Error-Amended Sharp Edge (EASE) Scheme for Image Zooming Using MATLAB

ABSTRACT:
Earlier there are different interpolation techniques for de-blurring of images. When an image is zoomed a checkerboard effect arises in the images. In order to remove/reduce interpolation artifacts such as image blur and the checkerboard effect (ringing), EASE tries to amend the interpolation error by employing the classical interpolation error theorem in an edge-adaptive fashion. In this project we are using an interpolation method, called the error-amended sharp edge (EASE) scheme, which is a modified bilinear method. In order to remove/reduce interpolation artifacts such as image blur and the checkerboard effect (ringing), EASE tries to amend the interpolation error by employing the classical interpolation error theorem in an edge-adaptive fashion. EASE is applied for image zooming by both integer and non integer magnification factors. The new interpolation scheme has proved to result in high-resolution images having clearer and sharper edges than linear interpolation methods, for all synthetic and natural images we are testing using MATLAB 7.0. EASE can be implemented with ease; it turns out to be similarly efficient as cubic interpolation schemes. More effective interpolation methods are yet to be developed in order to accurately preserve the edge orientation without introducing a high computation cost. This ease scheme is developed using MATLAB 7.0 software Index TermsCheckerboard effect, directional Sobel derivative, Error-amended sharp edge (EASE) scheme, image zooming, interpolation, Interpolation error theorem.

## Dept of ECE, GPREC, KNL

Page 1

The Error-Amended Sharp Edge (EASE) Scheme for Image Zooming Using MATLAB
1. INTRODUCTION
IMAGE re-sampling consists of two basic steps: interpolation and evaluation (sampling). Image interpolation turns discrete data into a continuous function, which is necessary for various geometric transform of discrete images. There are two kinds of interpolation methods: linear and nonlinear ones. For linear methods, diverse interpolation kernels of finite size have been introduced, in the literature, as approximations of the ideal interpolation kernel (the sinc function) which is spatially unlimited. However, such linear interpolation methods have been introduced without considering specific local information on edges. Thus, they may bring up artifacts, such as the checkerboard effect or image blur, when the image content shows discontinuities or edges. Nonlinear interpolation methods have been suggested to reduce the artifacts of linear methods. The major step in the nonlinear methods is to either fit the edges with some templates or predict edge information for the high resolution image from the low resolution one. However, these nonlinear methods are often computation-intensive and they can be one to two orders more expensive than linear methods for 2-D images. Furthermore, they may become ineffective in the estimation of the edge orientation for the class of edge models with fine scales (e.g., tightly packed edges that can be commonly found in the texture patterns). More effective interpolation methods are yet to be developed in order to accurately preserve the edge orientation without introducing a high computation cost. Recently, the authors have studied edge-forming methods as a post process of conventional interpolation schemes, to form clear and sharp edges by applying partial differential equations (PDEs) of anisotropic diffusion. Such PDE-based methods have proved to form reliable edges satisfactorily for image zooming by integer and non integer magnification factors, for both gray-scale and color images.

1.1 Image sensing and Acquisition Most of the images in which we are interested are generated by the combination of an illumination source and reflection or absorption of energy from that source by the elements of the scene being imaged. We enclose illumination and scene in quotes to emphasize the fact that they are considerably more general than the familiar situation in which the visible light source illuminates a common everyday 3D (three dimensional) scene. For example, the illumination may originate from a source such as ultrasound or even a computer generated Dept of ECE, GPREC, KNL Page 2

The Error-Amended Sharp Edge (EASE) Scheme for Image Zooming Using MATLAB
illumination pattern. Similarly, the scene elements could be familiar objects, but they can just as easily be molecules, buried rock formations, or a human brain. Depending on the nature of the source, illumination energy is reflected from, or transmitted through, objects .An example in the first category is light reflected from a planar surface .An example in the second category when x-rays pass through a diagnostic x-ray film. In some applications the reflected or transmitted energy is focused onto a photo converter which converts energy into visible light.

The below figure shows the three principal sensor arrangements used to transform illumination energy into digital images. The idea is simple: Incoming energy is transformed into a voltage by the combination of input electrical power and sensor material that is responsive to the particular type of energy being detected, the output voltage waveform is the response of the sensor and a digital quantity is obtained from the each sensor by digitising the response.

FIG 1.1

In order to generate a 2D image using a single sensor there has to be relative displacement in both x and y directions between the sensor and the area to be imaged .In this a film negative is mounted onto a drum whose mechanical rotation provides displacement in one dimension. A single sensor is mounted on a lead screw that provides motion in the perpendicular direction. Because mechanical rotation can be controlled with high precision , this method is inexpensive but slow way to obtain high resolution images other similar mechanical arrangements use a flat bed, with the sensor moving in two linear directions. Page 3

## Dept of ECE, GPREC, KNL

The Error-Amended Sharp Edge (EASE) Scheme for Image Zooming Using MATLAB
1.2 Sampling and Quantization When we want to convert a continuous image digital image .An image may be continuous with respect to x and y directions, and also in amplitude .To convert into a digital form, we have to sample the function in both coordinates and in amplitude. Digitizing the coordinates values is called sampling. Digitizing the amplitude values is called quantization. 1.3What is Resampling? Digital images consist of a rectangular grid of evenly spaced pixels. Each pixel can be thought of as a measurement or sample of the light from a subject. Commonly, the original samples are obtained using a scanner or digital camera by averaging the amount of red, green and blue light that falls on the sensitive area of each of its CCD sensing elements.

Resampling is the mathematical technique used to create a new version of the image with a different width and/or height in pixels. Increasing the size of an image is called upsampling; reducing its size is called downsampling. When images are upsampled, the number of pixels increases, but, with reference to the original subject, new image detail cannot be created that was not already present in the original image. As a result, images normally become softer the more they ar enlarged since the amount of information per pixel goes down. When images are downsampled, information in the original image has to be discarded to make the image smaller. Thus if you downsample and then upsample an image, you will not get all the original image detail back. Downsampling a soft image can make it appear sharper even though it contains less information than the original.

Why is Resampling Important? A few situations where image resampling comes into play are: Reducing the size of an image from a scanner or digital camera for emailing or display on the web. This step is normally followed by saving the file in JPEG format and uploading it to a web site or attaching it to an email message. Increasing the size of an image before or during the printing process.

Printing an image almost always requires resampling it as it will usually be too small or too large to make a print of the desired size. This resampling is handled automatically by your Dept of ECE, GPREC, KNL Page 4

The Error-Amended Sharp Edge (EASE) Scheme for Image Zooming Using MATLAB
Windows printer driver. Most drivers do a good job of resizing images, but you can resample the image yourself prior to printing if you suspect the driver is not doing a good job. How Resampling Works It turns out that resampling a 2-dimensional image can be broken down into two onedimensional resampling passes. In one pass, horizontal resampling is performed producing an image with a different width but the same height. In the next pass, this intermediate image is resampled vertically, changing it height while leaving the width the same. This is computationally much more efficient than trying to combine the work into a single pass. Upsampling involves interpolating between the existing pixels to obtain an estimate of their values at the new pixel locations. Downsampling involves computing a weighted average of the original pixels that overlap each new pixel. In the mathematical subfield of numerical analysis, interpolation is a method of constructing new data points within the range of a discrete set of known data points. In engineering and science one often has a number of data points, as obtained by sampling or experimentation, and tries to construct a function which closely fits those data points. This is called curve fitting or regression analysis. Interpolation is a specific case of curve fitting, in which the function must go exactly through the data points. A different problem which is closely related to interpolation is the approximation of a complicated function by a simple function. Suppose we know the function but it is too complex to evaluate efficiently. Then we could pick a few known data points from the complicated function, creating a lookup table, and try to interpolate those data points to construct a simpler function. Of course, when using the simple function to calculate new data points we usually do not receive the same result as when using the original function, but depending on the problem domain and the interpolation method used the gain in simplicity might offset the error. 1.4 DEFINITION OF INTERPOLATION From inter meaning between and pole, the points or nodes. Any means of calculating a new point between two existing data points is therefore interpolation. There are many methods for doing this, many of which involve fitting some sort of function to the data and evaluating that Dept of ECE, GPREC, KNL Page 5

The Error-Amended Sharp Edge (EASE) Scheme for Image Zooming Using MATLAB
function at the desired point. This does not exclude other means such as statistical methods of calculating interpolated data. The simplest form of interpolation is to take the mean average of x and y of two adjacent points to find the mid point. This will give the same result as linear interpolation evaluated at the midpoint. Given a sequence of n distinct numbers xk called nodes and for each xk a second number yk, we are looking for a function f so that,

A pair xk, yk is called a data point and f is called an interpolant for the data points. When the numbers yk are given by a known function f, we sometimes write fk.

Figure 1.1: An interpolation of a finite set of points on an epitrochoid. In the above figure, the points through which curve is splined are red; the blue curve connecting them is interpolation.

## Dept of ECE, GPREC, KNL

Page 6

The Error-Amended Sharp Edge (EASE) Scheme for Image Zooming Using MATLAB
So, the Interpolation provides a means of estimating the function at intermediate points. This can be explained in detail by taking an example given below. For example, suppose we have a table like this, which gives some values of an unknown function f.

x 0 1 2 3 4 5 6

f(x) 0 0.8415 0.9093 0.1411 0.7568 0.9589 0.2794 Figure 1.2: Plot of the data points as given in the table.

Interpolation provides a means of estimating the function at intermediate points, such as x = 2.5. Image interpolation techniques often are required in medical imaging for image generation (e.g., discrete back projection for inverse Radon transform) and processing such as compression or re sampling. Since the ideal interpolation function spatially is unlimited, several interpolation kernels of finite size have been introduced. This thesis compares 1) Nearest neighbour interpolation 2) Bi-linear interpolation 3) Bi-cubic interpolation 4) B-spline interpolation The comparison is done by: Dept of ECE, GPREC, KNL Page 7

The Error-Amended Sharp Edge (EASE) Scheme for Image Zooming Using MATLAB
1) Spatial and Fourier analyses; 2) Computational complexity as well as runtime evaluations; and 3) Qualitative and quantitative interpolation error determinations for particular interpolation tasks which were taken from common situations in medical image processing.

For local and Fourier analyses, a standardized notation is introduced and fundamental properties of interpolators are derived. Successful methods should be direct current (DC)constant and interpolators rather than DC-inconstant or approximators. Each methods parameters are tuned with respect to those properties. This results in three novel kernels, which are introduced in this chapter and proven to be within the best choices for medical image interpolation: the 6 X 6 BlackmanHarris windowed sinc interpolator, and the C2continuous cubic kernels with N = 6 and N = 8 supporting points. For quantitative error evaluations, a set of 50 direct digital X rays was used. They have been selected arbitrarily from clinical routine. In general, large kernel sizes were found to be superior to small interpolation masks. Except for truncated sinc interpolators, all kernels with N = 6 or larger sizes perform significantly better than N = 2 or N = 3 point methods (p << 0:005). However, the differences within the group of large sized kernels were not significant. Summarizing the results, the cubic 6 X 6 interpolator with continuous second derivatives and can be recommended for most common interpolation tasks. It appears to be the fastest six-point kernel to implement computationally. It provides eminent local and Fourier properties, is easy to implement, and has only small errors. The same characteristics apply to B-spline interpolation, but the 6 X 6 cubic avoids the intrinsic border effects produced by the B-spline technique. However, the goal of this study was not to determine an overall best method, but to present a comprehensive catalogue of methods in a uniform terminology, to define general properties and requirements of local techniques, and to enable the reader to select that method which is optimal for his specific application in medical imaging.

## Dept of ECE, GPREC, KNL

Page 8

The Error-Amended Sharp Edge (EASE) Scheme for Image Zooming Using MATLAB
2. MOTIVATION FOR THE THESIS
The issue of quality is particularly relevant to the medical community; for ethical reasons, it is a prime concern when manipulating data. Any manipulation should result in the least amount of distortion or artifacts, so as not to influence the clinicians judgment. For practical reasons, efficiency is another prime concern. Any processing should result in the least computational effort, particularly when dealing with the large amount of data involved in volumetric medical imaging. In this thesis, we analyze the tradeoff between the quality and the cost of several interpolation methods, and we introduce generalized interpolation as a means to overcome the limitations of traditional interpolation. The essence of interpolation is to represent an arbitrary continuously defined function as a discrete sum of weighted and shifted basis functions. An important issue is the adequate choice of those basis functions. The traditional view asks that they satisfy the interpolation property, and many researchers have put a significant effort in optimizing them under this specific constraint This thesis proposes a new interpolation method, called the Error-Amended Sharp Edge (EASE) scheme. EASE is a modified bilinear method which tries to amend the interpolation error in an edge-adaptive way by employing the Interpolation Error Theorem. The resulting scheme has proved to result in zoomed images having sharper edges than bilinear, C1bicubic, and C2-bicubic interpolation methods. EASE is similarly efficient as cubic interpolation methods and can be implemented with ease. In this project, the performance of EASE Scheme has been found though the simulation in MATLAB and the results have been compared with the nearest neighborhood method.

2.1 OBJECTIVES
The objective will be to implement an Error-Amended Sharp Edge (EASE) Scheme for Image Zooming. The development tool used will be MATLAB. MATLAB provides an excellent RAD environment, with its image processing toolbox, and high level programming methodology. The system is to be composed of a number of sub-systems, which correspond to each stage of image processing. MATLAB has few in built functions for interpolation of images. Using these techniques some of the basic Zooming techniques like Nearest neighbor interpolation, Bi-linear and Bi-cubic interpolation can be performed. Additionally, the EASE technique can be implemented using MATLAB more conveniently.

## Dept of ECE, GPREC, KNL

Page 9

The Error-Amended Sharp Edge (EASE) Scheme for Image Zooming Using MATLAB
3 MATLAB
MATLAB is a high-performance language for technical computing. It integrates computation, visualization, and programming in an easy-to-use environment where problems and solutions are expressed in familiar mathematical notation. MATLAB is used convert .avi or .mpg to text format. Typical uses include: Math and computation Algorithm development Modeling, simulation, and prototyping Data analysis, exploration, and visualization Scientific and engineering graphics Application development, including graphical user interface building.

MATLAB is an interactive system whose basic data element is an array that does not require dimensioning. This allows you to solve many technical computing problems, especially those with matrix and vector formulations, in a fraction of the time it would take to write a program in a scalar no interactive language such as C or FORTRAN.

The name MATLAB stands for matrix laboratory. MATLAB was originally written to provide easy access to matrix software developed by the LINPACK and EISPACK projects. Today, MATLAB uses software developed by the LAPACK and ARPACK projects, which together represent the state-of-the-art in software for matrix computation.

MATLAB has evolved over a period of years with input from many users. In university environments, it is the standard instructional tool for introductory and advanced courses in mathematics, engineering, and science. In industry, MATLAB is the tool of choice for highproductivity research, development, and analysis.

The MATLAB system consists of five main parts: Development Environment. This is the set of tools and facilities that help you use

MATLAB functions and files. Many of these tools are graphical user interfaces. It includes the MATLAB desktop and Command Window, a command history, and browsers for viewing help, the workspace, files, and the search path. Dept of ECE, GPREC, KNL Page 10

The Error-Amended Sharp Edge (EASE) Scheme for Image Zooming Using MATLAB
The MATLAB Mathematical Function Library. This is a vast collection of computational algorithms ranging from elementary functions like sum, sine, cosine, and complex arithmetic, to more sophisticated functions like matrix inverse, matrix eigenvalues, Bessel functions, and fast Fourier transforms. The MATLAB Language. This is a high-level matrix/array language with control

flow statements, functions, data structures, input/output, and object-oriented programming features. It allows both "programming in the small" to rapidly create quick and dirty throw-away programs, and "programming in the large" to create complete large and complex application programs. Handle Graphics. This is the MATLAB graphics system. It includes high-level commands for two-dimensional and three-dimensional data visualization, image processing, animation, and presentation graphics. It also includes low-level commands that allow you to fully customize the appearance of graphics as well as to build complete graphical user interfaces on your MATLAB applications. The MATLAB Application Program Interface (API). This is a library that allows

you to write C and FORTRAN programs that interact with MATLAB. It include facilities for calling routines from MATLAB (dynamic linking), calling MATLAB as a computational engine, and for reading and writing MAT-files.

## 3.1 MATLAB's desktop tools:

You can also use MATLAB functions to perform most of the features found in the desktop tools. The tools are: Command Window Command History Launch Pad Help Browser Current Directory Browser Workspace Browser Array Editor Editor/Debugger Command Window: Use the Command Window to enter variables and run functions and M-files. Dept of ECE, GPREC, KNL Page 11

The Error-Amended Sharp Edge (EASE) Scheme for Image Zooming Using MATLAB
Command History: Lines you enter in the Command Window are logged in the Command History window. In the Command History, you can view previously used functions, and copy and execute selected lines. To save the input and output from a MATLAB session to a file, use the diary function.

You can run external programs from the MATLAB Command Window. The exclamation point character is a shell escape and indicates that the rest of the input line is a command to the operating system. This is useful for invoking utilities or running other programs without quitting MATLAB. On Linux, for example, Macs magik.m invokes an editor called emacs for a file named magik.m. When you quit the external program, the operating system returns control to MATLAB.

Help Browser: Use the Help browser to search and view documentation for all your Math Works products. The Help browser is a Web browser integrated into the MATLAB desktop that displays HTML documents. Use to Help Navigator to find information. It includes: Product filter - Set the filter to show documentation only for the products you specify. Contents tab - View the titles and tables of contents of documentation for your products. Index tab- Find specific index entries (selected keywords) in the Math Works documentation for your products. Search tab- Look for a specific phrase in the documentation. To get help for a specific function, set the Search type to Function Name. Favorites tab- View a list of documents you previously designated as favorites. After finding documentation using the Help Navigator, view it in the display pane. While viewing the documentation, you can: Browse to other pages - Use the arrows at the tops and bottoms of the pages, or use the back and forward buttons in the toolbar. Bookmark pages - Click the Add to Favorites button in the toolbar. Dept of ECE, GPREC, KNL Page 12

The Error-Amended Sharp Edge (EASE) Scheme for Image Zooming Using MATLAB
Print pages - Click the print button in the toolbar. Find a term in the page - Type a term in the Find in page field in the toolbar and click Go. Other features available in the display pane are: copying information, evaluating a selection, and viewing Web pages.

Current Directory Browser: MATLAB file operations use the current directory and the search path as reference points. Any file you want to run must either be in the current directory or on the search path. T o determine how to execute functions you call, MATLAB uses a search path to find M-files and other MATLAB-related files, which are organized in directories on your file system. Any file you want to run in MATLAB must reside in the current directory or in a directory that is on the search path. By default, the files supplied with MATLAB and Math Works toolboxes are included in the search path.

Workspace Browser: The MATLAB workspace consists of the set of variables (named arrays) built up during a MATLAB session and stored in memory. You add variables to the workspace by using functions, running M-files, and loading saved workspaces. To view the workspace and information about each variable, use the Workspace browser, or use the functions who and whos. To delete variables from the workspace, select the variable and select Delete from the Edit menu. Alternatively, use the clear function. The workspace is not maintained after you end the MATLAB session. To save the workspace to a file that can be read during a later MATLAB session, select Save Workspace As from the File menu, or use the save function. This saves the workspace to a binary file called a MAT-file, which has a .mat extension. There are options for saving to different formats. To read in a MAT-file, select Import Data from the File menu, or use the load function.

Array Editor: Double-click on a variable in the Workspace browser to see it in the Array Editor. Use the Array Editor to view and edit a visual representation of one- or twodimensional numeric arrays, strings, and cell arrays of strings that are in the workspace.

## Dept of ECE, GPREC, KNL

Page 13

The Error-Amended Sharp Edge (EASE) Scheme for Image Zooming Using MATLAB
Editor/Debugger: Use the Editor/Debugger to create and debug M-files, which are programs you write to run MATLAB functions. The Editor/Debugger provides a graphical user interface for basic text editing, as well as for M-file debugging. You can use any text editor to create M-files, such as Emacs, and can use preferences (accessible from the desktop File menu) to specify that editor as the default. If you use another editor, you can still use the MATLAB Editor/Debugger for debugging, or you can use debugging functions, such as dbstop, which sets a breakpoint.

If you just need to view the contents of an M-file, you can display it in the Command Window by using the type function. MATLAB features a family of application-specific solutions called toolboxes. Very important to most users of MATLAB, toolboxes allow you to learn and apply specialized technology. Toolboxes are comprehensive collections of MATLAB functions (M-files) that extend the MATLAB environment to solve particular classes of problems. Areas in which toolboxes are available include signal processing, control systems, neural networks, fuzzy logic, wavelets, simulation, and many others.

## 3.2 IMAGE PROCESSING TOOLBARS:

The Image Processing Toolbox software is a collection of functions that extend the capability of the MATLAB numeric computing environment. The toolbox supports a wide range of image processing operations, including. Spatial image transformations Morphological operations Neighborhood and block operations Linear filtering and filter design Transforms Image analysis and enhancement Image registration Deblurring Region of interest operations

## Dept of ECE, GPREC, KNL

Page 14

The Error-Amended Sharp Edge (EASE) Scheme for Image Zooming Using MATLAB
Many of the toolbox functions are MATLAB M-files, a series of MATLAB statements that implement specialized image processing algorithms. You can view the MATLAB code for these functions using the statement

## type function name.

You can extend the capabilities of the toolbox by writing your own M-files, or by using the toolbox in combination with other toolboxes, such as the Signal Processing Toolbox software and the Wavelet Toolbox software. This example introduces some basic image processing concepts. The example starts by reading an image into the MATLAB workspace. The example then performs some contrast adjustment on the image. Finally, the example writes the adjusted image to a file.

## Read and Display an Image

First, clear the MATLAB workspace of any variables and close open figure windows.

Close all;
To read an image, use the imread command. The example reads one of the sample images included with the toolbox, pout.tif, and stores it in an array named I.

imread infers from the file that the graphics file format is Tagged Image File Format (TIFF). For the list of supported graphics file formats, see the imread function reference documentation. Now display the image.

## The toolbox includes two image display functions

imshow and imtool. imshow is the toolboxs fundamental image display function. imtool starts the Image Tool which presents an integrated environment for displaying images and performing some common image processing tasks. The Image Tool provides all the image display capabilities of imshow but also provides access to several other tools for navigating Dept of ECE, GPREC, KNL Page 15

The Error-Amended Sharp Edge (EASE) Scheme for Image Zooming Using MATLAB
and exploring images, such as scroll bars, the Pixel Region tool, Image Information tool, and the Contrast Adjustment tool. For more information,Displaying and Exploring Images. You can use either function to display an image. This example uses imshow.

Imshow (I)
To write the newly adjusted image I2 to a disk file, use the imwrite function. If you include the filename extension '.png', the imwrite function writes the image to a file in Portable Network Graphics (PNG) format, but you can specify other formats.

## imwrite (I2, 'pout2.png');

See the imwrite function reference page for a list of file formats it supports. See also Writing Image Data to a File on page 3-5 for more information about writing image data to files. First, clear the MATLAB workspace of any variables, close open figure windows, and close all open Image Tools.

close all
Read and display the grayscale image rice.png.

The Image Processing Toolbox software includes two display functions, imshow and imtool. Both functions work within the Handle Graphics architecture: they create an image object and display it in an axes object contained in a figure object. To display image data, use the imshow function. The following example reads an image into the MATLAB workspace and then displays the image in a MATLAB figure window.

Page 16

## Dept of ECE, GPREC, KNL

The Error-Amended Sharp Edge (EASE) Scheme for Image Zooming Using MATLAB
imshow(moon);
The imshow function displays the image in a MATLAB figure window, as shown in the following figure.

## Image Displayed in a Figure Window by imshow

To import an image from any supported graphics image file format, in any of the supported bit depths, use the imread function. This example reads a truecolor image into the MATLAB workspace as the variable RGB.

If the image file format uses 8-bit pixels, imread stores the data in the workspace as a uint8 array. For file formats that support 16-bit data, such as PNG and TIFF, imread creates a uint16 array. imread uses two variables to store an indexed image in the workspace: one for

## Dept of ECE, GPREC, KNL

Page 17

The Error-Amended Sharp Edge (EASE) Scheme for Image Zooming Using MATLAB
the image and another for its associated colormap. imread always reads the colormap into a matrix of class double, even though the image array It may be of class.

In these examples, imread infers the file format to use from the contents of the file. You can also specify the file format as an argument to imread. Imread supports many common graphics file formats, such as Microsoft Windows Bitmap (BMP), Graphics Interchange Format (GIF), Joint Photographic Experts Group (JPEG), Portable Network Graphics (PNG), and Tagged Image File Format (TIFF) formats. For the latest information concerning the bit depths and/or image formats supported, see imread and informants. If the graphics file contains multiple images, imread imports only the first image from the file. To import additional images, you must use imread with format-specific arguments to specify the image you want to import. In this example, imread imports a series of 27 images from a TIFF file and stores the images in a four-dimensional array. You can use imfinfo to determine how many images are stored in the file.

## mri = zeros([128 128 1 27],'uint8'); for frame=1:27

% preallocate 4-D

array

## Dept of ECE, GPREC, KNL

Page 18

The Error-Amended Sharp Edge (EASE) Scheme for Image Zooming Using MATLAB
4 INTERPOLATION METHODS
Interpolation is the process used to estimate an image value at a location in between image pixels. There are many different interpolation methods, some of which are described below. Some of the concerns to take into account when choosing an appropriate algorithm are: How accurate is the method? How expensive is it? How smooth is the interpolant? How many data points are needed? Common interpolation algorithms can be grouped into two categories: adaptive and nonadaptive. 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.

Original

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.

## Dept of ECE, GPREC, KNL

Page 19

The Error-Amended Sharp Edge (EASE) Scheme for Image Zooming Using MATLAB
The interpolation methods all work in a fundamentally similar way. In each case, to determine the value for an interpolated pixel, they find the point in the input image that the output pixel corresponds to. They then assign a value to the output pixel by computing a weighted average of some set of pixels in the vicinity of the point. The weightings are based on the distance each pixel is from the point. As we discussed above, for image resampling, the interpolation step must reconstruct a twodimensional (2-D) continuous signal s(x.y) from its discrete samples s(k,l). Thus, the amplitude at the position (x,y) must be estimated from its discrete neighbors. This can be described formally as the convolution of the discrete image samples with the continuous 2-D impulse response of a 2-D h(x,y) of a 2-D reconstruction filter s(x,y) = k l s(k,1).2Dh(x-k,y-1) .. (1)

Usually, symmetrical and separable interpolation kernels are used to reduce the computational complexity
2Dh(x,y)

= h(x).h(y)

..

(2)

Fig. 1 illustrates the interpolation of the point (x,y) in a 4X4 neighborhood. Interpolation is performed in the x direction first. The small grey intermediate points in Fig. 1 are generated by four one-dimensional (1-D) interpolations. They are used for the final 1-D interpolation in the y- direction.

## Dept of ECE, GPREC, KNL

Page 20

The Error-Amended Sharp Edge (EASE) Scheme for Image Zooming Using MATLAB
4.1 NEAREST NEIGHBOUR 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. Here the output pixel is assigned the value of the pixel that the point falls within. No other pixels are considered i.e; in this method, we are trying to approximate the sinc function by a spatially limited kernel that can be given by the nearest neighbor. The value s(x) at the location (x) is chosen as the next known value s(k). Therefore, only N=1 supporting point is required for the nearest neighbor interpolation. This is tantamount to convolution with a rect function [Fig. 2(a)]

## (3) Clearly, h1(x) is a DC-constant interpolator

Figure2. Nearest Neighbor Interpolation a) Kernel b) Magnitude of Fourier Transform c) Logarithmic plot of magnitude Fig. 2(b) shows that the Fourier spectrum of the nearest neighbor kernel equals the sinc function (expressed in the frequency domain). The logarithmical scale shows prominent sidelobes in those regions of the frequency domain where the repetitions of S caused by s scanning should be suppressed [Fig. 2(c)]. The gain in the pass band rapidly falls off to 2/ 64% at the cutoff point, and the

amplitude of the side maxima is more than 20%. Therefore, strong aliasing and blurring effects are associated with the nearest neighbor method for image interpolation.

## Dept of ECE, GPREC, KNL

Page 21

The Error-Amended Sharp Edge (EASE) Scheme for Image Zooming Using MATLAB

## 4.2 BI-LINEAR 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. Here the values of both direct neighbors are weighted by their distance to the opposite point of interpolation. Therefore, the linear approximation of the sinc function follows the triangular function (4) The triangular function h2(x) corresponds to a modest low-pass filter H2(f) in the frequency domain [figure 3]. Again,h2(0)=1,h2(1,2,)=0,H2(0)=1 and H2(1,2,..)=0.

Figure3. Bi-linear Interpolation a) Kernel b) Magnitude of Fourier Transform c) Logarithmic plot of magnitude

## Dept of ECE, GPREC, KNL

Page 22

The Error-Amended Sharp Edge (EASE) Scheme for Image Zooming Using MATLAB
Therefore, the linear kernel is a Dc constant interpolator. The side lobes in the stop band are below 10%, which still is considerable. Therefore, the main disadvantages of linear interpolation are both the attenuation of high-frequency components and the aliasing of the data beyond the cutoff point into the low frequencies.

## 4.3 CUBIC CONVOLUTION:

Cubic convolution determines the grey level from the weighted average of the 16 closest pixels to the specified input coordinates, and assigns that value to the output coordinates or CC calculates a distance weighted average of a block of 16 pixels from the original image which surround the new output pixel location.

## Dept of ECE, GPREC, KNL

Page 23

The Error-Amended Sharp Edge (EASE) Scheme for Image Zooming Using MATLAB
5. INTRODUCTION TO EASE
This thesis explains a new interpolation method, called the error-amended sharp edge (EASE) scheme, which is a modified bilinear method. In order to remove/reduce interpolation artifacts such as image blur and the checkerboard effect (ringing), EASE tries to amend the interpolation error by employing the classical interpolation error theorem in an edge-adaptive fashion. EASE is applied for image zooming by both integer and non integer magnification factors. The new interpolation scheme has proved to result in high-resolution images having clearer and sharper edges than linear interpolation methods, for all synthetic and natural images we have tested. EASE can be implemented with ease; it turns out to be similarly efficient as cubic interpolation schemes.

## 5.1 ERROR AMENDED SHARP EDGE SCHEME FOR IMAGE INTERPOLATION

Desirable features of any digital image resolution- enhancement algorithm include exact interpolation (for 'distortion less' or 'lossless' processing) adjustable resolution, adjustable smoothness, and ease of computation. As discussed above the image re-sampling consists of two basic steps: interpolation and evaluation (sampling). Image interpolation turns discrete data into a continuous function, which is necessary for various geometric transform of discrete images. There are two kinds of interpolation methods: linear and nonlinear ones. For linear methods, diverse interpolation kernels of finite size have been introduced, in the literature, as approximations of the ideal interpolation kernel which is spatially unlimited. However, such linear interpolation methods have been introduced without considering specific local information on edges. Thus, they may bring up artifacts, such as the checkerboard effect or image blur, when the image content shows discontinuities or edges.

Nonlinear interpolation methods have been suggested to reduce the artifacts of linear methods. The major step in the nonlinear methods is to either fit the edges with some templates or predict edge information for the high resolution image from the low resolution one. However, these nonlinear methods are often computation-intensive and they can be one to two order more expensive than linear methods for 2-D images. Furthermore, they may become ineffective in the estimation of the edge orientation for the class of edge models with Dept of ECE, GPREC, KNL Page 24

The Error-Amended Sharp Edge (EASE) Scheme for Image Zooming Using MATLAB
fine scales(e.g., tightly packed edges that can be commonly found in the texture patterns). More effective interpolation methods are yet to be developed in order to accurately preserve the edge orientation without introducing a high computation cost. Recently, the authors have studied edge-forming methods as a postprocess of conventional interpolation schemes, to form clear and sharp edges by applying partial differential equations (PDEs) of anisotropic diffusion. Such PDE-based methods have proved to form reliable edges satisfactorily for image zooming by integer and noninteger magnification factors, for both gray-scale and color images. In this article, we will introduce a new interpolation method,called the error-amended sharp edge (EASE) scheme. The EASE scheme is based on the bilinear interpolation method; however, the interpolation error will be amended by the interpolation error theorem in an edge-adaptive fashion. In EASE, each resampling evaluation requires at most 12 pixel values of the low resolution image for the estimation of the edge orientation, and at most seven pixel values for the resampling. EASE can be implemented with ease. It is applicable to image zooming by both integer and noninteger magnification factors conveniently. EASE turns out to be similarly efficient as the C2 -bicubic and bicubic B-spline interpolation schemes; however, it shows an ability to preserve edges much better than those conventional linear interpolation schemes.

The organization of this article is as follows. The next section presents a brief review of linear interpolation methods and the interpolation error theorem, as preliminaries. In the next section, we introduce the EASE scheme for 1-D signals and 2-D images.

The section discusses strategies for the computation of the error amender in an edge-adaptive manner and the estimation of the edge orientation. After this section we have presented the numerical experiments to show superior properties of EASE in the preservation of edges. Compared with linear methods such as the bilinear, the C1-and C2 -bicubic methods, and the bicubic B-spline interpolators, the new interpolation scheme results in clearer and sharper edges for all synthetic, natural, and medical images we have tested. Section V summarizes our development and experiments.

## Dept of ECE, GPREC, KNL

Page 25

The Error-Amended Sharp Edge (EASE) Scheme for Image Zooming Using MATLAB

5.2 PRELIMINARIES
Discussed here are a number of interpolation methods, this is by no means an exhaustive list but the methods shown tend to be those in common use in computer graphics. The main attributes is that they are easy to compute and are stable. Interpolation as used here is different to "smoothing", the techniques discussed here have the characteristic that the estimated curve passes through all the given points. The idea is that the points are in some sense correct and lie on an underlying but unknown curve, the problem is to be able to estimate the values of the curve at any position between the known points. This section begins with a brief review of linear interpolation methods. Then, we will present the interpolation error theorem as a preliminary of our new interpolation scheme.

## 5.3 LINEAR INTERPOLATION METHODS

Linear interpolation is the simplest method of getting values at positions in between the data points. The points are simply joined by straight line segments. Each segment (bounded by two data points) can be interpolated independently.

The interpolation step of image resampling is to construct a 2-D continuous function u(x,y) from its discrete image samples u(k,l), where x and y are real numbers and k and l are integers. It can be formally expressed as the convolution of the discrete image samples with a continuous 2-D filter H2D

.................... (3.1)

Usually, the interpolation kernel H2D is selected to be symmetric and separable to reduce the computational complexity

## . (3.2) Dept of ECE, GPREC, KNL Page 26

The Error-Amended Sharp Edge (EASE) Scheme for Image Zooming Using MATLAB
Where H is symmetric, i.e., H (-x) =H(x). It is often required for the kernel H to satisfy the zero crossing condition

## And the partition of unity condition

(3.4)

The conditions in (3.3) guarantee that the image is not modified if it is resampled on the same grid, and, therefore, the kernel can avoid smoothing and preserve high frequencies.Kernels that fulfill (3.3) are called interpolators, while others are called approximators.The condition (3.4) implies that the energy of the resampled image remains unchanged. In other words, the mean brightness of the image is not altered when the image is interpolated or resampled. Kernels that satisfy or fail (3.4) are named respectively direct current (DC)-constant or DCinconstant. It is known that superior kernels are interpolators and DC-constant. The converse is not always true.

Here, for a completeness of the article, we present a few kernels of linear interpolation methods, with which our new interpolation scheme will be compared. In particular, we consider popular ones such as the linear, cubic, and cubic B-spline kernels

## .. (3.5) Dept of ECE, GPREC, KNL Page 27

The Error-Amended Sharp Edge (EASE) Scheme for Image Zooming Using MATLAB
Where a is a parameter, * denotes the convolution, and

Here,H3 is the cubic B-spline approximator , while HB- spline is its associated cubic B-spline interpolator satisfying the zero crossing condition (3.3)and the partition of unity condition (3.4) . The interpolator Hcubic is C1- continuous, in general; one can impose C2- continuity by setting a=-3/4.

## 5.4 INTERPOLATION ERROR THEOREM

The following theorem can be found in most textbooks dealing with introductory numerical methods. Theorem 1: (Interpolation Error Theorem): Let the interval be partitioned in to {a= x0<x1<..< Xn =b} and an N th-order polynomial Pn interpolate at the nodal points of the partitioning. Assume that uN+1 (x) exists for each x [a,b]. Then, for every x [a,b], there is a point [a,b] such that

.. (3.6) | uN+1(x)|

Furthermore, assume that the points are uniformly spaced and max M , for some M>0. Then

x[a,b]

.. (3.7)

When N=1, it follows from the theorem that for two points x0 and x0+h, there is a point between x0 and x0+h such that

## Dept of ECE, GPREC, KNL

Page 28

The Error-Amended Sharp Edge (EASE) Scheme for Image Zooming Using MATLAB

(3.8) For x = x0+ (j/k)h, where k is an integer (k2) and j= 1,..,k-1, we have

(3.9) for some j (x0,x0+h). In particular, when k=2 and j=1, the above identity becomes

.. (3.10) For some 1 (x0, x0+h). In the next section, we will explore the interpolation error theorem, particularly (3.9) and (3.10), in order to derive an effective interpolation scheme. For later references, we define the second-order Newton polynomial interpolating over {xi-1, xi,xi+1}, where xi- xi-1 = xi+1- xi=h, as

(3.11)

## Dept of ECE, GPREC, KNL

Page 29

The Error-Amended Sharp Edge (EASE) Scheme for Image Zooming Using MATLAB
5.5. IMPLEMENTATION OF EASE
This section introduces EASE which tries to amend the error of the bilinear method by adopting the interpolation error theorem in an edge-adaptive way. The only assumption we need is that the given image is locally smooth.

## A. EASE FOR 1-D SIGNALS

We will begin with the EASE scheme applied for the interpolation of an 1-D signal. Pick a point P (xi, xi+1) as in Fig. 1, where u is to be evaluated. For simplicity, we first let p be the midpoint of xi and xi+1

## Dept of ECE, GPREC, KNL

Page 30

The Error-Amended Sharp Edge (EASE) Scheme for Image Zooming Using MATLAB
The error-amender Ci+1/2 is ideally the vertical distance connecting the two points in Fig. 1 marked by o and . The error-amender is not available for the current interpolation; however, it may be estimated by utilizing the following quantities:

L

and C

## the signal u is to be interpolated from a lower resolution. For example, since

It follows from (3.10) that the quantity C L can be seen as an error-amender which represents the interpolation error

(3.15) for some 2 (xi-1,xi+1) . Now we assume that the second derivative u varies little over (xi-1,xi+1). Then from (3.13) and (3.15), we have

Thus, assuming that the second derivative u varies little on each smooth portion of the signal, we suggest the EASE scheme for the interpolation of 1-D signals (by a magnification factor of 2 ) as follows:

(3.16)

## Dept of ECE, GPREC, KNL

Page 31

The Error-Amended Sharp Edge (EASE) Scheme for Image Zooming Using MATLAB

The minmod determines the direction of the error-amending. When the values CL and CR have different signs, the interval (xi, xi+1) is assumed to contain either an edge or an inflection point, and, therefore, the linear interpolation scheme can be accurate enough to evaluate ui+1/2 . The minmod function chooses the minimum in modulus when and show the same sign. The EASE scheme is an edge-adaptive interpolation scheme; it is nonlinear overall due to the involvement of the minmod function. The above scheme can be applied for image zooming by a magnification factor of k 2 . The EASE scheme for the interpolation of 1-D signals (by a magnification factor of k 2) can be formulated as follows: for xi+j/k= xi+ j/k, j=1,.,k-1

.(3.17) Where

And Di-1(j/k) is defined to be the difference between,p2,1,i-1 and the linear interpolation of ui-1 and ui+1, both evaluated at xi-1+2j/k

.(3.18) Where p2,1,i-1 is defined in (3.11). We close this subsection along with the following remarks. EASE has been developed based on the assumption that u varies little. Thus, it may reveal common artifacts (such as image blur and ringing) at pixels where the image content is varying fast locally. The selection process in the minmod function is introduced in order to reduce the

## Dept of ECE, GPREC, KNL

Page 32

The Error-Amended Sharp Edge (EASE) Scheme for Image Zooming Using MATLAB
ringing artifact in the interpolation result and to incorporate an edge-adaption mechanism as well. In practice, EASE has interpolated various images satisfactorily and more effectively than other linear interpolation methods. EASE can be applied for image zooming by arbitrary magnification factor; for each interpolation point, the evaluation can be performed by linear interpolation followed by an error-amending. Note that (3.17) and (3.18) are still valid although j/k is replaced by a real number (0,1). Given CL and CR , the minmod function determines the same error-amending direction for all sampling points xi+ (xi+xi+1). B. EASE FOR 2-D IMAGES In Fig. 2, we present an illustration of EASE to be applied for the (2 2)-magnification of 2D images. The solid circular dots indicate pixels from the original image of low resolution. We begin with the interpolation for the points marked by , the aligned points. There, the values can be computed by applying the 1-D EASE scheme presented in Section III-A. This step can be simply performed by computing a series of 1-D directional (horizontal or vertical) interpolations.

## Dept of ECE, GPREC, KNL

Page 33

The Error-Amended Sharp Edge (EASE) Scheme for Image Zooming Using MATLAB
Let all values at the aligned points be evaluated. Then, we must determine values at points marked by }, the interior points. We will evaluate these values by trying to interpolate along the local edge direction. In order to estimate the edge orientation, we first compute absolute values of four directional Sobel derivatives at each circled point (i+1/2,j+1/2)

..(3.19)

Assuming that the image content on the edges is locally bilinear, we can see that the edge direction is between the two directions that evaluate the two smallest directional Sobel derivatives. Furthermore, the two flattest directions can be proved to be adjacent to each other, i.e., they differ by 45degrees ; see Section III-C below. Let Dp and Dq be the two smallest directional Sobel derivatives, respectively, in the vertical/horizontal direction and the 45 /135 degrees direction

.(3.20) Then, the interpolation formula along the edge direction can be derived as follows:

## .(3.21) Dept of ECE, GPREC, KNL Page 34

The Error-Amended Sharp Edge (EASE) Scheme for Image Zooming Using MATLAB

The claim that the two flattest directions differ by 45 degrees plays an important role in the estimation of the edge direction, because otherwise the edge orientation is difficult to determine and the formula (3.21) is hardly meaningful. It is straightforward to apply the above scheme for image zooming of a kk magnification where k2 is an integer. The aligned points can again be determined as for 1-D signals. For the interior points ( s), the four directional Sobel derivatives can be computed as in image zooming by (22)-magnification. Once the two flattest directions are determined, the interpolation along the estimated edge direction can be fulfilled correspondingly for all (k-1)(k-1) interior sampling points, utilizing the same estimated edge orientation. For example, assume that D1(horizontal) and D2 (450) are the two smallest directional Sobel derivatives, as in Fig. 3. Then the interpolation procedure for every interior point (marked by ) can be summarized as follows.

## Dept of ECE, GPREC, KNL

Page 35

The Error-Amended Sharp Edge (EASE) Scheme for Image Zooming Using MATLAB
1) Compute four values at the corresponding aligned points( s) which are in either the horizontal or 450 direction from the interior point(o) . The 1-D EASE scheme is utilized for the computation of values at the aligned points. 2) Obtain L1 and L2 which interpolate linearly the aligned values for the interior point in the horizontal and 450 directions, respectively. 3) Evaluate the value at o ,u0 , utilizing the formula (3.21)

..(3.22)

## where L1 and L2 are obtained at the previous step.

Note that EASE utilizes 12 points in maximum for the estimation of the edge orientation: the four corner points and two nearest points outside each of four sides. On the other hand, it fulfills the sampling by utilizing 3, 5, 6, or 7 pixel values of the low resolution image. It is clear to see that the support of the EASE interpolation kernel is a proper subset of those of cubic schemes such as the C2-bicubic and bicubic B-spline methods. The basic idea of EASE is applicable for higher-order linear interpolation schemes along with corresponding error-amenders. However, higher-order interpolation schemes may introduce higher levels of image blur or checkerboard effect. The major challenge in image zooming is to estimate local edges in order not to interpolate the data across them. EASE is designed to be both low order (requiring a small support for the interpolation kernel) and edge-adaptive.

## Dept of ECE, GPREC, KNL

Page 36

The Error-Amended Sharp Edge (EASE) Scheme for Image Zooming Using MATLAB
6. EXPERIMENTAL RESULTS
Input image:

RGB to Gray

## Dept of ECE, GPREC, KNL

Page 37

The Error-Amended Sharp Edge (EASE) Scheme for Image Zooming Using MATLAB
Image zoomed to 400% using nearest neighborhood method in Matlab

## Dept of ECE, GPREC, KNL

Page 38

The Error-Amended Sharp Edge (EASE) Scheme for Image Zooming Using MATLAB
Imaged Zoomed using EASE Scheme by a factor 4

## Dept of ECE, GPREC, KNL

Page 39

The Error-Amended Sharp Edge (EASE) Scheme for Image Zooming Using MATLAB
Comparison of EASE and nearest neighborhood methods

## Dept of ECE, GPREC, KNL

Page 40

The Error-Amended Sharp Edge (EASE) Scheme for Image Zooming Using MATLAB
7. Source Code:
%NOTE:program for ease k*k */ function a=e2(img,img2,m,n,k); k=4; img2=imread('kalam.jpg'); imview(img2); %Function to convert RGB image to gray image*/ [m,n,z]=size(img2); %To conver the data clause of the image to double*/ if z==3 img1=rgb2gray(img2); imview(img1); else img1=img2; end img=im2double(img1); % Zero padding and preallocating the memory*/ a=zeros(k*m+k*3,k*n+k*3); %Transfering the pixel values from input image to the output image*/ count2=0; for j=k+1:k:(k*n+1) count1=0; count2=count2+1; for i=k+1:k:(k*m+1) count1=count1+1; a(i,j)=a(i,j)+img(count1,count2); Dept of ECE, GPREC, KNL Page 41

The Error-Amended Sharp Edge (EASE) Scheme for Image Zooming Using MATLAB
end end %To find the aligned points in horizontal direction*/ for j=k+1:k:k*m for i=k+2:k:k*n

%Calculating minmod function*/ c1=a(j,i-1)-(a(j,i-k-1)+a(j,i+k-1))*0.5; c2=a(j,i+k-1)-(a(j,i-1)+a(j,i+2*k-1))*0.5; if((c1*c2)>0) if(abs(c1)<=abs(c2)) x=c1; else x=c2; end else x=0; end

for p=1:1:k-1

x1=4*x*(p/k)*(1-p/k); a(j,i+p-1)=a(j,i+p-1)+a(j,i-1)*(1-p/k)+(p/k)*a(j,i+k-1)+x1*0.25; end end end Dept of ECE, GPREC, KNL Page 42

The Error-Amended Sharp Edge (EASE) Scheme for Image Zooming Using MATLAB
%To find the aligned points in vertical direction*/ for i=k+1:k:(k*n+1) for j=k+2:k:(k*m+2)

c3=a(j-1,i)-(a(j-k-1,i)+a(j+k-1,i))*0.5; c4=a(j+k-1,i)-(a(j-1,i)+a(j+2*k-1,i))*0.5;

if((c3*c4)>0) if(abs(c3)<=abs(c4)) y=c3; else y=c4; end else y=0; end for p=1:1:k-1 x1=4*y*(p/k)*(1-p/k); a(j+p-1,i)=a(j+p-1,i)+a(j-1,i)*(1-p/k)+(p/k)*a(j+k-1,i)+x1*0.25; end end end %To find the interior points*/ for j=k+1:k:k*m+1 for i=k+1:k:k*n+1 %To estimate the edge direction using sobel derivatives*/ Dept of ECE, GPREC, KNL Page 43

The Error-Amended Sharp Edge (EASE) Scheme for Image Zooming Using MATLAB
x2=a(j,i)-(a(j,i-k)+a(j,i+k))*0.5; x3=a(j,i+k)-(a(j,i)+a(j,i+2*k))*0.5; if((x2*x3)>0) if(abs(x2)<=abs(x3)) x1=x2; else x1=x3; end else x1=0; end

e1=(a(j,i)+a(j,i+k))*0.5+x1*0.25; x5=a(j+k,i)-(a(j+k,i-k)+a(j+k,i+k))*0.5; x6=a(j+k,i+k)-(a(j+k,i)+a(j+k,i+2*k))*0.5; if((x5*x6)>0) if(abs(x5)<=abs(x6)) x4=x5; else x4=x6; end else x4=0; end e2=(a(j+k,i)+a(j+k,i+k))*0.5+x4*0.25; x8=a(j,i)-(a(j-k,i)+a(j+k,i))*0.5; Dept of ECE, GPREC, KNL Page 44

The Error-Amended Sharp Edge (EASE) Scheme for Image Zooming Using MATLAB
x9=a(j+k,i)-(a(j,i)+a(j+2*k,i))*0.5; if((x8*x9)>0) if(abs(x8)<=abs(x9)) x7=x8; else x7=x9; end else x7=0; end e3=(a(j,i)+a(j+k,i))*0.5+x7*0.25; x11=a(j,i+k)-(a(j-k,i+k)+a(j+k,i+k))*0.5; x12=a(j+k,i+k)-(a(j,i+k)+a(j+2*k,i+k))*0.5; if((x11*x12)>0) if(abs(x11)<=abs(x12)) x10=x11; else x10=x12; end else x10=0; end e4=(a(j,i+k)+a(j+k,i+k))*0.5+x10*0.25; d1=abs(a(j+k,i+k)+2*e1+a(j,i+k)-a(j+k,i)-2*e3-a(j,i)); d2=(sqrt(2))*abs(e1+a(j,i+k)+e4-e3-a(j+k,i)-e2); d3=abs(a(j,i)+2*e1+a(j,i+k)-a(j+k,i)-2*e2-a(j+k,i+k)); Dept of ECE, GPREC, KNL Page 45

The Error-Amended Sharp Edge (EASE) Scheme for Image Zooming Using MATLAB
d4=(sqrt(2))*abs(e3+a(j,i)+e1-e2-a(j+k,i+k)-e4); for j1=1:1:k-1 for i1=1:1:k-1 k1=i1+j1; k2=i1-j1; if(d1<=d3) dp=d1; lp=(1-i1/k)*a(j+j1,i)+(i1/k)*a(j+j1,i+k); elseif(d1>d3) dp=d3; lp=(1-j1/k)*a(j,i+i1)+(j1/k)*a(j+k,i+i1); end if(d2<=d4) dq=d2; if(k1<=k) lq=(1-i1/k1)*a(j+k1,i)+(i1/k1)*a(j,i+k1); elseif(k1>k) lq=((k-i1)/(2*k-k1))*a(j+k,i+k1-k)+(1-((k-i1)/(2*k-k1)))*a(j+k1-k,i+k); end elseif(d2>d4) dq=d4; if(j1<=i1) lq=(1-j1/(k-k2))*a(j,i+k2)+(j1/(k-k2))*a(j+k-k2,i+k); elseif(j1>i1) lq=(1-i1/(k+k2))*a(j-k2,i)+(i1/(k+k2))*a(j+k,i+k+k2); end Dept of ECE, GPREC, KNL Page 46

The Error-Amended Sharp Edge (EASE) Scheme for Image Zooming Using MATLAB
end a(j+j1,i+i1)=(1.414*dq*lp/(dp+1.414*dq))+(dp*lq)/(dp+1.414*dq); end end end end %Cropping the image to the required size*/ a1=a(k+1:k*m+2,k+1:k*n+2); %Output image*/ imview(a1)

## Dept of ECE, GPREC, KNL

Page 47

The Error-Amended Sharp Edge (EASE) Scheme for Image Zooming Using MATLAB
8. CONCLUSIONS
We have introduced a new interpolation method, called the EASE scheme. EASE is based on the bilinear method and tries to amend the error by utilizing the interpolation error theorem in an edge-adaptive way. Effective strategies have been suggested for the computation of the erroramender and the estimation of edge directions by utilizing local pixel values. The new interpolation scheme has proved better in accuracy and reliability than linear interpolation methods such as the bilinear scheme, the C1- and C2bicubic methods, and the bicubic B-spline interpolator. EASE turns out to be similarly efficient as cubic interpolation schemes.

## Dept of ECE, GPREC, KNL

Page 48

The Error-Amended Sharp Edge (EASE) Scheme for Image Zooming Using MATLAB
9. BIBLIOGRAPHY
 T. Blu, P. Thvenaz, and M. Unser, Minimum support interpolators with optimum approximation properties, in Proc. IEEE Int. Conf. Image Processing, 1998, pp. 242245.  T. Blu, P. Thvenaz, and M. Unser, Linear interpolation revitalized, IEEE Trans. Image Processing, vol. 13, no. 5, pp. 710719, May 2004.  W. Carey, D. Chuang, and S. Hemami, Regularity-preserving image interpolation, IEEE Trans. Image Process., vol. 8, no. 9, pp.12931297, Sep. 1999.  Y. Cha and S. Kim, Edge-forming methods for color image zooming, IEEE Trans. Image Process., vol. 15, no. 8, pp. 23152323, Aug. 2006.  Y. Cha and S. Kim, Edge-forming methods for image zooming, J. Math. Imag. Vis., vol. 25, no. 3, pp. 353364, 2006.

 R. Gonzalez and R.Woods, Digital Image Processing, 2nd ed. Upper Saddle River, NJ: Prentice-Hall, 2002.  H. S. Hou and H. C. Andrews, Cubic splines for image interpolation and digital filtering, IEEE Trans. Acoust., Speech, Signal Process., vol. ASSP-26, no. 6, pp. 508517, Jun. 1978.  K. Jensen and D. Anastassiou, Subpixel edge localization and the interpolation of still images, IEEE Trans. Image Process., vol. 4, no. 3, pp. 285295, May 1995.  R. G. Keys, Cubic convolution interpolation for digital image processing, IEEE Trans. Acoust., Speech, Signal Process., vol. ASSP-29, no. 6, pp. 11531160, Jun. 1981.  T. Lehmann, C. Gnner, and K. Spitzer, Survey: Interpolation methods in medical image processing, IEEE Trans. Med. Imag., vol.18, no. 11, pp. 10491075, Nov. 1999.

## Dept of ECE, GPREC, KNL

Page 49

The Error-Amended Sharp Edge (EASE) Scheme for Image Zooming Using MATLAB
 T. Lehmann, C. Gnner, and K. Spitzer, Addendum: B-spline interpolation in medical image processing, IEEE Trans. Med. Imag., vol.20, no. 7, pp. 660665, Jul. 2001.  X. Li and M. Orchard, New edge-directed interpolation, IEEE Trans. Image Process., vol. 10, no. 10, pp. 15211527, Oct. 2001.  P. Thvenaz, T. Blu, and M. Unser, Interpolation revisited, IEEE Trans. Med. Imag., vol. 19, no. 7, pp. 739758, Jul. 2000.  M. Unser, A. Aldroubi, and M. Eden, Enlargement and reduction of digital images with minimum loss of information, IEEE Trans. Image Process., vol. 4, no. 3, pp. 247257, Mar. 1995.

Page 50