OCR Project
Loading...
Searching...
No Matches
segment.h
Go to the documentation of this file.
1
15
16#ifndef SEGMENT_H
17#define SEGMENT_H
18
19#include <stddef.h>
20
21/* -------------------------------------------------------------------------
22 * Types
23 * ---------------------------------------------------------------------- */
24
28typedef struct {
29 int x;
30 int y;
31 int w;
32 int h;
34
38typedef struct {
40 size_t count;
41 int cols;
42 int rows;
44
45/* -------------------------------------------------------------------------
46 * Public API
47 * ---------------------------------------------------------------------- */
48
69SegmentResult *segment_image(const unsigned char *pixels,
70 int width, int height);
71
89int segment_detect_grid(const unsigned char *pixels,
90 int width, int height, float min_span,
91 SegmentResult *out);
92
106int segment_connected_components(const unsigned char *pixels,
107 int width, int height,
108 SegmentResult *out);
109
120
127
128#endif /* SEGMENT_H */
int segment_connected_components(const unsigned char *pixels, int width, int height, SegmentResult *out)
Extract letter bounding boxes via connected-component analysis.
Definition segment.c:104
int segment_detect_grid(const unsigned char *pixels, int width, int height, float min_span, SegmentResult *out)
Detect grid lines and infer cell geometry.
Definition segment.c:220
void segment_result_free(SegmentResult *res)
Free a SegmentResult returned by segment_image().
Definition segment.c:320
void segment_sort_reading_order(SegmentResult *res)
Sort a SegmentResult's cells in reading order (top-to-bottom, left-to-right).
Definition segment.c:284
SegmentResult * segment_image(const unsigned char *pixels, int width, int height)
Segment a binarised image into letter cell bounding boxes.
Definition segment.c:295
Axis-aligned bounding box of one letter cell.
Definition segment.h:28
int x
Definition segment.h:29
int y
Definition segment.h:30
int w
Definition segment.h:31
int h
Definition segment.h:32
Result of a grid detection / segmentation pass.
Definition segment.h:38
size_t count
Definition segment.h:40
int rows
Definition segment.h:42
int cols
Definition segment.h:41
BoundingBox * cells
Definition segment.h:39