-
Notifications
You must be signed in to change notification settings - Fork 3
/
alias_dense_depthmap_image_at_edge_image.c
106 lines (85 loc) · 2.14 KB
/
alias_dense_depthmap_image_at_edge_image.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
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
#include "header.h"
void alias_dense_depthmap_image_at_edge_image(
int width,
int height,
int *dense_depthmap_image_arr,
int *edge_image_arr,
int *edge_alpha_arr
)
/*
Any pixel in the edge image
should take the disparity of its neighbor
if the neighbor is not in the edge image and is more in the foreground
*/
{
int i;
int j;
int pixel;
int depth;
int i_radius;
int j_radius;
int i2;
int j2;
int pixel2;
int depth2;
int edge_alph;
int edge_alph2;
for ( i= 0 ; i< height ; i++ ) {
for ( j= 0 ; j< width ; j++ ) {
pixel= i*width+j;
/*
Let's see if pixel is part of the edge image
*/
edge_alph= edge_alpha_arr[pixel];
if ( edge_alph == 0 ) {
/*
Pixel is not part of the edge image
*/
continue;
}
if ( edge_alph == 255 ) {
/*
Pixel is part of the edge image
*/
}
depth= dense_depthmap_image_arr[pixel];
for ( i_radius= -1 ; i_radius<= +1 ; i_radius++ ) {
for ( j_radius= -1 ; j_radius<= +1 ; j_radius++ ) {
i2= i+i_radius;
j2= j+j_radius;
if ( i2 < 0 )
continue;
if ( i2 > height-1 )
continue;
if ( j2 < 0 )
continue;
if ( j2 > width-1 )
continue;
pixel2= i2*width+j2;
if ( pixel2 == pixel )
continue;
/*
Let's see if pixel2 is part of the edge image
*/
edge_alph2= edge_alpha_arr[pixel2];
if ( edge_alph2 == 0 ) {
/*
Pixel2 is not part of the edge image
*/
}
if ( edge_alph2 == 255 ) {
/*
Pixel2 is part of the edge image
*/
continue;
}
depth2= dense_depthmap_image_arr[pixel2];
if ( !(depth2 > depth) )
continue;
dense_depthmap_image_arr[pixel]= depth2;
depth= dense_depthmap_image_arr[pixel];
}
}
}
}
}