CR2RE Pipeline Reference Manual 1.6.7
hdrl_correlation.h
1/* $Id: hdrl_correlation.h,v 0.1 2017-04-12 16:49:47 msalmist Exp $
2 *
3 * This file is part of the HDRL
4 * Copyright (C) 2017 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: msalmist $
23 * $Date: 2017-04-12 16:49:47 $
24 * $Revision: 0.1 $
25 * $Name: not supported by cvs2svn $
26 */
27
28#ifndef HDRL_CORRELATION_H
29#define HDRL_CORRELATION_H
30
31/*-----------------------------------------------------------------------------
32 Includes
33 -----------------------------------------------------------------------------*/
34
35#include <cpl.h>
36#include "hdrl_types.h"
37
38CPL_BEGIN_DECLS
39
40
41typedef struct{
42 double peakpos; /* Position of the peak of the gaussian fitted to the cross correlation */
43 double sigma; /* Width of the gaussian fitted to the cross correlation */
44 double area; /* Area of the gaussian fitted to the cross correlation */
45 double offset; /* Fitted background level */
46 double mse; /* Mean squared error of the best fit */
47 cpl_array * xcorr; /* Cross-correlation */
48 cpl_size pix_peakpos; /* Pixel position of the peak */
49 cpl_size half_window;
50}hdrl_xcorrelation_result;
51
52hdrl_xcorrelation_result *
53hdrl_xcorrelation_result_wrap(cpl_array * x_corr, const cpl_size max_idx,
54 const cpl_size half_window);
55
56void hdrl_xcorrelation_result_delete(hdrl_xcorrelation_result * self);
57
58cpl_size
59hdrl_xcorrelation_result_get_peak_pixel(const hdrl_xcorrelation_result * self);
60
61double
62hdrl_xcorrelation_result_get_peak_subpixel(const hdrl_xcorrelation_result * self);
63
64cpl_size
65hdrl_xcorrelation_result_get_half_window (const hdrl_xcorrelation_result * self);
66
67double
68hdrl_xcorrelation_result_get_sigma(const hdrl_xcorrelation_result * self);
69
70const cpl_array *
71hdrl_xcorrelation_result_get_correlation(const hdrl_xcorrelation_result * self);
72
73
74hdrl_xcorrelation_result * hdrl_compute_xcorrelation(
75 const cpl_array * arr1,
76 const cpl_array * arr2,
77 const cpl_size half_window, const cpl_boolean normalize);
78
79hdrl_xcorrelation_result * hdrl_compute_offset_gaussian(
80 const cpl_array * arr1,
81 const cpl_array * arr2,
82 const cpl_size half_win, const cpl_boolean normalize,
83 const double bin, const double wrange);
84
85#if defined HDRL_USE_PRIVATE
86
87hdrl_xcorrelation_result *
89 const cpl_array * arr1, const cpl_array * arr2,
90 const cpl_size half_win, const cpl_boolean normalize,
91 const double bin, const double wrange);
92
93#endif
94
95CPL_END_DECLS
96
97#endif
void hdrl_xcorrelation_result_delete(hdrl_xcorrelation_result *self)
Destructor for hdrl_xcorrelation_result.
hdrl_xcorrelation_result * hdrl_compute_xcorrelation(const cpl_array *arr1, const cpl_array *arr2, const cpl_size half_window, const cpl_boolean normalize)
Calculate cross-correlation.
const cpl_array * hdrl_xcorrelation_result_get_correlation(const hdrl_xcorrelation_result *self)
Getter for the cross correlation.
cpl_size hdrl_xcorrelation_result_get_peak_pixel(const hdrl_xcorrelation_result *self)
Get the index where the cross correlation reaches its maximum.
cpl_size hdrl_xcorrelation_result_get_half_window(const hdrl_xcorrelation_result *self)
Get the half_window used to calculate the cross-correlation.
hdrl_xcorrelation_result * hdrl_compute_offset_gaussian_internal(const cpl_array *arr1, const cpl_array *arr2, const cpl_size half_win, const cpl_boolean normalize, const double bin, const double wrange)
Calculate gaussian fit on cross-correlation.
hdrl_xcorrelation_result * hdrl_compute_offset_gaussian(const cpl_array *arr1, const cpl_array *arr2, const cpl_size half_win, const cpl_boolean normalize, const double bin, const double wrange)
Calculate gaussian fit on cross-correlation, does a second fitting for refinement.
double hdrl_xcorrelation_result_get_peak_subpixel(const hdrl_xcorrelation_result *self)
Get the index where the cross correlation reaches its maximum, with sub-pixel precision.
double hdrl_xcorrelation_result_get_sigma(const hdrl_xcorrelation_result *self)
Get the estimated standard deviation of the correlation.
hdrl_xcorrelation_result * hdrl_xcorrelation_result_wrap(cpl_array *x_corr, const cpl_size max_idx, const cpl_size half_window)
Constructor for hdrl_xcorrelation_result.