ho_bitmap.h

Langue: en

Version: 172393 (fedora - 06/07/09)

Section: 3 (Bibliothèques de fonctions)

Sommaire

NAME

src/ho_bitmap.h - libhocr C language header.

SYNOPSIS


Data Structures


struct ho_bitmap
libhocr bitmap struct

Defines


#define HO_BITMAP_H 1

#define ho_bitmap_get(m, x, y) (((((m)->data[(x) / 8 + (y) * (m)->rowstride]) & (0x80 >> ((x) % 8))) > 0)?1:0)

#define ho_bitmap_set(m, x, y) (((m)->data[(x) / 8 + (y) * (m)->rowstride]) |= (0x80 >> ((x) % 8)))

#define ho_bitmap_unset(m, x, y) (((m)->data[(x) / 8 + (y) * (m)->rowstride]) &= ~(0x80 >> ((x) % 8)))

#define ho_bitmap_get_x(m) ((m)->x)

#define ho_bitmap_get_y(m) ((m)->y)

#define ho_bitmap_set_x(m, new_x) ((m)->x=(new_x))

#define ho_bitmap_set_y(m, new_y) ((m)->y=(new_y))

#define ho_bitmap_get_width(m) ((m)->width)

#define ho_bitmap_get_height(m) ((m)->height)

Functions


ho_bitmap * ho_bitmap_new (const int width, const int height)

int ho_bitmap_free (ho_bitmap *m)

ho_bitmap * ho_bitmap_clone (const ho_bitmap *m)

ho_bitmap * ho_bitmap_clone_window (const ho_bitmap *m, const int x, const int y, const int width, const int height)

int ho_bitmap_and (ho_bitmap *m_left, const ho_bitmap *m_right)

int ho_bitmap_or (ho_bitmap *m_left, const ho_bitmap *m_right)

int ho_bitmap_xor (ho_bitmap *m_left, const ho_bitmap *m_right)

int ho_bitmap_andnot (ho_bitmap *m_left, const ho_bitmap *m_right)

int ho_bitmap_copy (ho_bitmap *m_left, const ho_bitmap *m_right)

ho_bitmap * ho_bitmap_not (const ho_bitmap *m)

ho_bitmap * ho_bitmap_dilation_n (const ho_bitmap *m, const unsigned char n)

ho_bitmap * ho_bitmap_erosion_n (const ho_bitmap *m, const unsigned char n)

ho_bitmap * ho_bitmap_set_height (const ho_bitmap *m, const int height, const int top, const int bottom)

ho_bitmap * ho_bitmap_set_height_from_bottom (const ho_bitmap *m, const int height, const int top, const int bottom)

ho_bitmap * ho_bitmap_dilation (const ho_bitmap *m)

ho_bitmap * ho_bitmap_erosion (const ho_bitmap *m)

ho_bitmap * ho_bitmap_opening (const ho_bitmap *m)

ho_bitmap * ho_bitmap_closing (const ho_bitmap *m)

ho_bitmap * ho_bitmap_hlink (const ho_bitmap *m, const int size)

ho_bitmap * ho_bitmap_herode (const ho_bitmap *m, const int size)

ho_bitmap * ho_bitmap_vlink (const ho_bitmap *m, const int size)

ho_bitmap * ho_bitmap_edge (const ho_bitmap *m, const int n)

double ho_bitmap_get_fill (const ho_bitmap *m, const int x, const int y, const int width, const int height)

ho_bitmap * ho_bitmap_filter_hlink (ho_bitmap *m, int size, int max_height)

ho_bitmap * ho_bitmap_filter_by_size (const ho_bitmap *m, int min_height, int max_height, int min_width, int max_width)

ho_bitmap * ho_bitmap_filter_boxes (const ho_bitmap *m, const int leeway_down, const int leeway_up)

ho_bitmap * ho_bitmap_filter_fill (const ho_bitmap *m)

ho_bitmap * ho_bitmap_filter_set_height (const ho_bitmap *m, const int height, const int top, const int bottom)

ho_bitmap * ho_bitmap_filter_set_height_from_bottom (const ho_bitmap *m, const int height, const int top, const int bottom)

ho_bitmap * ho_bitmap_filter_obj_extend_lateraly (const ho_bitmap *m, const int ext_width)

ho_bitmap * ho_bitmap_filter_remove_dots (const ho_bitmap *m, const unsigned char erosion_n, const unsigned char dilation_n)

