-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathlaplaceBlending.h
109 lines (97 loc) · 2.04 KB
/
laplaceBlending.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
108
109
typedef struct
{
unsigned char *data;
int width;
int height;
int channels;
} Image;
Image *create_image(const char *filename);
Image *create_image_mask(int width, int height, float range, int left, int right);
int save_image(Image *img, char *out_filename);
int image_size(Image *img);
void destroy_image(Image *img);
Image *upsample(Image *img);
Image *downsample(Image *img);
Image *compute_laplacian(Image *original, Image *upsampled);
void crop_image(Image *img, int cut_top, int cut_bottom, int cut_left, int cut_right);
typedef struct
{
int x;
int y;
} Point;
typedef struct
{
int x;
int y;
int width;
int height;
} Rect;
Point br(Rect r);
Rect create_rect(int x, int y, int width, int height);
typedef struct
{
int num_bands;
Rect output_size;
int *out_width_levels;
int *out_height_levels;
Image **out;
Image **out_mask;
Image *result;
} Blender;
Blender *create_blender(Rect out_size, int nb);
int feed(Blender *b, Image *img, Image *maskImg, Point tl);
void blend(Blender *b);
void destroy_blender(Blender *blender);
typedef struct
{
int start_row;
int end_row;
int new_width;
int new_height;
Image *img;
unsigned char *sampled;
} SamplingThreadData;
typedef struct
{
unsigned char *original_data;
unsigned char *upsampled_data;
unsigned char *laplacian_data;
int total_size;
int start_index;
int end_index;
} LaplacianWorkerArgs;
typedef struct
{
int start_row;
int end_row;
int rows;
int cols;
int x_tl;
int y_tl;
int out_level_width;
int out_level_height;
int level_width;
int level_height;
int level;
Image **img_laplacians;
Image **mask_gaussian;
Image **out;
Image **out_mask;
} FeedWorkerArgs;
typedef struct
{
int start_row;
int end_row;
int output_width;
int level;
Image **out;
Image **out_mask;
} NormalizeWorkerArgs;
typedef struct
{
int start_index;
int end_index;
int out_size;
Image *blended_image;
Image *out_level;
} BlendWorkerArgs;