easimage
|
Functions to create and process image structures. More...
Functions | |
Image * | imgNew (unsigned int width, unsigned int height, unsigned short depth) |
Creates a new image. More... | |
Image * | imgFromBitmap (const char *filename) |
Loads an image from a BMP image file. More... | |
Image * | imgFromPPM (const char *filename) |
Loads an image from a PPM image file. More... | |
Image * | imgFromFile (const char *filename) |
int | imgSavePPM (Image *img, char *fname) |
int | imgSavePAM (Image *img, char *fname) |
int | imgSaveRAW (Image *img, char *fname) |
Save RAW file. More... | |
Image * | imgCopy (Image *img) |
Creates a copy of an Image. More... | |
void | imgScale (Image *img, unsigned int sfactor) |
Scales an image. | |
Image * | imgCrop (Image *img, int x1, int y1, int x2, int y2) |
Crops an image. More... | |
Image * | imgCreateGaussian (int dim, float sig) |
Image * | imgConvolution (Image *img1, Image *img2, Image *res) |
Image convolution. More... | |
int | imgFindPattern (Image *img, Image *pat, int *best_x, int *best_y) |
Searches image for a pattern. More... | |
int | imgFindPatternArea (Image *img, Image *pat, int x1, int y1, int x2, int y2, int *best_x, int *best_y) |
Searches image area for a pattern. More... | |
void | imgDestroy (Image *img) |
Destroys the image. | |
void | imgMakeSymmetricX (Image *img) |
void | imgMakeSymmetricY (Image *img) |
void | imgMakeSymmetric (Image *img) |
int | imgGetSymmetryError (Image *img, int x, int y, int radius) |
Evaluates simmetry error at location. More... | |
Image * | imgPatternDifference (Image *img, Image *pat, Image *res, int x1, int y1, int x2, int y2) |
Searches image for a pattern. More... | |
int | imgGetPixelDifference (unsigned char *p1, unsigned char *p2) |
int | imgGetSumArea (Image *img, int x1, int y1, int x2, int y2) |
Evaluates the addition of pixel components. More... | |
float | imgGetMeanArea (Image *img, int x1, int y1, int x2, int y2) |
Evaluates the pixel component mean value. More... | |
float | imgGetMean (Image *img) |
Evaluates the pixel component mean value. More... | |
unsigned int | imgGetWidth (Image *img) |
unsigned int | imgGetHeight (Image *img) |
void | imgSetPixel (Image *img, unsigned int x, unsigned int y, unsigned char *pdata) |
void | imgSetPixelRGB (Image *img, unsigned int x, unsigned int y, unsigned char r, unsigned char g, unsigned char b) |
void | imgSetPixelRGBA (Image *img, unsigned int x, unsigned int y, unsigned char r, unsigned char g, unsigned char b, unsigned char a) |
unsigned char * | imgGetPixel (Image *img, unsigned int x, unsigned int y) |
Gets pixel data. More... | |
unsigned char * | imgPixel (Image *img, unsigned int x, unsigned int y) |
void | MarkImagePositionRGB (Image *img, int x, int y, unsigned char r, unsigned char g, unsigned char b) |
void | MarkImagePosition (Image *img, int x, int y) |
int | imgGetSymmetricError (Image *img, int x1, int x2, int y1, int y2) |
Functions to create and process image structures.
Image convolution.
Performs a convolution beteween Image img1
and Image img2
. Convolution result is stored in preallocated Image res
. Image res
should have dimensions and depth matching Image img1
. If res
equals NULL, a new Image is allocated. Implementation is optimized for img1
larger than img2
. This is usually adequated for processing Image img1
through kernel Image img2
. Image img2
should have odd dimensions. Image img2
must use a pixel depth of 8 bits or the same pixel depth as Image img1
.
img | Location of Image structure |
x | Number of pixel columns |
y | Number of pixel rows |
Crops an image.
Copies a rectangular area to a new Image. Image is created with undefined colors. Image can then be released by calling the imgDestroy() function.
img | the source Image (Image to crop) |
x1 | the column number of first vertex |
y1 | the row number of first vertex |
x2 | the column number of second vertex |
y2 | the row number of second vertex |
Searches image for a pattern.
Searches the full specified area from Image img
for ocurrences of pattern Image pat
. Selectes and informs the location of the best matching pattern.
img | Image to be searched. |
pat | Image pattern to search for. |
best_x | location to store the column number of the selected location. |
best_y | location to store the row number of the selected location. |
int imgFindPatternArea | ( | Image * | img, |
Image * | pat, | ||
int | x1, | ||
int | y1, | ||
int | x2, | ||
int | y2, | ||
int * | best_x, | ||
int * | best_y | ||
) |
Searches image area for a pattern.
Searches the full specified area from Image img
for ocurrences of pattern Image pat
. Selectes and informs the location of the best matching pattern.
img | Image to be searched. |
pat | Image pattern to search for. |
x1 | the column number of the top left corner of the image area to be searched |
y1 | the row number of the top left corner of the image area to be searched |
x2 | the column number of the bottom right corner of the image area |
y2 | the row number of the bottom right corner of the image area to be searched |
best_x | location to store the column number of the selected location. |
best_y | location to store the row number of the selected location. |
Image * imgFromBitmap | ( | const char * | filename | ) |
Loads an image from a BMP image file.
Creates a new Image using the data read from the specified BMP image file. Image can then be released by calling imgDestroy() function.
filename | the name of the BMP image file |
Image * imgFromPPM | ( | const char * | filename | ) |
Loads an image from a PPM image file.
Creates a new Image using the data read from the specified PPM image file. Image can then be released by calling imgDestroy() function.
filename | the name of the PPM image file |
float imgGetMean | ( | Image * | img | ) |
float imgGetMeanArea | ( | Image * | img, |
int | x1, | ||
int | y1, | ||
int | x2, | ||
int | y2 | ||
) |
Evaluates the pixel component mean value.
Evaluates the mean value from all (color) components and all pixel within the specified area of the Image img
.
img | Image to be processed. |
x1 | the column number of the top left corner of the image area to be processed |
y1 | the row number of the top left corner of the image area to be processed |
x2 | the column number of the bottom right corner of the image area to be processed |
y2 | the row number of the bottom right corner of the image area to be processed |
unsigned char * imgGetPixel | ( | Image * | img, |
unsigned int | x, | ||
unsigned int | y | ||
) |
Gets pixel data.
Returns a pointer to the pixel data
img | Image structure location |
x | pixel column number |
y | pixel row number |
int imgGetSumArea | ( | Image * | img, |
int | x1, | ||
int | y1, | ||
int | x2, | ||
int | y2 | ||
) |
Evaluates the addition of pixel components.
Evaluates the total addition of all (color) components' values from all pixels within the specified area of the Image img
.
img | Image to be processed. |
x1 | the column number of the top left corner of the image area to be processed |
y1 | the row number of the top left corner of the image area to be processed |
x2 | the column number of the bottom right corner of the image area to be processed |
y2 | the row number of the bottom right corner of the image area to be processed |
int imgGetSymmetryError | ( | Image * | img, |
int | x, | ||
int | y, | ||
int | radius | ||
) |
Evaluates simmetry error at location.
Evaluates the simmetry error of an image's square area. Computed error will be zero if the squre area is fully simmetric along the X and Y axis.
img | Image to be processed |
x | the column number of the image area to be evaluated |
y | the row number of the image area to be evaluated |
radius | the half side dimension of the square area |
Image * imgNew | ( | unsigned int | width, |
unsigned int | height, | ||
unsigned short | depth | ||
) |
Creates a new image.
Allocates a memory block to store an Image structure. Image is created with undefined colors. Image can then be released by calling imgDestroy() function.
width | the number of columns |
height | the number of rows |
depth | the pixel size in bits |
Image * imgPatternDifference | ( | Image * | img, |
Image * | pat, | ||
Image * | res, | ||
int | x1, | ||
int | y1, | ||
int | x2, | ||
int | y2 | ||
) |
Searches image for a pattern.
Searches full specified area from Image img
for ocurrences of pattern Image pat
. Produces resulting Image res
with calculated differences.
img | Image to be searched. |
pat | Image pattern to search for. |
res | Previously allocated Image where resulting differences will be stored. If res equals NULL, a new Image is created. |
x1 | the column number of the top left corner of the image area to be searched |
y1 | the row number of the top left corner of the image area to be searched |
x2 | the column number of the bottom right corner of the image area |
y2 | the row number of the bottom right corner of the image area to be searched |