-
Notifications
You must be signed in to change notification settings - Fork 4
/
findLines_notes
80 lines (53 loc) · 1.58 KB
/
findLines_notes
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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
Using Hough transform:
Accuracy not great - need to figure out if the parameters need to be tweaked, or if it is better to try something else.
----------------------------------------
Using Leptonica:
Seems to be working better. Can clean up, e.g., threshold image before handing to Tesseract.
Can recover lines using Leptonica.
Vertical lines - look at Tesseract code.
linefind.cpp l.618
in GetLineMask
----------------------------------------
Other routines we might need from Leptonica:
pixAddPix
pixOr
pixXor
pixOpenBrick
pixCloseBrick
pixGetWpl l.724
pixConnComp l.738 (might be exactly what we need)
boxCreate (lept)
boxDestroy (lept)
FindLineVectors
pixClearInRect
pixSubtract
pixDilateBrick
pixSeedfillBinary
pixDistanceFunction
pixClipRectangle
pixCountPixels
pixZero
pixErodeBrick
Leptonica is writing to console - need to capture tprintf()
pixGetPixel expects x, y
matrix in R is written y, x - so code needs to be clear
----------------------------------------
Using test image
ThresholdtoBinary = inverts values, low values -> 1
Out of pixThresholdToBinary():
1 = white
0 = black
out of getLines(..., asLines = TRUE, invert = !asLines):
1 = black
0 = white
pixGetPixels:
1 = black
0 = white
pixWrite() + readPNG():
1 = white
0 = black
Appears that readPNG and pixGetPixels are in the same order - there does not appear to be any flipping.
in ConvertTo8, colormap = FALSE, might cause issues with the color map
----------------------------------------
Look at linefind.cpp, see what they are doing -
Pre-cleaning is difficult, avoid cmdline, avoid mixing computational models