/* ------------------------ */ /* --- ecc_generation.c --- */ /* ------------------------ */ #include #include #include #ifdef CLI #include "nrc_os_config.h" #include "nrc.h" #endif #include "lutNR.h" // pour conversion 0,1 <-> 0,255 #include "ecc_common.h" #include "ecc_features.h" #include "mt19937.h" // Mersenne Twister generator #include "ecc_generation.h" // ------------------------------------------------------------------------------------------------------------------------- void generate_granularity_density_float(uint8 **X, int i0, int i1, int j0, int j1, int granularity, float density, int seed) // ------------------------------------------------------------------------------------------------------------------------- { uint8 x; int i, j; int di, dj; double r; //srand(seed); // pour toujours generer les meme sequences init_genrand(seed); for(i=i0; i<=i1; i+=granularity) { for(j=j0; j<=j1; j+=granularity) { //r = 100.0*(double)rand() / rmax; //r = 100.0*(double)rand() / rmax; r = 100.0*(double)genrand_real2(); if(r <= density) x = 1; else x = 0; for(di=0; dins; // ne_segment = label->nea; // na_segment = label->na; // nb_concavity = ne_segment - na_segment; // nb_step = ne_pixel - ne_segment; // printf("%3d", d); // printf("%8d", np_pixel); // printf("%8d", ne_pixel); // printf("%8d", na_pixel); // printf("%6s", ""); // printf("%8d", ns_segment); // printf("%8d", ne_segment); // printf("%8d", na_segment); // printf("%6s", ""); // printf("%8d", nb_concavity); // printf("%8d", nb_step); // printf(""); // } // printf(""); // } // free_ui8matrix(X, 0-border, n-1+border, 0-border, n-1+border); // free_ui8matrix(X255, 0-border, n-1+border, 0-border, n-1+border); return 0; } // -------------------------- void test_generation_mt(void) // -------------------------- { int i, n = 32; printf("---------------------------"); printf("-- test_mersenne_twister --"); printf("---------------------------"); init_genrand(0); for(i=0; i