/*************************************************************************************************************************************/
/*                                                                                                                                   */
/*        D O N N E E S   C O M M U N E S   D ' I M A G E S   D E   T Y P E   ' char '   P O U R                                     */
/*        L ' E T U D E   D E   L A   C O M P L E X I T E   S T R U C T U R E L L E  :                                               */
/*                                                                                                                                   */
/*                                                                                                                                   */
/*        Author of '$xrC/images_1octet.01$vv$I' :                                                                                   */
/*                                                                                                                                   */
/*                    Jean-Francois Colonna (LACTAMME, 20130504120645).                                                              */
/*                                                                                                                                   */
/*************************************************************************************************************************************/

#define   TYPE_OCTET
                                        /* Introduit le 20130730102143...                                                            */

#ifndef   STORE_IMAGE_PLAN
                                        /* Cas des images de type 'char' :                                                           */
#         define    dimXb                                                                                                               \
                              dimX

#         define    DimImages                                                                                                           \
                              gMUL2(dimX,dimY)                                                                                          \
                                        /* Dimension introduit le 20140116110716...                                                  */

#         define    IMAGE_TEMPORAIRE_1                                                                                                  \
                              TypeImage DEFINITION_IMAGE(imageT1,dimY,dimX)                                                             \
                                        /* Introduit le 20140113143958...                                                            */

#         include   "images.01.vv.I"

TypeImage DEFINITION_IMAGE(image,dimY,dimX);

#         define    gLOAD_IMAGE_PLAN(image,x,y)                                                                                         \
                              INDEXATION_IMAGE(image,y,x)
#         define    gLOAD_IMAGE_TORE(image,x,y)                                                                                         \
                              gLOAD_IMAGE_PLAN(image                                                                                    \
                                              ,ADD2(REST(ADD2(REST(SOUS(x,Xmin),dimX),dimX),dimX),Xmin)                                 \
                                              ,ADD2(REST(ADD2(REST(SOUS(y,Ymin),dimY),dimY),dimY),Ymin)                                 \
                                               )
                                        /* Definitions introduites le 20130730092749...                                              */

#         define    gLOAD_IMAGE_PLAN_BIT_OCTET(image,x,y)                                                                               \
                              gLOAD_IMAGE_PLAN(image,x,y)
#         define    gLOAD_IMAGE_TORE_BIT_OCTET(image,x,y)                                                                               \
                              gLOAD_IMAGE_TORE(image,x,y)
                                        /* Definitions introduites le 20130730104256...                                              */

#         define    LOAD_IMAGE_PLAN(x,y)                                                                                                \
                              gLOAD_IMAGE_PLAN(image,x,y)
#         define    LOAD_IMAGE_TORE(x,y)                                                                                                \
                              gLOAD_IMAGE_TORE(image,x,y)
                                        /* Definitions introduites le 20130730092749...                                              */

#         define    LOAD_IMAGE_PLAN_BIT_OCTET(x,y)                                                                                      \
                              gLOAD_IMAGE_PLAN(image,x,y)
#         define    LOAD_IMAGE_TORE_BIT_OCTET(x,y)                                                                                      \
                              gLOAD_IMAGE_TORE(image,x,y)
                                        /* Definitions introduites le 20130730103057...                                              */

#         define    gTRANSFORMATION_NIVEAU(x,y,niveauA,niveauR)                                                                         \
                              COND(niveauA==NOIR                                                                                        \
                                  ,niveauA                                                                                              \
                                  ,niveauR                                                                                              \
                                   )                                                                                                    \
                                        /* Definition introduite le 20130904075353...                                                */

#         ifdef     ENRICHIR_LES_NIVEAUX_NON_NOIRS__METHODE_01
TypeImage niveau_aleatoire_courant=NOIR;
                                        /* Niveau destine a remplacer les niveaux non NOIRs et qui est incremente d'une unite        */
                                        /* avant chaque 'gSTORE_IMAGE_PLAN(...)' de facon a n'etre jamais lui-meme NOIR...           */

