CR2RE Pipeline Reference Manual 1.6.7
hdrl_imagelist_view-test.c
1/* $Id: hdrl_imagelist_view-test.c,v 1.3 2013-10-22 08:26:11 jtaylor Exp $
2 *
3 * This file is part of the HDRL
4 * Copyright (C) 2013 European Southern Observatory
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
19 */
20
21/*
22 * $Author: jtaylor $
23 * $Date: 2013-10-22 08:26:11 $
24 * $Revision: 1.3 $
25 * $Name: not supported by cvs2svn $
26 */
27
28#ifdef HAVE_CONFIG_H
29#include <config.h>
30#endif
31
32/*-----------------------------------------------------------------------------
33 Includes
34 -----------------------------------------------------------------------------*/
35
36#include "hdrl_imagelist.h"
37#include "hdrl_test.h"
38#include "hdrl_imagelist_view.h" /* TODO put in public api? */
39
40#include <cpl.h>
41
42#define IMG_PTR(a) \
43 cpl_image_get_data(hdrl_image_get_image(a))
44#define ERR_PTR(a) \
45 cpl_image_get_data(hdrl_image_get_image(a))
46#define MSK_PTR(a) \
47 cpl_mask_get_data(hdrl_image_get_mask(a))
48#define CIMG_PTR(a) \
49 cpl_image_get_data_const(hdrl_image_get_image_const(a))
50#define CERR_PTR(a) \
51 cpl_image_get_data_const(hdrl_image_get_image_const(a))
52#define CMSK_PTR(a) \
53 cpl_mask_get_data_const(hdrl_image_get_mask_const(a))
54
55/*----------------------------------------------------------------------------*/
60/*----------------------------------------------------------------------------*/
61
62#define YSIZE 73
63#define XSIZE 50
64
65cpl_error_code test_row_view(void)
66{
67 hdrl_imagelist * hlist;
68 hdrl_image * himg;
69 hdrl_image * himg2;
70 cpl_image * contrib;
71 cpl_image * contrib2;
72
73 cpl_size nimages = 20;
74 hdrl_imagelist * view;
75 const hdrl_imagelist * cview;
76 cpl_imagelist * clist;
77
78 /* Create an image list */
79 hlist = hdrl_imagelist_new() ;
80 clist = cpl_imagelist_new() ;
81 for (cpl_size i = 0 ; i < nimages ; i++) {
82
83 cpl_image *ima = cpl_image_new(XSIZE, YSIZE, HDRL_TYPE_DATA);
84 cpl_image *ima_err = cpl_image_new(XSIZE, YSIZE, HDRL_TYPE_ERROR);
85
86 cpl_image_add_scalar(ima_err, 1.);
87 cpl_image_reject(ima, 1, 5);
88 if ((i % 5) == 0) {
89 cpl_image_reject(ima, 2, 5);
90 }
91 himg = hdrl_image_create(ima, ima_err);
92 cpl_image_delete(ima_err);
93 hdrl_imagelist_set(hlist, himg, i);
94 cpl_imagelist_set(clist, ima, i);
95 }
96
97 view = hdrl_imagelist_row_view(NULL, 10, 20);
98 cpl_test_null(view);
99 cpl_test_error(CPL_ERROR_NULL_INPUT);
100 view = hdrl_imagelist_row_view(hlist, 20, 10);
101 cpl_test_null(view);
102 cpl_test_error(CPL_ERROR_ILLEGAL_INPUT);
103 view = hdrl_imagelist_row_view(hlist, 0, 10);
104 cpl_test_null(view);
105 cpl_test_error(CPL_ERROR_ACCESS_OUT_OF_RANGE);
106 view = hdrl_imagelist_row_view(hlist, 1, YSIZE + 11);
107 cpl_test_null(view);
108 cpl_test_error(CPL_ERROR_ACCESS_OUT_OF_RANGE);
109
110 /* const variant */
111 cview = hdrl_imagelist_const_row_view(NULL, 10, 20);
112 cpl_test_null(cview);
113 cpl_test_error(CPL_ERROR_NULL_INPUT);
114 cview = hdrl_imagelist_const_row_view(hlist, 20, 10);
115 cpl_test_null(cview);
116 cpl_test_error(CPL_ERROR_ILLEGAL_INPUT);
117 cview = hdrl_imagelist_const_row_view(hlist, 0, 10);
118 cpl_test_null(cview);
119 cpl_test_error(CPL_ERROR_ACCESS_OUT_OF_RANGE);
120 cview = hdrl_imagelist_const_row_view(hlist, 1, YSIZE + 11);
121 cpl_test_null(cview);
122 cpl_test_error(CPL_ERROR_ACCESS_OUT_OF_RANGE);
123
124 // Mean collapse
125 hdrl_imagelist_collapse_mean(hlist, &himg, &contrib);
126
127 view = hdrl_imagelist_row_view(hlist, 1, YSIZE);
128 hdrl_imagelist_collapse_mean(view, &himg2, &contrib2);
129
130 hdrl_test_image_abs(himg, himg2, 0);
131 cpl_test_image_abs(contrib, contrib2, 0);
132 cpl_image * ccontrib = cpl_image_new_from_accepted(clist);
133 cpl_test_image_abs(ccontrib, contrib2, 0);
134 cpl_image * cerror = cpl_image_cast(ccontrib, HDRL_TYPE_ERROR);
135 cpl_image_power(cerror, -0.5);
136 cpl_test_image_abs(hdrl_image_get_error(himg), cerror, HDRL_EPS_ERROR);
137 cpl_image_delete(contrib2);
138 hdrl_image_delete(himg2);
139 cpl_image_delete(cerror);
140
141 /* const variant */
142 cview = hdrl_imagelist_const_row_view(hlist, 1, YSIZE);
143 hdrl_imagelist_collapse_mean(view, &himg2, &contrib2);
144
145 hdrl_test_image_abs(himg, himg2, 0);
146 cpl_test_image_abs(contrib, contrib2, 0);
147 cpl_test_image_abs(ccontrib, contrib2, 0);
148 cerror = cpl_image_cast(ccontrib, HDRL_TYPE_ERROR);
149 cpl_image_power(cerror, -0.5);
150 cpl_test_image_abs(hdrl_image_get_error(himg), cerror, HDRL_EPS_ERROR);
151 hdrl_image_delete(himg);
152 cpl_image_delete(contrib2);
153 hdrl_image_delete(himg2);
154 cpl_image_delete(ccontrib);
155 cpl_image_delete(cerror);
156 cpl_image_delete(contrib);
157
158 /* one has no bpm */
159 hdrl_image * iorig = hdrl_imagelist_get(hlist, 1);
160 hdrl_image * iview = hdrl_imagelist_get(view, 1);
161 cpl_test_eq_ptr(IMG_PTR(iorig), IMG_PTR(iview));
162 cpl_test_eq_ptr(ERR_PTR(iorig), ERR_PTR(iview));
163 cpl_test_eq_ptr(MSK_PTR(iorig), MSK_PTR(iview));
164
165 hdrl_image * ciview = hdrl_imagelist_get(cview, 1);
166 cpl_test_eq_ptr(IMG_PTR(iorig), CIMG_PTR(ciview));
167 cpl_test_eq_ptr(ERR_PTR(iorig), CERR_PTR(ciview));
168 cpl_test_eq_ptr(MSK_PTR(iorig), CMSK_PTR(ciview));
169
170 /* zero has bpm */
171 iorig = hdrl_imagelist_get(hlist, 0);
172 iview = hdrl_imagelist_get(view, 0);
173 cpl_test_eq_ptr(IMG_PTR(iorig), IMG_PTR(iview));
174 cpl_test_eq_ptr(ERR_PTR(iorig), ERR_PTR(iview));
175 cpl_test_eq_ptr(MSK_PTR(iorig), MSK_PTR(iview));
176
177 ciview = hdrl_imagelist_get(cview, 0);
178 cpl_test_eq_ptr(IMG_PTR(iorig), CIMG_PTR(ciview));
179 cpl_test_eq_ptr(ERR_PTR(iorig), CERR_PTR(ciview));
180 cpl_test_eq_ptr(MSK_PTR(iorig), CMSK_PTR(ciview));
181
182 hdrl_image * icopy = hdrl_image_duplicate(iview);
183 cpl_test_eq(hdrl_image_get_size_y(icopy), YSIZE);
184 cpl_test_noneq_ptr(IMG_PTR(icopy), IMG_PTR(iview));
185 cpl_test_noneq_ptr(ERR_PTR(icopy), ERR_PTR(iview));
186 cpl_test_noneq_ptr(MSK_PTR(icopy), MSK_PTR(iview));
187 hdrl_image_delete(icopy);
188
189 hdrl_imagelist * lcopy = hdrl_imagelist_duplicate(view);
191 cpl_test_eq(hdrl_imagelist_get_size(lcopy), nimages);
192 cpl_test_eq(hdrl_image_get_size_y(hdrl_imagelist_get(lcopy, 0)), YSIZE);
194
195 cpl_size nsizey = YSIZE - 17 - 5 + 1;
196 view = hdrl_imagelist_row_view(hlist, 5, YSIZE - 17);
197 hdrl_image * vimg = hdrl_imagelist_get(view, 0);
198 hdrl_image_add_scalar(vimg, (hdrl_value){5, 1});
199
200 cpl_test_eq(hdrl_image_get_size_x(vimg), XSIZE);
201 cpl_test_eq(hdrl_image_get_size_y(vimg), nsizey);
202
203 hdrl_image * orig = hdrl_imagelist_get(hlist, 0);
204 /* mean of original image (mix of 5s and zeros) */
205 cpl_test_noneq(hdrl_image_get_mean(orig).data, 5);
206
207 vimg = hdrl_imagelist_get(view, 0);
208 cpl_test_rel(hdrl_image_get_mean(vimg).data, 5,
209 HDRL_EPS_DATA * XSIZE * YSIZE);
210
212
213 CPL_DIAG_PRAGMA_PUSH_IGN(-Wcast-qual);
214 hdrl_imagelist_delete((hdrl_imagelist*)cview);
215 CPL_DIAG_PRAGMA_POP;
216
218 cpl_imagelist_delete(clist);
219
220 return cpl_error_get_code();
221}
222
223cpl_error_code test_cpl_row_view_invalid(void)
224{
225 cpl_imagelist * imglist = cpl_imagelist_new();
226 cpl_imagelist * errlist = cpl_imagelist_new();
227 const hdrl_imagelist * view;
228
229 view = hdrl_imagelist_const_cpl_row_view(NULL, errlist, 1, 2);
230 cpl_test_null(view);
231 cpl_test_error(CPL_ERROR_NULL_INPUT);
232
233 view = hdrl_imagelist_const_cpl_row_view(imglist, errlist, 1, 0);
234 cpl_test_null(view);
235 cpl_test_error(CPL_ERROR_ILLEGAL_INPUT);
236
237 view = hdrl_imagelist_const_cpl_row_view(imglist, errlist, 1, 2);
238 cpl_test_null(view);
239 cpl_test_error(CPL_ERROR_ACCESS_OUT_OF_RANGE);
240
241 cpl_image * img = cpl_image_new(5, 5, HDRL_TYPE_DATA);
242 cpl_imagelist_set(imglist, img, 0);
243 cpl_image * err = cpl_image_new(6, 5, HDRL_TYPE_ERROR);
244 cpl_imagelist_set(errlist, err, 0);
245
246 view = hdrl_imagelist_const_cpl_row_view(imglist, errlist, 1, 2);
247 cpl_test_null(view);
248 cpl_test_error(CPL_ERROR_INCOMPATIBLE_INPUT);
249
250 cpl_image_delete(cpl_imagelist_unset(imglist, 0));
251 cpl_image_delete(cpl_imagelist_unset(errlist, 0));
252
253 img = cpl_image_new(5, 5, CPL_TYPE_INT);
254 cpl_imagelist_set(imglist, img, 0);
255 err = cpl_image_new(5, 5, CPL_TYPE_INT);
256 cpl_imagelist_set(errlist, err, 0);
257
258 view = hdrl_imagelist_const_cpl_row_view(imglist, errlist, 1, 2);
259 cpl_test_null(view);
260 cpl_test_error(CPL_ERROR_INCOMPATIBLE_INPUT);
261
262 cpl_image_delete(cpl_imagelist_unset(imglist, 0));
263 cpl_image_delete(cpl_imagelist_unset(errlist, 0));
264
265 img = cpl_image_new(5, 5, HDRL_TYPE_DATA);
266 cpl_imagelist_set(imglist, img, 0);
267 err = cpl_image_new(5, 5, HDRL_TYPE_ERROR);
268 cpl_imagelist_set(errlist, err, 0);
269 cpl_image_reject(img, 1, 1);
270
271 view = hdrl_imagelist_const_cpl_row_view(imglist, errlist, 1, 2);
272 cpl_test_null(view);
273 cpl_test_error(CPL_ERROR_INCOMPATIBLE_INPUT);
274
275 cpl_image_reject(img, 1, 1);
276 cpl_image_reject(err, 1, 2);
277
278 view = hdrl_imagelist_const_cpl_row_view(imglist, errlist, 1, 2);
279 cpl_test_null(view);
280 cpl_test_error(CPL_ERROR_INCOMPATIBLE_INPUT);
281
282 cpl_image_accept_all(img);
283
284 view = hdrl_imagelist_const_cpl_row_view(imglist, errlist, 1, 2);
285 cpl_test_null(view);
286 cpl_test_error(CPL_ERROR_INCOMPATIBLE_INPUT);
287
288 cpl_imagelist_delete(imglist);
289 cpl_imagelist_delete(errlist);
290
291 return cpl_error_get_code();
292}
293
294cpl_error_code test_cpl_row_view(void)
295{
296 hdrl_imagelist * hlist;
297 hdrl_imagelist * hlist_noerr;
298 hdrl_image * himg;
299 hdrl_image * vhimg;
300 cpl_image * contrib;
301 cpl_image * vcontrib;
302
303 cpl_size nimages = 20;
304 const hdrl_imagelist * cview;
305 cpl_imagelist * cimglist, * cerrlist;
306
307 /* Create an image list */
308 hlist = hdrl_imagelist_new() ;
309 hlist_noerr = hdrl_imagelist_new() ;
310 cimglist = cpl_imagelist_new() ;
311 cerrlist = cpl_imagelist_new() ;
312 for (cpl_size i = 0 ; i < nimages ; i++) {
313
314 cpl_image *ima = cpl_image_new(XSIZE, YSIZE, HDRL_TYPE_DATA);
315 cpl_image *ima_err = cpl_image_new(XSIZE, YSIZE, HDRL_TYPE_ERROR);
316
317 cpl_image_add_scalar(ima_err, 1.);
318 cpl_image_reject(ima, 1, 5);
319 cpl_image_reject(ima_err, 1, 5);
320 if ((i % 5) == 0) {
321 cpl_image_reject(ima, 2, 5);
322 cpl_image_reject(ima_err, 2, 5);
323 }
324 himg = hdrl_image_create(ima, ima_err);
325 hdrl_imagelist_set(hlist, himg, i);
326 hdrl_imagelist_set(hlist_noerr, hdrl_image_create(ima, NULL), i);
327 cpl_imagelist_set(cimglist, ima, i);
328 cpl_imagelist_set(cerrlist, ima_err, i);
329 }
330
331 cview = hdrl_imagelist_const_cpl_row_view(cimglist, cerrlist, 1, YSIZE);
332 cpl_test_nonnull(cview);
333 cpl_test_error(CPL_ERROR_NONE);
334 hdrl_imagelist_collapse_weighted_mean(hlist, &himg, &contrib);
335 hdrl_imagelist_collapse_weighted_mean(cview, &vhimg, &vcontrib);
336 hdrl_test_image_abs(himg, vhimg, 0);
337 cpl_test_image_abs(contrib, vcontrib, 0);
338 hdrl_image_delete(himg);
339 hdrl_image_delete(vhimg);
340 cpl_image_delete(contrib);
341 cpl_image_delete(vcontrib);
342
343 hdrl_imagelist_collapse_mean(hlist, &himg, &contrib);
344 hdrl_imagelist_collapse_mean(cview, &vhimg, &vcontrib);
345 hdrl_test_image_abs(himg, vhimg, 0);
346 cpl_test_image_abs(contrib, vcontrib, 0);
347 hdrl_image_delete(himg);
348 hdrl_image_delete(vhimg);
349 cpl_image_delete(contrib);
350 cpl_image_delete(vcontrib);
351 CPL_DIAG_PRAGMA_PUSH_IGN(-Wcast-qual);
352 hdrl_imagelist_delete((hdrl_imagelist*)cview);
353 CPL_DIAG_PRAGMA_POP;
354
355 /* no error test */
356 cview = hdrl_imagelist_const_cpl_row_view(cimglist, NULL, 1, YSIZE);
357 hdrl_imagelist_collapse_mean(hlist_noerr, &himg, &contrib);
358 hdrl_imagelist_collapse_mean(cview, &vhimg, &vcontrib);
359 hdrl_test_image_abs(himg, vhimg, 0);
360 cpl_test_image_abs(contrib, vcontrib, 0);
361 hdrl_image_delete(himg);
362 hdrl_image_delete(vhimg);
363 cpl_image_delete(contrib);
364 cpl_image_delete(vcontrib);
365
366 hdrl_imagelist_collapse_median(hlist_noerr, &himg, &contrib);
367 hdrl_imagelist_collapse_median(cview, &vhimg, &vcontrib);
368 hdrl_test_image_abs(himg, vhimg, 0);
369 cpl_test_image_abs(contrib, vcontrib, 0);
370 hdrl_image_delete(himg);
371 hdrl_image_delete(vhimg);
372 cpl_image_delete(contrib);
373 cpl_image_delete(vcontrib);
374
375 hdrl_imagelist_collapse_sigclip(hlist_noerr, 3., 3., 3, &himg, &contrib,
376 NULL, NULL);
377 hdrl_imagelist_collapse_sigclip(cview, 3., 3., 3, &vhimg, &vcontrib,
378 NULL, NULL);
379 hdrl_test_image_abs(himg, vhimg, 0);
380 cpl_test_image_abs(contrib, vcontrib, 0);
381 hdrl_image_delete(himg);
382 hdrl_image_delete(vhimg);
383 cpl_image_delete(contrib);
384 cpl_image_delete(vcontrib);
385
386 hdrl_imagelist_collapse_minmax(hlist_noerr, 3., 3., &himg, &contrib,
387 NULL, NULL);
388 hdrl_imagelist_collapse_minmax(cview, 3., 3., &vhimg, &vcontrib,
389 NULL, NULL);
390 hdrl_test_image_abs(himg, vhimg, 0);
391 cpl_test_image_abs(contrib, vcontrib, 0);
392 hdrl_image_delete(himg);
393 hdrl_image_delete(vhimg);
394 cpl_image_delete(contrib);
395 cpl_image_delete(vcontrib);
396
397 CPL_DIAG_PRAGMA_PUSH_IGN(-Wcast-qual);
398 hdrl_imagelist_delete((hdrl_imagelist*)cview);
399 CPL_DIAG_PRAGMA_POP;
400
402 hdrl_imagelist_delete(hlist_noerr);
403 cpl_imagelist_delete(cimglist);
404 cpl_imagelist_delete(cerrlist);
405
406 return cpl_error_get_code();
407}
408
409
410cpl_error_code test_image_view(void)
411{
412 hdrl_imagelist * hl = hdrl_imagelist_new();
413 hdrl_imagelist * view;
414
415 view = hdrl_imagelist_image_view(hl, 5, 1);
416 cpl_test_error(CPL_ERROR_ILLEGAL_INPUT);
417 cpl_test_null(view);
418
419 view = hdrl_imagelist_image_view(hl, 1, 1);
420 cpl_test_error(CPL_ERROR_ILLEGAL_INPUT);
421 cpl_test_null(view);
422
423 view = hdrl_imagelist_image_view(hl, 0, 1);
424 cpl_test_error(CPL_ERROR_ACCESS_OUT_OF_RANGE);
425 cpl_test_null(view);
426
428
429 view = hdrl_imagelist_image_view(hl, 1, 2);
430 cpl_test_error(CPL_ERROR_ACCESS_OUT_OF_RANGE);
431 cpl_test_null(view);
432
433 view = hdrl_imagelist_image_view(hl, -1, 1);
434 cpl_test_error(CPL_ERROR_ACCESS_OUT_OF_RANGE);
435 cpl_test_null(view);
436
437 view = hdrl_imagelist_image_view(hl, 0, 1);
438 cpl_test_error(CPL_ERROR_NONE);
439 cpl_test_nonnull(view);
440
441 cpl_test_eq(hdrl_imagelist_get_size(view), hdrl_imagelist_get_size(hl));
442
443 hdrl_imagelist_add_scalar(hl, (hdrl_value){1, 1});
444
445 hdrl_test_image_abs(hdrl_imagelist_get(view, 0),
446 hdrl_imagelist_get(hl, 0), 0);
447
448 hdrl_image * n = hdrl_image_new(5, 7);
450
451 hdrl_test_image_abs(hdrl_imagelist_get(view, 0),
452 hdrl_imagelist_get(hl, 0), 0);
453 hdrl_test_image_abs(hdrl_imagelist_get(hl, 1), n, 0);
456
459 view = hdrl_imagelist_image_view(hl, 1, 2);
460 cpl_test_error(CPL_ERROR_NONE);
461 cpl_test_eq(hdrl_imagelist_get_size(view), 1);
462 cpl_test_eq_ptr(IMG_PTR(hdrl_imagelist_get(view, 0)),
463 IMG_PTR(hdrl_imagelist_get(hl, 1)));
464 cpl_test_eq_ptr(ERR_PTR(hdrl_imagelist_get(view, 0)),
465 ERR_PTR(hdrl_imagelist_get(hl, 1)));
466 cpl_test_eq_ptr(MSK_PTR(hdrl_imagelist_get(view, 0)),
467 MSK_PTR(hdrl_imagelist_get(hl, 1)));
469
470 view = hdrl_imagelist_image_view(hl, 1, 3);
471 cpl_test_eq(hdrl_imagelist_get_size(view), 2);
472 cpl_test_eq_ptr(IMG_PTR(hdrl_imagelist_get(view, 0)),
473 IMG_PTR(hdrl_imagelist_get(hl, 1)));
474 cpl_test_eq_ptr(ERR_PTR(hdrl_imagelist_get(view, 0)),
475 ERR_PTR(hdrl_imagelist_get(hl, 1)));
476 cpl_test_eq_ptr(MSK_PTR(hdrl_imagelist_get(view, 0)),
477 MSK_PTR(hdrl_imagelist_get(hl, 1)));
478 cpl_test_eq_ptr(IMG_PTR(hdrl_imagelist_get(view, 1)),
479 IMG_PTR(hdrl_imagelist_get(hl, 2)));
480 cpl_test_eq_ptr(ERR_PTR(hdrl_imagelist_get(view, 1)),
481 ERR_PTR(hdrl_imagelist_get(hl, 2)));
482 cpl_test_eq_ptr(MSK_PTR(hdrl_imagelist_get(view, 1)),
483 MSK_PTR(hdrl_imagelist_get(hl, 2)));
484
485 /* test view of view */
486 hdrl_imagelist * rview = hdrl_imagelist_row_view(view, 2, 7);
487 cpl_test_eq(hdrl_imagelist_get_size(rview), hdrl_imagelist_get_size(view));
488 hdrl_image * tmp = hdrl_imagelist_get(rview, 0);
489 cpl_test_eq(hdrl_image_get_size_x(tmp), 5);
490 cpl_test_eq(hdrl_image_get_size_y(tmp), 6);
492
495
496 return cpl_error_get_code();
497}
498
499/*----------------------------------------------------------------------------*/
503/*----------------------------------------------------------------------------*/
504int main(void)
505{
506 cpl_test_init(PACKAGE_BUGREPORT, CPL_MSG_WARNING);
507
508 test_row_view();
509 test_image_view();
510 test_cpl_row_view_invalid();
511 test_cpl_row_view();
512
513 return cpl_test_end(0);
514}
hdrl_image * hdrl_image_duplicate(const hdrl_image *himg)
copy hdrl_image
Definition: hdrl_image.c:391
cpl_error_code hdrl_image_add_scalar(hdrl_image *self, hdrl_value value)
Elementwise addition of a scalar to an image.
cpl_image * hdrl_image_get_error(hdrl_image *himg)
get error as cpl image
Definition: hdrl_image.c:131
hdrl_value hdrl_image_get_mean(const hdrl_image *self)
computes mean pixel value and associated error of an image.
cpl_size hdrl_image_get_size_y(const hdrl_image *self)
return size of Y dimension of image
Definition: hdrl_image.c:540
cpl_size hdrl_image_get_size_x(const hdrl_image *self)
return size of X dimension of image
Definition: hdrl_image.c:525
hdrl_image * hdrl_image_create(const cpl_image *image, const cpl_image *error)
create a new hdrl_image from to existing images by copying them
Definition: hdrl_image.c:295
hdrl_image * hdrl_image_new(cpl_size nx, cpl_size ny)
create new zero filled hdrl image
Definition: hdrl_image.c:311
void hdrl_image_delete(hdrl_image *himg)
delete hdrl_image
Definition: hdrl_image.c:379
cpl_error_code hdrl_imagelist_collapse_sigclip(const hdrl_imagelist *himlist, double kappa_low, double kappa_high, int niter, hdrl_image **out, cpl_image **contrib, cpl_image **reject_low, cpl_image **reject_high)
Sigma-clipped collapsing of image list.
cpl_error_code hdrl_imagelist_add_scalar(hdrl_imagelist *himlist, hdrl_value value)
Elementwise addition of a scalar to each image in the himlist.
cpl_error_code hdrl_imagelist_collapse_mean(const hdrl_imagelist *himlist, hdrl_image **out, cpl_image **contrib)
Mean collapsing of image list.
cpl_error_code hdrl_imagelist_set(hdrl_imagelist *himlist, hdrl_image *himg, cpl_size pos)
Insert an image into an imagelist.
void hdrl_imagelist_delete(hdrl_imagelist *himlist)
Free all memory used by a hdrl_imagelist object including the images.
cpl_size hdrl_imagelist_get_size(const hdrl_imagelist *himlist)
Get the number of images in the imagelist.
hdrl_imagelist * hdrl_imagelist_new(void)
Create an empty imagelist.
cpl_error_code hdrl_imagelist_collapse_median(const hdrl_imagelist *himlist, hdrl_image **out, cpl_image **contrib)
Median collapsing of image list.
hdrl_imagelist * hdrl_imagelist_duplicate(const hdrl_imagelist *himlist)
Duplicate an image list.
cpl_error_code hdrl_imagelist_collapse_minmax(const hdrl_imagelist *himlist, double nlow, double nhigh, hdrl_image **out, cpl_image **contrib, cpl_image **reject_low, cpl_image **reject_high)
Minmax-clipped collapsing of image list.
cpl_error_code hdrl_imagelist_collapse_weighted_mean(const hdrl_imagelist *himlist, hdrl_image **out, cpl_image **contrib)
Weighted Mean collapsing of image list.
hdrl_image * hdrl_imagelist_get(const hdrl_imagelist *himlist, cpl_size inum)
Get an image from a list of images.