00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023 #include <stdio.h>
00024 #include <stdlib.h>
00025 #include <string.h>
00026
00027 #include <flgrCoreData.h>
00028 #include <flgrCoreSlideWindow.h>
00029 #include <flgrCoreNhbManage.h>
00030 #include <flgrCoreCopy.h>
00031 #include <flgrCoreDispatch.h>
00032 #include <flgrArith.h>
00033
00034 #include "flgrMorphoKerOp.h"
00035 #include "flgrMorphoBase.h"
00036 #include "flgrMorphoBaseFast.h"
00037 #include "flgrMorphoBaseSegment.h"
00038
00039
00040
00055 void flgr1d_minkowski_sub_fgBIT(FLGR_Data1D* datdest, FLGR_Data1D* datsrc, FLGR_Data1D *nhb) {
00056
00057 flgr1d_raster_slide_window_fgBIT(datdest, datsrc, nhb, FLGR_NHB_SYM, flgr1d_get_nhb_minimum_fgBIT);
00058 }
00059 void flgr1d_minkowski_sub_fgUINT8(FLGR_Data1D* datdest, FLGR_Data1D* datsrc, FLGR_Data1D *nhb) {
00060
00061 flgr1d_raster_slide_window_fgUINT8(datdest, datsrc, nhb, FLGR_NHB_SYM, flgr1d_get_nhb_minimum_fgUINT8);
00062 }
00063 void flgr1d_minkowski_sub_fgUINT16(FLGR_Data1D *datdest, FLGR_Data1D *datsrc, FLGR_Data1D *nhb) {
00064
00065 flgr1d_raster_slide_window_fgUINT16(datdest, datsrc, nhb, FLGR_NHB_SYM, flgr1d_get_nhb_minimum_fgUINT16);
00066 }
00067 void flgr1d_minkowski_sub_fgUINT32(FLGR_Data1D *datdest, FLGR_Data1D *datsrc, FLGR_Data1D *nhb) {
00068
00069 flgr1d_raster_slide_window_fgUINT32(datdest, datsrc, nhb, FLGR_NHB_SYM, flgr1d_get_nhb_minimum_fgUINT32);
00070 }
00071 void flgr1d_minkowski_sub_fgINT8(FLGR_Data1D *datdest, FLGR_Data1D *datsrc, FLGR_Data1D *nhb) {
00072
00073 flgr1d_raster_slide_window_fgINT8(datdest, datsrc, nhb, FLGR_NHB_SYM, flgr1d_get_nhb_minimum_fgINT8);
00074 }
00075 void flgr1d_minkowski_sub_fgINT16(FLGR_Data1D *datdest, FLGR_Data1D *datsrc, FLGR_Data1D *nhb) {
00076
00077 flgr1d_raster_slide_window_fgINT16(datdest, datsrc, nhb, FLGR_NHB_SYM, flgr1d_get_nhb_minimum_fgINT16);
00078 }
00079 void flgr1d_minkowski_sub_fgINT32(FLGR_Data1D *datdest, FLGR_Data1D *datsrc, FLGR_Data1D *nhb) {
00080
00081 flgr1d_raster_slide_window_fgINT32(datdest, datsrc, nhb, FLGR_NHB_SYM, flgr1d_get_nhb_minimum_fgINT32);
00082 }
00083 void flgr1d_minkowski_sub_fgFLOAT32(FLGR_Data1D *datdest, FLGR_Data1D *datsrc, FLGR_Data1D *nhb) {
00084
00085 flgr1d_raster_slide_window_fgFLOAT32(datdest, datsrc, nhb, FLGR_NHB_SYM, flgr1d_get_nhb_minimum_fgFLOAT32);
00086 }
00087 void flgr1d_minkowski_sub_fgFLOAT64(FLGR_Data1D *datdest, FLGR_Data1D *datsrc, FLGR_Data1D *nhb) {
00088
00089 flgr1d_raster_slide_window_fgFLOAT64(datdest, datsrc, nhb, FLGR_NHB_SYM, flgr1d_get_nhb_minimum_fgFLOAT64);
00090 }
00092
00098
00099 FLGR_Ret flgr1d_minkowski_sub(FLGR_Data1D *datdest, FLGR_Data1D *datsrc, FLGR_Data1D *nhb) {
00100 FLGR_Ret ret;
00101
00102
00103 if((datdest==NULL) || (datsrc==NULL) || (nhb==NULL)) {
00104 POST_ERROR("Null objects!\n");
00105 return FLGR_RET_NULL_OBJECT;
00106 }
00107
00108 if((ret=flgr1d_is_data_same_attributes(datdest,datsrc,__FUNCTION__))!=FLGR_RET_OK) return ret;
00109 if((ret=flgr1d_is_data_same_type(datdest,nhb))!=FLGR_RET_OK) {
00110 POST_ERROR("data types differents\n");
00111 return ret;
00112 }
00113
00114 if((ret=flgr1d_is_data_same_spp(datdest,nhb))!=FLGR_RET_OK) {
00115 POST_ERROR("spp differents\n");
00116 return ret;
00117 }
00118
00119 FLGR_DISPATCH_PROCEDURE(datdest->type,flgr1d_minkowski_sub,datdest,datsrc,nhb);
00120
00121 }
00122
00123
00124
00125 void flgr1d_minkowski_add_fgBIT(FLGR_Data1D* datdest, FLGR_Data1D* datsrc, FLGR_Data1D *nhb) {
00126
00127 flgr1d_raster_slide_window_fgBIT(datdest, datsrc, nhb, FLGR_NHB_SYM, flgr1d_get_nhb_maximum_fgBIT);
00128 }
00129 void flgr1d_minkowski_add_fgUINT8(FLGR_Data1D* datdest, FLGR_Data1D* datsrc, FLGR_Data1D *nhb) {
00130
00131 flgr1d_raster_slide_window_fgUINT8(datdest, datsrc, nhb, FLGR_NHB_SYM, flgr1d_get_nhb_maximum_fgUINT8);
00132 }
00133 void flgr1d_minkowski_add_fgUINT16(FLGR_Data1D *datdest, FLGR_Data1D *datsrc, FLGR_Data1D *nhb) {
00134
00135 flgr1d_raster_slide_window_fgUINT16(datdest, datsrc, nhb, FLGR_NHB_SYM, flgr1d_get_nhb_maximum_fgUINT16);
00136 }
00137 void flgr1d_minkowski_add_fgUINT32(FLGR_Data1D *datdest, FLGR_Data1D *datsrc, FLGR_Data1D *nhb) {
00138
00139 flgr1d_raster_slide_window_fgUINT32(datdest, datsrc, nhb, FLGR_NHB_SYM, flgr1d_get_nhb_maximum_fgUINT32);
00140 }
00141 void flgr1d_minkowski_add_fgINT8(FLGR_Data1D *datdest, FLGR_Data1D *datsrc, FLGR_Data1D *nhb) {
00142
00143 flgr1d_raster_slide_window_fgINT8(datdest, datsrc, nhb, FLGR_NHB_SYM, flgr1d_get_nhb_maximum_fgINT8);
00144 }
00145 void flgr1d_minkowski_add_fgINT16(FLGR_Data1D *datdest, FLGR_Data1D *datsrc, FLGR_Data1D *nhb) {
00146
00147 flgr1d_raster_slide_window_fgINT16(datdest, datsrc, nhb, FLGR_NHB_SYM, flgr1d_get_nhb_maximum_fgINT16);
00148 }
00149 void flgr1d_minkowski_add_fgINT32(FLGR_Data1D *datdest, FLGR_Data1D *datsrc, FLGR_Data1D *nhb) {
00150
00151 flgr1d_raster_slide_window_fgINT32(datdest, datsrc, nhb, FLGR_NHB_SYM, flgr1d_get_nhb_maximum_fgINT32);
00152 }
00153 void flgr1d_minkowski_add_fgFLOAT32(FLGR_Data1D *datdest, FLGR_Data1D *datsrc, FLGR_Data1D *nhb) {
00154
00155 flgr1d_raster_slide_window_fgFLOAT32(datdest, datsrc, nhb, FLGR_NHB_SYM, flgr1d_get_nhb_maximum_fgFLOAT32);
00156 }
00157 void flgr1d_minkowski_add_fgFLOAT64(FLGR_Data1D *datdest, FLGR_Data1D *datsrc, FLGR_Data1D *nhb) {
00158
00159 flgr1d_raster_slide_window_fgFLOAT64(datdest, datsrc, nhb, FLGR_NHB_SYM, flgr1d_get_nhb_maximum_fgFLOAT64);
00160 }
00162
00168
00169 FLGR_Ret flgr1d_minkowski_add(FLGR_Data1D *datdest, FLGR_Data1D *datsrc, FLGR_Data1D *nhb) {
00170 FLGR_Ret ret;
00171
00172
00173
00174 if((datdest==NULL) || (datsrc==NULL) || (nhb==NULL)) {
00175 POST_ERROR("Null objects!\n");
00176 return FLGR_RET_NULL_OBJECT;
00177 }
00178
00179 if((ret=flgr1d_is_data_same_attributes(datdest,datsrc,__FUNCTION__))!=FLGR_RET_OK) return ret;
00180 if((ret=flgr1d_is_data_same_type(datdest,nhb))!=FLGR_RET_OK) {
00181 POST_ERROR("data types differents\n");
00182 return ret;
00183 }
00184
00185 if((ret=flgr1d_is_data_same_spp(datdest,nhb))!=FLGR_RET_OK) {
00186 POST_ERROR("spp differents\n");
00187 return ret;
00188 }
00189
00190 FLGR_DISPATCH_PROCEDURE(datdest->type,flgr1d_minkowski_add,datdest,datsrc,nhb);
00191
00192 }
00193
00194
00195 void flgr1d_erode_fgBIT(FLGR_Data1D* datdest, FLGR_Data1D* datsrc, FLGR_Data1D *nhb) {
00196
00197 flgr1d_raster_slide_window_fgBIT(datdest, datsrc, nhb, FLGR_NHB_NO_SYM, flgr1d_get_nhb_maximum_fgBIT);
00198 }
00199 void flgr1d_erode_fgUINT8(FLGR_Data1D* datdest, FLGR_Data1D* datsrc, FLGR_Data1D *nhb) {
00200
00201 flgr1d_raster_slide_window_fgUINT8(datdest, datsrc, nhb, FLGR_NHB_NO_SYM, flgr1d_get_nhb_maximum_fgUINT8);
00202 }
00203 void flgr1d_erode_fgUINT16(FLGR_Data1D *datdest, FLGR_Data1D *datsrc, FLGR_Data1D *nhb) {
00204
00205 flgr1d_raster_slide_window_fgUINT16(datdest, datsrc, nhb, FLGR_NHB_NO_SYM, flgr1d_get_nhb_maximum_fgUINT16);
00206 }
00207 void flgr1d_erode_fgUINT32(FLGR_Data1D *datdest, FLGR_Data1D *datsrc, FLGR_Data1D *nhb) {
00208
00209 flgr1d_raster_slide_window_fgUINT32(datdest, datsrc, nhb, FLGR_NHB_NO_SYM, flgr1d_get_nhb_maximum_fgUINT32);
00210 }
00211 void flgr1d_erode_fgINT8(FLGR_Data1D *datdest, FLGR_Data1D *datsrc, FLGR_Data1D *nhb) {
00212
00213 flgr1d_raster_slide_window_fgINT8(datdest, datsrc, nhb, FLGR_NHB_NO_SYM, flgr1d_get_nhb_maximum_fgINT8);
00214 }
00215 void flgr1d_erode_fgINT16(FLGR_Data1D *datdest, FLGR_Data1D *datsrc, FLGR_Data1D *nhb) {
00216
00217 flgr1d_raster_slide_window_fgINT16(datdest, datsrc, nhb, FLGR_NHB_NO_SYM, flgr1d_get_nhb_maximum_fgINT16);
00218 }
00219 void flgr1d_erode_fgINT32(FLGR_Data1D *datdest, FLGR_Data1D *datsrc, FLGR_Data1D *nhb) {
00220
00221 flgr1d_raster_slide_window_fgINT32(datdest, datsrc, nhb, FLGR_NHB_NO_SYM, flgr1d_get_nhb_maximum_fgINT32);
00222 }
00223 void flgr1d_erode_fgFLOAT32(FLGR_Data1D *datdest, FLGR_Data1D *datsrc, FLGR_Data1D *nhb) {
00224
00225 flgr1d_raster_slide_window_fgFLOAT32(datdest, datsrc, nhb, FLGR_NHB_NO_SYM, flgr1d_get_nhb_maximum_fgFLOAT32);
00226 }
00227 void flgr1d_erode_fgFLOAT64(FLGR_Data1D *datdest, FLGR_Data1D *datsrc, FLGR_Data1D *nhb) {
00228
00229 flgr1d_raster_slide_window_fgFLOAT64(datdest, datsrc, nhb, FLGR_NHB_NO_SYM, flgr1d_get_nhb_maximum_fgFLOAT64);
00230 }
00232
00238
00239 FLGR_Ret flgr1d_erode(FLGR_Data1D *datdest, FLGR_Data1D *datsrc, FLGR_Data1D *nhb) {
00240 FLGR_Ret ret;
00241
00242
00243
00244 if((datdest==NULL) || (datsrc==NULL) || (nhb==NULL)) {
00245 POST_ERROR("Null objects!\n");
00246 return FLGR_RET_NULL_OBJECT;
00247 }
00248
00249 if((ret=flgr1d_is_data_same_attributes(datdest,datsrc,__FUNCTION__))!=FLGR_RET_OK) return ret;
00250 if((ret=flgr1d_is_data_same_type(datdest,nhb))!=FLGR_RET_OK) {
00251 POST_ERROR("data types differents\n");
00252 return ret;
00253 }
00254
00255 if((ret=flgr1d_is_data_same_spp(datdest,nhb))!=FLGR_RET_OK) {
00256 POST_ERROR("spp differents\n");
00257 return ret;
00258 }
00259
00260 FLGR_DISPATCH_PROCEDURE(datdest->type,flgr1d_erode,datdest,datsrc,nhb);
00261
00262 }
00263
00264
00265
00266 void flgr1d_dilate_fgBIT(FLGR_Data1D* datdest, FLGR_Data1D* datsrc, FLGR_Data1D *nhb) {
00267
00268 flgr1d_raster_slide_window_fgBIT(datdest, datsrc, nhb, FLGR_NHB_NO_SYM, flgr1d_get_nhb_maximum_fgBIT);
00269 }
00270 void flgr1d_dilate_fgUINT8(FLGR_Data1D* datdest, FLGR_Data1D* datsrc, FLGR_Data1D *nhb) {
00271
00272 flgr1d_raster_slide_window_fgUINT8(datdest, datsrc, nhb, FLGR_NHB_NO_SYM, flgr1d_get_nhb_maximum_fgUINT8);
00273 }
00274 void flgr1d_dilate_fgUINT16(FLGR_Data1D *datdest, FLGR_Data1D *datsrc, FLGR_Data1D *nhb) {
00275
00276 flgr1d_raster_slide_window_fgUINT16(datdest, datsrc, nhb, FLGR_NHB_NO_SYM, flgr1d_get_nhb_maximum_fgUINT16);
00277 }
00278 void flgr1d_dilate_fgUINT32(FLGR_Data1D *datdest, FLGR_Data1D *datsrc, FLGR_Data1D *nhb) {
00279
00280 flgr1d_raster_slide_window_fgUINT32(datdest, datsrc, nhb, FLGR_NHB_NO_SYM, flgr1d_get_nhb_maximum_fgUINT32);
00281 }
00282 void flgr1d_dilate_fgINT8(FLGR_Data1D *datdest, FLGR_Data1D *datsrc, FLGR_Data1D *nhb) {
00283
00284 flgr1d_raster_slide_window_fgINT8(datdest, datsrc, nhb, FLGR_NHB_NO_SYM, flgr1d_get_nhb_maximum_fgINT8);
00285 }
00286 void flgr1d_dilate_fgINT16(FLGR_Data1D *datdest, FLGR_Data1D *datsrc, FLGR_Data1D *nhb) {
00287
00288 flgr1d_raster_slide_window_fgINT16(datdest, datsrc, nhb, FLGR_NHB_NO_SYM, flgr1d_get_nhb_maximum_fgINT16);
00289 }
00290 void flgr1d_dilate_fgINT32(FLGR_Data1D *datdest, FLGR_Data1D *datsrc, FLGR_Data1D *nhb) {
00291
00292 flgr1d_raster_slide_window_fgINT32(datdest, datsrc, nhb, FLGR_NHB_NO_SYM, flgr1d_get_nhb_maximum_fgINT32);
00293 }
00294 void flgr1d_dilate_fgFLOAT32(FLGR_Data1D *datdest, FLGR_Data1D *datsrc, FLGR_Data1D *nhb) {
00295
00296 flgr1d_raster_slide_window_fgFLOAT32(datdest, datsrc, nhb, FLGR_NHB_NO_SYM, flgr1d_get_nhb_maximum_fgFLOAT32);
00297 }
00298 void flgr1d_dilate_fgFLOAT64(FLGR_Data1D *datdest, FLGR_Data1D *datsrc, FLGR_Data1D *nhb) {
00299
00300 flgr1d_raster_slide_window_fgFLOAT64(datdest, datsrc, nhb, FLGR_NHB_NO_SYM, flgr1d_get_nhb_maximum_fgFLOAT64);
00301 }
00303
00309
00310 FLGR_Ret flgr1d_dilate(FLGR_Data1D *datdest, FLGR_Data1D *datsrc, FLGR_Data1D *nhb) {
00311 FLGR_Ret ret;
00312
00313
00314
00315 if((datdest==NULL) || (datsrc==NULL) || (nhb==NULL)) {
00316 POST_ERROR("Null objects!\n");
00317 return FLGR_RET_NULL_OBJECT;
00318 }
00319
00320 if((ret=flgr1d_is_data_same_attributes(datdest,datsrc,__FUNCTION__))!=FLGR_RET_OK) return ret;
00321 if((ret=flgr1d_is_data_same_type(datdest,nhb))!=FLGR_RET_OK) {
00322 POST_ERROR("data types differents\n");
00323 return ret;
00324 }
00325
00326 if((ret=flgr1d_is_data_same_spp(datdest,nhb))!=FLGR_RET_OK) {
00327 POST_ERROR("spp differents\n");
00328 return ret;
00329 }
00330
00331 FLGR_DISPATCH_PROCEDURE(datdest->type,flgr1d_dilate,datdest,datsrc,nhb);
00332
00333 }
00334
00335
00336 void flgr1d_median_fgBIT(FLGR_Data1D* datdest, FLGR_Data1D* datsrc, FLGR_Data1D *nhb) {
00337 flgr_no_define_type_function(FLGR_BIT);
00338 }
00339 void flgr1d_median_fgUINT8(FLGR_Data1D* datdest, FLGR_Data1D* datsrc, FLGR_Data1D *nhb) {
00340
00341 flgr1d_raster_slide_window_fgUINT8(datdest, datsrc, nhb, FLGR_NHB_NO_SYM, flgr1d_get_nhb_median_fgUINT8);
00342 }
00343 void flgr1d_median_fgUINT16(FLGR_Data1D *datdest, FLGR_Data1D *datsrc, FLGR_Data1D *nhb) {
00344
00345 flgr1d_raster_slide_window_fgUINT16(datdest, datsrc, nhb, FLGR_NHB_NO_SYM, flgr1d_get_nhb_median_fgUINT16);
00346 }
00347 void flgr1d_median_fgUINT32(FLGR_Data1D *datdest, FLGR_Data1D *datsrc, FLGR_Data1D *nhb) {
00348
00349 flgr1d_raster_slide_window_fgUINT32(datdest, datsrc, nhb, FLGR_NHB_NO_SYM, flgr1d_get_nhb_median_fgUINT32);
00350 }
00351 void flgr1d_median_fgINT8(FLGR_Data1D *datdest, FLGR_Data1D *datsrc, FLGR_Data1D *nhb) {
00352
00353 flgr1d_raster_slide_window_fgINT8(datdest, datsrc, nhb, FLGR_NHB_NO_SYM, flgr1d_get_nhb_median_fgINT8);
00354 }
00355 void flgr1d_median_fgINT16(FLGR_Data1D *datdest, FLGR_Data1D *datsrc, FLGR_Data1D *nhb) {
00356
00357 flgr1d_raster_slide_window_fgINT16(datdest, datsrc, nhb, FLGR_NHB_NO_SYM, flgr1d_get_nhb_median_fgINT16);
00358 }
00359 void flgr1d_median_fgINT32(FLGR_Data1D *datdest, FLGR_Data1D *datsrc, FLGR_Data1D *nhb) {
00360
00361 flgr1d_raster_slide_window_fgINT32(datdest, datsrc, nhb, FLGR_NHB_NO_SYM, flgr1d_get_nhb_median_fgINT32);
00362 }
00363 void flgr1d_median_fgFLOAT32(FLGR_Data1D *datdest, FLGR_Data1D *datsrc, FLGR_Data1D *nhb) {
00364
00365 flgr1d_raster_slide_window_fgFLOAT32(datdest, datsrc, nhb, FLGR_NHB_NO_SYM, flgr1d_get_nhb_median_fgFLOAT32);
00366 }
00367 void flgr1d_median_fgFLOAT64(FLGR_Data1D *datdest, FLGR_Data1D *datsrc, FLGR_Data1D *nhb) {
00368
00369 flgr1d_raster_slide_window_fgFLOAT64(datdest, datsrc, nhb, FLGR_NHB_NO_SYM, flgr1d_get_nhb_median_fgFLOAT64);
00370 }
00372
00378
00379 FLGR_Ret flgr1d_median(FLGR_Data1D *datdest, FLGR_Data1D *datsrc, FLGR_Data1D *nhb) {
00380 FLGR_Ret ret;
00381
00382
00383
00384 if((datdest==NULL) || (datsrc==NULL) || (nhb==NULL)) {
00385 POST_ERROR("Null objects!\n");
00386 return FLGR_RET_NULL_OBJECT;
00387 }
00388
00389 if((ret=flgr1d_is_data_same_attributes(datdest,datsrc,__FUNCTION__))!=FLGR_RET_OK) return ret;
00390 if((ret=flgr1d_is_data_same_type(datdest,nhb))!=FLGR_RET_OK) {
00391 POST_ERROR("data types differents\n");
00392 return ret;
00393 }
00394
00395 if((ret=flgr1d_is_data_same_spp(datdest,nhb))!=FLGR_RET_OK) {
00396 POST_ERROR("spp differents\n");
00397 return ret;
00398 }
00399
00400 FLGR_DISPATCH_PROCEDURE(datdest->type,flgr1d_median,datdest,datsrc,nhb);
00401
00402 }
00403
00404
00406
00412
00413 FLGR_Ret flgr1d_gradient_inner(FLGR_Data1D *datdest, FLGR_Data1D *datsrc, FLGR_Data1D *nhb) {
00414 FLGR_Data1D *dattmp;
00415 FLGR_Ret val;
00416
00417
00418
00419
00420 if((datdest==NULL) || (datsrc==NULL) || (nhb==NULL)) {
00421 POST_ERROR("Null objects!\n");
00422 return FLGR_RET_NULL_OBJECT;
00423 }
00424
00425 dattmp = flgr1d_create_signal(datsrc->length, datdest->spp, datsrc->type);
00426 if(dattmp==NULL) return FLGR_RET_ALLOCATION_ERROR;
00427
00428 if((val=flgr1d_erode(dattmp, datsrc, nhb))!=0) return val;
00429 if((val=flgr1d_arith_sub(datdest,datsrc,dattmp))!=0) return val;
00430
00431 flgr1d_destroy(dattmp);
00432
00433 return val;
00434 }
00435
00437
00443
00444 FLGR_Ret flgr1d_gradient_outer(FLGR_Data1D *datdest, FLGR_Data1D *datsrc, FLGR_Data1D *nhb) {
00445 FLGR_Data1D *dattmp;
00446 FLGR_Ret val;
00447
00448
00449
00450
00451 if((datdest==NULL) || (datsrc==NULL) || (nhb==NULL)) {
00452 POST_ERROR("Null objects!\n");
00453 return FLGR_RET_NULL_OBJECT;
00454 }
00455
00456 dattmp=flgr1d_create_signal(datsrc->length, datdest->spp, datsrc->type);
00457 if(dattmp==NULL) return FLGR_RET_ALLOCATION_ERROR;
00458
00459 if((val=flgr1d_dilate(dattmp, datsrc, nhb))!=0) return val;
00460 if((val=flgr1d_arith_sub(datdest,dattmp,datsrc))!=0) return val;
00461
00462 flgr1d_destroy(dattmp);
00463
00464 return val;
00465 }
00466
00468
00474
00475 FLGR_Ret flgr1d_gradient_thick(FLGR_Data1D *datdest, FLGR_Data1D *datsrc, FLGR_Data1D *nhb) {
00476 FLGR_Data1D *dattmpE,*dattmpD;
00477 FLGR_Ret val;
00478
00479
00480
00481 if((datdest==NULL) || (datsrc==NULL) || (nhb==NULL)) {
00482 POST_ERROR("Null objects!\n");
00483 return FLGR_RET_NULL_OBJECT;
00484 }
00485
00486 dattmpE = flgr1d_create_signal(datsrc->length, datdest->spp, datsrc->type);
00487 dattmpD = flgr1d_create_signal(datsrc->length, datdest->spp, datsrc->type);
00488 if(dattmpE==NULL) return FLGR_RET_ALLOCATION_ERROR;
00489 if(dattmpD==NULL) return FLGR_RET_ALLOCATION_ERROR;
00490
00491 if((val=flgr1d_erode(dattmpE, datsrc, nhb))!=0) return val;
00492 if((val=flgr1d_dilate(dattmpD, datsrc, nhb))!=0) return val;
00493 if((val=flgr1d_arith_sub(datdest,dattmpD,dattmpE))!=0) return val;
00494
00495 flgr1d_destroy(dattmpE);
00496 flgr1d_destroy(dattmpD);
00497
00498 return val;
00499 }
00500
00502
00508
00509 FLGR_Ret flgr1d_open(FLGR_Data1D *datdest, FLGR_Data1D *datsrc, FLGR_Data1D *nhb) {
00510 FLGR_Data1D *dattmp;
00511 FLGR_Ret val;
00512
00513
00514
00515 if((datdest==NULL) || (datsrc==NULL) || (nhb==NULL)) {
00516 POST_ERROR("Null objects!\n");
00517 return FLGR_RET_NULL_OBJECT;
00518 }
00519
00520 dattmp = flgr1d_create_signal(datsrc->length, datdest->spp, datsrc->type);
00521 if(dattmp==NULL) return FLGR_RET_ALLOCATION_ERROR;
00522
00523 if((val=flgr1d_erode(dattmp, datsrc, nhb))!=0) {
00524 flgr1d_destroy(dattmp);
00525 return val;
00526 }
00527
00528 val=flgr1d_minkowski_add(datdest,dattmp,nhb);
00529
00530 flgr1d_destroy(dattmp);
00531
00532 return val;
00533 }
00534
00536
00542
00543 FLGR_Ret flgr1d_close(FLGR_Data1D *datdest, FLGR_Data1D *datsrc, FLGR_Data1D *nhb) {
00544 FLGR_Data1D *dattmp;
00545 FLGR_Ret val;
00546
00547
00548
00549 if((datdest==NULL) || (datsrc==NULL) || (nhb==NULL)) {
00550 POST_ERROR("Null objects!\n");
00551 return FLGR_RET_NULL_OBJECT;
00552 }
00553
00554 dattmp = flgr1d_create_signal(datsrc->length, datdest->spp, datsrc->type);
00555 if(dattmp==NULL) return FLGR_RET_ALLOCATION_ERROR;
00556
00557 if((val=flgr1d_dilate(dattmp, datsrc, nhb))!=0) {
00558 flgr1d_destroy(dattmp);
00559 return val;
00560 }
00561
00562 val=flgr1d_minkowski_sub(datdest,dattmp,nhb);
00563
00564 flgr1d_destroy(dattmp);
00565
00566 return val;
00567 }
00568
00570
00576
00577 FLGR_Ret flgr1d_open_tophat(FLGR_Data1D *datdest, FLGR_Data1D *datsrc, FLGR_Data1D *nhb) {
00578 FLGR_Ret val;
00579
00580
00581
00582 if((datdest==NULL) || (datsrc==NULL) || (nhb==NULL)) {
00583 POST_ERROR("Null objects!\n");
00584 return FLGR_RET_NULL_OBJECT;
00585 }
00586
00587 if((val=flgr1d_open(datdest, datsrc, nhb))!=0) return val;
00588
00589 val=flgr1d_arith_sub(datdest,datsrc,datdest);
00590
00591 return val;
00592 }
00593
00595
00601
00602 FLGR_Ret flgr1d_close_tophat(FLGR_Data1D *datdest, FLGR_Data1D *datsrc, FLGR_Data1D *nhb) {
00603 FLGR_Ret val;
00604
00605
00606
00607 if((datdest==NULL) || (datsrc==NULL) || (nhb==NULL)) {
00608 POST_ERROR("Null objects!\n");
00609 return FLGR_RET_NULL_OBJECT;
00610 }
00611
00612 if((val=flgr1d_close(datdest,datsrc,nhb))!=0) return val;
00613
00614 val=flgr1d_arith_sub(datdest,datdest,datsrc);
00615
00616 return val;
00617 }
00618
00619
00620
00621
00622
00623
00624 void flgr2d_minkowski_sub_fgBIT(FLGR_Data2D* datdest, FLGR_Data2D* datsrc, FLGR_Data2D *nhb) {
00625 FLGR_MorphoOptim flag;
00626
00627
00628
00629 flag = flgr2d_get_optimization_available(datdest, datsrc, nhb);
00630
00631 switch(flag) {
00632 case FLGR_MORPHO_OPTIM_SQUARE:
00633 flgr2d_erode_square_fgBIT(datdest,datsrc,nhb->size_x/2);
00634 break;
00635 case FLGR_MORPHO_OPTIM_CROSS:
00636 flgr2d_erode_cross_fgBIT(datdest,datsrc,1);
00637 break;
00638 case FLGR_MORPHO_OPTIM_HEXAGON:
00639 flgr2d_erode_hexa_fgBIT(datdest,datsrc,nhb->size_x/2);
00640 break;
00641 case FLGR_MORPHO_OPTIM_OCTAGON:
00642 flgr2d_erode_octagon_fgBIT(datdest,datsrc,nhb->size_x/2);
00643 break;
00644 case FLGR_MORPHO_OPTIM_DIAMOND:
00645 flgr2d_erode_cross_fgBIT(datdest,datsrc,nhb->size_x/2);
00646 break;
00647 default:
00648 flgr2d_raster_slide_window_fgBIT(datdest, datsrc, nhb, FLGR_NHB_SYM, flgr2d_get_nhb_minimum_fgBIT);
00649 }
00650 }
00651
00652 void flgr2d_minkowski_sub_fgUINT8(FLGR_Data2D* datdest, FLGR_Data2D* datsrc, FLGR_Data2D *nhb) {
00653 FLGR_MorphoOptim flag;
00654
00655
00656
00657 flag = flgr2d_get_optimization_available(datdest, datsrc, nhb);
00658
00659 switch(flag) {
00660 case FLGR_MORPHO_OPTIM_SQUARE:
00661 flgr2d_erode_square_fgUINT8(datdest,datsrc,nhb->size_x/2);
00662 break;
00663 case FLGR_MORPHO_OPTIM_CROSS:
00664 flgr2d_erode_cross_fgUINT8(datdest,datsrc,1);
00665 break;
00666 case FLGR_MORPHO_OPTIM_HEXAGON:
00667 flgr2d_erode_hexa_fgUINT8(datdest,datsrc,nhb->size_x/2);
00668 break;
00669 case FLGR_MORPHO_OPTIM_RECTANGLE:
00670 flgr2d_erode_rectangle_fgUINT8(datdest,datsrc,nhb->size_x,nhb->size_y);
00671 break;
00672 case FLGR_MORPHO_OPTIM_OCTAGON:
00673 flgr2d_erode_octagon_fgUINT8(datdest,datsrc,nhb->size_x/2);
00674 break;
00675 case FLGR_MORPHO_OPTIM_DIAMOND:
00676 flgr2d_erode_cross_fgUINT8(datdest,datsrc,nhb->size_x/2);
00677 break;
00678 default:
00679 flgr2d_raster_slide_window_fgUINT8(datdest, datsrc, nhb, FLGR_NHB_SYM, flgr2d_get_nhb_minimum_fgUINT8);
00680 }
00681
00682 }
00683
00684 void flgr2d_minkowski_sub_fgUINT16(FLGR_Data2D *datdest, FLGR_Data2D *datsrc, FLGR_Data2D *nhb) {
00685 FLGR_MorphoOptim flag;
00686
00687
00688
00689 flag = flgr2d_get_optimization_available(datdest, datsrc, nhb);
00690
00691 switch(flag) {
00692 case FLGR_MORPHO_OPTIM_SQUARE:
00693 flgr2d_erode_square_fgUINT16(datdest,datsrc,nhb->size_x/2);
00694 break;
00695 case FLGR_MORPHO_OPTIM_CROSS:
00696 flgr2d_erode_cross_fgUINT16(datdest,datsrc,1);
00697 break;
00698 case FLGR_MORPHO_OPTIM_HEXAGON:
00699 flgr2d_erode_hexa_fgUINT16(datdest,datsrc,nhb->size_x/2);
00700 break;
00701 case FLGR_MORPHO_OPTIM_RECTANGLE:
00702 flgr2d_erode_rectangle_fgUINT16(datdest,datsrc,nhb->size_x,nhb->size_y);
00703 break;
00704 case FLGR_MORPHO_OPTIM_OCTAGON:
00705 flgr2d_erode_octagon_fgUINT16(datdest,datsrc,nhb->size_x/2);
00706 break;
00707 case FLGR_MORPHO_OPTIM_DIAMOND:
00708 flgr2d_erode_cross_fgUINT16(datdest,datsrc,nhb->size_x/2);
00709 break;
00710 default:
00711 flgr2d_raster_slide_window_fgUINT16(datdest, datsrc, nhb, FLGR_NHB_SYM, flgr2d_get_nhb_minimum_fgUINT16);
00712 }
00713
00714 }
00715 void flgr2d_minkowski_sub_fgUINT32(FLGR_Data2D *datdest, FLGR_Data2D *datsrc, FLGR_Data2D *nhb) {
00716 FLGR_MorphoOptim flag;
00717
00718
00719
00720 flag = flgr2d_get_optimization_available(datdest, datsrc, nhb);
00721
00722 switch(flag) {
00723 case FLGR_MORPHO_OPTIM_SQUARE:
00724 flgr2d_erode_square_fgUINT32(datdest,datsrc,nhb->size_x/2);
00725 break;
00726 case FLGR_MORPHO_OPTIM_CROSS:
00727 flgr2d_erode_cross_fgUINT32(datdest,datsrc,1);
00728 break;
00729 case FLGR_MORPHO_OPTIM_HEXAGON:
00730 flgr2d_erode_hexa_fgUINT32(datdest,datsrc,nhb->size_x/2);
00731 break;
00732 case FLGR_MORPHO_OPTIM_RECTANGLE:
00733 flgr2d_erode_rectangle_fgUINT32(datdest,datsrc,nhb->size_x,nhb->size_y);
00734 break;
00735 case FLGR_MORPHO_OPTIM_OCTAGON:
00736 flgr2d_erode_octagon_fgUINT32(datdest,datsrc,nhb->size_x/2);
00737 break;
00738 case FLGR_MORPHO_OPTIM_DIAMOND:
00739 flgr2d_erode_cross_fgUINT32(datdest,datsrc,nhb->size_x/2);
00740 break;
00741 default:
00742 flgr2d_raster_slide_window_fgUINT32(datdest, datsrc, nhb, FLGR_NHB_SYM, flgr2d_get_nhb_minimum_fgUINT32);
00743 }
00744
00745 }
00746 void flgr2d_minkowski_sub_fgINT8(FLGR_Data2D *datdest, FLGR_Data2D *datsrc, FLGR_Data2D *nhb) {
00747 FLGR_MorphoOptim flag;
00748
00749
00750
00751 flag = flgr2d_get_optimization_available(datdest, datsrc, nhb);
00752
00753 switch(flag) {
00754 case FLGR_MORPHO_OPTIM_SQUARE:
00755 flgr2d_erode_square_fgINT8(datdest,datsrc,nhb->size_x/2);
00756 break;
00757 case FLGR_MORPHO_OPTIM_CROSS:
00758 flgr2d_erode_cross_fgINT8(datdest,datsrc,1);
00759 break;
00760 case FLGR_MORPHO_OPTIM_HEXAGON:
00761 flgr2d_erode_hexa_fgINT8(datdest,datsrc,nhb->size_x/2);
00762 break;
00763 case FLGR_MORPHO_OPTIM_RECTANGLE:
00764 flgr2d_erode_rectangle_fgINT8(datdest,datsrc,nhb->size_x,nhb->size_y);
00765 break;
00766 case FLGR_MORPHO_OPTIM_OCTAGON:
00767 flgr2d_erode_octagon_fgINT8(datdest,datsrc,nhb->size_x/2);
00768 break;
00769 case FLGR_MORPHO_OPTIM_DIAMOND:
00770 flgr2d_erode_cross_fgINT8(datdest,datsrc,nhb->size_x/2);
00771 break;
00772 default:
00773 flgr2d_raster_slide_window_fgINT8(datdest, datsrc, nhb, FLGR_NHB_SYM, flgr2d_get_nhb_minimum_fgINT8);
00774 }
00775
00776 }
00777 void flgr2d_minkowski_sub_fgINT16(FLGR_Data2D *datdest, FLGR_Data2D *datsrc, FLGR_Data2D *nhb) {
00778 FLGR_MorphoOptim flag;
00779
00780
00781
00782 flag = flgr2d_get_optimization_available(datdest, datsrc, nhb);
00783
00784 switch(flag) {
00785 case FLGR_MORPHO_OPTIM_SQUARE:
00786 flgr2d_erode_square_fgINT16(datdest,datsrc,nhb->size_x/2);
00787 break;
00788 case FLGR_MORPHO_OPTIM_CROSS:
00789 flgr2d_erode_cross_fgINT16(datdest,datsrc,1);
00790 break;
00791 case FLGR_MORPHO_OPTIM_HEXAGON:
00792 flgr2d_erode_hexa_fgINT16(datdest,datsrc,nhb->size_x/2);
00793 break;
00794 case FLGR_MORPHO_OPTIM_RECTANGLE:
00795 flgr2d_erode_rectangle_fgINT16(datdest,datsrc,nhb->size_x,nhb->size_y);
00796 break;
00797 case FLGR_MORPHO_OPTIM_OCTAGON:
00798 flgr2d_erode_octagon_fgINT16(datdest,datsrc,nhb->size_x/2);
00799 break;
00800 case FLGR_MORPHO_OPTIM_DIAMOND:
00801 flgr2d_erode_cross_fgINT16(datdest,datsrc,nhb->size_x/2);
00802 break;
00803 default:
00804 flgr2d_raster_slide_window_fgINT16(datdest, datsrc, nhb, FLGR_NHB_SYM, flgr2d_get_nhb_minimum_fgINT16);
00805 }
00806
00807 }
00808 void flgr2d_minkowski_sub_fgINT32(FLGR_Data2D *datdest, FLGR_Data2D *datsrc, FLGR_Data2D *nhb) {
00809 FLGR_MorphoOptim flag;
00810
00811
00812
00813 flag = flgr2d_get_optimization_available(datdest, datsrc, nhb);
00814
00815 switch(flag) {
00816 case FLGR_MORPHO_OPTIM_SQUARE:
00817 flgr2d_erode_square_fgINT32(datdest,datsrc,nhb->size_x/2);
00818 break;
00819 case FLGR_MORPHO_OPTIM_CROSS:
00820 flgr2d_erode_cross_fgINT32(datdest,datsrc,1);
00821 break;
00822 case FLGR_MORPHO_OPTIM_HEXAGON:
00823 flgr2d_erode_hexa_fgINT32(datdest,datsrc,nhb->size_x/2);
00824 break;
00825 case FLGR_MORPHO_OPTIM_RECTANGLE:
00826 flgr2d_erode_rectangle_fgINT32(datdest,datsrc,nhb->size_x,nhb->size_y);
00827 break;
00828 case FLGR_MORPHO_OPTIM_OCTAGON:
00829 flgr2d_erode_octagon_fgINT32(datdest,datsrc,nhb->size_x/2);
00830 break;
00831 case FLGR_MORPHO_OPTIM_DIAMOND:
00832 flgr2d_erode_cross_fgINT32(datdest,datsrc,nhb->size_x/2);
00833 break;
00834 default:
00835 flgr2d_raster_slide_window_fgINT32(datdest, datsrc, nhb, FLGR_NHB_SYM, flgr2d_get_nhb_minimum_fgINT32);
00836 }
00837
00838 }
00839 void flgr2d_minkowski_sub_fgFLOAT32(FLGR_Data2D *datdest, FLGR_Data2D *datsrc, FLGR_Data2D *nhb) {
00840 FLGR_MorphoOptim flag;
00841
00842
00843
00844 flag = flgr2d_get_optimization_available(datdest, datsrc, nhb);
00845
00846 switch(flag) {
00847 case FLGR_MORPHO_OPTIM_SQUARE:
00848 flgr2d_erode_square_fgFLOAT32(datdest,datsrc,nhb->size_x/2);
00849 break;
00850 case FLGR_MORPHO_OPTIM_CROSS:
00851 flgr2d_erode_cross_fgFLOAT32(datdest,datsrc,1);
00852 break;
00853 case FLGR_MORPHO_OPTIM_HEXAGON:
00854 flgr2d_erode_hexa_fgFLOAT32(datdest,datsrc,nhb->size_x/2);
00855 break;
00856 case FLGR_MORPHO_OPTIM_RECTANGLE:
00857 flgr2d_erode_rectangle_fgFLOAT32(datdest,datsrc,nhb->size_x,nhb->size_y);
00858 break;
00859 case FLGR_MORPHO_OPTIM_OCTAGON:
00860 flgr2d_erode_octagon_fgFLOAT32(datdest,datsrc,nhb->size_x/2);
00861 break;
00862 case FLGR_MORPHO_OPTIM_DIAMOND:
00863 flgr2d_erode_cross_fgFLOAT32(datdest,datsrc,nhb->size_x/2);
00864 break;
00865 default:
00866 flgr2d_raster_slide_window_fgFLOAT32(datdest, datsrc, nhb, FLGR_NHB_SYM, flgr2d_get_nhb_minimum_fgFLOAT32);
00867 }
00868
00869 }
00870 void flgr2d_minkowski_sub_fgFLOAT64(FLGR_Data2D *datdest, FLGR_Data2D *datsrc, FLGR_Data2D *nhb) {
00871 FLGR_MorphoOptim flag;
00872
00873
00874
00875 flag = flgr2d_get_optimization_available(datdest, datsrc, nhb);
00876
00877 switch(flag) {
00878 case FLGR_MORPHO_OPTIM_SQUARE:
00879 flgr2d_erode_square_fgFLOAT64(datdest,datsrc,nhb->size_x/2);
00880 break;
00881 case FLGR_MORPHO_OPTIM_CROSS:
00882 flgr2d_erode_cross_fgFLOAT64(datdest,datsrc,1);
00883 break;
00884 case FLGR_MORPHO_OPTIM_HEXAGON:
00885 flgr2d_erode_hexa_fgFLOAT64(datdest,datsrc,nhb->size_x/2);
00886 break;
00887 case FLGR_MORPHO_OPTIM_RECTANGLE:
00888 flgr2d_erode_rectangle_fgFLOAT64(datdest,datsrc,nhb->size_x,nhb->size_y);
00889 break;
00890 case FLGR_MORPHO_OPTIM_OCTAGON:
00891 flgr2d_erode_octagon_fgFLOAT64(datdest,datsrc,nhb->size_x/2);
00892 break;
00893 case FLGR_MORPHO_OPTIM_DIAMOND:
00894 flgr2d_erode_cross_fgFLOAT64(datdest,datsrc,nhb->size_x/2);
00895 break;
00896 default:
00897 flgr2d_raster_slide_window_fgFLOAT64(datdest, datsrc, nhb, FLGR_NHB_SYM, flgr2d_get_nhb_minimum_fgFLOAT64);
00898 }
00899
00900 }
00901
00902
00904
00910
00911 FLGR_Ret flgr2d_minkowski_sub(FLGR_Data2D *datdest, FLGR_Data2D *datsrc, FLGR_Data2D *nhb) {
00912 FLGR_Ret ret;
00913
00914
00915
00916 if((datdest==NULL) || (datsrc==NULL) || (nhb==NULL)) {
00917 POST_ERROR("Null objects!\n");
00918 return FLGR_RET_NULL_OBJECT;
00919 }
00920
00921 if((ret=flgr2d_is_data_same_attributes(datdest,datsrc,__FUNCTION__))!=FLGR_RET_OK) return ret;
00922 if((ret=flgr2d_is_data_same_type(datdest,nhb))!=FLGR_RET_OK) {
00923 POST_ERROR("data types differents\n");
00924 return ret;
00925 }
00926
00927 if((ret=flgr2d_is_data_same_spp(datdest,nhb))!=FLGR_RET_OK) {
00928 POST_ERROR("spp differents\n");
00929 return ret;
00930 }
00931
00932 FLGR_DISPATCH_PROCEDURE(datdest->type,flgr2d_minkowski_sub,datdest,datsrc,nhb);
00933
00934 }
00935
00936
00937
00938
00939
00940
00941
00942
00943
00944
00945
00946
00947
00948
00949
00950
00951
00952 void flgr2d_minkowski_add_fgBIT(FLGR_Data2D *datdest, FLGR_Data2D *datsrc, FLGR_Data2D *nhb) {
00953 FLGR_MorphoOptim flag;
00954
00955
00956
00957 flag = flgr2d_get_optimization_available(datdest, datsrc, nhb);
00958
00959 switch(flag) {
00960 case FLGR_MORPHO_OPTIM_SQUARE:
00961 flgr2d_dilate_square_fgBIT(datdest,datsrc,nhb->size_x/2);
00962 break;
00963 case FLGR_MORPHO_OPTIM_CROSS:
00964 flgr2d_dilate_cross_fgBIT(datdest,datsrc,1);
00965 break;
00966 case FLGR_MORPHO_OPTIM_HEXAGON:
00967 flgr2d_dilate_hexa_fgBIT(datdest,datsrc,nhb->size_x/2);
00968 break;
00969 case FLGR_MORPHO_OPTIM_OCTAGON:
00970 flgr2d_dilate_octagon_fgBIT(datdest,datsrc,nhb->size_x/2);
00971 break;
00972 case FLGR_MORPHO_OPTIM_DIAMOND:
00973 flgr2d_dilate_cross_fgBIT(datdest,datsrc,nhb->size_x/2);
00974 break;
00975 default:
00976 flgr2d_raster_slide_window_fgBIT(datdest, datsrc, nhb, FLGR_NHB_SYM, flgr2d_get_nhb_maximum_fgBIT);
00977 }
00978 }
00979 void flgr2d_minkowski_add_fgUINT8(FLGR_Data2D *datdest, FLGR_Data2D *datsrc, FLGR_Data2D *nhb) {
00980 FLGR_MorphoOptim flag;
00981
00982
00983
00984 flag = flgr2d_get_optimization_available(datdest, datsrc, nhb);
00985
00986 switch(flag) {
00987 case FLGR_MORPHO_OPTIM_SQUARE:
00988 flgr2d_dilate_square_fgUINT8(datdest,datsrc,nhb->size_x/2);
00989 break;
00990 case FLGR_MORPHO_OPTIM_CROSS:
00991 flgr2d_dilate_cross_fgUINT8(datdest,datsrc,1);
00992 break;
00993 case FLGR_MORPHO_OPTIM_HEXAGON:
00994 flgr2d_dilate_hexa_fgUINT8(datdest,datsrc,nhb->size_x/2);
00995 break;
00996 case FLGR_MORPHO_OPTIM_RECTANGLE:
00997 flgr2d_dilate_rectangle_fgUINT8(datdest,datsrc,nhb->size_x,nhb->size_y);
00998 break;
00999 case FLGR_MORPHO_OPTIM_OCTAGON:
01000 flgr2d_dilate_octagon_fgUINT8(datdest,datsrc,nhb->size_x/2);
01001 break;
01002 case FLGR_MORPHO_OPTIM_DIAMOND:
01003 flgr2d_dilate_cross_fgUINT8(datdest,datsrc,nhb->size_x/2);
01004 break;
01005 default:
01006 flgr2d_raster_slide_window_fgUINT8(datdest, datsrc, nhb, FLGR_NHB_SYM, flgr2d_get_nhb_maximum_fgUINT8);
01007 }
01008
01009 }
01010 void flgr2d_minkowski_add_fgUINT16(FLGR_Data2D *datdest, FLGR_Data2D *datsrc, FLGR_Data2D *nhb) {
01011 FLGR_MorphoOptim flag;
01012
01013
01014
01015 flag = flgr2d_get_optimization_available(datdest, datsrc, nhb);
01016
01017 switch(flag) {
01018 case FLGR_MORPHO_OPTIM_SQUARE:
01019 flgr2d_dilate_square_fgUINT16(datdest,datsrc,nhb->size_x/2);
01020 break;
01021 case FLGR_MORPHO_OPTIM_CROSS:
01022 flgr2d_dilate_cross_fgUINT16(datdest,datsrc,1);
01023 break;
01024 case FLGR_MORPHO_OPTIM_HEXAGON:
01025 flgr2d_dilate_hexa_fgUINT16(datdest,datsrc,nhb->size_x/2);
01026 break;
01027 case FLGR_MORPHO_OPTIM_RECTANGLE:
01028 flgr2d_dilate_rectangle_fgUINT16(datdest,datsrc,nhb->size_x,nhb->size_y);
01029 break;
01030 case FLGR_MORPHO_OPTIM_OCTAGON:
01031 flgr2d_dilate_octagon_fgUINT16(datdest,datsrc,nhb->size_x/2);
01032 break;
01033 case FLGR_MORPHO_OPTIM_DIAMOND:
01034 flgr2d_dilate_cross_fgUINT16(datdest,datsrc,nhb->size_x/2);
01035 break;
01036 default:
01037 flgr2d_raster_slide_window_fgUINT16(datdest, datsrc, nhb, FLGR_NHB_SYM, flgr2d_get_nhb_maximum_fgUINT16);
01038 }
01039
01040 }
01041 void flgr2d_minkowski_add_fgUINT32(FLGR_Data2D *datdest, FLGR_Data2D *datsrc, FLGR_Data2D *nhb) {
01042 FLGR_MorphoOptim flag;
01043
01044
01045
01046 flag = flgr2d_get_optimization_available(datdest, datsrc, nhb);
01047
01048 switch(flag) {
01049 case FLGR_MORPHO_OPTIM_SQUARE:
01050 flgr2d_dilate_square_fgUINT32(datdest,datsrc,nhb->size_x/2);
01051 break;
01052 case FLGR_MORPHO_OPTIM_CROSS:
01053 flgr2d_dilate_cross_fgUINT32(datdest,datsrc,1);
01054 break;
01055 case FLGR_MORPHO_OPTIM_HEXAGON:
01056 flgr2d_dilate_hexa_fgUINT32(datdest,datsrc,nhb->size_x/2);
01057 break;
01058 case FLGR_MORPHO_OPTIM_RECTANGLE:
01059 flgr2d_dilate_rectangle_fgUINT32(datdest,datsrc,nhb->size_x,nhb->size_y);
01060 break;
01061 case FLGR_MORPHO_OPTIM_OCTAGON:
01062 flgr2d_dilate_octagon_fgUINT32(datdest,datsrc,nhb->size_x/2);
01063 break;
01064 case FLGR_MORPHO_OPTIM_DIAMOND:
01065 flgr2d_dilate_cross_fgUINT32(datdest,datsrc,nhb->size_x/2);
01066 break;
01067 default:
01068 flgr2d_raster_slide_window_fgUINT32(datdest, datsrc, nhb, FLGR_NHB_SYM, flgr2d_get_nhb_maximum_fgUINT32);
01069 }
01070
01071 }
01072 void flgr2d_minkowski_add_fgINT8(FLGR_Data2D *datdest, FLGR_Data2D *datsrc, FLGR_Data2D *nhb) {
01073 FLGR_MorphoOptim flag;
01074
01075
01076
01077 flag = flgr2d_get_optimization_available(datdest, datsrc, nhb);
01078
01079 switch(flag) {
01080 case FLGR_MORPHO_OPTIM_SQUARE:
01081 flgr2d_dilate_square_fgINT8(datdest,datsrc,nhb->size_x/2);
01082 break;
01083 case FLGR_MORPHO_OPTIM_CROSS:
01084 flgr2d_dilate_cross_fgINT8(datdest,datsrc,1);
01085 break;
01086 case FLGR_MORPHO_OPTIM_HEXAGON:
01087 flgr2d_dilate_hexa_fgINT8(datdest,datsrc,nhb->size_x/2);
01088 break;
01089 case FLGR_MORPHO_OPTIM_RECTANGLE:
01090 flgr2d_dilate_rectangle_fgINT8(datdest,datsrc,nhb->size_x,nhb->size_y);
01091 break;
01092 case FLGR_MORPHO_OPTIM_OCTAGON:
01093 flgr2d_dilate_octagon_fgINT8(datdest,datsrc,nhb->size_x/2);
01094 break;
01095 case FLGR_MORPHO_OPTIM_DIAMOND:
01096 flgr2d_dilate_cross_fgINT8(datdest,datsrc,nhb->size_x/2);
01097 break;
01098 default:
01099 flgr2d_raster_slide_window_fgINT8(datdest, datsrc, nhb, FLGR_NHB_SYM, flgr2d_get_nhb_maximum_fgINT8);
01100 }
01101
01102 }
01103 void flgr2d_minkowski_add_fgINT16(FLGR_Data2D *datdest, FLGR_Data2D *datsrc, FLGR_Data2D *nhb) {
01104 FLGR_MorphoOptim flag;
01105
01106
01107
01108 flag = flgr2d_get_optimization_available(datdest, datsrc, nhb);
01109
01110 switch(flag) {
01111 case FLGR_MORPHO_OPTIM_SQUARE:
01112 flgr2d_dilate_square_fgINT16(datdest,datsrc,nhb->size_x/2);
01113 break;
01114 case FLGR_MORPHO_OPTIM_CROSS:
01115 flgr2d_dilate_cross_fgINT16(datdest,datsrc,1);
01116 break;
01117 case FLGR_MORPHO_OPTIM_HEXAGON:
01118 flgr2d_dilate_hexa_fgINT16(datdest,datsrc,nhb->size_x/2);
01119 break;
01120 case FLGR_MORPHO_OPTIM_RECTANGLE:
01121 flgr2d_dilate_rectangle_fgINT16(datdest,datsrc,nhb->size_x,nhb->size_y);
01122 break;
01123 case FLGR_MORPHO_OPTIM_OCTAGON:
01124 flgr2d_dilate_octagon_fgINT16(datdest,datsrc,nhb->size_x/2);
01125 break;
01126 case FLGR_MORPHO_OPTIM_DIAMOND:
01127 flgr2d_dilate_cross_fgINT16(datdest,datsrc,nhb->size_x/2);
01128 break;
01129 default:
01130 flgr2d_raster_slide_window_fgINT16(datdest, datsrc, nhb, FLGR_NHB_SYM, flgr2d_get_nhb_maximum_fgINT16);
01131 }
01132
01133 }
01134 void flgr2d_minkowski_add_fgINT32(FLGR_Data2D *datdest, FLGR_Data2D *datsrc, FLGR_Data2D *nhb) {
01135 FLGR_MorphoOptim flag;
01136
01137
01138
01139 flag = flgr2d_get_optimization_available(datdest, datsrc, nhb);
01140
01141 switch(flag) {
01142 case FLGR_MORPHO_OPTIM_SQUARE:
01143 flgr2d_dilate_square_fgINT32(datdest,datsrc,nhb->size_x/2);
01144 break;
01145 case FLGR_MORPHO_OPTIM_CROSS:
01146 flgr2d_dilate_cross_fgINT32(datdest,datsrc,1);
01147 break;
01148 case FLGR_MORPHO_OPTIM_HEXAGON:
01149 flgr2d_dilate_hexa_fgINT32(datdest,datsrc,nhb->size_x/2);
01150 break;
01151 case FLGR_MORPHO_OPTIM_RECTANGLE:
01152 flgr2d_dilate_rectangle_fgINT32(datdest,datsrc,nhb->size_x,nhb->size_y);
01153 break;
01154 case FLGR_MORPHO_OPTIM_OCTAGON:
01155 flgr2d_dilate_octagon_fgINT32(datdest,datsrc,nhb->size_x/2);
01156 break;
01157 case FLGR_MORPHO_OPTIM_DIAMOND:
01158 flgr2d_dilate_cross_fgINT32(datdest,datsrc,nhb->size_x/2);
01159 break;
01160 default:
01161 flgr2d_raster_slide_window_fgINT32(datdest, datsrc, nhb, FLGR_NHB_SYM, flgr2d_get_nhb_maximum_fgINT32);
01162 }
01163
01164 }
01165 void flgr2d_minkowski_add_fgFLOAT32(FLGR_Data2D *datdest, FLGR_Data2D *datsrc, FLGR_Data2D *nhb) {
01166 FLGR_MorphoOptim flag;
01167
01168
01169
01170 flag = flgr2d_get_optimization_available(datdest, datsrc, nhb);
01171
01172 switch(flag) {
01173 case FLGR_MORPHO_OPTIM_SQUARE:
01174 flgr2d_dilate_square_fgFLOAT32(datdest,datsrc,nhb->size_x/2);
01175 break;
01176 case FLGR_MORPHO_OPTIM_CROSS:
01177 flgr2d_dilate_cross_fgFLOAT32(datdest,datsrc,1);
01178 break;
01179 case FLGR_MORPHO_OPTIM_HEXAGON:
01180 flgr2d_dilate_hexa_fgFLOAT32(datdest,datsrc,nhb->size_x/2);
01181 break;
01182 case FLGR_MORPHO_OPTIM_RECTANGLE:
01183 flgr2d_dilate_rectangle_fgFLOAT32(datdest,datsrc,nhb->size_x,nhb->size_y);
01184 break;
01185 case FLGR_MORPHO_OPTIM_OCTAGON:
01186 flgr2d_dilate_octagon_fgFLOAT32(datdest,datsrc,nhb->size_x/2);
01187 break;
01188 case FLGR_MORPHO_OPTIM_DIAMOND:
01189 flgr2d_dilate_cross_fgFLOAT32(datdest,datsrc,nhb->size_x/2);
01190 break;
01191 default:
01192 flgr2d_raster_slide_window_fgFLOAT32(datdest, datsrc, nhb, FLGR_NHB_SYM, flgr2d_get_nhb_maximum_fgFLOAT32);
01193 }
01194
01195 }
01196 void flgr2d_minkowski_add_fgFLOAT64(FLGR_Data2D *datdest, FLGR_Data2D *datsrc, FLGR_Data2D *nhb) {
01197 FLGR_MorphoOptim flag;
01198
01199
01200
01201 flag = flgr2d_get_optimization_available(datdest, datsrc, nhb);
01202
01203 switch(flag) {
01204 case FLGR_MORPHO_OPTIM_SQUARE:
01205 flgr2d_dilate_square_fgFLOAT64(datdest,datsrc,nhb->size_x/2);
01206 break;
01207 case FLGR_MORPHO_OPTIM_CROSS:
01208 flgr2d_dilate_cross_fgFLOAT64(datdest,datsrc,1);
01209 break;
01210 case FLGR_MORPHO_OPTIM_HEXAGON:
01211 flgr2d_dilate_hexa_fgFLOAT64(datdest,datsrc,nhb->size_x/2);
01212 break;
01213 case FLGR_MORPHO_OPTIM_RECTANGLE:
01214 flgr2d_dilate_rectangle_fgFLOAT64(datdest,datsrc,nhb->size_x,nhb->size_y);
01215 break;
01216 case FLGR_MORPHO_OPTIM_OCTAGON:
01217 flgr2d_dilate_octagon_fgFLOAT64(datdest,datsrc,nhb->size_x/2);
01218 break;
01219 case FLGR_MORPHO_OPTIM_DIAMOND:
01220 flgr2d_dilate_cross_fgFLOAT64(datdest,datsrc,nhb->size_x/2);
01221 break;
01222 default:
01223 flgr2d_raster_slide_window_fgFLOAT64(datdest, datsrc, nhb, FLGR_NHB_SYM, flgr2d_get_nhb_maximum_fgFLOAT64);
01224 }
01225
01226 }
01227
01228
01230
01236
01237 FLGR_Ret flgr2d_minkowski_add(FLGR_Data2D *datdest, FLGR_Data2D *datsrc, FLGR_Data2D *nhb) {
01238 FLGR_Ret ret;
01239
01240
01241
01242 if((datdest==NULL) || (datsrc==NULL) || (nhb==NULL)) {
01243 POST_ERROR("Null objects!\n");
01244 return FLGR_RET_NULL_OBJECT;
01245 }
01246
01247 if((ret=flgr2d_is_data_same_attributes(datdest,datsrc,__FUNCTION__))!=FLGR_RET_OK) return ret;
01248 if((ret=flgr2d_is_data_same_type(datdest,nhb))!=FLGR_RET_OK) {
01249 POST_ERROR("data types differents\n");
01250 return ret;
01251 }
01252 if((ret=flgr2d_is_data_same_spp(datdest,nhb))!=FLGR_RET_OK) {
01253 POST_ERROR("spp differents\n");
01254 return ret;
01255 }
01256
01257 FLGR_DISPATCH_PROCEDURE(datdest->type,flgr2d_minkowski_add,datdest,datsrc,nhb);
01258
01259 }
01260
01261
01262
01263
01264
01265
01266
01267
01268
01269
01270
01271
01272 void flgr2d_erode_fgBIT(FLGR_Data2D *datdest, FLGR_Data2D *datsrc, FLGR_Data2D *nhb) {
01273 FLGR_MorphoOptim flag;
01274
01275
01276
01277 flag = flgr2d_get_optimization_available(datdest, datsrc, nhb);
01278
01279 switch(flag) {
01280 case FLGR_MORPHO_OPTIM_SQUARE:
01281 flgr2d_erode_square_fgBIT(datdest,datsrc,nhb->size_x/2);
01282 break;
01283 case FLGR_MORPHO_OPTIM_CROSS:
01284 flgr2d_erode_cross_fgBIT(datdest,datsrc,1);
01285 break;
01286 case FLGR_MORPHO_OPTIM_HEXAGON:
01287 flgr2d_erode_hexa_fgBIT(datdest,datsrc,nhb->size_x/2);
01288 break;
01289 case FLGR_MORPHO_OPTIM_OCTAGON:
01290 flgr2d_erode_octagon_fgBIT(datdest,datsrc,nhb->size_x/2);
01291 break;
01292 case FLGR_MORPHO_OPTIM_DIAMOND:
01293 flgr2d_erode_cross_fgBIT(datdest,datsrc,nhb->size_x/2);
01294 break;
01295 default:
01296 flgr2d_raster_slide_window_fgBIT(datdest, datsrc, nhb, FLGR_NHB_NO_SYM, flgr2d_get_nhb_minimum_fgBIT);
01297 }
01298
01299 }
01300 void flgr2d_erode_fgUINT8(FLGR_Data2D *datdest, FLGR_Data2D *datsrc, FLGR_Data2D *nhb) {
01301 FLGR_MorphoOptim flag;
01302
01303
01304
01305 flag = flgr2d_get_optimization_available(datdest, datsrc, nhb);
01306
01307 switch(flag) {
01308 case FLGR_MORPHO_OPTIM_SQUARE:
01309 flgr2d_erode_square_fgUINT8(datdest,datsrc,nhb->size_x/2);
01310 break;
01311 case FLGR_MORPHO_OPTIM_CROSS:
01312 flgr2d_erode_cross_fgUINT8(datdest,datsrc,1);
01313 break;
01314 case FLGR_MORPHO_OPTIM_HEXAGON:
01315 flgr2d_erode_hexa_fgUINT8(datdest,datsrc,nhb->size_x/2);
01316 break;
01317 case FLGR_MORPHO_OPTIM_RECTANGLE:
01318 flgr2d_erode_rectangle_fgUINT8(datdest,datsrc,nhb->size_x,nhb->size_y);
01319 break;
01320 case FLGR_MORPHO_OPTIM_OCTAGON:
01321 flgr2d_erode_octagon_fgUINT8(datdest,datsrc,nhb->size_x/2);
01322 break;
01323 case FLGR_MORPHO_OPTIM_DIAMOND:
01324 flgr2d_erode_cross_fgUINT8(datdest,datsrc,nhb->size_x/2);
01325 break;
01326 default:
01327 flgr2d_raster_slide_window_fgUINT8(datdest, datsrc, nhb, FLGR_NHB_NO_SYM, flgr2d_get_nhb_minimum_fgUINT8);
01328 }
01329
01330 }
01331 void flgr2d_erode_fgUINT16(FLGR_Data2D *datdest, FLGR_Data2D *datsrc, FLGR_Data2D *nhb) {
01332 FLGR_MorphoOptim flag;
01333
01334
01335
01336 flag = flgr2d_get_optimization_available(datdest, datsrc, nhb);
01337
01338 switch(flag) {
01339 case FLGR_MORPHO_OPTIM_SQUARE:
01340 flgr2d_erode_square_fgUINT16(datdest,datsrc,nhb->size_x/2);
01341 break;
01342 case FLGR_MORPHO_OPTIM_CROSS:
01343 flgr2d_erode_cross_fgUINT16(datdest,datsrc,1);
01344 break;
01345 case FLGR_MORPHO_OPTIM_HEXAGON:
01346 flgr2d_erode_hexa_fgUINT16(datdest,datsrc,nhb->size_x/2);
01347 break;
01348 case FLGR_MORPHO_OPTIM_RECTANGLE:
01349 flgr2d_erode_rectangle_fgUINT16(datdest,datsrc,nhb->size_x,nhb->size_y);
01350 break;
01351 case FLGR_MORPHO_OPTIM_OCTAGON:
01352 flgr2d_erode_octagon_fgUINT16(datdest,datsrc,nhb->size_x/2);
01353 break;
01354 case FLGR_MORPHO_OPTIM_DIAMOND:
01355 flgr2d_erode_cross_fgUINT16(datdest,datsrc,nhb->size_x/2);
01356 break;
01357 default:
01358 flgr2d_raster_slide_window_fgUINT16(datdest, datsrc, nhb, FLGR_NHB_NO_SYM, flgr2d_get_nhb_minimum_fgUINT16);
01359 }
01360
01361 }
01362 void flgr2d_erode_fgUINT32(FLGR_Data2D *datdest, FLGR_Data2D *datsrc, FLGR_Data2D *nhb) {
01363 FLGR_MorphoOptim flag;
01364
01365
01366
01367 flag = flgr2d_get_optimization_available(datdest, datsrc, nhb);
01368
01369 switch(flag) {
01370 case FLGR_MORPHO_OPTIM_SQUARE:
01371 flgr2d_erode_square_fgUINT32(datdest,datsrc,nhb->size_x/2);
01372 break;
01373 case FLGR_MORPHO_OPTIM_CROSS:
01374 flgr2d_erode_cross_fgUINT32(datdest,datsrc,1);
01375 break;
01376 case FLGR_MORPHO_OPTIM_HEXAGON:
01377 flgr2d_erode_hexa_fgUINT32(datdest,datsrc,nhb->size_x/2);
01378 break;
01379 case FLGR_MORPHO_OPTIM_RECTANGLE:
01380 flgr2d_erode_rectangle_fgUINT32(datdest,datsrc,nhb->size_x,nhb->size_y);
01381 break;
01382 case FLGR_MORPHO_OPTIM_OCTAGON:
01383 flgr2d_erode_octagon_fgUINT32(datdest,datsrc,nhb->size_x/2);
01384 break;
01385 case FLGR_MORPHO_OPTIM_DIAMOND:
01386 flgr2d_erode_cross_fgUINT32(datdest,datsrc,nhb->size_x/2);
01387 break;
01388 default:
01389 flgr2d_raster_slide_window_fgUINT32(datdest, datsrc, nhb, FLGR_NHB_NO_SYM, flgr2d_get_nhb_minimum_fgUINT32);
01390 }
01391
01392 }
01393 void flgr2d_erode_fgINT8(FLGR_Data2D *datdest, FLGR_Data2D *datsrc, FLGR_Data2D *nhb) {
01394 FLGR_MorphoOptim flag;
01395
01396
01397
01398 flag = flgr2d_get_optimization_available(datdest, datsrc, nhb);
01399
01400 switch(flag) {
01401 case FLGR_MORPHO_OPTIM_SQUARE:
01402 flgr2d_erode_square_fgINT8(datdest,datsrc,nhb->size_x/2);
01403 break;
01404 case FLGR_MORPHO_OPTIM_CROSS:
01405 flgr2d_erode_cross_fgINT8(datdest,datsrc,1);
01406 break;
01407 case FLGR_MORPHO_OPTIM_HEXAGON:
01408 flgr2d_erode_hexa_fgINT8(datdest,datsrc,nhb->size_x/2);
01409 break;
01410 case FLGR_MORPHO_OPTIM_RECTANGLE:
01411 flgr2d_erode_rectangle_fgINT8(datdest,datsrc,nhb->size_x,nhb->size_y);
01412 break;
01413 case FLGR_MORPHO_OPTIM_OCTAGON:
01414 flgr2d_erode_octagon_fgINT8(datdest,datsrc,nhb->size_x/2);
01415 break;
01416 case FLGR_MORPHO_OPTIM_DIAMOND:
01417 flgr2d_erode_cross_fgINT8(datdest,datsrc,nhb->size_x/2);
01418 break;
01419 default:
01420 flgr2d_raster_slide_window_fgINT8(datdest, datsrc, nhb, FLGR_NHB_NO_SYM, flgr2d_get_nhb_minimum_fgINT8);
01421 }
01422
01423 }
01424 void flgr2d_erode_fgINT16(FLGR_Data2D *datdest, FLGR_Data2D *datsrc, FLGR_Data2D *nhb) {
01425 FLGR_MorphoOptim flag;
01426
01427
01428
01429 flag = flgr2d_get_optimization_available(datdest, datsrc, nhb);
01430
01431 switch(flag) {
01432 case FLGR_MORPHO_OPTIM_SQUARE:
01433 flgr2d_erode_square_fgINT16(datdest,datsrc,nhb->size_x/2);
01434 break;
01435 case FLGR_MORPHO_OPTIM_CROSS:
01436 flgr2d_erode_cross_fgINT16(datdest,datsrc,1);
01437 break;
01438 case FLGR_MORPHO_OPTIM_HEXAGON:
01439 flgr2d_erode_hexa_fgINT16(datdest,datsrc,nhb->size_x/2);
01440 break;
01441 case FLGR_MORPHO_OPTIM_RECTANGLE:
01442 flgr2d_erode_rectangle_fgINT16(datdest,datsrc,nhb->size_x,nhb->size_y);
01443 break;
01444 case FLGR_MORPHO_OPTIM_OCTAGON:
01445 flgr2d_erode_octagon_fgINT16(datdest,datsrc,nhb->size_x/2);
01446 break;
01447 case FLGR_MORPHO_OPTIM_DIAMOND:
01448 flgr2d_erode_cross_fgINT16(datdest,datsrc,nhb->size_x/2);
01449 break;
01450 default:
01451 flgr2d_raster_slide_window_fgINT16(datdest, datsrc, nhb, FLGR_NHB_NO_SYM, flgr2d_get_nhb_minimum_fgINT16);
01452 }
01453
01454 }
01455 void flgr2d_erode_fgINT32(FLGR_Data2D *datdest, FLGR_Data2D *datsrc, FLGR_Data2D *nhb) {
01456 FLGR_MorphoOptim flag;
01457
01458
01459
01460 flag = flgr2d_get_optimization_available(datdest, datsrc, nhb);
01461
01462 switch(flag) {
01463 case FLGR_MORPHO_OPTIM_SQUARE:
01464 flgr2d_erode_square_fgINT32(datdest,datsrc,nhb->size_x/2);
01465 break;
01466 case FLGR_MORPHO_OPTIM_CROSS:
01467 flgr2d_erode_cross_fgINT32(datdest,datsrc,1);
01468 break;
01469 case FLGR_MORPHO_OPTIM_HEXAGON:
01470 flgr2d_erode_hexa_fgINT32(datdest,datsrc,nhb->size_x/2);
01471 break;
01472 case FLGR_MORPHO_OPTIM_RECTANGLE:
01473 flgr2d_erode_rectangle_fgINT32(datdest,datsrc,nhb->size_x,nhb->size_y);
01474 break;
01475 case FLGR_MORPHO_OPTIM_OCTAGON:
01476 flgr2d_erode_octagon_fgINT32(datdest,datsrc,nhb->size_x/2);
01477 break;
01478 case FLGR_MORPHO_OPTIM_DIAMOND:
01479 flgr2d_erode_cross_fgINT32(datdest,datsrc,nhb->size_x/2);
01480 break;
01481 default:
01482 flgr2d_raster_slide_window_fgINT32(datdest, datsrc, nhb, FLGR_NHB_NO_SYM, flgr2d_get_nhb_minimum_fgINT32);
01483 }
01484
01485 }
01486 void flgr2d_erode_fgFLOAT32(FLGR_Data2D *datdest, FLGR_Data2D *datsrc, FLGR_Data2D *nhb) {
01487 FLGR_MorphoOptim flag;
01488
01489
01490
01491 flag = flgr2d_get_optimization_available(datdest, datsrc, nhb);
01492
01493 switch(flag) {
01494 case FLGR_MORPHO_OPTIM_SQUARE:
01495 flgr2d_erode_square_fgFLOAT32(datdest,datsrc,nhb->size_x/2);
01496 break;
01497 case FLGR_MORPHO_OPTIM_CROSS:
01498 flgr2d_erode_cross_fgFLOAT32(datdest,datsrc,1);
01499 break;
01500 case FLGR_MORPHO_OPTIM_HEXAGON:
01501 flgr2d_erode_hexa_fgFLOAT32(datdest,datsrc,nhb->size_x/2);
01502 break;
01503 case FLGR_MORPHO_OPTIM_RECTANGLE:
01504 flgr2d_erode_rectangle_fgFLOAT32(datdest,datsrc,nhb->size_x,nhb->size_y);
01505 break;
01506 case FLGR_MORPHO_OPTIM_OCTAGON:
01507 flgr2d_erode_octagon_fgFLOAT32(datdest,datsrc,nhb->size_x/2);
01508 break;
01509 case FLGR_MORPHO_OPTIM_DIAMOND:
01510 flgr2d_erode_cross_fgFLOAT32(datdest,datsrc,nhb->size_x/2);
01511 break;
01512 default:
01513 flgr2d_raster_slide_window_fgFLOAT32(datdest, datsrc, nhb, FLGR_NHB_NO_SYM, flgr2d_get_nhb_minimum_fgFLOAT32);
01514 }
01515
01516 }
01517 void flgr2d_erode_fgFLOAT64(FLGR_Data2D *datdest, FLGR_Data2D *datsrc, FLGR_Data2D *nhb) {
01518 FLGR_MorphoOptim flag;
01519
01520
01521
01522 flag = flgr2d_get_optimization_available(datdest, datsrc, nhb);
01523
01524 switch(flag) {
01525 case FLGR_MORPHO_OPTIM_SQUARE:
01526 flgr2d_erode_square_fgFLOAT64(datdest,datsrc,nhb->size_x/2);
01527 break;
01528 case FLGR_MORPHO_OPTIM_CROSS:
01529 flgr2d_erode_cross_fgFLOAT64(datdest,datsrc,1);
01530 break;
01531 case FLGR_MORPHO_OPTIM_HEXAGON:
01532 flgr2d_erode_hexa_fgFLOAT64(datdest,datsrc,nhb->size_x/2);
01533 break;
01534 case FLGR_MORPHO_OPTIM_RECTANGLE:
01535 flgr2d_erode_rectangle_fgFLOAT64(datdest,datsrc,nhb->size_x,nhb->size_y);
01536 break;
01537 case FLGR_MORPHO_OPTIM_OCTAGON:
01538 flgr2d_erode_octagon_fgFLOAT64(datdest,datsrc,nhb->size_x/2);
01539 break;
01540 case FLGR_MORPHO_OPTIM_DIAMOND:
01541 flgr2d_erode_cross_fgFLOAT64(datdest,datsrc,nhb->size_x/2);
01542 break;
01543 default:
01544 flgr2d_raster_slide_window_fgFLOAT64(datdest, datsrc, nhb, FLGR_NHB_NO_SYM, flgr2d_get_nhb_minimum_fgFLOAT64);
01545 }
01546
01547 }
01548
01549
01551
01557
01558 FLGR_Ret flgr2d_erode(FLGR_Data2D *datdest, FLGR_Data2D *datsrc, FLGR_Data2D *nhb) {
01559 FLGR_Ret ret;
01560
01561
01562
01563 if((datdest==NULL) || (datsrc==NULL) || (nhb==NULL)) {
01564 POST_ERROR("Null objects!\n");
01565 return FLGR_RET_NULL_OBJECT;
01566 }
01567
01568 if((ret=flgr2d_is_data_same_attributes(datdest,datsrc,__FUNCTION__))!=FLGR_RET_OK) return ret;
01569 if((ret=flgr2d_is_data_same_type(datdest,nhb))!=FLGR_RET_OK) {
01570 POST_ERROR("data types differents\n");
01571 return ret;
01572 }
01573 if((ret=flgr2d_is_data_same_spp(datdest,nhb))!=FLGR_RET_OK) {
01574 POST_ERROR("spp differents\n");
01575 return ret;
01576 }
01577
01578 FLGR_DISPATCH_PROCEDURE(datdest->type,flgr2d_erode,datdest,datsrc,nhb);
01579
01580 }
01581
01582
01583
01584
01585
01586
01587
01588
01589
01590
01591
01592
01593
01594
01595
01596
01597
01598
01599
01600 void flgr2d_dilate_fgBIT(FLGR_Data2D *datdest, FLGR_Data2D *datsrc, FLGR_Data2D *nhb) {
01601 FLGR_MorphoOptim flag;
01602
01603
01604
01605 flag = flgr2d_get_optimization_available(datdest, datsrc, nhb);
01606
01607 switch(flag) {
01608 case FLGR_MORPHO_OPTIM_SQUARE:
01609 flgr2d_dilate_square_fgBIT(datdest,datsrc,nhb->size_x/2);
01610 break;
01611 case FLGR_MORPHO_OPTIM_CROSS:
01612 flgr2d_dilate_cross_fgBIT(datdest,datsrc,1);
01613 break;
01614 case FLGR_MORPHO_OPTIM_OCTAGON:
01615 flgr2d_dilate_octagon_fgBIT(datdest,datsrc,nhb->size_x/2);
01616 break;
01617 case FLGR_MORPHO_OPTIM_DIAMOND:
01618 flgr2d_dilate_cross_fgBIT(datdest,datsrc,nhb->size_x/2);
01619 break;
01620 default:
01621 flgr2d_raster_slide_window_fgBIT(datdest, datsrc, nhb, FLGR_NHB_NO_SYM, flgr2d_get_nhb_maximum_fgBIT);
01622 }
01623 }
01624 void flgr2d_dilate_fgUINT8(FLGR_Data2D *datdest, FLGR_Data2D *datsrc, FLGR_Data2D *nhb) {
01625 FLGR_MorphoOptim flag;
01626
01627
01628
01629 flag = flgr2d_get_optimization_available(datdest, datsrc, nhb);
01630
01631 switch(flag) {
01632 case FLGR_MORPHO_OPTIM_SQUARE:
01633 flgr2d_dilate_square_fgUINT8(datdest,datsrc,nhb->size_x/2);
01634 break;
01635 case FLGR_MORPHO_OPTIM_CROSS:
01636 flgr2d_dilate_cross_fgUINT8(datdest,datsrc,1);
01637 break;
01638 case FLGR_MORPHO_OPTIM_HEXAGON:
01639 flgr2d_dilate_hexa_fgUINT8(datdest,datsrc,nhb->size_x/2);
01640 break;
01641 case FLGR_MORPHO_OPTIM_RECTANGLE:
01642 flgr2d_dilate_rectangle_fgUINT8(datdest,datsrc,nhb->size_x,nhb->size_y);
01643 break;
01644 case FLGR_MORPHO_OPTIM_OCTAGON:
01645 flgr2d_dilate_octagon_fgUINT8(datdest,datsrc,nhb->size_x/2);
01646 break;
01647 case FLGR_MORPHO_OPTIM_DIAMOND:
01648 flgr2d_dilate_cross_fgUINT8(datdest,datsrc,nhb->size_x/2);
01649 break;
01650 default:
01651 flgr2d_raster_slide_window_fgUINT8(datdest, datsrc, nhb, FLGR_NHB_NO_SYM, flgr2d_get_nhb_maximum_fgUINT8);
01652 }
01653 }
01654 void flgr2d_dilate_fgUINT16(FLGR_Data2D *datdest, FLGR_Data2D *datsrc, FLGR_Data2D *nhb) {
01655 FLGR_MorphoOptim flag;
01656
01657
01658
01659 flag = flgr2d_get_optimization_available(datdest, datsrc, nhb);
01660
01661 switch(flag) {
01662 case FLGR_MORPHO_OPTIM_SQUARE:
01663 flgr2d_dilate_square_fgUINT16(datdest,datsrc,nhb->size_x/2);
01664 break;
01665 case FLGR_MORPHO_OPTIM_CROSS:
01666 flgr2d_dilate_cross_fgUINT16(datdest,datsrc,1);
01667 break;
01668 case FLGR_MORPHO_OPTIM_HEXAGON:
01669 flgr2d_dilate_hexa_fgUINT16(datdest,datsrc,nhb->size_x/2);
01670 break;
01671 case FLGR_MORPHO_OPTIM_RECTANGLE:
01672 flgr2d_dilate_rectangle_fgUINT16(datdest,datsrc,nhb->size_x,nhb->size_y);
01673 break;
01674 case FLGR_MORPHO_OPTIM_OCTAGON:
01675 flgr2d_dilate_octagon_fgUINT16(datdest,datsrc,nhb->size_x/2);
01676 break;
01677 case FLGR_MORPHO_OPTIM_DIAMOND:
01678 flgr2d_dilate_cross_fgUINT16(datdest,datsrc,nhb->size_x/2);
01679 break;
01680 default:
01681 flgr2d_raster_slide_window_fgUINT16(datdest, datsrc, nhb, FLGR_NHB_NO_SYM, flgr2d_get_nhb_maximum_fgUINT16);
01682 }
01683 }
01684 void flgr2d_dilate_fgUINT32(FLGR_Data2D *datdest, FLGR_Data2D *datsrc, FLGR_Data2D *nhb) {
01685 FLGR_MorphoOptim flag;
01686
01687
01688
01689 flag = flgr2d_get_optimization_available(datdest, datsrc, nhb);
01690
01691 switch(flag) {
01692 case FLGR_MORPHO_OPTIM_SQUARE:
01693 flgr2d_dilate_square_fgUINT32(datdest,datsrc,nhb->size_x/2);
01694 break;
01695 case FLGR_MORPHO_OPTIM_CROSS:
01696 flgr2d_dilate_cross_fgUINT32(datdest,datsrc,1);
01697 break;
01698 case FLGR_MORPHO_OPTIM_HEXAGON:
01699 flgr2d_dilate_hexa_fgUINT32(datdest,datsrc,nhb->size_x/2);
01700 break;
01701 case FLGR_MORPHO_OPTIM_RECTANGLE:
01702 flgr2d_dilate_rectangle_fgUINT32(datdest,datsrc,nhb->size_x,nhb->size_y);
01703 break;
01704 case FLGR_MORPHO_OPTIM_OCTAGON:
01705 flgr2d_dilate_octagon_fgUINT32(datdest,datsrc,nhb->size_x/2);
01706 break;
01707 case FLGR_MORPHO_OPTIM_DIAMOND:
01708 flgr2d_dilate_cross_fgUINT32(datdest,datsrc,nhb->size_x/2);
01709 break;
01710 default:
01711 flgr2d_raster_slide_window_fgUINT32(datdest, datsrc, nhb, FLGR_NHB_NO_SYM, flgr2d_get_nhb_maximum_fgUINT32);
01712 }
01713 }
01714 void flgr2d_dilate_fgINT8(FLGR_Data2D *datdest, FLGR_Data2D *datsrc, FLGR_Data2D *nhb) {
01715 FLGR_MorphoOptim flag;
01716
01717
01718
01719 flag = flgr2d_get_optimization_available(datdest, datsrc, nhb);
01720
01721 switch(flag) {
01722 case FLGR_MORPHO_OPTIM_SQUARE:
01723 flgr2d_dilate_square_fgINT8(datdest,datsrc,nhb->size_x/2);
01724 break;
01725 case FLGR_MORPHO_OPTIM_CROSS:
01726 flgr2d_dilate_cross_fgINT8(datdest,datsrc,1);
01727 break;
01728 case FLGR_MORPHO_OPTIM_HEXAGON:
01729 flgr2d_dilate_hexa_fgINT8(datdest,datsrc,nhb->size_x/2);
01730 break;
01731 case FLGR_MORPHO_OPTIM_RECTANGLE:
01732 flgr2d_dilate_rectangle_fgINT8(datdest,datsrc,nhb->size_x,nhb->size_y);
01733 break;
01734 case FLGR_MORPHO_OPTIM_OCTAGON:
01735 flgr2d_dilate_octagon_fgINT8(datdest,datsrc,nhb->size_x/2);
01736 break;
01737 case FLGR_MORPHO_OPTIM_DIAMOND:
01738 flgr2d_dilate_cross_fgINT8(datdest,datsrc,nhb->size_x/2);
01739 break;
01740 default:
01741 flgr2d_raster_slide_window_fgINT8(datdest, datsrc, nhb, FLGR_NHB_NO_SYM, flgr2d_get_nhb_maximum_fgINT8);
01742 }
01743 }
01744 void flgr2d_dilate_fgINT16(FLGR_Data2D *datdest, FLGR_Data2D *datsrc, FLGR_Data2D *nhb) {
01745 FLGR_MorphoOptim flag;
01746
01747
01748
01749 flag = flgr2d_get_optimization_available(datdest, datsrc, nhb);
01750
01751 switch(flag) {
01752 case FLGR_MORPHO_OPTIM_SQUARE:
01753 flgr2d_dilate_square_fgINT16(datdest,datsrc,nhb->size_x/2);
01754 break;
01755 case FLGR_MORPHO_OPTIM_CROSS:
01756 flgr2d_dilate_cross_fgINT16(datdest,datsrc,1);
01757 break;
01758 case FLGR_MORPHO_OPTIM_HEXAGON:
01759 flgr2d_dilate_hexa_fgINT16(datdest,datsrc,nhb->size_x/2);
01760 break;
01761 case FLGR_MORPHO_OPTIM_RECTANGLE:
01762 flgr2d_dilate_rectangle_fgINT16(datdest,datsrc,nhb->size_x,nhb->size_y);
01763 break;
01764 case FLGR_MORPHO_OPTIM_OCTAGON:
01765 flgr2d_dilate_octagon_fgINT16(datdest,datsrc,nhb->size_x/2);
01766 break;
01767 case FLGR_MORPHO_OPTIM_DIAMOND:
01768 flgr2d_dilate_cross_fgINT16(datdest,datsrc,nhb->size_x/2);
01769 break;
01770 default:
01771 flgr2d_raster_slide_window_fgINT16(datdest, datsrc, nhb, FLGR_NHB_NO_SYM, flgr2d_get_nhb_maximum_fgINT16);
01772 }
01773 }
01774 void flgr2d_dilate_fgINT32(FLGR_Data2D *datdest, FLGR_Data2D *datsrc, FLGR_Data2D *nhb) {
01775 FLGR_MorphoOptim flag;
01776
01777
01778
01779 flag = flgr2d_get_optimization_available(datdest, datsrc, nhb);
01780
01781 switch(flag) {
01782 case FLGR_MORPHO_OPTIM_SQUARE:
01783 flgr2d_dilate_square_fgINT32(datdest,datsrc,nhb->size_x/2);
01784 break;
01785 case FLGR_MORPHO_OPTIM_CROSS:
01786 flgr2d_dilate_cross_fgINT32(datdest,datsrc,1);
01787 break;
01788 case FLGR_MORPHO_OPTIM_HEXAGON:
01789 flgr2d_dilate_hexa_fgINT32(datdest,datsrc,nhb->size_x/2);
01790 break;
01791 case FLGR_MORPHO_OPTIM_RECTANGLE:
01792 flgr2d_dilate_rectangle_fgINT32(datdest,datsrc,nhb->size_x,nhb->size_y);
01793 break;
01794 case FLGR_MORPHO_OPTIM_OCTAGON:
01795 flgr2d_dilate_octagon_fgINT32(datdest,datsrc,nhb->size_x/2);
01796 break;
01797 case FLGR_MORPHO_OPTIM_DIAMOND:
01798 flgr2d_dilate_cross_fgINT32(datdest,datsrc,nhb->size_x/2);
01799 break;
01800 default:
01801 flgr2d_raster_slide_window_fgINT32(datdest, datsrc, nhb, FLGR_NHB_NO_SYM, flgr2d_get_nhb_maximum_fgINT32);
01802 }
01803 }
01804 void flgr2d_dilate_fgFLOAT32(FLGR_Data2D *datdest, FLGR_Data2D *datsrc, FLGR_Data2D *nhb) {
01805 FLGR_MorphoOptim flag;
01806
01807
01808
01809 flag = flgr2d_get_optimization_available(datdest, datsrc, nhb);
01810
01811 switch(flag) {
01812 case FLGR_MORPHO_OPTIM_SQUARE:
01813 flgr2d_dilate_square_fgFLOAT32(datdest,datsrc,nhb->size_x/2);
01814 break;
01815 case FLGR_MORPHO_OPTIM_CROSS:
01816 flgr2d_dilate_cross_fgFLOAT32(datdest,datsrc,1);
01817 break;
01818 case FLGR_MORPHO_OPTIM_HEXAGON:
01819 flgr2d_dilate_hexa_fgFLOAT32(datdest,datsrc,nhb->size_x/2);
01820 break;
01821 case FLGR_MORPHO_OPTIM_RECTANGLE:
01822 flgr2d_dilate_rectangle_fgFLOAT32(datdest,datsrc,nhb->size_x,nhb->size_y);
01823 break;
01824 case FLGR_MORPHO_OPTIM_OCTAGON:
01825 flgr2d_dilate_octagon_fgFLOAT32(datdest,datsrc,nhb->size_x/2);
01826 break;
01827 case FLGR_MORPHO_OPTIM_DIAMOND:
01828 flgr2d_dilate_cross_fgFLOAT32(datdest,datsrc,nhb->size_x/2);
01829 break;
01830 default:
01831 flgr2d_raster_slide_window_fgFLOAT32(datdest, datsrc, nhb, FLGR_NHB_NO_SYM, flgr2d_get_nhb_maximum_fgFLOAT32);
01832 }
01833 }
01834 void flgr2d_dilate_fgFLOAT64(FLGR_Data2D *datdest, FLGR_Data2D *datsrc, FLGR_Data2D *nhb) {
01835 FLGR_MorphoOptim flag;
01836
01837
01838
01839 flag = flgr2d_get_optimization_available(datdest, datsrc, nhb);
01840
01841 switch(flag) {
01842 case FLGR_MORPHO_OPTIM_SQUARE:
01843 flgr2d_dilate_square_fgFLOAT64(datdest,datsrc,nhb->size_x/2);
01844 break;
01845 case FLGR_MORPHO_OPTIM_CROSS:
01846 flgr2d_dilate_cross_fgFLOAT64(datdest,datsrc,1);
01847 break;
01848 case FLGR_MORPHO_OPTIM_HEXAGON:
01849 flgr2d_dilate_hexa_fgFLOAT64(datdest,datsrc,nhb->size_x/2);
01850 break;
01851 case FLGR_MORPHO_OPTIM_RECTANGLE:
01852 flgr2d_dilate_rectangle_fgFLOAT64(datdest,datsrc,nhb->size_x,nhb->size_y);
01853 break;
01854 case FLGR_MORPHO_OPTIM_OCTAGON:
01855 flgr2d_dilate_octagon_fgFLOAT64(datdest,datsrc,nhb->size_x/2);
01856 break;
01857 case FLGR_MORPHO_OPTIM_DIAMOND:
01858 flgr2d_dilate_cross_fgFLOAT64(datdest,datsrc,nhb->size_x/2);
01859 break;
01860 default:
01861 flgr2d_raster_slide_window_fgFLOAT64(datdest, datsrc, nhb, FLGR_NHB_NO_SYM, flgr2d_get_nhb_maximum_fgFLOAT64);
01862 }
01863 }
01864
01865
01867
01873
01874 FLGR_Ret flgr2d_dilate(FLGR_Data2D *datdest, FLGR_Data2D *datsrc, FLGR_Data2D *nhb) {
01875 FLGR_Ret ret;
01876
01877
01878
01879 if((datdest==NULL) || (datsrc==NULL) || (nhb==NULL)) {
01880 POST_ERROR("Null objects!\n");
01881 return FLGR_RET_NULL_OBJECT;
01882 }
01883
01884 if((ret=flgr2d_is_data_same_attributes(datdest,datsrc,__FUNCTION__))!=FLGR_RET_OK) return ret;
01885 if((ret=flgr2d_is_data_same_type(datdest,nhb))!=FLGR_RET_OK) {
01886 POST_ERROR("data types differents\n");
01887 return ret;
01888 }
01889 if((ret=flgr2d_is_data_same_spp(datdest,nhb))!=FLGR_RET_OK) {
01890 POST_ERROR("spp differents\n");
01891 return ret;
01892 }
01893
01894 FLGR_DISPATCH_PROCEDURE(datdest->type,flgr2d_dilate,datdest,datsrc,nhb);
01895
01896 }
01897
01898
01899
01900
01901
01902
01903
01904
01905
01906
01907
01908
01909
01910
01911
01912
01913
01914
01915 void flgr2d_median_fgBIT(FLGR_Data2D *datdest, FLGR_Data2D *datsrc, FLGR_Data2D *nhb) {
01916 flgr_no_define_type_function(FLGR_BIT);
01917 }
01918 void flgr2d_median_fgUINT8(FLGR_Data2D *datdest, FLGR_Data2D *datsrc, FLGR_Data2D *nhb) {
01919
01920 if(nhb->shape == FLGR_RECT) {
01921 if(nhb->connexity == FLGR_8_CONNEX) {
01922 if(nhb->size_x == nhb->size_y) {
01923 if(nhb->size_x == 3) {
01924 flgr2d_median_8_connexity_fgUINT8(datdest,datsrc);
01925 return;
01926 }
01927 }
01928 }
01929 }
01930
01931 flgr2d_raster_slide_window_fgUINT8(datdest, datsrc, nhb, FLGR_NHB_NO_SYM, flgr2d_get_nhb_median_fgUINT8);
01932 }
01933 void flgr2d_median_fgUINT16(FLGR_Data2D *datdest, FLGR_Data2D *datsrc, FLGR_Data2D *nhb) {
01934
01935 flgr2d_raster_slide_window_fgUINT16(datdest, datsrc, nhb, FLGR_NHB_NO_SYM, flgr2d_get_nhb_median_fgUINT16);
01936 }
01937 void flgr2d_median_fgUINT32(FLGR_Data2D *datdest, FLGR_Data2D *datsrc, FLGR_Data2D *nhb) {
01938
01939 flgr2d_raster_slide_window_fgUINT32(datdest, datsrc, nhb, FLGR_NHB_NO_SYM, flgr2d_get_nhb_median_fgUINT32);
01940 }
01941 void flgr2d_median_fgINT8(FLGR_Data2D *datdest, FLGR_Data2D *datsrc, FLGR_Data2D *nhb) {
01942
01943 flgr2d_raster_slide_window_fgINT8(datdest, datsrc, nhb, FLGR_NHB_NO_SYM, flgr2d_get_nhb_median_fgINT8);
01944 }
01945 void flgr2d_median_fgINT16(FLGR_Data2D *datdest, FLGR_Data2D *datsrc, FLGR_Data2D *nhb) {
01946
01947 flgr2d_raster_slide_window_fgINT16(datdest, datsrc, nhb, FLGR_NHB_NO_SYM, flgr2d_get_nhb_median_fgINT16);
01948 }
01949 void flgr2d_median_fgINT32(FLGR_Data2D *datdest, FLGR_Data2D *datsrc, FLGR_Data2D *nhb) {
01950
01951 flgr2d_raster_slide_window_fgINT32(datdest, datsrc, nhb, FLGR_NHB_NO_SYM, flgr2d_get_nhb_median_fgINT32);
01952 }
01953 void flgr2d_median_fgFLOAT32(FLGR_Data2D *datdest, FLGR_Data2D *datsrc, FLGR_Data2D *nhb) {
01954
01955 flgr2d_raster_slide_window_fgFLOAT32(datdest, datsrc, nhb, FLGR_NHB_NO_SYM, flgr2d_get_nhb_median_fgFLOAT32);
01956 }
01957 void flgr2d_median_fgFLOAT64(FLGR_Data2D *datdest, FLGR_Data2D *datsrc, FLGR_Data2D *nhb) {
01958
01959 flgr2d_raster_slide_window_fgFLOAT64(datdest, datsrc, nhb, FLGR_NHB_NO_SYM, flgr2d_get_nhb_median_fgFLOAT64);
01960 }
01961
01962
01963
01965
01971
01972 FLGR_Ret flgr2d_median(FLGR_Data2D *datdest, FLGR_Data2D *datsrc, FLGR_Data2D *nhb) {
01973 FLGR_Ret ret;
01974
01975
01976
01977
01978 if((datdest==NULL) || (datsrc==NULL) || (nhb==NULL)) {
01979 POST_ERROR("Null objects!\n");
01980 return FLGR_RET_NULL_OBJECT;
01981 }
01982
01983 if((ret=flgr2d_is_data_same_attributes(datdest,datsrc,__FUNCTION__))!=FLGR_RET_OK) return ret;
01984 if((ret=flgr2d_is_data_same_type(datdest,nhb))!=FLGR_RET_OK) {
01985 POST_ERROR("data types differents\n");
01986 return ret;
01987 }
01988 if((ret=flgr2d_is_data_same_spp(datdest,nhb))!=FLGR_RET_OK) {
01989 POST_ERROR("spp differents\n");
01990 return ret;
01991 }
01992
01993 FLGR_DISPATCH_PROCEDURE(datdest->type,flgr2d_median,datdest,datsrc,nhb);
01994
01995 }
01996
01997
01998
01999
02000
02001
02002
02003
02004
02005
02006
02008
02014
02015 FLGR_Ret flgr2d_gradient_inner(FLGR_Data2D *datdest, FLGR_Data2D *datsrc, FLGR_Data2D *nhb) {
02016 FLGR_Ret val;
02017
02018
02019
02020 if((datdest==NULL) || (datsrc==NULL) || (nhb==NULL)) {
02021 POST_ERROR("Null objects!\n");
02022 return FLGR_RET_NULL_OBJECT;
02023 }
02024
02025 if((val=flgr2d_erode(datdest, datsrc, nhb))!=0) return val;
02026 if((val=flgr2d_arith_sub(datdest,datsrc,datdest))!=0) return val;
02027
02028 return val;
02029 }
02030
02032
02038
02039 FLGR_Ret flgr2d_gradient_outer(FLGR_Data2D *datdest, FLGR_Data2D *datsrc, FLGR_Data2D *nhb) {
02040 FLGR_Ret val;
02041
02042
02043
02044 if((datdest==NULL) || (datsrc==NULL) || (nhb==NULL)) {
02045 POST_ERROR("Null objects!\n");
02046 return FLGR_RET_NULL_OBJECT;
02047 }
02048
02049 if((val=flgr2d_dilate(datdest, datsrc, nhb))!=0) return val;
02050 if((val=flgr2d_arith_sub(datdest,datdest,datsrc))!=0) return val;
02051
02052 return val;
02053 }
02054
02056
02062
02063 FLGR_Ret flgr2d_gradient_thick(FLGR_Data2D *datdest, FLGR_Data2D *datsrc, FLGR_Data2D *nhb) {
02064 FLGR_Data2D *dattmpD;
02065 FLGR_Ret val;
02066
02067
02068
02069 if((datdest==NULL) || (datsrc==NULL) || (nhb==NULL)) {
02070 POST_ERROR("Null objects!\n");
02071 return FLGR_RET_NULL_OBJECT;
02072 }
02073
02074 dattmpD = flgr2d_create_pixmap(datsrc->size_y, datsrc->size_x, datdest->spp, datsrc->type);
02075 if(dattmpD==NULL) return FLGR_RET_ALLOCATION_ERROR;
02076
02077 if((val=flgr2d_erode(datdest, datsrc, nhb))!=0) return val;
02078 if((val=flgr2d_dilate(dattmpD, datsrc, nhb))!=0) return val;
02079 if((val=flgr2d_arith_sub(datdest,dattmpD,datdest))!=0) return val;
02080
02081 flgr2d_destroy(dattmpD);
02082
02083 return val;
02084 }
02085
02087
02093
02094 FLGR_Ret flgr2d_open(FLGR_Data2D *datdest, FLGR_Data2D *datsrc, FLGR_Data2D *nhb) {
02095 FLGR_MorphoOptim flag;
02096 FLGR_Data2D *dattmp;
02097 FLGR_Ret ret;
02098
02099
02100
02101 if((datdest==NULL) || (datsrc==NULL) || (nhb==NULL)) {
02102 POST_ERROR("Null objects!\n");
02103 return FLGR_RET_NULL_OBJECT;
02104 }
02105
02106 if((ret=flgr2d_is_data_same_attributes(datdest,datsrc,__FUNCTION__))!=FLGR_RET_OK) return ret;
02107 if((ret=flgr2d_is_data_same_type(datdest,nhb))!=FLGR_RET_OK) {
02108 POST_ERROR("data types differents\n");
02109 return ret;
02110 }
02111 if((ret=flgr2d_is_data_same_spp(datdest,nhb))!=FLGR_RET_OK) {
02112 POST_ERROR("spp differents\n");
02113 return ret;
02114 }
02115
02116
02117 flag = flgr2d_get_optimization_available(datdest, datsrc, nhb);
02118
02119 switch(flag) {
02120 case FLGR_MORPHO_OPTIM_SQUARE:
02121 return flgr2d_open_square(datdest,datsrc,nhb->size_x/2);
02122
02123 case FLGR_MORPHO_OPTIM_HEXAGON:
02124 return flgr2d_open_hexa(datdest,datsrc,nhb->size_x/2);
02125
02126 case FLGR_MORPHO_OPTIM_RECTANGLE:
02127 if(nhb->type != FLGR_BIT)
02128 return flgr2d_open_rectangle(datdest,datsrc,nhb->size_x,nhb->size_y);
02129 else
02130 return flgr2d_open_square(datdest,datsrc,nhb->size_x/2);
02131
02132 case FLGR_MORPHO_OPTIM_OCTAGON:
02133 return flgr2d_open_octagon(datdest,datsrc,nhb->size_x/2);
02134
02135 case FLGR_MORPHO_OPTIM_DIAMOND:
02136 return flgr2d_open_cross(datdest,datsrc,nhb->size_x/2);
02137
02138 default:
02139 break;
02140 }
02141
02142
02143 dattmp = flgr2d_create_pixmap(datsrc->size_y, datsrc->size_x, datdest->spp, datsrc->type);
02144 if(dattmp==NULL) return FLGR_RET_ALLOCATION_ERROR;
02145
02146 if((ret=flgr2d_erode(dattmp, datsrc, nhb))!=0) {
02147 flgr2d_destroy(dattmp);
02148 return ret;
02149 }
02150
02151 ret=flgr2d_minkowski_add(datdest,dattmp,nhb);
02152
02153 flgr2d_destroy(dattmp);
02154
02155 return ret;
02156 }
02157
02159
02165
02166 FLGR_Ret flgr2d_close(FLGR_Data2D *datdest, FLGR_Data2D *datsrc, FLGR_Data2D *nhb) {
02167 FLGR_MorphoOptim flag;
02168 FLGR_Data2D *dattmp;
02169 FLGR_Ret ret;
02170
02171
02172
02173 if((datdest==NULL) || (datsrc==NULL) || (nhb==NULL)) {
02174 POST_ERROR("Null objects!\n");
02175 return FLGR_RET_NULL_OBJECT;
02176 }
02177
02178 if((ret=flgr2d_is_data_same_attributes(datdest,datsrc,__FUNCTION__))!=FLGR_RET_OK) return ret;
02179 if((ret=flgr2d_is_data_same_type(datdest,nhb))!=FLGR_RET_OK) {
02180 POST_ERROR("data types differents\n");
02181 return ret;
02182 }
02183 if((ret=flgr2d_is_data_same_spp(datdest,nhb))!=FLGR_RET_OK) {
02184 POST_ERROR("spp differents\n");
02185 return ret;
02186 }
02187
02188
02189 flag = flgr2d_get_optimization_available(datdest, datsrc, nhb);
02190
02191 switch(flag) {
02192 case FLGR_MORPHO_OPTIM_SQUARE:
02193 return flgr2d_close_square(datdest,datsrc,nhb->size_x/2);
02194
02195 case FLGR_MORPHO_OPTIM_HEXAGON:
02196 return flgr2d_close_hexa(datdest,datsrc,nhb->size_x/2);
02197
02198 case FLGR_MORPHO_OPTIM_RECTANGLE:
02199 if(nhb->type != FLGR_BIT)
02200 return flgr2d_close_rectangle(datdest,datsrc,nhb->size_x,nhb->size_y);
02201 else
02202 return flgr2d_close_square(datdest,datsrc,nhb->size_x/2);
02203
02204 case FLGR_MORPHO_OPTIM_OCTAGON:
02205 return flgr2d_close_octagon(datdest,datsrc,nhb->size_x/2);
02206
02207 case FLGR_MORPHO_OPTIM_DIAMOND:
02208 return flgr2d_close_cross(datdest,datsrc,nhb->size_x/2);
02209
02210 default:
02211 break;
02212 }
02213
02214
02215 dattmp = flgr2d_create_pixmap(datsrc->size_y, datsrc->size_x, datdest->spp, datsrc->type);
02216 if(dattmp==NULL) return FLGR_RET_ALLOCATION_ERROR;
02217
02218 if((ret=flgr2d_dilate(dattmp, datsrc, nhb))!=0) {
02219 flgr2d_destroy(dattmp);
02220 return ret;
02221 }
02222
02223 ret=flgr2d_minkowski_sub(datdest,dattmp,nhb);
02224
02225 flgr2d_destroy(dattmp);
02226
02227 return ret;
02228 }
02229
02231
02237
02238 FLGR_Ret flgr2d_open_tophat(FLGR_Data2D *datdest, FLGR_Data2D *datsrc, FLGR_Data2D *nhb) {
02239 FLGR_Ret ret;
02240
02241
02242
02243 if((datdest==NULL) || (datsrc==NULL) || (nhb==NULL)) {
02244 POST_ERROR("Null objects!\n");
02245 return FLGR_RET_NULL_OBJECT;
02246 }
02247
02248 if((ret=flgr2d_open(datdest, datsrc, nhb))!=0) return ret;
02249
02250 ret=flgr2d_arith_sub(datdest,datsrc,datdest);
02251
02252 return ret;
02253 }
02254
02256
02262
02263 FLGR_Ret flgr2d_close_tophat(FLGR_Data2D *datdest, FLGR_Data2D *datsrc, FLGR_Data2D *nhb) {
02264 FLGR_Ret ret;
02265
02266
02267
02268 if((datdest==NULL) || (datsrc==NULL) || (nhb==NULL)) {
02269 POST_ERROR("Null objects!\n");
02270 return FLGR_RET_NULL_OBJECT;
02271 }
02272
02273 if((ret=flgr2d_close(datdest,datsrc,nhb))!=0) return ret;
02274
02275 ret=flgr2d_arith_sub(datdest,datdest,datsrc);
02276
02277 return ret;
02278 }
02279
02280