#                   define    TRANSFORMATION_NIVEAU(x,y,niveau)                                                                         \
                                        gTRANSFORMATION_NIVEAU(x,y                                                                      \
                                                              ,niveau                                                                   \
                                                              ,COND((niveau_aleatoire_courant==BLANC)                                   \
                                                                   ,(niveau_aleatoire_courant=ADD2(NOIR,1))                             \
                                                                   ,(niveau_aleatoire_courant=ADD2(niveau_aleatoire_courant,1))         \
                                                                    )                                                                   \
                                                               )                                                                        \
                                        /* Definition introduite le 20130902145025...                                                */
#         else
#         endif

#         ifdef     ENRICHIR_LES_NIVEAUX_NON_NOIRS__METHODE_02
#                   define    TRANSFORMATION_NIVEAU(x,y,niveau)                                                                         \
                                        gTRANSFORMATION_NIVEAU(x,y                                                                      \
                                                              ,niveau                                                                   \
                                                              ,COND(((TypeImage)ADD2(x,y))==NOIR                                        \
                                                                   ,ADD2(NOIR,1)                                                        \
                                                                   ,(TypeImage)ADD2(x,y)                                                \
                                                                    )                                                                   \
                                                               )                                                                        \
                                        /* Definition introduite le 20130903150219...                                                */
#         else
#         endif

#         ifdef     ENRICHIR_LES_NIVEAUX_NON_NOIRS__METHODE_12
#                   define    TRANSFORMATION_NIVEAU(x,y,niveau)                                                                         \
                                        gTRANSFORMATION_NIVEAU(x,y                                                                      \
                                                              ,niveau                                                                   \
                                                              ,(TypeImage)ADD2(x,y)                                                     \
                                                               )                                                                        \
                                        /* Definition introduite le 20130904075353...                                                */
#         else
#         endif

#         ifdef     ENRICHIR_LES_NIVEAUX_NON_NOIRS__METHODE_03
#                   define    TRANSFORMATION_NIVEAU(x,y,niveau)                                                                         \
                                        gTRANSFORMATION_NIVEAU(x,y                                                                      \
                                                              ,niveau                                                                   \
                                                              ,COND(((TypeImage)MUL2(x,y))==NOIR                                        \
                                                                   ,ADD2(NOIR,1)                                                        \
                                                                   ,(TypeImage)MUL2(x,y)                                                \
                                                                    )                                                                   \
                                                               )                                                                        \
                                        /* Definition introduite le 20130903150219...                                                */
#         else
#         endif

#         ifdef     ENRICHIR_LES_NIVEAUX_NON_NOIRS__METHODE_13
#                   define    TRANSFORMATION_NIVEAU(x,y,niveau)                                                                         \
                                        gTRANSFORMATION_NIVEAU(x,y                                                                      \
                                                              ,niveau                                                                   \
                                                              ,(TypeImage)MUL2(x,y)                                                     \
                                                               )                                                                        \
                                        /* Definition introduite le 20130904075353...                                                */
#         else
#         endif

#         ifdef     ENRICHIR_LES_NIVEAUX_NON_NOIRS__METHODE_04
#                   define    TRANSFORMATION_NIVEAU(x,y,niveau)                                                                         \
                                        gTRANSFORMATION_NIVEAU(x,y                                                                      \
                                                              ,niveau                                                                   \
                                                              ,COND(((TypeImage)(x))==NOIR                                              \
                                                                   ,ADD2(NOIR,1)                                                        \
                                                                   ,(TypeImage)(x)                                                      \
                                                                    )                                                                   \
                                                               )                                                                        \
                                        /* Definition introduite le 20130904075353...                                                */
#         else
#         endif

#         ifdef     ENRICHIR_LES_NIVEAUX_NON_NOIRS__METHODE_14
#                   define    TRANSFORMATION_NIVEAU(x,y,niveau)                                                                         \
                                        gTRANSFORMATION_NIVEAU(x,y                                                                      \
                                                              ,niveau                                                                   \
                                                              ,(TypeImage)(x)                                                           \
                                                               )                                                                        \
                                        /* Definition introduite le 20130904075353...                                                */
#         else
#         endif

#         ifdef     ENRICHIR_LES_NIVEAUX_NON_NOIRS__METHODE_05
#                   define    TRANSFORMATION_NIVEAU(x,y,niveau)                                                                         \
                                        gTRANSFORMATION_NIVEAU(x,y                                                                      \
                                                              ,niveau                                                                   \
                                                              ,COND(((TypeImage)(y))==NOIR                                              \
                                                                   ,ADD2(NOIR,1)                                                        \
                                                                   ,(TypeImage)(y)                                                      \
                                                                    )                                                                   \
                                                               )                                                                        \
                                        /* Definition introduite le 20130904075353...                                                */
