NAME
translate - moves the entire image or a part of the image
SYNOPSIS
#include <CVIPimage.h>
#include <CVIPmatrix.h>
#include <CVIPgeometry.h>
#include <CVIPdef.h>
Image *translate(Image *cvipImage, CVIP_BOOLEAN do_wrap, int
r_off, int c_off, int r_mount,int c_mount,int r_slide, int
c_slide, float fill_out)
<cvipImage> - pointer to an Image structure
<do_wrap> - wrap image during translation if CVIP_YES
<r_off> - row # of upper-left pixel in area to move
<c_off> - column # of upper-left pixel in area to move
<r_mount> - height of area to move
<c_mount> - width of area to move
<r_slide> - distance to slide vertically
<c_slide> - distance to slide horizontally
<fill_out> - value to fill vacated area in cut-and-paste
PATH
$CVIPHOME/GEOMETRY/translate.c
DESCRIPTION
Translate can perform two different operations, horizontal
and vertical translation of an image, or cut-and-paste of a
part of an image. Translation moves the image as a whole; it
can either wrap the image around the 'edges' or fill vacated
areas with a constant value. Cut-and-paste moves a user-
defined part of the image, and fills the vacated area with a
user-provided value.
TYPES AND CONSTANTS
none
RETURN VALUES
Returns a translated image upon successful completion;
returns NULL if an error occurs.
BUGS
None at this time
EXAMPLE
#include <CVIPtoolkit.h>
#include <CVIPimage.h>
#include <CVIPdef.h>
#include <CVIPgeometry.h>
#include <CVIPconvert.h>
#include <CVIPview.h>
#define VIEWER "picture"
#define VIDEO_APP "SunVideo &"
void main()
{
Image *cvipImage;
IMAGE_FORMAT format;
char *inputfile,*outputfile;
setDisplay_Image(VIEWER, "Default");
print_CVIP("0Enter the Input File Name: ");
inputfile =(char *) getString_CVIP();
format = getFormat_CVIP(inputfile);
cvipImage = read_Image(inputfile, 1);
view_Image(cvipImage, inputfile);
free(inputfile);
/*the following call translates the image both in the
horizontal and vertical direction.The starting point
of the translation is 0,0 and the ending point of
translation is 255,255.The amount of translation is
10 pixels in the horizontal and vertical direction*/
cvipImage = translate(cvipImage,CVIP_YES,0,0,256,256,
10,10,0);
print_CVIP("0Enter the Output File Name: ");
outputfile = getString_CVIP();
view_Image(cvipImage,outputfile);
write_Image(cvipImage,outputfile,CVIP_NO,CVIP_NO,format,1);
free(outputfile);
}
SEE ALSO
libgeometry
AUTHOR
Copyright (C) 1995 SIUE - by Scott Umbaugh and Kun Luo.