Changeset 777 for soft/giet_vm/applications/rosenfeld/src
- Timestamp:
- Feb 4, 2016, 6:25:22 PM (9 years ago)
- Location:
- soft/giet_vm/applications/rosenfeld/src
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
soft/giet_vm/applications/rosenfeld/src/ecc_common.c
r772 r777 5 5 #include <stdio.h> 6 6 #include <stdlib.h> 7 #include <string.h> 7 8 #include <math.h> 8 9 … … 310 311 char complete_filename[64]; 311 312 312 s printf(complete_filename, "%s.dot", filename);313 snprintf(complete_filename, 64, "%s.dot", filename); 313 314 314 315 fd = open(complete_filename, O_CREAT | O_TRUNC); … … 330 331 char complete_filename[64]; 331 332 332 s printf(complete_filename, "%s.dot", filename);333 snprintf(complete_filename, 64, "%s.dot", filename); 333 334 334 335 … … 351 352 char complete_filename[64]; 352 353 353 s printf(complete_filename, "%s.dot", filename);354 snprintf(complete_filename, 64, "%s.dot", filename); 354 355 355 356 … … 403 404 char complete_filename[64]; 404 405 405 s printf(complete_filename, "%s.dot", filename);406 snprintf(complete_filename, 64, "%s.dot", filename); 406 407 407 408 -
soft/giet_vm/applications/rosenfeld/src/ecc_generation.c
r772 r777 58 58 generate_granularity_density_float(X, i0, i1, j0, j1, granularity, (float) density, seed); 59 59 } 60 // --------------------------------------------------------------------------------------------- 61 void generate_granularity_density_name(char *name, int granularity, int density, char *filename )62 // --------------------------------------------------------------------------------------------- 63 { 64 s printf(filename, "%s_%02d_%03d.pgm", name, granularity, density);65 } 66 // ------------------------------------------------------------------------------------------------------------------ 67 void generate_granularity_density_ext_name(char *name, int granularity, int density, char *extension, char *filename )68 // ------------------------------------------------------------------------------------------------------------------ 69 { 70 s printf(filename, "%s_%02d_%03d.%s", name, granularity, density, extension);71 } 72 // ------------------------------------------------------------------------------------------------------------ 73 void generate_size_granularity_density_name(char *name, int size, int granularity, int density, char *filename )74 // ------------------------------------------------------------------------------------------------------------ 75 { 76 s printf(filename, "%s_%d_%02d_%03d.pgm", name, size, granularity, density);77 } 78 // --------------------------------------------------------------------------------------------------------------------------------- 79 void generate_size_granularity_density_ext_name(char *name, int size, int granularity, int density, char *extension, char *filename )80 // --------------------------------------------------------------------------------------------------------------------------------- 81 { 82 s printf(filename, "%s_%d_%02d_%03d.%s", name, size, granularity, density, extension);83 } 84 // --------------------------------------------------------------------------------------- 85 void generate_size_granularity_name(char *name, int size, int granularity, char *filename )86 // --------------------------------------------------------------------------------------- 87 { 88 s printf(filename, "%s_%d_%02d.pgm", name, size, granularity);89 }// ------------------------------------------------------------------------------ 90 void generate_name100(char *name, int granularity, float density, char *filename )91 // ------------------------------------------------------------------------------ 60 // --------------------------------------------------------------------------------------------------------- 61 void generate_granularity_density_name(char *name, int granularity, int density, char *filename, int maxlen) 62 // --------------------------------------------------------------------------------------------------------- 63 { 64 snprintf(filename, maxlen, "%s_%02d_%03d.pgm", name, granularity, density); 65 } 66 // ------------------------------------------------------------------------------------------------------------------------------ 67 void generate_granularity_density_ext_name(char *name, int granularity, int density, char *extension, char *filename, int maxlen) 68 // ------------------------------------------------------------------------------------------------------------------------------ 69 { 70 snprintf(filename, maxlen, "%s_%02d_%03d.%s", name, granularity, density, extension); 71 } 72 // ------------------------------------------------------------------------------------------------------------------------ 73 void generate_size_granularity_density_name(char *name, int size, int granularity, int density, char *filename, int maxlen) 74 // ------------------------------------------------------------------------------------------------------------------------ 75 { 76 snprintf(filename, maxlen, "%s_%d_%02d_%03d.pgm", name, size, granularity, density); 77 } 78 // --------------------------------------------------------------------------------------------------------------------------------------------- 79 void generate_size_granularity_density_ext_name(char *name, int size, int granularity, int density, char *extension, char *filename, int maxlen) 80 // --------------------------------------------------------------------------------------------------------------------------------------------- 81 { 82 snprintf(filename, maxlen, "%s_%d_%02d_%03d.%s", name, size, granularity, density, extension); 83 } 84 // --------------------------------------------------------------------------------------------------- 85 void generate_size_granularity_name(char *name, int size, int granularity, char *filename, int maxlen) 86 // --------------------------------------------------------------------------------------------------- 87 { 88 snprintf(filename, maxlen, "%s_%d_%02d.pgm", name, size, granularity); 89 }// ----------------------------------------------------------------------------------------- 90 void generate_name100(char *name, int granularity, float density, char *filename, int maxlen) 91 // ------------------------------------------------------------------------------------------ 92 92 { 93 93 // density en pourcentage: 0:100 94 94 // mais aussi <1, par exe 0.01 95 95 int d = (int) ceil(100 * density); 96 s printf(filename, "%s_%02d_%05d.pgm", name, granularity, d);96 snprintf(filename, maxlen, "%s_%02d_%05d.pgm", name, granularity, d); 97 97 } 98 98 // ---------------------------------------- … … 128 128 for(d=dmin; d<=dmax; d+=dstep) { 129 129 generate_granularity_density_int(X, 0, n-1, 0, n-1, g, d, seed); 130 generate_granularity_density_name("I", g, d, filename );130 generate_granularity_density_name("I", g, d, filename, 32); 131 131 printf(filename); 132 132 bin2gray_ui8matrix(X, 0, n-1, 0, n-1, X255); … … 256 256 X255 = ui8matrix(0, h-1, 0, w-1); 257 257 258 s printf(filename, "spirale_simple_%d.pgm", n);258 snprintf(filename, 128, "spirale_simple_%d.pgm", n); 259 259 spirale_simple(X, h, w); 260 260 bin2gray_ui8matrix(X, 0, h-1, 0, w-1, X255); 261 261 SavePGM_ui8matrix(X255, 0, h-1, 0, w-1, filename); 262 262 263 s printf(filename, "spirale_double_%d.pgm", n);263 snprintf(filename, 128, "spirale_double_%d.pgm", n); 264 264 spirale_double(X, h, w); 265 265 bin2gray_ui8matrix(X, 0, h-1, 0, w-1, X255); … … 306 306 307 307 generate_granularity_density_float(X, 0, h-1, 0, w-1, g, d, seed); 308 generate_granularity_density_name("HGH", g, d, filename );308 generate_granularity_density_name("HGH", g, d, filename, 32); 309 309 printf(filename); 310 310 bin2gray_ui8matrix(X, 0, h-1, 0, w-1, X255); -
soft/giet_vm/applications/rosenfeld/src/ecc_main_rosenfeld_sa.c
r772 r777 105 105 binarisation_ui8matrix(X0, i0, i1, j0, j1, 1, 1, X); // pour le traitement 106 106 binarisation_ui8matrix(X0, i0, i1, j0, j1, 1, 255, X0); // pour la verif visuelle 107 generate_path_filename(dst_path, "verif.pgm", complete_filename );107 generate_path_filename(dst_path, "verif.pgm", complete_filename, 1024); 108 108 SavePGM_ui8matrix(X0, i0, i1, j0, j1, complete_filename); 109 109 display_ui8matrix_positive(X, i0, i1, j0, j1, 3, "X"); … … 131 131 // traitement: desactiver FlattenL dans Rosenfeld 132 132 // pour voir l'image d'etiquettes sans re-etiquetage 133 na = Rosenfeld_UF_Org1_4C(X, height, width, E32, T, A, nemax, Stats); ECC_VERBOSE(printf("na = %d\n", na)); filename = "Rosenfeld_UF_Org1_4C.bmp"; mod_ui32matrix_ui8matrix(E32, i0, i1, j0, j1, E8); generate_path_filename(dst_path, filename, complete_filename ); SaveBMP2_ui8matrix(E8, width, height, palette, complete_filename); display_ui32matrix_positive(E32,i0, i1, j0, j1, 3, "E1"); zero_ui32matrix(E32, i0-border, i1+border, j0-border, j1+border); display_RegionStatsVector(Stats, 1, na, "Stats"); zero_RegionStatsVector(Stats, 0, nemax);134 135 136 na = Rosenfeld_UF_Org1_8C(X, height, width, E32, T, A, nemax, Stats); ECC_VERBOSE(printf("na = %d\n", na)); filename = "Rosenfeld_UF_Org1_8C.bmp"; mod_ui32matrix_ui8matrix(E32, i0, i1, j0, j1, E8); generate_path_filename(dst_path, filename, complete_filename ); SaveBMP2_ui8matrix(E8, width, height, palette, complete_filename); display_ui32matrix_positive(E32,i0, i1, j0, j1, 3, "E1"); zero_ui32matrix(E32, i0-border, i1+border, j0-border, j1+border); display_RegionStatsVector(Stats, 1, na, "Stats"); zero_RegionStatsVector(Stats, 0, nemax);137 138 139 na = Rosenfeld_UF_Org2_4C(X, height, width, E32, T, A, nemax, Stats); ECC_VERBOSE(printf("na = %d\n", na)); filename = "Rosenfeld_UF_Org2_4C.bmp"; mod_ui32matrix_ui8matrix(E32, i0, i1, j0, j1, E8); generate_path_filename(dst_path, filename, complete_filename ); SaveBMP2_ui8matrix(E8, width, height, palette, complete_filename); display_ui32matrix_positive(E32,i0, i1, j0, j1, 3, "E1"); zero_ui32matrix(E32, i0-border, i1+border, j0-border, j1+border); display_RegionStatsVector(Stats, 1, na, "Stats"); zero_RegionStatsVector(Stats, 0, nemax);133 na = Rosenfeld_UF_Org1_4C(X, height, width, E32, T, A, nemax, Stats); ECC_VERBOSE(printf("na = %d\n", na)); filename = "Rosenfeld_UF_Org1_4C.bmp"; mod_ui32matrix_ui8matrix(E32, i0, i1, j0, j1, E8); generate_path_filename(dst_path, filename, complete_filename, 1024); SaveBMP2_ui8matrix(E8, width, height, palette, complete_filename); display_ui32matrix_positive(E32,i0, i1, j0, j1, 3, "E1"); zero_ui32matrix(E32, i0-border, i1+border, j0-border, j1+border); display_RegionStatsVector(Stats, 1, na, "Stats"); zero_RegionStatsVector(Stats, 0, nemax); 134 135 136 na = Rosenfeld_UF_Org1_8C(X, height, width, E32, T, A, nemax, Stats); ECC_VERBOSE(printf("na = %d\n", na)); filename = "Rosenfeld_UF_Org1_8C.bmp"; mod_ui32matrix_ui8matrix(E32, i0, i1, j0, j1, E8); generate_path_filename(dst_path, filename, complete_filename, 1024); SaveBMP2_ui8matrix(E8, width, height, palette, complete_filename); display_ui32matrix_positive(E32,i0, i1, j0, j1, 3, "E1"); zero_ui32matrix(E32, i0-border, i1+border, j0-border, j1+border); display_RegionStatsVector(Stats, 1, na, "Stats"); zero_RegionStatsVector(Stats, 0, nemax); 137 138 139 na = Rosenfeld_UF_Org2_4C(X, height, width, E32, T, A, nemax, Stats); ECC_VERBOSE(printf("na = %d\n", na)); filename = "Rosenfeld_UF_Org2_4C.bmp"; mod_ui32matrix_ui8matrix(E32, i0, i1, j0, j1, E8); generate_path_filename(dst_path, filename, complete_filename, 1024); SaveBMP2_ui8matrix(E8, width, height, palette, complete_filename); display_ui32matrix_positive(E32,i0, i1, j0, j1, 3, "E1"); zero_ui32matrix(E32, i0-border, i1+border, j0-border, j1+border); display_RegionStatsVector(Stats, 1, na, "Stats"); zero_RegionStatsVector(Stats, 0, nemax); 140 140 141 141 // free … … 188 188 189 189 Palette_18ColorsBW(palette); 190 generate_path_filename(pathSrc, filename, complete_filename );190 generate_path_filename(pathSrc, filename, complete_filename, 1024); 191 191 192 192 // chargement d'une image depuis le disque … … 206 206 binarisation_ui8matrix(X0, i0, i1, j0, j1, 20, 1, X); // pour le traitement 207 207 binarisation_ui8matrix(X0, i0, i1, j0, j1, 20, 255, X0); // pour la verif visuelle 208 generate_path_filename(pathDst, "verif.pgm", complete_filename );208 generate_path_filename(pathDst, "verif.pgm", complete_filename, 1024); 209 209 SavePGM_ui8matrix(X0, i0, i1, j0, j1, complete_filename); 210 210 … … 236 236 filename = "Rosenfeld_UF_Org1_8C.bmp"; 237 237 mod_ui32matrix_ui8matrix(E32, i0, i1, j0, j1, E8); 238 generate_path_filename(pathDst, filename, complete_filename );238 generate_path_filename(pathDst, filename, complete_filename, 1024); 239 239 SaveBMP2_ui8matrix(E8, width, height, palette, complete_filename); 240 240 zero_ui32matrix(E32, i0 - border, i1 + border, j0 - border, j1 + border); -
soft/giet_vm/applications/rosenfeld/src/str_ext.c
r772 r777 9 9 #include <stdio.h> 10 10 #include <stdlib.h> 11 #include <string.h> 11 12 12 13 #include "nrc_os_config.h"
Note: See TracChangeset
for help on using the changeset viewer.