#         else
#         endif

#         ifdef     ENRICHIR_LES_NIVEAUX_NON_NOIRS__METHODE_15
#                   define    TRANSFORMATION_NIVEAU(x,y,niveau)                                                                         \
                                        gTRANSFORMATION_NIVEAU(x,y                                                                      \
                                                              ,niveau                                                                   \
                                                              ,(TypeImage)(y)                                                           \
                                                               )                                                                        \
                                        /* Definition introduite le 20130904075353...                                                */
#         else
#         endif

#         ifdef     ENRICHIR_LES_NIVEAUX_NON_NOIRS__METHODE_06
#                   define    TRANSFORMATION_NIVEAU(x,y,niveau)                                                                         \
                                        gTRANSFORMATION_NIVEAU(x,y                                                                      \
                                                              ,niveau                                                                   \
                                                              ,COND(((TypeImage)MUL2(x,y))==NOIR                                        \
                                                                   ,ADD2(NOIR,1)                                                        \
                                                                   ,(TypeImage)OUEX(x,y)                                                \
                                                                    )                                                                   \
                                                               )                                                                        \
                                        /* Definition introduite le 20150820212758...                                                */
#         else
#         endif

#         ifdef     ENRICHIR_LES_NIVEAUX_NON_NOIRS__METHODE_16
#                   define    TRANSFORMATION_NIVEAU(x,y,niveau)                                                                         \
                                        gTRANSFORMATION_NIVEAU(x,y                                                                      \
                                                              ,niveau                                                                   \
                                                              ,(TypeImage)OUEX(x,y)                                                     \
                                                               )                                                                        \
                                        /* Definition introduite le 20150820212758...                                                */
#         else
#         endif

#         ifdef     ENRICHIR_LES_NIVEAUX_NON_NOIRS__METHODE_07
#                   define    TRANSFORMATION_NIVEAU(x,y,niveau)                                                                         \
                                        gTRANSFORMATION_NIVEAU(x,y                                                                      \
                                                              ,niveau                                                                   \
                                                              ,COND(((TypeImage)MUL2(x,y))==NOIR                                        \
                                                                   ,ADD2(NOIR,1)                                                        \
                                                                   ,(TypeImage)OUIN(x,y)                                                \
                                                                    )                                                                   \
                                                               )                                                                        \
                                        /* Definition introduite le 20150820212758...                                                */
#         else
#         endif

#         ifdef     ENRICHIR_LES_NIVEAUX_NON_NOIRS__METHODE_17
#                   define    TRANSFORMATION_NIVEAU(x,y,niveau)                                                                         \
                                        gTRANSFORMATION_NIVEAU(x,y                                                                      \
                                                              ,niveau                                                                   \
                                                              ,(TypeImage)OUIN(x,y)                                                     \
                                                               )                                                                        \
                                        /* Definition introduite le 20150820212758...                                                */
#         else
#         endif

#         ifdef     ENRICHIR_LES_NIVEAUX_NON_NOIRS__METHODE_08
#                   define    TRANSFORMATION_NIVEAU(x,y,niveau)                                                                         \
                                        gTRANSFORMATION_NIVEAU(x,y                                                                      \
                                                              ,niveau                                                                   \
                                                              ,COND(((TypeImage)MUL2(x,y))==NOIR                                        \
                                                                   ,ADD2(NOIR,1)                                                        \
                                                                   ,(TypeImage)ETLO(x,y)                                                \
                                                                    )                                                                   \
                                                               )                                                                        \
                                        /* Definition introduite le 20150820212758...                                                */
#         else
#         endif

#         ifdef     ENRICHIR_LES_NIVEAUX_NON_NOIRS__METHODE_18
#                   define    TRANSFORMATION_NIVEAU(x,y,niveau)                                                                         \
                                        gTRANSFORMATION_NIVEAU(x,y                                                                      \
                                                              ,niveau                                                                   \
                                                              ,(TypeImage)ETLO(x,y)                                                     \
                                                               )                                                                        \
                                        /* Definition introduite le 20150820212758...                                                */
