43 int p_col,
Corner *patch_src){
45 int i, j, k, rows, cols, channels, pos, pos_s, inc, inc_s;
46 rows = p_row*wp - (p_row - 1)*wo;
47 cols = p_col*wp - (p_col - 1)*wo;
57 assert(x_rand<(
int)(src_img.
h-wp+1));
59 assert(y_rand<(
int)(src_img.
w-wp+1));
61 patch_src->
x = x_rand;
62 patch_src->
y = y_rand;
65 inc_s = src_img.
h*src_img.
w;
73 pos_s = (x_rand + i)*src_img.
w +(y_rand +j);
74 assert(pos_s < (
int) (src_img.
w*src_img.
h));
75 for(k=0; k<channels; k++)
77 img.
img[pos + k*inc] = src_img.
img[pos_s + k*inc_s];
102 size = rows*cols*channels;
103 im->
img = (
float *) calloc(size,
sizeof(
float));
122 size = rows*cols*channels;
123 im->
img = (
double *) calloc(size,
sizeof(
double));
142 size = rows*cols*channels;
143 im->
img = (
long double *) calloc(size,
sizeof(
long double));
162 size = rows*cols*channels;
163 im->
img = (
unsigned long *) calloc(size,
sizeof(
unsigned long));
177 size_t inc = pos_map.
h*pos_map.
w;
180 for(i=0;i<pos_map.
h;i++)
182 for(j=0;j<pos_map.
w;j++)
184 pos_map.
img[count] = (i*255)/pos_map.
h;
185 pos_map.
img[count+inc] = (j*255)/pos_map.
w;
186 pos_map.
img[count+2*inc] = (i*j*255)/(pos_map.
w*pos_map.
h);
202 if( (M > (
int) im->
h) || (N > (
int) im->
w) )
215 im_crop->
img[i*N+j + k*M*N] =
216 im->
img[i*im->
w+j + k*im->
h*im->
w];
239 int kk, ll, pos_posMap, pos_synthMap, x_s, y_s, x_o, y_o, inc_o, inc_s;
240 x_s = leftTop_src->
x;
241 y_s = leftTop_src->
y;
242 assert( (x_s < (
int)((synth_map->
w-wp+1)*(synth_map->
h-wp+1))) &&
243 (y_s < (
int)((synth_map->
w-wp+1)*(synth_map->
h-wp+1))) );
244 x_o = leftTop_output->
x;
245 y_o = leftTop_output->
y;
246 inc_s = pos_map->
w*pos_map->
h;
247 inc_o = synth_map->
w*synth_map->
h;
249 for (kk=0; kk<wp; kk++)
251 for (ll=0; ll<wp; ll++)
253 pos_posMap = (x_s + kk)*pos_map->
w + (y_s + ll);
254 pos_synthMap = (x_o + kk)*synth_map->
w + (y_o + ll);
255 assert(pos_posMap < (
int)(pos_map->
h*pos_map->
w));
256 assert(pos_synthMap < (
int)(synth_map->
h*synth_map->
w));
257 synth_map->
img[pos_synthMap] =
258 binIm.
img[kk*binIm.
w+ll]*synth_map->
img[pos_synthMap]
259 + (1-binIm.
img[kk*binIm.
w+ll])*pos_map->
img[pos_posMap];
260 synth_map->
img[pos_synthMap + inc_o] =
261 binIm.
img[kk*binIm.
w+ll]*synth_map->
img[pos_synthMap + inc_o]
262 + (1-binIm.
img[kk*binIm.
w+ll])*pos_map->
img[pos_posMap + inc_s];
263 synth_map->
img[pos_synthMap + 2*inc_o] =
264 binIm.
img[kk*binIm.
w+ll]*synth_map->
img[pos_synthMap + 2*inc_o]
265 + (1-binIm.
img[kk*binIm.
w+ll])*pos_map->
img[pos_posMap + 2*inc_s];
283 if ((file = strrchr( filename,
'/'))==NULL)
287 int i = strlen(file);
288 while( (file[i-1] !=
'.') && (i>0))
293 char *fileNoExt = (
char *) calloc(posDot,
sizeof(
char));
294 strncpy(fileNoExt,file,posDot);
306 int im_fft(
float *img, fftwl_complex *fft_im,
int h,
int w)
314 for(
int i=0; i<(int)h; i++)
316 for(
int j=0; j<(int)w; j++)
319 src_ld.
img[pos_im] = (
long double)(img[pos_im]);
324 #pragma omp critical (make_plan)
325 p_im = fftwl_plan_dft_r2c_2d(h,w,src_ld.
img,fft_im,FFTW_ESTIMATE);
330 #pragma omp critical (make_plan)
331 fftwl_destroy_plan(p_im);