/*************************************************************************************************************************************/
/*                                                                                                                                   */
/*        P A S S A G E   D E S   V R A I E S   A U X   F A U S S E S   C O U L E U R S                                              */
/*        P A R   A P P R O X I M A T I O N   E T   U T I L I S A T I O N   D U   ' H L S '                                          */
/*        ( S E C O N D E   M E T H O D E   P A R   S O U S -  E C H A N T I L L O N N A G E   D E S    I M A G E S )  :             */
/*                                                                                                                                   */
/*                                                                                                                                   */
/*        Definition :                                                                                                               */
/*                                                                                                                                   */
/*                    Cette commande calcule une image                                                                               */
/*                  en fausses couleurs a partir de ses                                                                              */
/*                  trois composantes par utilisation du 'HLS'.                                                                      */
/*                                                                                                                                   */
/*                                                                                                                                   */
/*        Author of '$xci/faux_HLS.03$K' :                                                                                           */
/*                                                                                                                                   */
/*                    Jean-Francois COLONNA (LACTAMME, 1989??????????).                                                              */
/*                                                                                                                                   */
/*************************************************************************************************************************************/

/*===================================================================================================================================*/
/*************************************************************************************************************************************/
/*                                                                                                                                   */
/*        I N T E R F A C E   ' listG '  :                                                                                           */
/*                                                                                                                                   */
/*                                                                                                                                   */
/*        :Debut_listG:                                                                                                              */
/*        :Fin_listG:                                                                                                                */
/*                                                                                                                                   */
/*************************************************************************************************************************************/

/*===================================================================================================================================*/
/*************************************************************************************************************************************/
/*                                                                                                                                   */
/*        D I R E C T I V E S   S P E C I F I Q U E S   D E   C O M P I L A T I O N  :                                               */
/*                                                                                                                                   */
/*************************************************************************************************************************************/

/*===================================================================================================================================*/
/*************************************************************************************************************************************/
/*                                                                                                                                   */
/*        F I C H I E R S   D ' I N C L U D E S  :                                                                                   */
/*                                                                                                                                   */
/*************************************************************************************************************************************/
#include  INCLUDES_BASE
#include  image_image_QUAD_IMAGE_EXT

/*===================================================================================================================================*/
/*************************************************************************************************************************************/
/*                                                                                                                                   */
/*        P A R A M E T R E S  :                                                                                                     */
/*                                                                                                                                   */
/*************************************************************************************************************************************/
#define   SPHERE_DE_VOISINAGE                                                                                                           \
                    FU                                                                                                                  \
                                        /* Carre du rayon de la sphere de voisinage.                                                 */
#define   PONDERATION_HUE                                                                                                               \
                    FU                                                                                                                  \
                                        /* Afin de ponderer la teinte par rapport aux autres quantites (H,L,S) ; plus cette          */ \
                                        /* valeur est grande, plus la luminance a d'importance (cf. 'MUL2').                         */
#define   PONDERATION_LUMINANCE                                                                                                         \
                    FU                                                                                                                  \
                                        /* Afin de ponderer la luminance par rapport aux autres quantites (H,L,S) ; plus cette       */ \
                                        /* valeur est grande, plus la luminance a d'importance (cf. 'MUL2').                         */
#define   PONDERATION_SATURATION                                                                                                        \
                    FU                                                                                                                  \
                                        /* Afin de ponderer la saturation par rapport aux autres quantites (H,L,S) ; plus cette      */ \
                                        /* valeur est grande, plus la luminance a d'importance (cf. 'MUL2').                         */

/*===================================================================================================================================*/
/*************************************************************************************************************************************/
/*                                                                                                                                   */
/*        M A C R O S   U T I L E S  :                                                                                               */
/*                                                                                                                                   */
/*************************************************************************************************************************************/
#include  xci/luminance.01.I"

