Main Page | Class List | Directories | File List | Class Members | File Members

gocr_image.h File Reference

This is the image header. More...

Go to the source code of this file.

Classes

struct  gocr_pixelbw
 This is the pixel structure. More...
struct  gocr_pixelgray
struct  gocr_pixelcolor
struct  gocr_pixel
 This is the pixel wrapper data structure. More...
struct  gocr_image
 This is the image structure. More...

Image

#define GOCR_BLACK   0
 Black pixel value.
#define GOCR_WHITE   1
 White pixel value.
#define gocr_isblock(image, x, y)   ((gocr_Pixel *)((image)->data.pix[y]+(x)*_gocr_imagePixelSize(image)))->isblock
#define gocr_ischar(image, x, y)   ((gocr_Pixel *)((image)->data.pix[y]+(x)*_gocr_imagePixelSize(image)))->ischar
typedef enum gocr_imagetype gocr_ImageType
 Typedef encapsulation.
typedef gocr_pixelbw gocr_PixelBW
 Typedef encapsulation.
typedef gocr_pixelgray gocr_PixelGray
typedef gocr_pixelcolor gocr_PixelColor
typedef gocr_pixel gocr_Pixel
typedef gocr_image gocr_Image
 Typedef encapsulation.
enum  gocr_imagetype {
  GOCR_NONE, GOCR_BW, GOCR_GRAY, GOCR_COLOR,
  GOCR_OTHER
}
 Image type values. More...
void gocr_imageFree (gocr_Image *image)
 Closes an image.
int gocr_imageWrite (gocr_Image *image, char *filename)
 Writes image to a file.
int gocr_mainImageWriteWithData (char *filename)
 Writes the whole image to a file with extra data.
int gocr_pixelGetMark1 (gocr_Image *image, int x, int y)
 Gets image pixel mark 1.
int gocr_pixelSetMark1 (gocr_Image *image, int x, int y, char value)
 Sets image pixel mark 1.
int gocr_pixelGetMark2 (gocr_Image *image, int x, int y)
 Gets image pixel mark 2.
int gocr_pixelSetMark2 (gocr_Image *image, int x, int y, char value)
 Sets image pixel mark 2.
int gocr_pixelGetMark3 (gocr_Image *image, int x, int y)
 Gets image pixel mark 3.
int gocr_pixelSetMark3 (gocr_Image *image, int x, int y, char value)
 Sets image pixel mark 3.
void gocr_imagePixelSetBW (gocr_Image *image, int x, int y, unsigned char data)
 Sets the value of a image pixel in BW.
unsigned char gocr_imagePixelGetBW (gocr_Image *image, int x, int y)
 Gets the value of a image pixel in BW.
void gocr_imagePixelSetGray (gocr_Image *image, int x, int y, unsigned char data)
 Sets the value of a image pixel in grayscale.
unsigned char gocr_imagePixelGetGray (gocr_Image *image, int x, int y)
 Gets the value of a image pixel in grayscate.
void gocr_imagePixelSetColor (gocr_Image *image, int x, int y, unsigned char data[3])
 Sets the value of a image pixel in color.
unsigned char * gocr_imagePixelGetColor (gocr_Image *image, int x, int y)
 Gets the value of a image pixel in color.

Variables

gocr_Imagecurrentimage
 A pointer to the current image.


Detailed Description

This is the image header.

Author:
Bruno Barberi Gnecco <brunobg@sourceforge.net>

Define Documentation

#define GOCR_BLACK   0
 

Black pixel value.

See also:
gocr_Pixel.

#define GOCR_WHITE   1
 

White pixel value.

See also:
gocr_Pixel.


Enumeration Type Documentation

enum gocr_imagetype
 

Image type values.

Enumerator:
GOCR_NONE  No type.
GOCR_BW  Black and white.
GOCR_GRAY  Grayscale.
GOCR_COLOR  Color.
GOCR_OTHER  Other (user-defined).


Function Documentation

void gocr_imageFree gocr_Image image  ) 
 

Closes an image.

This function closes the image, freeing all memory. Images that have "children", i.e., the "parent" of shared images may not be instantaneously freed, and the responsability of freeing it is handled to the internal garbage collector.

Parameters:
image A pointer to the image structure.

int gocr_imageWrite gocr_Image image,
char *  filename
 

Writes image to a file.

Long description.

Parameters:
image A pointer to the image.
filename The output file name.
See also:
gocr_imageWriteWithData
Return values:
0 OK
-1 error.

int gocr_mainImageWriteWithData char *  filename  ) 
 

Writes the whole image to a file with extra data.

Outputs the image to a file, in the PPM raw format, drawing boxes around:

  • boxes, in red
  • characters, in blue

Parameters:
filename The output file name. Do not call this function in the middle of a gocr_charBegin/gocr_charEnd or gocr_charSplitBegin/gocr_charSplitEnd pair; unpredictable behaviour will occur. This function may be slow if you have many boxes and blocks.
See also:
gocr_imageWriteData
Return values:
0 OK
-1 error.