int ho_bitmap_filter_count_objects (const ho_bitmap *m)

int ho_bitmap_draw_box (ho_bitmap *m, const int x, const int y, const int width, const int height)

int ho_bitmap_draw_box_empty (ho_bitmap *m, const int x, const int y, const int width, const int height)

int ho_bitmap_draw_vline (ho_bitmap *m, const int x, const int y, const int height)

int ho_bitmap_delete_vline (ho_bitmap *m, const int x, const int y, const int height)

int ho_bitmap_draw_hline (ho_bitmap *m, const int x, const int y, const int width)

int ho_bitmap_delete_hline (ho_bitmap *m, const int x, const int y, const int width)

ho_bitmap * ho_bitmap_rotate (const ho_bitmap *m, const double angle)

int ho_bitmap_pnm_save (const ho_bitmap *m, const char *filename)

int ho_bitmap_tiff_save (const ho_bitmap *m, const char *filename)

Detailed Description

libhocr C language header.

libhocr - LIBrary for Hebrew Optical Character Recognition

Define Documentation

#define HO_BITMAP_H 1

#define ho_bitmap_get(m, x, y) (((((m)->data[(x) / 8 + (y) * (m)->rowstride]) & (0x80 >> ((x) % 8))) > 0)?1:0)

#define ho_bitmap_set(m, x, y) (((m)->data[(x) / 8 + (y) * (m)->rowstride]) |= (0x80 >> ((x) % 8)))

#define ho_bitmap_unset(m, x, y) (((m)->data[(x) / 8 + (y) * (m)->rowstride]) &= ~(0x80 >> ((x) % 8)))

#define ho_bitmap_get_x(m) ((m)->x)

#define ho_bitmap_get_y(m) ((m)->y)

#define ho_bitmap_set_x(m, new_x) ((m)->x=(new_x))

#define ho_bitmap_set_y(m, new_y) ((m)->y=(new_y))

#define ho_bitmap_get_width(m) ((m)->width)

#define ho_bitmap_get_height(m) ((m)->height)

Function Documentation

ho_bitmap* ho_bitmap_new (const int width, const int height)

new ho_bitamp

Parameters:

height hight of pixbuf in pixels
width width of pixbuf in pixels

Returns:

newly allocated ho_bitmap

int ho_bitmap_free (ho_bitmap * m)

free an ho_bitmap

Parameters:

m pointer to an ho_bitmap

Returns:

FALSE

Referenced by hocr::Hocr::do_bitmap_closing(), hocr::Hocr::do_bitmap_dilation(), hocr::Hocr::do_bitmap_erosion(), hocr::Hocr::do_bitmap_opening(), hocr::Hocr::do_image_processing(), hocr::Hocr::set_bitmap(), hocr::Hocr::set_pixbuf(), and hocr::Hocr::~Hocr().

ho_bitmap* ho_bitmap_clone (const ho_bitmap * m)

copy a bitmap

Parameters:

m the bitmap to copy

Returns:

newly allocated ho_bitmap

ho_bitmap* ho_bitmap_clone_window (const ho_bitmap * m, const int x, const int y, const int width, const int height)

copy a window from a bitmap

Parameters:

m the bitmap to copy
x x-start of window
y y-start of window
width width of window
height height of window

Returns:

newly allocated ho_bitmap

int ho_bitmap_and (ho_bitmap * m_left, const ho_bitmap * m_right)

do bitwise and of two bitmaps

Parameters:

m_left the left hand bitmap
m_right the right hand bitmap

Returns:

FALSE

int ho_bitmap_or (ho_bitmap * m_left, const ho_bitmap * m_right)

do bitwise or of two bitmaps

Parameters:

m_left the left hand bitmap
m_right the right hand bitmap

Returns:

FALSE

int ho_bitmap_xor (ho_bitmap * m_left, const ho_bitmap * m_right)

do bitwise xor of two bitmaps

Parameters:

m_left the left hand bitmap
m_right the right hand bitmap

Returns:

FALSE

int ho_bitmap_andnot (ho_bitmap * m_left, const ho_bitmap * m_right)

do bitwise and not of two bitmaps

Parameters:

m_left the left hand bitmap
m_right the right hand bitmap

Returns:

FALSE

int ho_bitmap_copy (ho_bitmap * m_left, const ho_bitmap * m_right)

