40 #include "omega_dfs.h"
41 #include "omega_stats.h"
42 #include "omega_utils.h"
93 cpl_stats *stats = NULL;
98 image = cpl_image_duplicate(img);
100 stats = cpl_stats_new_from_image(image, CPL_STATS_ALL);
102 for(i=0; i<iter; i++){
103 mean = cpl_stats_get_mean(stats);
104 median = cpl_stats_get_median(stats);
105 stdev = cpl_stats_get_stdev(stats);
107 mask = cpl_mask_threshold_image_create(image,median-threshold*stdev,median+threshold*stdev);
109 cpl_image_reject_from_mask(image, mask);
114 stats = cpl_stats_new_from_image(image, CPL_STATS_ALL);
115 if((abs(stdev/cpl_stats_get_stdev(stats)-1) <0.01)){
153 cpl_stats *stats = NULL;
159 image = cpl_image_duplicate(img);
163 x0 = (int)cpl_vector_get(zone,0);
164 zy0 = (int)cpl_vector_get(zone,1);
165 x1 = (int)cpl_vector_get(zone,2);
166 zy1 = (int)cpl_vector_get(zone,3);
167 stats = cpl_stats_new_from_image_window(image, CPL_STATS_ALL,x0,zy0,x1,zy1);
170 stats = cpl_stats_new_from_image(image, CPL_STATS_ALL);
173 for(i=0; i<iter; i++){
175 mean = cpl_stats_get_mean(stats);
176 median = cpl_stats_get_median(stats);
177 stdev = cpl_stats_get_stdev(stats);
179 mask = cpl_mask_threshold_image_create(image,median-threshold*stdev,median+threshold*stdev);
181 cpl_image_reject_from_mask(image, mask);
186 stats = cpl_stats_new_from_image_window(image, CPL_STATS_ALL,x0,zy0,x1,zy1);
189 stats = cpl_stats_new_from_image(image, CPL_STATS_ALL);
191 if( (abs(mean/cpl_stats_get_mean(stats)-1) < 0.01) &&
192 (abs(stdev/cpl_stats_get_stdev(stats)-1) < 0.01) ){
206 float get_median_float(
float *a,
int n)
222 const char *_id =
"get_kth_float:";
224 register int i, j, l, m ;
229 cpl_msg_error(
"",
"%s Error in input for median of array",_id);
242 FLOAT_SWAP(a[i],a[j]) ;