int gocr_pixelGetMark1 gocr_Image image,
int  x,
int  y
[inline]
 

Gets image pixel mark 1.

Long description.

Parameters:
image Pointer to the image.
x x coordinate.
y y coordinate.
Return values:
0 unset.
1 set.
-1 error.

int gocr_pixelSetMark1 gocr_Image image,
int  x,
int  y,
char  value
[inline]
 

Sets image pixel mark 1.

Long description.

Parameters:
image Pointer to the image.
x x coordinate.
y y coordinate.
value New value.
Return values:
0 OK.
-1 error.

int gocr_pixelGetMark2 gocr_Image image,
int  x,
int  y
[inline]
 

Gets image pixel mark 2.

Long description.

Parameters:
image Pointer to the image.
x x coordinate.
y y coordinate.
Return values:
0 unset.
1 set.
-1 error.

int gocr_pixelSetMark2 gocr_Image image,
int  x,
int  y,
char  value
[inline]
 

Sets image pixel mark 2.

Long description.

Parameters:
image Pointer to the image.
x x coordinate.
y y coordinate.
value New value.
Return values:
0 OK.
-1 error.

int gocr_pixelGetMark3 gocr_Image image,
int  x,
int  y
[inline]
 

Gets image pixel mark 3.

Long description.

Parameters:
image Pointer to the image.
x x coordinate.
y y coordinate.
Return values:
0 unset.
1 set.
-1 error.

int gocr_pixelSetMark3 gocr_Image image,
int  x,
int  y,
char  value
[inline]
 

Sets image pixel mark 3.

Long description.

Parameters:
image Pointer to the image.
x x coordinate.
y y coordinate.
value New value.
Return values:
0 OK.
-1 error.

void gocr_imagePixelSetBW gocr_Image image,
int  x,
int  y,
unsigned char  data
 

Sets the value of a image pixel in BW.

Long description.

Parameters:
image Pointer to the image.
x x coordinate.
y y coordinate.
data New value.
See also:
gocr_imagePixelSetGray, gocr_imagePixelSetColor, gocr_imagePixelGetBW, gocr_imagePixelGetGray, gocr_imagePixelGetColor.

unsigned char gocr_imagePixelGetBW gocr_Image image,
int  x,
int  y
 

Gets the value of a image pixel in BW.

Long description.

Parameters:
image Pointer to the image.
x x coordinate.
y y coordinate.
Returns:
The pixel value, converted to BW.
See also:
gocr_imagePixelSetBW, gocr_imagePixelSetGray, gocr_imagePixelSetColor, gocr_imagePixelGetGray, gocr_imagePixelGetColor.

void gocr_imagePixelSetGray gocr_Image image,
int  x,
int  y,
unsigned char  data
 

Sets the value of a image pixel in grayscale.

Long description.

Parameters:
image Pointer to the image.
x x coordinate.
y y coordinate.
data New value.
See also:
gocr_imagePixelSetBW, gocr_imagePixelSetColor, gocr_imagePixelGetBW, gocr_imagePixelGetGray, gocr_imagePixelGetColor.

unsigned char gocr_imagePixelGetGray gocr_Image image,
int  x,
int  y
 

Gets the value of a image pixel in grayscate.

Long description.

Parameters:
image Pointer to the image.
x x coordinate.
y y coordinate.
Returns:
The pixel value, converted to BW.
See also:
gocr_imagePixelSetBW, gocr_imagePixelSetGray, gocr_imagePixelSetColor, gocr_imagePixelGetBW, gocr_imagePixelGetColor.

void gocr_imagePixelSetColor gocr_Image image,
int  x,
int  y,
unsigned char  data[3]
 

Sets the value of a image pixel in color.

Long description.

Parameters:
image Pointer to the image.
x x coordinate.
y y coordinate.
data New value.
See also:
gocr_imagePixelSetBW, gocr_imagePixelSetGray, gocr_imagePixelGetBW, gocr_imagePixelGetGray, gocr_imagePixelGetColor.

unsigned char* gocr_imagePixelGetColor gocr_Image image,
int  x,
int  y
 

Gets the value of a image pixel in color.

Long description.

Parameters:
image Pointer to the image.
x x coordinate.
y y coordinate.
Returns:
The pixel value, converted to BW.
See also:
gocr_imagePixelSetBW, gocr_imagePixelSetGray, gocr_imagePixelSetColor, gocr_imagePixelGetBW, gocr_imagePixelGetGray.


Variable Documentation

gocr_Image* currentimage
 

A pointer to the current image.

This variable holds the image being processed right now, and can be freely accessed by the programmer.

See also:
gocr_imageLoad, gocr_imageClose, gocr_Image.


Generated on Tue Oct 25 04:13:04 2005 for GOCR API by  doxygen 1.4.4