forked from tobez/citaa
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.c
54 lines (41 loc) · 1.06 KB
/
main.c
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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <limits.h>
#include <ctype.h>
#include "citaa.h"
#include "bsdqueue.h"
struct image* component_marks;
int
main(int argc, char **argv)
{
struct image *orig, *status;
struct component *c;
int x, y;
TAILQ_INIT(&free_text);
orig = read_image(stdin);
dump_image("original", orig);
status = create_image(orig->h, orig->w, ST_EMPTY);
TAILQ_INIT(&connected_components);
seen = ST_SEEN;
for (y = 0; y < orig->h; y++) {
for (x = 0; x < orig->w; x++) {
trace_component(orig, status, NULL, y, x);
}
}
dump_image("status", status);
TAILQ_INIT(&components);
TAILQ_FOREACH(c, &connected_components, list) {
compactify_component(c);
extract_branches(c, &components);
extract_loops(c, &components);
}
sort_components(&components);
build_components_by_point(&components, orig->h, orig->w);
determine_dashed_components(&components, orig);
component_marks = create_image(orig->h, orig->w, ' ');
mark_components(component_marks);
extract_text(orig);
paint(orig->h, orig->w);
return 0;
}