#         else
#         endif

#         ifdef     ENRICHIR_LES_NIVEAUX_NON_NOIRS__METHODE_09
#                   define    TRANSFORMATION_NIVEAU(x,y,niveau)                                                                         \
                                        gTRANSFORMATION_NIVEAU(x,y                                                                      \
                                                              ,niveau                                                                   \
                                                              ,(TypeImage)SOUS(x,y)                                                     \
                                                               )                                                                        \
                                        /* Definition introduite le 20150909130905...                                                */
#         else
#         endif

#         ifdef     QUANTIFIER_LES_NIVEAUX___METHODE_01

#                   ifndef    QUANTIFICATEUR
#                             define    QUANTIFICATEUR                                                                                  \
                                                  (1)
#                   else
#                   endif

int       quantificateur=QUANTIFICATEUR;
double    renormalisateur=gDIVI((double)BLANC,(double)gMUL2(gDIVI(BLANC,QUANTIFICATEUR),QUANTIFICATEUR));
                                        /* Le renormalisateur introduit le 20130910144143 permet de garantir l'acces a 'BLANC'...    */

#                   define    TRANSFORMATION_NIVEAU(x,y,niveau)                                                                         \
                                        MUL2(renormalisateur,MUL2(DIVI(niveau,quantificateur),quantificateur))                          \
                                        /* Definition introduite le 20130909143521...                                                */
#         else
#         endif

#         ifndef    TRANSFORMATION_NIVEAU
#                   define    TRANSFORMATION_NIVEAU(x,y,niveau)                                                                         \
                                        (niveau)                                                                                        \
                                        /* Definition introduite le 20130902142725...                                                */
#         else
#         endif

#         ifdef     DUPLICATION_POINT__METHODE_01

#                   ifndef    DELTA_X
#                             define    DELTA_X                                                                                         \
                                                  (0)
#                   else
#                   endif

#                   ifndef    DELTA_Y
#                             define    DELTA_Y                                                                                         \
                                                  (0)
#                   else
#                   endif

int       delta_X=DELTA_X;
int       delta_Y=DELTA_Y;

#                   define    DUPLICATION_POINT(sequence_rangement_point)                                                               \
                                        {                                                                                               \
                                        int       Xpave=Xplan;                                                                          \
                                        int       Ypave=Yplan;                                                                          \
                                                  {                                                                                     \
                                                  int       Xplan;                                                                      \
                                                  int       Yplan;                                                                      \
                                                                                                                                        \
                                                  for       (Xplan=(Xpave-delta_X) ; Xplan <= (Xpave+delta_X) ; Xplan++)                \
                                                            {                                                                           \
                                                            for       (Yplan=(Ypave-delta_Y) ; Yplan <= (Ypave+delta_Y) ; Yplan++)      \
                                                                      {                                                                 \
                                                                      if        (         ((Xplan >= Xmin) && (Xplan <= Xmax))          \
                                                                                &&        ((Yplan >= Ymin) && (Yplan <= Ymax))          \
                                                                                 )                                                      \
                                                                                {                                                       \
                                                                                sequence_rangement_point                                \
                                                                                }                                                       \
                                                                      else                                                              \
                                                                                {                                                       \
                                                                                }                                                       \
                                                                      }                                                                 \
                                                            }                                                                           \
                                                  }                                                                                     \
                                        }                                                                                               \
                                        /* Definition introduite le 20130916143624...                                                */
#         else
#         endif

#         ifndef    DUPLICATION_POINT
#                   define    DUPLICATION_POINT(sequence_rangement_point)                                                               \
                                        {                                                                                               \
                                        sequence_rangement_point                                                                        \
                                        }                                                                                               \
                                        /* Definition introduite le 20130916143153...                                                */
#         else
#         endif

