NAME
zoom - Enlarges a user-defined image area up to 10 times
SYNOPSIS
#include <CVIPtoolkit.h>
#include <CVIPgeometry.h>
Image *zoom(Image *input_Image, int quadrant, int c, int r,
int width, int height, float temp_factor)
<input_Image> - pointer to an Image
<quadrant> - 1=UL,2=UR,3=LL,4=LR,5=ALL,
6=Specify (x,y), dx, dy
<c> - column coordinate of area's upper-left corner
<r> - row coordinate of area's upper-left corner
<width> - width of area to enlarge
<height> - height of area to enlarge
<temp_factor> - degree of enlargement
PATH
$CVIPHOME/GEOMETRY/zoom.c
DESCRIPTION
To the function zoom, a pointer to the original image is
passed as a parameter. After performing the zooming opera-
tion, the pointer to the resultant image is returned to the
calling function to display the resultant image. As the
<quadrant> implies, the user can zoom the entire image, the
first quadrant, the second and so on as well as specifying
the co-ordinates and their respective distances to be
zoomed. The maximum zoom factor allowed is 10. The zoom
factor entered by the user is rounded before performing the
actual zooming. If the zoom factor is 3/4th or above the
closest integer value, the zooming factor is rounded to the
nearest integer value. Like wise if the zoom factor is 1/4th
or below the closest integer value, the zooming factor is
rounded to the nearest integer value. If the zoom factor is
between 1/4th or 3/4th an integer value, then depending upon
the zooming factor, selected pixels are skipped in a uniform
pattern and the zooming factor is rounded to the nearest
integer. In this case, if the zooming factor is close or
above 1/2 the integer value, the zooming factor is rounded
to the nearest high integer value, else it is rounded to the
nearest lower integer value.
The zooming is performed as a first order zooming algor-
ithmn. For example, a zooming factor n implies n*n pixels
are replicated in the neighborhood of any given original
pixel.
Depending upon the <quadrant> chosen by the user, the
oppropriate regions in the original image are chosen and
zoomed accordingly. A new image of the appropriate size is
created where the zoomed pixels of the original image are
written. The pointer to this newly created zoomed image is
returned to the calling function.
TYPES AND CONSTANTS
RETURN VALUES
Returns a pointer to an image.
EXAMPLE
#include <CVIPtoolkit.h>
#include <CVIPimage.h>
#include <CVIPconvert.h>
#include <CVIPgeometry.h>
void main()
{
Image *cvipImage;
IMAGE_FORMAT format;
char *inputfile, *outputfile;
setDisplay_Image("picture", "Default");
print_CVIP("\n\t\tEnter the Input File Name: ");
inputfile =(char *) getString_CVIP();
format = getFormat_CVIP(inputfile);
cvipImage = read_Image(inputfile, 1);
cvipImage = zoom(cvipImage, 1, -1, -1, -1, -1, 2.0);
print_CVIP("\n\t\tEnter the Output File Name: ");
outputfile = getString_CVIP();
write_Image(cvipImage, outputfile,CVIP_NO,CVIP_NO,format,
1);
display_Image(outputfile,format);
free(inputfile);
free(outputfile);
}
BUGS
None at this time
SEE ALSO
libgeometry
AUTHOR
Copyright (C) 1995 SIUE - by Scott Umbaugh and Srinivas
Madiraju.