do bitwise copy of two bitmaps

Parameters:

m_left the left hand bitmap
m_right the right hand bitmap

Returns:

FALSE

ho_bitmap* ho_bitmap_not (const ho_bitmap * m)

do bitwise not of a bitmap

Parameters:

m the left hand bitmap

Returns:

a newly allocated bitmap

ho_bitmap* ho_bitmap_dilation_n (const ho_bitmap * m, const unsigned char n)

dilation of a a bitmap with 3x3 box

Parameters:

m the bitmap to dilate
n dilation constant

Returns:

newly allocated ho_bitmap

ho_bitmap* ho_bitmap_erosion_n (const ho_bitmap * m, const unsigned char n)

erosion of a a bitmap with 3x3 box

Parameters:

m the bitmap to erode
n erosion constant

Returns:

newly allocated ho_bitmap

ho_bitmap* ho_bitmap_set_height (const ho_bitmap * m, const int height, const int top, const int bottom)

take only top height black pixels of bitmap

Parameters:

m the bitmap to erode
height the height to take
top space above black pixel included in new object
bottom space below black pixel included in new object

Returns:

newly allocated ho_bitmap

ho_bitmap* ho_bitmap_set_height_from_bottom (const ho_bitmap * m, const int height, const int top, const int bottom)

take only bottom height black pixels of bitmap

Parameters:

m the bitmap to erode
height the height to take
top space above black pixel included in new object
bottom space below black pixel included in new object

Returns:

newly allocated ho_bitmap

ho_bitmap* ho_bitmap_dilation (const ho_bitmap * m)

dilation of a a bitmap with 3x3 box

Parameters:

m the bitmap to dilate

Returns:

newly allocated ho_bitmap

Referenced by hocr::Hocr::do_bitmap_dilation().

ho_bitmap* ho_bitmap_erosion (const ho_bitmap * m)

erosion of a a bitmap with 3x3 box

Parameters:

m the bitmap to erode

Returns:

newly allocated ho_bitmap

Referenced by hocr::Hocr::do_bitmap_erosion().

ho_bitmap* ho_bitmap_opening (const ho_bitmap * m)

opening of a a bitmap with 3x3 box

Parameters:

m the bitmap to open

Returns:

newly allocated ho_bitmap

Referenced by hocr::Hocr::do_bitmap_opening().

ho_bitmap* ho_bitmap_closing (const ho_bitmap * m)

closing of a a bitmap with 3x3 box

Parameters:

m the bitmap to close

Returns:

newly allocated ho_bitmap

Referenced by hocr::Hocr::do_bitmap_closing().

horizontaly link black dots in a bitmap

Parameters:

m the bitmap to horizontaly link
size maximum distance

Returns:

newly allocated ho_bitmap

ho_bitmap* ho_bitmap_herode (const ho_bitmap * m, const int size)

horizontaly erode black dots in a bitmap

Parameters:

m the bitmap to horizontaly link
size maximum distance

Returns:

newly allocated ho_bitmap

verticaly link black dots in a bitmap

Parameters:

m the bitmap to verticaly link
size maximum distance

Returns:

newly allocated ho_bitmap

ho_bitmap* ho_bitmap_edge (const ho_bitmap * m, const int n)

copy edges in bitmap

Parameters:

m pointer to an ho_bitmap
n width of egde

Returns:

a newly allocated bitmap

double ho_bitmap_get_fill (const ho_bitmap * m, const int x, const int y, const int width, const int height)

return the ratio fill/volume value of a rectangle in the bitmap

Parameters:

m pointer to an ho_bitmap
x x of rectangel
y y of rectangel
width width of rectangel
height height of rectangel

Returns:

the ratio value

horizontaly link short objects in a bitmap

Parameters:

m the bitmap to horizontaly link
size maximum distance
max_height maximum hight of objects to link

Returns:

newly allocated ho_bitmap

ho_bitmap* ho_bitmap_filter_by_size (const ho_bitmap * m, int min_height, int max_height, int min_width, int max_width)

copy objects from bitmap to bitmap by size

Parameters:

m pointer to an ho_bitmap
min_height only objects with this minimal height are copied
max_height only objects with this maximal height are copied
min_width only objects with this minimal width are copied
max_width only objects with this maximal width are copied

Returns:

a newly allocated bitmap