#         define    gSTORE_IMAGE_PLAN(image,x,y,niveau)                                                                                 \
                              {                                                                                                         \
                              int       Xplan=x;                                                                                        \
                              int       Yplan=y;                                                                                        \
                                        /* Les variables {Xplan,Yplan} ont ete introduites le 20130916143624 a cause de la           */ \
                                        /* procedure 'DUPLICATION_POINT(...)' afin de pouvoir les redefinir explicitement et         */ \
                                        /* et donc de pouvoir iterer dessus a l'interieur de 'DUPLICATION_POINT(...)'...             */ \
                                                                                                                                        \
                              DUPLICATION_POINT(INDEXATION_IMAGE(image,Yplan,Xplan) = TRANSFORMATION_NIVEAU(Xplan,Yplan,niveau);)       \
                              }
#         define    gSTORE_IMAGE_TORE(image,x,y,niveau)                                                                                 \
                              {                                                                                                         \
                              int       Xtore=ADD2(REST(ADD2(REST(SOUS(x,Xmin),dimX),dimX),dimX),Xmin);                                 \
                              int       Ytore=ADD2(REST(ADD2(REST(SOUS(y,Ymin),dimY),dimY),dimY),Ymin);                                 \
                                                                                                                                        \
                              gSTORE_IMAGE_PLAN(image,Xtore,Ytore,niveau);                                                              \
                                        /* L'espace [Xmin,Xmax]x[Ymin,Ymax] est torique et ce afin de garantir le nombre de points   */ \
                                        /* marques dans une image (introduit le 20130505091302). On notera le double 'REST(...)'     */ \
                                        /* destine a garantir que le calcul donne un nombre positif...                               */ \
                              }

#         define    STORE_IMAGE_PLAN(x,y,niveau)                                                                                        \
                              {                                                                                                         \
                              gSTORE_IMAGE_PLAN(image,x,y,niveau);                                                                      \
                              }
#         define    STORE_IMAGE_TORE(x,y,niveau)                                                                                        \
                              {                                                                                                         \
                              gSTORE_IMAGE_TORE(image,x,y,niveau);                                                                      \
                              }

#         define    ACCES_IMAGE_REELLE(nom_de_l_image_reelle)                                                                           \
                                        /* On notera que 'image_reelle' ne peut etre un argument ci-dessus a cause de l'usage de     */ \
                                        /* cette procedure 'ACCES_IMAGE_REELLE(...)' dans 'MAIN(...)' qui n'autorise pas la          */ \
                                        /* presence de virgules a l'interieur de son argument...                                     */ \
                              {                                                                                                         \
                              FILE                *Fdescripteur;                                                                        \
                                                                                                                                        \
                              Fdescripteur = fopen(nom_de_l_image_reelle,"r");                                                          \
                              fread(image_reelle,1,GDimImages,Fdescripteur);                                                            \
                                        /* Le 20140127115547, 'GDimImages' a remplace 'DimImages' par "symetrie" avec ce qui         */ \
                                        /* est fait dans 'v $xrC/images_1bit.01$vv$I GDimImages'...                                  */ \
                                                                                                                                        \
                              INITIALISATION_IMAGE(image_reelle[((y-Ymin)*dimX) + (x-Xmin)]);                                           \
                              }                                                                                                         \
                                        /* Procedure introduite le 20130626112654...                                                 */
#         define    ACCES_IMAGE_SYNTHETIQUE(nom_de_l_image_synthetique)                                                                 \
                              {                                                                                                         \
                              ACCES_IMAGE_REELLE(nom_de_l_image_synthetique);                                                           \
                              }                                                                                                         \
                                        /* Procedure introduite le 20150128100429...                                                 */

#         ifdef     NE_PAS_SORTIR_LE_FICHIER_IMAGE
#                   define    SORTIE_DU_FICHIER_IMAGE                                                                                   \
                                        {                                                                                               \
                                        }
#         else
#                   define    SORTIE_DU_FICHIER_IMAGE                                                                                   \
                                        {                                                                                               \
                                        CONVOLUTION_IMAGE;                                                                              \
                                        TRANSFORMATION_IMAGE;                                                                           \
                                        /* Les transformations ont ete introduites le 20140113114557...                              */ \
                                                                                                                                        \
                                        write(STDOUT,image,DimImages);                                                                  \
                                        }
#         endif
#else
                                        /* Cas des images de type 'bit'...                                                           */
#endif




Copyright © Jean-François Colonna, 2013-2021.
Copyright © CMAP (Centre de Mathématiques APpliquées) UMR CNRS 7641 / Ecole Polytechnique, 2013-2021.