94 cpl_bivector * offsets;
97 const cpl_frame * frame;
98 cpl_propertylist * plist;
103 if (fset == NULL)
return NULL;
106 nfiles = cpl_frameset_get_size(fset);
107 offsets = cpl_bivector_new(nfiles);
108 offsets_x = cpl_bivector_get_x_data(offsets);
109 offsets_y = cpl_bivector_get_y_data(offsets);
110 for (i=0; i<nfiles; i++) {
111 if (cpl_error_get_code()) {
112 cpl_bivector_delete(offsets);
116 frame = cpl_frameset_get_position_const(fset, i);
117 plist=cpl_propertylist_load(cpl_frame_get_filename(frame),0);
120 cpl_propertylist_delete(plist);
121 if (cpl_error_get_code()) {
122 cpl_msg_error(cpl_func,
"Cannot get offsets from header");
123 cpl_bivector_delete(offsets);
128 for (i=1; i<nfiles; i++) {
129 offsets_x[i] -= offsets_x[0];
130 offsets_y[i] -= offsets_y[0];
132 offsets_x[0] = offsets_y[0] = 0.00;
281 cpl_image * quad1_corr;
282 cpl_image * quad2_corr;
283 cpl_image * quad3_corr;
284 cpl_image * quad4_corr;
292 int i, j, pos1, pos2, pos3, pos4;
295 if (in == NULL)
return NULL;
298 nx = cpl_image_get_size_x(in);
299 ny = cpl_image_get_size_y(in);
302 quad1 = cpl_image_extract(in, 1, 1, nx/2, ny/2);
303 quad2 = cpl_image_extract(in, (nx/2)+1, 1, nx, ny/2);
304 quad3 = cpl_image_extract(in, 1, (ny/2)+1, nx/2, ny);
305 quad4 = cpl_image_extract(in, (nx/2)+1, (ny/2)+1, nx, ny);
308 quad1_corr = irplib_oddeven_correct(quad1);
309 quad2_corr = irplib_oddeven_correct(quad2);
310 quad3_corr = irplib_oddeven_correct(quad3);
311 quad4_corr = irplib_oddeven_correct(quad4);
313 cpl_image_delete(quad1);
314 cpl_image_delete(quad2);
315 cpl_image_delete(quad3);
316 cpl_image_delete(quad4);
319 out = cpl_image_duplicate(in);
320 pout = cpl_image_get_data_float(out);
321 pin1 = cpl_image_get_data_float(quad1_corr);
322 pin2 = cpl_image_get_data_float(quad2_corr);
323 pin3 = cpl_image_get_data_float(quad3_corr);
324 pin4 = cpl_image_get_data_float(quad4_corr);
326 for (j=0; j<ny/2; j++) {
327 for (i=0; i<nx/2; i++) {
329 pos2 = (i+(nx/2)) + j * nx;
330 pos3 = i + (j+(ny/2)) * nx;
331 pos4 = (i+(nx/2)) + (j+(ny/2)) * nx;
332 pout[pos1] = pin1[i+j*(nx/2)];
333 pout[pos2] = pin2[i+j*(nx/2)];
334 pout[pos3] = pin3[i+j*(nx/2)];
335 pout[pos4] = pin4[i+j*(nx/2)];
339 cpl_image_delete(quad1_corr);
340 cpl_image_delete(quad2_corr);
341 cpl_image_delete(quad3_corr);
342 cpl_image_delete(quad4_corr);
359 const cpl_size nframes = cpl_frameset_get_size(self);
360 cpl_frameset * newset = NULL;
363 if (self == NULL)
return NULL;
364 if (tag == NULL)
return NULL;
366 for (cpl_size i = 0; i < nframes; i++) {
367 const cpl_frame * frame = cpl_frameset_get_position_const(self, i);
368 const char * mytag = cpl_frame_get_tag(frame);
370 if (mytag != NULL && !strcmp(mytag, tag)) {
371 cpl_frame * newframe = cpl_frame_duplicate(frame);
374 if (newset == NULL) newset = cpl_frameset_new();
376 if (cpl_frameset_insert(newset, newframe)) {
377 cpl_frame_delete(newframe);
378 cpl_frameset_delete(newset);
379 (void)cpl_error_set(cpl_func, cpl_error_get_code());