00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021 #include <flgrCoreData.h>
00022 #include <flgrCoreIO.h>
00023 #include <flgrCoreVector.h>
00024 #include <flgrCoreCopy.h>
00025 #include <flgrCoreShift.h>
00026 #include <flgrCoreDispatch.h>
00027 #include <flgrCoreArithDef.h>
00028 #include <flgrArith.h>
00029 #include <flgrArithShift.h>
00030 #include "flgrMorphoBaseLog.h"
00031
00039
00040
00041
00042
00043
00044
00046
00048 #define FLGR_1D_MACRO_INTERNAL_ERODE_LOG(dtype) \
00049 if(size == 1) { \
00050 flgr1d_erode_2_points_##dtype(lineout,linein,tmpline,1); \
00051 return; \
00052 } \
00053 \
00054 flgr1d_erode_2_points_##dtype(lineout,linein,tmpline,size/2); \
00055 \
00056 flgr1d_internal_erode_log_##dtype(lineout,lineout,tmpline,size/2); \
00057 \
00058 if((size%2) == 1) \
00059 flgr1d_erode_2_points_##dtype(lineout,lineout,tmpline,1)
00060
00061
00062 void flgr1d_internal_erode_log_fgBIT(FLGR_Data1D *lineout, FLGR_Data1D *linein,
00063 FLGR_Data1D *tmpline, int size) {
00064 FLGR_1D_MACRO_INTERNAL_ERODE_LOG(fgBIT);
00065 }
00066 void flgr1d_internal_erode_log_fgUINT8(FLGR_Data1D *lineout, FLGR_Data1D *linein,
00067 FLGR_Data1D *tmpline, int size) {
00068 FLGR_1D_MACRO_INTERNAL_ERODE_LOG(fgUINT8);
00069 }
00070 void flgr1d_internal_erode_log_fgUINT16(FLGR_Data1D *lineout, FLGR_Data1D *linein,
00071 FLGR_Data1D *tmpline, int size) {
00072 FLGR_1D_MACRO_INTERNAL_ERODE_LOG(fgUINT16);
00073 }
00074 void flgr1d_internal_erode_log_fgUINT32(FLGR_Data1D *lineout, FLGR_Data1D *linein,
00075 FLGR_Data1D *tmpline, int size) {
00076 FLGR_1D_MACRO_INTERNAL_ERODE_LOG(fgUINT32);
00077 }
00078 void flgr1d_internal_erode_log_fgINT8(FLGR_Data1D *lineout, FLGR_Data1D *linein,
00079 FLGR_Data1D *tmpline, int size) {
00080 FLGR_1D_MACRO_INTERNAL_ERODE_LOG(fgINT8);
00081 }
00082 void flgr1d_internal_erode_log_fgINT16(FLGR_Data1D *lineout, FLGR_Data1D *linein,
00083 FLGR_Data1D *tmpline, int size) {
00084 FLGR_1D_MACRO_INTERNAL_ERODE_LOG(fgINT16);
00085 }
00086 void flgr1d_internal_erode_log_fgINT32(FLGR_Data1D *lineout, FLGR_Data1D *linein,
00087 FLGR_Data1D *tmpline, int size) {
00088 FLGR_1D_MACRO_INTERNAL_ERODE_LOG(fgINT32);
00089 }
00090 void flgr1d_internal_erode_log_fgFLOAT32(FLGR_Data1D *lineout, FLGR_Data1D *linein,
00091 FLGR_Data1D *tmpline, int size) {
00092 FLGR_1D_MACRO_INTERNAL_ERODE_LOG(fgFLOAT32);
00093 }
00094 void flgr1d_internal_erode_log_fgFLOAT64(FLGR_Data1D *lineout, FLGR_Data1D *linein,
00095 FLGR_Data1D *tmpline, int size) {
00096 FLGR_1D_MACRO_INTERNAL_ERODE_LOG(fgFLOAT64);
00097 }
00098
00099
00100
00101
00102
00103
00104
00106
00108 #define FLGR_1D_MACRO_INTERNAL_DILATE_LOG(dtype) \
00109 if(size == 1) { \
00110 flgr1d_dilate_2_points_##dtype(lineout,linein,tmpline,1); \
00111 return; \
00112 } \
00113 \
00114 flgr1d_dilate_2_points_##dtype(lineout,linein,tmpline,size/2); \
00115 \
00116 flgr1d_internal_dilate_log_##dtype(lineout,lineout,tmpline,size/2); \
00117 \
00118 if((size%2) == 1) \
00119 flgr1d_dilate_2_points_##dtype(lineout,lineout,tmpline,1)
00120
00121
00122 void flgr1d_internal_dilate_log_fgBIT(FLGR_Data1D *lineout, FLGR_Data1D *linein,
00123 FLGR_Data1D *tmpline, int size) {
00124 FLGR_1D_MACRO_INTERNAL_DILATE_LOG(fgBIT);
00125 }
00126 void flgr1d_internal_dilate_log_fgUINT8(FLGR_Data1D *lineout, FLGR_Data1D *linein,
00127 FLGR_Data1D *tmpline, int size) {
00128 FLGR_1D_MACRO_INTERNAL_DILATE_LOG(fgUINT8);
00129 }
00130 void flgr1d_internal_dilate_log_fgUINT16(FLGR_Data1D *lineout, FLGR_Data1D *linein,
00131 FLGR_Data1D *tmpline, int size) {
00132 FLGR_1D_MACRO_INTERNAL_DILATE_LOG(fgUINT16);
00133 }
00134 void flgr1d_internal_dilate_log_fgUINT32(FLGR_Data1D *lineout, FLGR_Data1D *linein,
00135 FLGR_Data1D *tmpline, int size) {
00136 FLGR_1D_MACRO_INTERNAL_DILATE_LOG(fgUINT32);
00137 }
00138 void flgr1d_internal_dilate_log_fgINT8(FLGR_Data1D *lineout, FLGR_Data1D *linein,
00139 FLGR_Data1D *tmpline, int size) {
00140 FLGR_1D_MACRO_INTERNAL_DILATE_LOG(fgINT8);
00141 }
00142 void flgr1d_internal_dilate_log_fgINT16(FLGR_Data1D *lineout, FLGR_Data1D *linein,
00143 FLGR_Data1D *tmpline, int size) {
00144 FLGR_1D_MACRO_INTERNAL_DILATE_LOG(fgINT16);
00145 }
00146 void flgr1d_internal_dilate_log_fgINT32(FLGR_Data1D *lineout, FLGR_Data1D *linein,
00147 FLGR_Data1D *tmpline, int size) {
00148 FLGR_1D_MACRO_INTERNAL_DILATE_LOG(fgINT32);
00149 }
00150 void flgr1d_internal_dilate_log_fgFLOAT32(FLGR_Data1D *lineout, FLGR_Data1D *linein,
00151 FLGR_Data1D *tmpline, int size) {
00152 FLGR_1D_MACRO_INTERNAL_DILATE_LOG(fgFLOAT32);
00153 }
00154 void flgr1d_internal_dilate_log_fgFLOAT64(FLGR_Data1D *lineout, FLGR_Data1D *linein,
00155 FLGR_Data1D *tmpline, int size) {
00156 FLGR_1D_MACRO_INTERNAL_DILATE_LOG(fgFLOAT64);
00157 }
00158
00159
00160
00161
00162
00163
00164
00165
00166 void flgr1d_erode_log_fgBIT(FLGR_Data1D *lineout, FLGR_Data1D *linein, int size) {
00167 FLGR_Data1D *linetmp = flgr1d_create_signal_from(linein);
00168
00169
00170
00171 flgr1d_internal_erode_log_fgBIT(lineout,linein,linetmp,size);
00172
00173 flgr1d_destroy(linetmp);
00174 }
00175 void flgr1d_erode_log_fgUINT8(FLGR_Data1D *lineout, FLGR_Data1D *linein, int size) {
00176 FLGR_Data1D *linetmp = flgr1d_create_signal_from(linein);
00177
00178
00179
00180 flgr1d_internal_erode_log_fgUINT8(lineout,linein,linetmp,size);
00181
00182 flgr1d_destroy(linetmp);
00183 }
00184 void flgr1d_erode_log_fgUINT16(FLGR_Data1D *lineout, FLGR_Data1D *linein, int size) {
00185 FLGR_Data1D *linetmp = flgr1d_create_signal_from(linein);
00186
00187
00188
00189 flgr1d_internal_erode_log_fgUINT16(lineout,linein,linetmp,size);
00190
00191 flgr1d_destroy(linetmp);
00192 }
00193 void flgr1d_erode_log_fgUINT32(FLGR_Data1D *lineout, FLGR_Data1D *linein, int size) {
00194 FLGR_Data1D *linetmp = flgr1d_create_signal_from(linein);
00195
00196
00197
00198 flgr1d_internal_erode_log_fgUINT32(lineout,linein,linetmp,size);
00199
00200 flgr1d_destroy(linetmp);
00201 }
00202 void flgr1d_erode_log_fgINT8(FLGR_Data1D *lineout, FLGR_Data1D *linein, int size) {
00203 FLGR_Data1D *linetmp = flgr1d_create_signal_from(linein);
00204
00205
00206
00207 flgr1d_internal_erode_log_fgINT8(lineout,linein,linetmp,size);
00208
00209 flgr1d_destroy(linetmp);
00210 }
00211 void flgr1d_erode_log_fgINT16(FLGR_Data1D *lineout, FLGR_Data1D *linein, int size) {
00212 FLGR_Data1D *linetmp = flgr1d_create_signal_from(linein);
00213
00214
00215
00216 flgr1d_internal_erode_log_fgINT16(lineout,linein,linetmp,size);
00217
00218 flgr1d_destroy(linetmp);
00219 }
00220 void flgr1d_erode_log_fgINT32(FLGR_Data1D *lineout, FLGR_Data1D *linein, int size) {
00221 FLGR_Data1D *linetmp = flgr1d_create_signal_from(linein);
00222
00223
00224
00225 flgr1d_internal_erode_log_fgINT32(lineout,linein,linetmp,size);
00226
00227 flgr1d_destroy(linetmp);
00228 }
00229 void flgr1d_erode_log_fgFLOAT32(FLGR_Data1D *lineout, FLGR_Data1D *linein, int size) {
00230 FLGR_Data1D *linetmp = flgr1d_create_signal_from(linein);
00231
00232
00233
00234 flgr1d_internal_erode_log_fgFLOAT32(lineout,linein,linetmp,size);
00235
00236 flgr1d_destroy(linetmp);
00237 }
00238 void flgr1d_erode_log_fgFLOAT64(FLGR_Data1D *lineout, FLGR_Data1D *linein, int size) {
00239 FLGR_Data1D *linetmp = flgr1d_create_signal_from(linein);
00240
00241
00242
00243 flgr1d_internal_erode_log_fgFLOAT64(lineout,linein,linetmp,size);
00244
00245 flgr1d_destroy(linetmp);
00246 }
00248
00259
00260 FLGR_Ret flgr1d_erode_log(FLGR_Data1D *lineout, FLGR_Data1D *linein, int size) {
00261 FLGR_Ret ret;
00262
00263
00264
00265 if((lineout==NULL) || (linein==NULL)) {
00266 POST_ERROR("Null objects!\n");
00267 return FLGR_RET_NULL_OBJECT;
00268 }
00269
00270 if((ret=flgr1d_is_data_same_attributes(lineout,linein,__FUNCTION__))!=FLGR_RET_OK) return ret;
00271
00272 FLGR_DISPATCH_PROCEDURE(lineout->type,flgr1d_erode_log,lineout,linein,size);
00273
00274 }
00275
00276
00277
00278
00279
00280 void flgr1d_dilate_log_fgBIT(FLGR_Data1D *lineout, FLGR_Data1D *linein, int size) {
00281 FLGR_Data1D *linetmp = flgr1d_create_signal_from(linein);
00282
00283
00284
00285 flgr1d_internal_dilate_log_fgBIT(lineout,linein,linetmp,size);
00286
00287 flgr1d_destroy(linetmp);
00288 }
00289 void flgr1d_dilate_log_fgUINT8(FLGR_Data1D *lineout, FLGR_Data1D *linein, int size) {
00290 FLGR_Data1D *linetmp = flgr1d_create_signal_from(linein);
00291
00292
00293
00294 flgr1d_internal_dilate_log_fgUINT8(lineout,linein,linetmp,size);
00295
00296 flgr1d_destroy(linetmp);
00297 }
00298 void flgr1d_dilate_log_fgUINT16(FLGR_Data1D *lineout, FLGR_Data1D *linein, int size) {
00299 FLGR_Data1D *linetmp = flgr1d_create_signal_from(linein);
00300
00301
00302
00303 flgr1d_internal_dilate_log_fgUINT16(lineout,linein,linetmp,size);
00304
00305 flgr1d_destroy(linetmp);
00306 }
00307 void flgr1d_dilate_log_fgUINT32(FLGR_Data1D *lineout, FLGR_Data1D *linein, int size) {
00308 FLGR_Data1D *linetmp = flgr1d_create_signal_from(linein);
00309
00310
00311
00312 flgr1d_internal_dilate_log_fgUINT32(lineout,linein,linetmp,size);
00313
00314 flgr1d_destroy(linetmp);
00315 }
00316 void flgr1d_dilate_log_fgINT8(FLGR_Data1D *lineout, FLGR_Data1D *linein, int size) {
00317 FLGR_Data1D *linetmp = flgr1d_create_signal_from(linein);
00318
00319
00320
00321 flgr1d_internal_dilate_log_fgINT8(lineout,linein,linetmp,size);
00322
00323 flgr1d_destroy(linetmp);
00324 }
00325 void flgr1d_dilate_log_fgINT16(FLGR_Data1D *lineout, FLGR_Data1D *linein, int size) {
00326 FLGR_Data1D *linetmp = flgr1d_create_signal_from(linein);
00327
00328
00329
00330 flgr1d_internal_dilate_log_fgINT16(lineout,linein,linetmp,size);
00331
00332 flgr1d_destroy(linetmp);
00333 }
00334 void flgr1d_dilate_log_fgINT32(FLGR_Data1D *lineout, FLGR_Data1D *linein, int size) {
00335 FLGR_Data1D *linetmp = flgr1d_create_signal_from(linein);
00336
00337
00338
00339 flgr1d_internal_dilate_log_fgINT32(lineout,linein,linetmp,size);
00340
00341 flgr1d_destroy(linetmp);
00342 }
00343 void flgr1d_dilate_log_fgFLOAT32(FLGR_Data1D *lineout, FLGR_Data1D *linein, int size) {
00344 FLGR_Data1D *linetmp = flgr1d_create_signal_from(linein);
00345
00346
00347
00348 flgr1d_internal_dilate_log_fgFLOAT32(lineout,linein,linetmp,size);
00349
00350 flgr1d_destroy(linetmp);
00351 }
00352 void flgr1d_dilate_log_fgFLOAT64(FLGR_Data1D *lineout, FLGR_Data1D *linein, int size) {
00353 FLGR_Data1D *linetmp = flgr1d_create_signal_from(linein);
00354
00355
00356
00357 flgr1d_internal_dilate_log_fgFLOAT64(lineout,linein,linetmp,size);
00358
00359 flgr1d_destroy(linetmp);
00360 }
00362
00373
00374 FLGR_Ret flgr1d_dilate_log(FLGR_Data1D *lineout, FLGR_Data1D *linein, int size) {
00375 FLGR_Ret ret;
00376
00377
00378
00379 if((lineout==NULL) || (linein==NULL)) {
00380 POST_ERROR("Null objects!\n");
00381 return FLGR_RET_NULL_OBJECT;
00382 }
00383
00384 if((ret=flgr1d_is_data_same_attributes(lineout,linein,__FUNCTION__))!=FLGR_RET_OK) return ret;
00385
00386 FLGR_DISPATCH_PROCEDURE(lineout->type,flgr1d_dilate_log,lineout,linein,size);
00387
00388 }
00389
00390
00391
00392
00393
00394
00395
00396
00397
00398
00400
00402 #define FLGR_2D_MACRO_ERODE_LINE_H_LOG(dtype) \
00403 FLGR_Data1D **psrc = datsrc->row; \
00404 FLGR_Data1D **pdest = datdest->row; \
00405 FLGR_Data1D *linetmp = flgr1d_create_signal_from(*pdest); \
00406 int i; \
00407 \
00408 \
00409 \
00410 for(i=0 ; i<datdest->size_y ; i++,psrc++,pdest++) \
00411 flgr1d_internal_erode_log_##dtype(*pdest,*psrc,linetmp,size); \
00412 \
00413 flgr1d_destroy(linetmp)
00414
00415 void flgr2d_erode_line_horizontal_log_fgBIT(FLGR_Data2D *datdest, FLGR_Data2D *datsrc, int size) {
00416 FLGR_2D_MACRO_ERODE_LINE_H_LOG(fgBIT);
00417 }
00418 void flgr2d_erode_line_horizontal_log_fgUINT8(FLGR_Data2D *datdest, FLGR_Data2D *datsrc, int size) {
00419 FLGR_2D_MACRO_ERODE_LINE_H_LOG(fgUINT8);
00420 }
00421 void flgr2d_erode_line_horizontal_log_fgUINT16(FLGR_Data2D *datdest, FLGR_Data2D *datsrc, int size) {
00422 FLGR_2D_MACRO_ERODE_LINE_H_LOG(fgUINT16);
00423 }
00424 void flgr2d_erode_line_horizontal_log_fgUINT32(FLGR_Data2D *datdest, FLGR_Data2D *datsrc, int size) {
00425 FLGR_2D_MACRO_ERODE_LINE_H_LOG(fgUINT32);
00426 }
00427 void flgr2d_erode_line_horizontal_log_fgINT8(FLGR_Data2D *datdest, FLGR_Data2D *datsrc, int size) {
00428 FLGR_2D_MACRO_ERODE_LINE_H_LOG(fgINT8);
00429 }
00430 void flgr2d_erode_line_horizontal_log_fgINT16(FLGR_Data2D *datdest, FLGR_Data2D *datsrc, int size) {
00431 FLGR_2D_MACRO_ERODE_LINE_H_LOG(fgINT16);
00432 }
00433 void flgr2d_erode_line_horizontal_log_fgINT32(FLGR_Data2D *datdest, FLGR_Data2D *datsrc, int size) {
00434 FLGR_2D_MACRO_ERODE_LINE_H_LOG(fgINT32);
00435 }
00436 void flgr2d_erode_line_horizontal_log_fgFLOAT32(FLGR_Data2D *datdest, FLGR_Data2D *datsrc, int size) {
00437 FLGR_2D_MACRO_ERODE_LINE_H_LOG(fgFLOAT32);
00438 }
00439 void flgr2d_erode_line_horizontal_log_fgFLOAT64(FLGR_Data2D *datdest, FLGR_Data2D *datsrc, int size) {
00440 FLGR_2D_MACRO_ERODE_LINE_H_LOG(fgFLOAT64);
00441 }
00443
00454
00455 FLGR_Ret flgr2d_erode_line_horizontal_log(FLGR_Data2D *datdest, FLGR_Data2D *datsrc, int size) {
00456 FLGR_Ret ret;
00457
00458
00459
00460 if((datdest==NULL) || (datsrc==NULL)) {
00461 POST_ERROR("Null objects!\n");
00462 return FLGR_RET_NULL_OBJECT;
00463 }
00464
00465 if((ret=flgr2d_is_data_same_attributes(datdest,datsrc,__FUNCTION__))!=FLGR_RET_OK) return ret;
00466
00467 FLGR_DISPATCH_PROCEDURE(datdest->type,flgr2d_erode_line_horizontal_log,datdest,datsrc,size);
00468
00469 }
00470
00471
00472
00473
00474
00476
00478 #define FLGR_2D_MACRO_DILATE_LINE_H_LOG(dtype) \
00479 FLGR_Data1D **psrc = datsrc->row; \
00480 FLGR_Data1D **pdest = datdest->row; \
00481 FLGR_Data1D *linetmp = flgr1d_create_signal_from(*pdest); \
00482 int i; \
00483 \
00484 \
00485 \
00486 for(i=0 ; i<datdest->size_y ; i++,psrc++,pdest++) \
00487 flgr1d_internal_dilate_log_##dtype(*pdest,*psrc,linetmp,size); \
00488 \
00489 flgr1d_destroy(linetmp)
00490
00491 void flgr2d_dilate_line_horizontal_log_fgBIT(FLGR_Data2D *datdest, FLGR_Data2D *datsrc, int size) {
00492 FLGR_2D_MACRO_DILATE_LINE_H_LOG(fgBIT);
00493 }
00494 void flgr2d_dilate_line_horizontal_log_fgUINT8(FLGR_Data2D *datdest, FLGR_Data2D *datsrc, int size) {
00495 FLGR_2D_MACRO_DILATE_LINE_H_LOG(fgUINT8);
00496 }
00497 void flgr2d_dilate_line_horizontal_log_fgUINT16(FLGR_Data2D *datdest, FLGR_Data2D *datsrc, int size) {
00498 FLGR_2D_MACRO_DILATE_LINE_H_LOG(fgUINT16);
00499 }
00500 void flgr2d_dilate_line_horizontal_log_fgUINT32(FLGR_Data2D *datdest, FLGR_Data2D *datsrc, int size) {
00501 FLGR_2D_MACRO_DILATE_LINE_H_LOG(fgUINT32);
00502 }
00503 void flgr2d_dilate_line_horizontal_log_fgINT8(FLGR_Data2D *datdest, FLGR_Data2D *datsrc, int size) {
00504 FLGR_2D_MACRO_DILATE_LINE_H_LOG(fgINT8);
00505 }
00506 void flgr2d_dilate_line_horizontal_log_fgINT16(FLGR_Data2D *datdest, FLGR_Data2D *datsrc, int size) {
00507 FLGR_2D_MACRO_DILATE_LINE_H_LOG(fgINT16);
00508 }
00509 void flgr2d_dilate_line_horizontal_log_fgINT32(FLGR_Data2D *datdest, FLGR_Data2D *datsrc, int size) {
00510 FLGR_2D_MACRO_DILATE_LINE_H_LOG(fgINT32);
00511 }
00512 void flgr2d_dilate_line_horizontal_log_fgFLOAT32(FLGR_Data2D *datdest, FLGR_Data2D *datsrc, int size) {
00513 FLGR_2D_MACRO_DILATE_LINE_H_LOG(fgFLOAT32);
00514 }
00515 void flgr2d_dilate_line_horizontal_log_fgFLOAT64(FLGR_Data2D *datdest, FLGR_Data2D *datsrc, int size) {
00516 FLGR_2D_MACRO_DILATE_LINE_H_LOG(fgFLOAT64);
00517 }
00519
00530
00531 FLGR_Ret flgr2d_dilate_line_horizontal_log(FLGR_Data2D *datdest, FLGR_Data2D *datsrc, int size) {
00532 FLGR_Ret ret;
00533
00534
00535
00536 if((datdest==NULL) || (datsrc==NULL)) {
00537 POST_ERROR("Null objects!\n");
00538 return FLGR_RET_NULL_OBJECT;
00539 }
00540
00541 if((ret=flgr2d_is_data_same_attributes(datdest,datsrc,__FUNCTION__))!=FLGR_RET_OK) return ret;
00542
00543 FLGR_DISPATCH_PROCEDURE(datdest->type,flgr2d_dilate_line_horizontal_log,datdest,datsrc,size);
00544
00545 }
00546
00547
00548
00549