/*===================================================================================================================================*/
/*************************************************************************************************************************************/
/*                                                                                                                                   */
/*        P A S S A G E   D E S   V R A I E S   A U X   F A U S S E S   C O U L E U R S  :                                           */
/*                                                                                                                                   */
/*************************************************************************************************************************************/
BCommande(nombre_d_arguments,arguments)
/*-----------------------------------------------------------------------------------------------------------------------------------*/
     Bblock
     DEFV(CHAR,INIC(POINTERc(nom_imageR),NOM_PIPE));
                                        /* Nom de l'image a generer.                                                                 */
     DEFV(CHAR,INIC(POINTERc(nom_paletteA),NOM_PIPE));
                                        /* Nom de la palette a utiliser.                                                             */
     DEFV(CHAR,INIC(POINTERc(nom_imageA),NOM_UNDEF));
                                        /* Nom de l'image {ROUGE,VERTE,BLEUE} a utiliser (ce mode "RVB" implicite a ete introduit    */
                                        /* le 20050920154318).                                                                       */
     DEFV(CHAR,INIC(POINTERc(nom_imageAR),NOM_PIPE));
                                        /* Nom de l'image ROUGE a utiliser,                                                          */
     DEFV(CHAR,INIC(POINTERc(nom_imageAV),NOM_PIPE));
                                        /* Nom de l'image VERTE a utiliser,                                                          */
     DEFV(CHAR,INIC(POINTERc(nom_imageAB),NOM_PIPE));
                                        /* Nom de l'image BLEUE a utiliser.                                                          */
     DEFV(Float,INIT(sphere_de_voisinage,SPHERE_DE_VOISINAGE));
                                        /* Definition du carre du rayon de la sphere de voisinage des points de l'espace 'HLS'.      */
     DEFV(Float,INIT(ponderation_Hue,PONDERATION_HUE));
                                        /* Afin de ponderer 'H' par rapport a (H,L,S),                                               */
     DEFV(Float,INIT(ponderation_Luminance,PONDERATION_LUMINANCE));
                                        /* Afin de ponderer 'L' par rapport a (H,L,S),                                               */
     DEFV(Float,INIT(ponderation_Saturation,PONDERATION_SATURATION));
                                        /* Afin de ponderer 'S' par rapport a (H,L,S).                                               */
     /*..............................................................................................................................*/
     GET_ARGUMENTSi(nombre_d_arguments
                   ,BLOC(GET_ARGUMENT_C("imageR=""R=",nom_imageR);
                         GET_ARGUMENT_C("imageA=""A=",nom_imageA);
                         GET_ARGUMENT_C("Rouge=""ROUGE=""AR=",nom_imageAR);
                         GET_ARGUMENT_C("Verte=""VERTE=""AV=",nom_imageAV);
                         GET_ARGUMENT_C("Bleue=""BLEUE=""AB=",nom_imageAB);
                         GET_ARGUMENT_C("paletteA=""palette=""pA=""p=",nom_paletteA);
                         GET_ARGUMENT_F("v=",sphere_de_voisinage);
                         GET_ARGUMENT_F("teinte=""hue=""h=""H=",ponderation_Hue);
                         GET_ARGUMENT_F("luminance=""l=""L=",ponderation_Luminance);
                         GET_ARGUMENT_F("saturation=""s=""S=",ponderation_Saturation);
                         )
                    );

     GENERER_LE_NOM_DE_TROIS_COMPOSANTES_CHROMATIQUES_RVB(nom_imageA,nom_imageAR,nom_imageAV,nom_imageAB)
                                        /* Introduit le 20050920154318...                                                            */

     CALS(Iload_palette_de_couleurs(nom_paletteA,ESPACE_DE_COULEURS_RVB));
                                        /* Chargement de la palette de couleurs...                                                   */

     Test(PAS_D_ERREUR(CODE_ERROR(Iload_image(Image_ROUGE,nom_imageAR))))
          Bblock
          Test(PAS_D_ERREUR(CODE_ERROR(Iload_image(Image_VERTE,nom_imageAV))))
               Bblock
               Test(PAS_D_ERREUR(CODE_ERROR(Iload_image(Image_BLEUE,nom_imageAB))))
                    Bblock
                    CALS(Ifausses_couleurs_HLS_approximees_2(ImageR
                                                            ,Image_ROUGE,Image_VERTE,Image_BLEUE
                                                            ,ponderation_Hue,ponderation_Luminance,ponderation_Saturation
                                                            ,sphere_de_voisinage
                                                             )
                         );
                                        /* Passage des vraies aux fausses couleurs via la palette courante.                          */
                    CALi(Iupdate_image(nom_imageR,ImageR));
                    Eblock
               ATes
                    Bblock
                    Test__CODE_ERREUR__ERREUR07;
                    Eblock
               ETes
               Eblock
          ATes
               Bblock
               Test__CODE_ERREUR__ERREUR07;
               Eblock
          ETes
          Eblock
     ATes
          Bblock
          Test__CODE_ERREUR__ERREUR07;
          Eblock
     ETes

     RETU_Commande;
     Eblock
ECommande



Copyright © Jean-François COLONNA, 2019-2024.
Copyright © CMAP (Centre de Mathématiques APpliquées) UMR CNRS 7641 / École polytechnique, Institut Polytechnique de Paris, 2019-2024.