ho_bitmap* ho_bitmap_filter_boxes (const ho_bitmap * m, const int leeway_down, const int leeway_up)

copy boxed objects from bitmap

Parameters:

m pointer to an ho_bitmap
leeway_down space below object to be included in box
leeway_up space above object to be included in box

Returns:

a newly allocated bitmap

ho_bitmap* ho_bitmap_filter_fill (const ho_bitmap * m)

copy filled objects from bitmap

Parameters:

m pointer to an ho_bitmap

Returns:

a newly allocated bitmap

ho_bitmap* ho_bitmap_filter_set_height (const ho_bitmap * m, const int height, const int top, const int bottom)

take height top pixels from objects in bitmap

Parameters:

m pointer to an ho_bitmap
height of new objects
top space above black pixel included in new object
bottom space below black pixel included in new object

Returns:

a newly allocated bitmap

ho_bitmap* ho_bitmap_filter_set_height_from_bottom (const ho_bitmap * m, const int height, const int top, const int bottom)

take height bottom pixels from objects in bitmap

Parameters:

m pointer to an ho_bitmap
height of new objects
top space above black pixel included in new object
bottom space below black pixel included in new object

Returns:

a newly allocated bitmap

ho_bitmap* ho_bitmap_filter_obj_extend_lateraly (const ho_bitmap * m, const int ext_width)

take extend objects lateraly

Parameters:

m pointer to an ho_bitmap
ext_width width of lateral extention

Returns:

a newly allocated bitmap

ho_bitmap* ho_bitmap_filter_remove_dots (const ho_bitmap * m, const unsigned char erosion_n, const unsigned char dilation_n)

remove halftone dots from bitmap

Parameters:

m pointer to an ho_bitmap
erosion_n the erosion operator factor
dilation_n the dilation operator factor

Returns:

a newly allocated bitmap

int ho_bitmap_filter_count_objects (const ho_bitmap * m)

count the number of objects in a bitmap

Parameters:

m pointer to an ho_bitmap

Returns:

the number of objects in a bitmap

int ho_bitmap_draw_box (ho_bitmap * m, const int x, const int y, const int width, const int height)

draw a black box on bitmap

Parameters:

m the bitmap to draw on
x x-start of box
y y-start of box
width width of box
height height of box

Returns:

FALSE

int ho_bitmap_draw_box_empty (ho_bitmap * m, const int x, const int y, const int width, const int height)

draw a black empty box on bitmap

Parameters:

m the bitmap to draw on
x x-start of box
y y-start of box
width width of box
height height of box

Returns:

FALSE

int ho_bitmap_draw_vline (ho_bitmap * m, const int x, const int y, const int height)

draw vertical line on bitmap

Parameters:

m the bitmap to draw on
x x-start of line
y y-start of line
height height of line

Returns:

FALSE

int ho_bitmap_delete_vline (ho_bitmap * m, const int x, const int y, const int height)

delete vertical line on bitmap

Parameters:

m the bitmap to draw on
x x-start of line
y y-start of line
height height of line

Returns:

FALSE

int ho_bitmap_draw_hline (ho_bitmap * m, const int x, const int y, const int width)

draw horizontal line on bitmap

Parameters:

m the bitmap to draw on
x x-start of line
y y-start of line
width height of line

Returns:

FALSE

int ho_bitmap_delete_hline (ho_bitmap * m, const int x, const int y, const int width)

delete horizontal line on bitmap

Parameters:

m the bitmap to draw on
x x-start of line
y y-start of line
width height of line

Returns:

FALSE

ho_bitmap* ho_bitmap_rotate (const ho_bitmap * m, const double angle)

rotate a bitmap

Parameters:

m the bitmap to rotate
angle the angle in deg.

Returns:

newly allocated ho_bitmap

int ho_bitmap_pnm_save (const ho_bitmap * m, const char * filename)

writes ho_bitmap to pnm file

Parameters:

m ho_bitmap 1 bpp
filename save as file name

Returns:

FALSE

Referenced by hocr::Hocr::save_bitmap_as_pnm().

int ho_bitmap_tiff_save (const ho_bitmap * m, const char * filename)

writes ho_bitmap to tiff file

Parameters:

m ho_bitmap 1 bpp
filename save as file name

Returns:

FALSE

Referenced by hocr::Hocr::save_bitmap_as_tiff().

Author

Generated automatically by Doxygen for libhocr from the source code.