NAME
crop - crops a sub-image
SYNOPSIS
#include "CVIPimage.h"
#include "CVIPgeometry.h"
#include <stdio.h>
Image *crop(Image *imgP, unsigned row_offset, unsigned
col_offset, unsigned rows, unsigned cols)
<imgP> - pointer to an Image structure
<row_offset> - row coordinate of upper-left corner
<col_offset> - column coordinate of upper-left corner
<rows> - height of desired subimage
<cols> - width of desired subimage
PATH
$CVIPHOME/GEOMETRY/crop.c
DESCRIPTION
This function allows the user to specify a subimage to be
cropped from an input image. The user specifies the row and
column coordinates of the upper-left corner of the desired
area, along with the subimage's width and height. The
passed image is deleted. The function works on all data
types and supports complex images.
TYPES AND CONSTANTS
None
RETURN VALUES
The desired subimage
HISTORY
History information recorded: None
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("\n\t\tEnter 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 selects a subimage of size 10x10 from
location 10,10 of the original image */
cvipImage = crop(cvipImage,10,10,10,10);
print_CVIP("\n\t\tEnter 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) 1996 SIUE - by Scott E. Umbaugh, Greg Hance,
and Arve Kjoelen.