forked from GabRayz/OCR
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsegmentation.h
35 lines (31 loc) · 1.08 KB
/
segmentation.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#ifndef SEPARATION_H
# define SEPARATION_H
#include "image.h"
#include "linkedlist.h"
#include <stdbool.h>
typedef struct _Block
{
int x;
int y;
int width;
int height;
char label;
} Block;
LinkedList *segmentation(Img *source, bool whitespaces);
void assert(int condition);
Block *block_init();
void block_delete(Block *block);
void remove_white_margin(Img *image, Block *block);
double vertical_white_rate(Img *image, Block *block, int x);
double horizontal_white_rate(Img *image, Block *block, int y);
Block *img_make_block(Img *image);
Img *img_from_block(Img *source, Block *block);
LinkedList *block_split_vertical(Img *image, Block *block, bool shouldRetry);
LinkedList *block_split_horizontal(Img *image, Block *block, bool shouldRetry);
Block *remove_top_margin(Img *img, Block *block);
Block *remove_bottom_margin(Img *img, Block *block);
Block *remove_left_margin(Img *img, Block *block);
Block *remove_right_margin(Img *img, Block *block);
LinkedList *line_split(Img *image, Block *block);
LinkedList *character_split(Img *image, Block *block, bool whitespaces);
#endif