forked from unpaper/unpaper
-
Notifications
You must be signed in to change notification settings - Fork 0
/
imageprocess.h
107 lines (54 loc) · 2.98 KB
/
imageprocess.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
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
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
/*
* This file is part of Unpaper.
*
* Copyright © 2005-2007 Jens Gulden
* Copyright © 2011-2011 Diego Elio Pettenò
*
* Unpaper is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, version 2 of the License.
*
* Unpaper is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, see <http://www.gnu.org/licenses/>.
*/
#ifndef IMAGEPROCESS_H
#define IMAGEPROCESS_H
/****************************************************************************
* image processing functions *
****************************************************************************/
/* --- deskewing ---------------------------------------------------------- */
float detectRotation(AVFrame *image, int mask[EDGES_COUNT]);
void rotate(const float radians, AVFrame *source, AVFrame *target);
/* --- stretching / resizing / shifting ------------------------------------ */
void stretch(int w, int h, AVFrame **image);
void resize(int w, int h, AVFrame **image);
void shift(int shiftX, int shiftY, AVFrame **image);
/* --- mask-detection ----------------------------------------------------- */
void detectMasks(AVFrame *image);
void applyMasks(int mask[MAX_MASKS][EDGES_COUNT], const int maskCount, AVFrame *image);
/* --- wiping ------------------------------------------------------------- */
void applyWipes(int area[MAX_MASKS][EDGES_COUNT], int areaCount, AVFrame *image);
/* --- mirroring ---------------------------------------------------------- */
void mirror(int directions, AVFrame *image);
/* --- flip-rotating ------------------------------------------------------ */
void flipRotate(int direction, AVFrame **image);
/* --- blackfilter -------------------------------------------------------- */
void blackfilter(AVFrame *image);
/* --- noisefilter -------------------------------------------------------- */
int noisefilter(AVFrame *image);
/* --- blurfilter --------------------------------------------------------- */
int blurfilter(AVFrame *image);
/* --- grayfilter --------------------------------------------------------- */
int grayfilter(AVFrame *image);
/* --- border-detection --------------------------------------------------- */
void centerMask(AVFrame *image, int center[COORDINATES_COUNT], int mask[EDGES_COUNT]);
void alignMask(int mask[EDGES_COUNT], int outside[EDGES_COUNT], AVFrame *image);
void detectBorder(int border[EDGES_COUNT], int outsideMask[EDGES_COUNT], AVFrame *image);
void borderToMask(int border[EDGES_COUNT], int mask[EDGES_COUNT], AVFrame *image);
void applyBorder(int border[EDGES_COUNT], AVFrame *image);
#endif /* IMAGEPROCESS_H */