18 #ifndef PIC_FILTERING_FILTER_GROW_CUT_HPP 19 #define PIC_FILTERING_FILTER_GROW_CUT_HPP 21 #include "../filtering/filter.hpp" 22 #include "../util/array.hpp" 43 Image *state_cur = src[0];
45 Image *img_max = src[2];
47 Image *state_next = dst;
51 for(
int j = box->
y0; j < box->y1; j++) {
52 for(
int i = box->
x0; i < box->x1; i++) {
53 float *s_cur = (*state_cur)(i, j);
54 float *s_next = (*state_next)(i, j);
55 float *col = (*img)(i, j);
57 float C = (*img_max)(i, j)[0];
62 for(
int k = 0; k < 8; k++) {
66 float *s_cur_k = (*state_cur)(x, y);
67 float *col_k = (*img)(x, y);
71 float g_theta = 1.0f - (dist / C);
72 g_theta *= s_cur_k[1];
74 if(g_theta > s_cur[1]) {
75 s_next[0] = s_cur_k[0];
91 int dx_t[8] = {-1, 0, 1, -1, 1, -1, 0, 1};
92 int dy_t[8] = { 1, 1, 1, 0, 0, -1, -1, -1};
94 memcpy(
dx, dx_t,
sizeof(
int) * 8);
95 memcpy(
dy, dy_t,
sizeof(
int) * 8);
The BBox class manages the creation of bounding boxes for images.
Definition: bbox.hpp:29
int channels
Definition: image.hpp:80
std::vector< Image * > ImageVec
ImageVec an std::vector of pic::Image.
Definition: image_vec.hpp:29
int x0
Definition: bbox.hpp:32
The Filter class.
Definition: filter.hpp:50
static T distanceSq(T *data0, T *data1, int n)
distanceSq
Definition: array.hpp:195
int dy[8]
Definition: filter_grow_cut.hpp:33
int y0
Definition: bbox.hpp:32
void ProcessBBox(Image *dst, ImageVec src, BBox *box)
ProcessBBox.
Definition: filter_grow_cut.hpp:41
int dx[8]
Definition: filter_grow_cut.hpp:33
The FilterGrowCut class.
Definition: filter_grow_cut.hpp:29
The Image class stores an image as buffer of float.
Definition: image.hpp:60
FilterGrowCut()
FilterGrowCut.
Definition: filter_grow_cut.hpp:89
Definition: bilateral_separation.hpp:25