00001
00002
00003 /*---------------------------------------------------------------------------
00004 E.S.O.
00005 ----------------------------------------------------------------------------
00006 File name : spectro_detect.h
00007 Author : T.Rogon
00008 Created on : October 1999
00009 Language : ANSI C
00010 Description : spectroscopy routines
00011 *--------------------------------------------------------------------------*/
00012
00013 /*
00014
00015 $Id: spectro_detect.h,v 1.1 2003/09/03 12:50:47 amodigli Exp $
00016 $Author: amodigli $
00017 $Date: 2003/09/03 12:50:47 $
00018 $Revision: 1.1 $
00019
00020 */
00021
00022 #ifndef _SPECTRO_DETECT_H_
00023 #define _SPECTRO_DETECT_H_
00024
00025 /*---------------------------------------------------------------------------
00026 Includes
00027 ---------------------------------------------------------------------------*/
00028
00029 #include <stdio.h>
00030 #include <stdlib.h>
00031
00032 #include "eclipse.h"
00033
00034 /*---------------------------------------------------------------------------
00035 Defines
00036 ---------------------------------------------------------------------------*/
00037
00038
00039
00040 /* Spectrum detection */
00041 #define SPEC_PARAM_PTYPE BPP_DEFAULT
00042 #define SPEC_PARAM_WINDOWSIZE 32
00043 #define SPEC_PARAM_MINGOODPIX 100
00044 #define SPEC_PARAM_THRESHFACT 1.0
00045 #define SPEC_MIN_LEN_FACT 5 /* fraction of image length */
00046 #define SPEC_SHADOW_FACT 8.0 /* Negative spectrum intensity*/
00047 #define SPEC_MAXWIDTH 48
00048 #define SPEC_PARAM_MEDIAN_SIZE 10
00049
00050 #define SPEC_DEBUG_LEVEL 8
00051
00052
00053
00054
00055 /*---------------------------------------------------------------------------
00056 New types
00057 ---------------------------------------------------------------------------*/
00058
00059
00060
00061
00062 typedef struct _SPEC_PARAM_T_ {
00063 /* zone to avoid in arc detection */
00064 int badtop;
00065 int badbot;
00066 int badleft;
00067 int badright;
00068 /* size of median filter for detection */
00069 int vert_med_size;
00070 /* factor on moving median for detection */
00071 double thresh_fact;
00072 /* size of window for moving theshold */
00073 int window_size;
00074 /* Min nb of detected arcs in order to be able to estimate a 2-d dist poly*/
00075 int min_nb_specs;
00076 /* Minimum arclen for detection */
00077 int min_speclen;
00078 /* Maximum arcwidth for detection */
00079 int max_specwidth;
00080 /* minimum white pixels to try and detect arcs with */
00081 int min_good_pixels;
00082 /* detect horizontal or vertical lines */
00083 orientation_t orientation;
00084 } spec_param_t;
00085
00086
00087 /* Criteria for spectrum detection */
00088 typedef enum SPEC_DETECT_MODE_T{
00089 EQUALLY_SPACED_SHADOW_SPECTRA, /* 2 shadows above and below true spectrum */
00090 ONE_SHADOW_SPECTRUM, /* 1 shadow at specified distance from spectrum */
00091 NO_SHADOW_SPECTRUM /* Do not search for shadow */
00092 } spec_detect_mode_t;
00093
00094
00095
00096 /*---------------------------------------------------------------------------
00097 Function prototypes
00098 ---------------------------------------------------------------------------*/
00099 /*-------------------------------------------------------------------------
00100 * Function : setup_default_spec_param()
00101 * In : the moving median thresholding window size,
00102 the size of the vertical median filter
00103 the minimal number of spectra anticipated
00104 * Out : an spec_param_t structure to be freed by free()
00105 * Job : Sets up default and hidden
00106 parameters for dist_engine;
00107 * Notice : After calling this function, the parameters
00108 badleft, badright, badtop, badbot, orientation
00109 MUST be set up manually
00110 (see the spec_param_t definition)
00111 *------------------------------------------------------------------------*/
00112 spec_param_t *setup_default_spec_param(
00113 int window_size,
00114 int vert_med_size,
00115 double thresh_fact,
00116 int min_nb_specs) ;
00117
00118 /*--------------------------------------------------------------------------
00119 * Function : find_brightest_spectrum_1d()
00120 * In : OneImage, the zone to consider defined within
00121 the coordinates badleft badright badtop badbot
00122 the orientation of the spectrum (arc_orientation)
00123 the main offset diff, i.e. the characteristic
00124 difference between positive and negative spectra
00125 The spectrum detection method (see relevant typedef
00126 for explanation), minimum brightness required for a spectrum
00127 to be detected.
00128 * Out : The coordinates of the found spectrum, NULL if error
00129 if the orientation is HORIZONTAL the returned x
00130 coordinate is 0, if the orientation is VERTICAL the
00131 returned y coordinate is 0
00132 * Job : Finds the brightest spectrum in an image
00133 * Notice : This function s a wrapper calling
00134 find_spectra_1d()
00135 C-style convention for coordinates is used, i.e.
00136 top,left=0,0
00137 *------------------------------------------------------------------------*/
00138 dpoint * find_brightest_spectrum_1d(
00139 OneImage * in,
00140 int badleft,
00141 int badright,
00142 int badtop,
00143 int badbot,
00144 orientation_t orientation,
00145 int main_offset_diff,
00146 spec_detect_mode_t spec_detect_mode,
00147 double min_bright);
00148
00149
00150 /*--------------------------------------------------------------------------
00151 * Function : find_brightest_spectrum()
00152 * In : OneImage, the zone to consider defined within
00153 the coordinates badleft badright badtop badbot
00154 the orientation of the spectrum (arc_orientation)
00155 the main offset diff, i.e. the characteristic
00156 difference between positive and negative spectra
00157 The spectrum detection method (see relevant typedef
00158 for explanation).
00159 * Out : The coordinates of the found spectrum, NULL if error
00160 * Job : Finds the brightest spectrum in an image
00161 * Notice : This function s a wrapper calling
00162 find_spectra()
00163 C-style convention for coordinates is used, i.e.
00164 top,left=0,0
00165 *------------------------------------------------------------------------*/
00166 dpoint * find_brightest_spectrum(
00167 OneImage * in,
00168 int badleft,
00169 int badright,
00170 int badtop,
00171 int badbot,
00172 orientation_t orientation,
00173 int main_offset_diff,
00174 spec_detect_mode_t spec_detect_mode);
00175
00176
00177
00178 #endif
1.2.13.1 written by Dimitri van Heesch,
© 1997-2001