/*************************************************************************************************************************************/
/*                                                                                                                                   */
/*        M I S E   C O T E   A   C O T E   D E   D E U X   I M A G E S   E T                                                        */
/*        P A R   E X E M P L E   D ' U N E   P A I R E   S T E R E O S C O P I Q U E  :                                             */
/*                                                                                                                                   */
/*                                                                                                                                   */
/*        Definition :                                                                                                               */
/*                                                                                                                                   */
/*                    Cette commande genere une image                                                                                */
/*                  presentant deux autres images mises                                                                              */
/*                  cote a cote, et formant par exemple                                                                              */
/*                  un couple stereoscopique.                                                                                        */
/*                                                                                                                                   */
/*                                                                                                                                   */
/*                    La disposition utilisee est la suivante                                                                        */
/*                  par rapport a une matrice 2x2 carree                                                                             */
/*                  d'images :                                                                                                       */
/*                                                                                                                                   */
/*                                                                                                                                   */
/*                Y ^                                                                                                                */
/*                  |                                                                                                                */
/*             Ymax |++++++++++                                                                                                      */
/*                  |----------                                                                                                      */
/*                  | Ga | Dr |                                                                                                      */
/*                  |----------                                                                                                      */
/*             Ymin |++++++++++                                                                                                      */
/*                  |------------->                                                                                                  */
/*                 Xmin     Xmax  X                                                                                                  */
/*                                                                                                                                   */
/*                                                                                                                                   */
/*        ATTENTION :                                                                                                                */
/*                    Pour les images dont les dimensions ne                                                                         */
/*                  sont pas divisibles par 2, cette operation                                                                       */
/*                  introduit une bande noire a droite (si 'dimX'                                                                    */
/*                  n'est pas divisible par 2) et/ou en haut (si                                                                     */
/*                  'dimY' n'est pas divisible par 2).                                                                               */
/*                                                                                                                                   */
/*                                                                                                                                   */
/*        Author of '$xci/cote_a_cote$K' :                                                                                           */
/*                                                                                                                                   */
/*                    Jean-Francois COLONNA (LACTAMME, 1993??????????).                                                              */
/*                                                                                                                                   */
/*************************************************************************************************************************************/

/*===================================================================================================================================*/
/*************************************************************************************************************************************/
/*                                                                                                                                   */
/*        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  :                                               */
/*                                                                                                                                   */
/*************************************************************************************************************************************/
@define   PRAGMA_CPP_____POUR_LES_Iload_NE_PAS_VERIFIER_LES_MULTIPLES_UTILISATIONS_DE_L_IMAGE_____ImageA1
                                        /* Introduit le 20060124092106.                                                              */

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

/*===================================================================================================================================*/
/*************************************************************************************************************************************/
/*                                                                                                                                   */
/*        P A R A M E T R E S  :                                                                                                     */
/*                                                                                                                                   */
/*************************************************************************************************************************************/
#define   EDITER_LES_MESSAGES_D_ERREUR                                                                                                  \
                    EDITER_LES_MESSAGES_D_ERREUR_DES_FICHIERS                                                                           \
                                        /* Indique si les messages d'erreur des fichiers doivent etre emis ('VRAI') ou pas ('FAUX'). */

#define   METTRE_UN_FOND                                                                                                                \
                    FAUX                                                                                                                \
                                        /* Faut-il mettre un fond au cas ou l'on ne charge pas toutes les images...                  */

#define   MOYENNAGE                                                                                                                     \
                    VRAI                                                                                                                \
                                        /* Indique si l'on moyenne ('VRAI'), ou bien si l'on prend le 'MAXI' ('FAUX').               */
#define   CALCULER_LE_MAXIMUM                                                                                                           \
                    CALCUL_DU_MAXIMUM_DANS_UNE_DEMI_FENETRE                                                                             \
                                        /* Dans le cas ou il ne faut pas calculer la moyenne, indique s'il faut calculer le          */ \
                                        /* maximum ('VRAI') ou pas ('FAUX'), c'est-a-dire prendre le point courant...                */

/*===================================================================================================================================*/
/*************************************************************************************************************************************/
/*                                                                                                                                   */
/*        M A C R O S   U T I L E S  :                                                                                               */
/*                                                                                                                                   */
/*************************************************************************************************************************************/
#define   GENERE(FENETRE,imageR,nom_image)                                                                                              \
                    Bblock                                                                                                              \
                    Test(PAS_D_ERREUR(CODE_ERROR(Iload_image(ImageA1,nom_image))))                                                      \
                                        /* A = image courante.                                                                       */ \
                         Bblock                                                                                                         \
                         FENETRE(imageR                                                                                                 \
                                ,ImageA1                                                                                                \
                                ,MULTIPLICITE_2x2_POUR_LES_DEMI_FENETRES                                                                \
                                ,MULTIPLICITE_2x2_POUR_LES_DEMI_FENETRES                                                                \
                                ,moyennage                                                                                              \
                                ,calculer_le_maximum                                                                                    \
                                 );                                                                                                     \
                                        /* R = image courante reduite la ou il faut ; on notera que la reduction de moitie est       */ \
                                        /*     faite par extraction du 'MAXI' (voir 'moyennage') et ce afin d'eviter des artefacts   */ \
                                        /*     dans les images "multi-palettes"...                                                   */ \
                         Eblock                                                                                                         \
                    ATes                                                                                                                \
                         Bblock                                                                                                         \
                         Test(IL_NE_FAUT_PAS(mettre_un_fond))                                                                           \
                              Bblock                                                                                                    \
                              Test(IL_FAUT(files_____editer_les_messages_d_erreur_de_lecture_des_fichiers))                             \
                                   Bblock                                                                                               \
                                   Test__CODE_ERREUR__ERREUR07;                                                                         \
                                   Eblock                                                                                               \
                              ATes                                                                                                      \
                                   Bblock                                                                                               \
                                   Eblock                                                                                               \
                              ETes                                                                                                      \
                              Eblock                                                                                                    \
                         ATes                                                                                                           \
                              Bblock                                                                                                    \
                              Eblock                                                                                                    \
                         ETes                                                                                                           \
                         Eblock                                                                                                         \
                    ETes                                                                                                                \
                    Eblock                                                                                                              \
                                        /* Procedure d'insertion de l'image courante dans une fenetre.                               */

/*===================================================================================================================================*/
/*************************************************************************************************************************************/
/*                                                                                                                                   */
/*        M I S E   C O T E   A   C O T E   D E   D E U X   I M A G E S   E T                                                        */
/*        P A R   E X E M P L E   D ' U N E   P A I R E   S T E R E O S C O P I Q U E  :                                             */
/*                                                                                                                                   */
/*************************************************************************************************************************************/
BCommande(nombre_d_arguments,arguments)
/*-----------------------------------------------------------------------------------------------------------------------------------*/
     Bblock
     DEFV(CHAR,INIC(POINTERc(nom_imageF),NOM_PIPE));
                                        /* Nom du fond a utiliser au cas ou l'on ne charge pas toutes les images...                  */
     DEFV(Logical,INIT(mettre_un_fond,METTRE_UN_FOND));
                                        /* Indique s'il faut mettre ('VRAI') ou pas ('FAUX') un fond derriere...                     */
     DEFV(CHAR,INIC(POINTERc(nom_imageAG),NOM_PIPE));
     DEFV(CHAR,INIC(POINTERc(nom_imageAD),NOM_PIPE));
                                        /* Nom des deux images arguments.                                                            */
     DEFV(CHAR,INIC(POINTERc(nom_imageR),NOM_PIPE));
                                        /* Nom de l'image a generer.                                                                 */
     DEFV(Logical,INIT(moyennage,MOYENNAGE));
                                        /* Indique si l'on moyenne ('VRAI'), ou bien si l'on prend le 'MAXI' ('FAUX').               */
     DEFV(Logical,INIT(calculer_le_maximum,CALCULER_LE_MAXIMUM));
                                        /* Dans le cas ou il ne faut pas calculer la moyenne, indique s'il faut calculer le          */
                                        /* maximum ('VRAI') ou pas ('FAUX'), c'est-a-dire prendre le point courant...                */
     DEFV(deltaF_2D,translation);
                                        /* Translation de centrage vertical du couple d'image...                                     */
     /*..............................................................................................................................*/
     EGAL(files_____editer_les_messages_d_erreur_de_lecture_des_fichiers,EDITER_LES_MESSAGES_D_ERREUR);
                                        /* Initialisation de l'indicateur d'edition des messages d'erreur...                         */

     GET_ARGUMENTSi(nombre_d_arguments
                   ,BLOC(GET_ARGUMENT_C("imageF=""F=",nom_imageF);
                         GET_ARGUMENT_L("fond=",mettre_un_fond);
                         GET_ARGUMENT_C("imageAG=""AG=",nom_imageAG);
                         GET_ARGUMENT_C("imageAD=""AD=",nom_imageAD);
                         GET_ARGUMENT_C("imageR=""R=",nom_imageR);
                         GET_ARGUMENT_L("moyenne=",moyennage);
                         GET_ARGUMENT_L("maximum=",calculer_le_maximum);
                         )
                    );

     CALi(Inoir(ImageR));
                                        /* Initialisation de l'image Resultat.                                                       */

     Test(IL_FAUT(mettre_un_fond))
          Bblock
          Test(PAS_D_ERREUR(CODE_ERROR(Iload_image(ImageR,nom_imageF))))
                                        /* Un fond a ete demande, on le charge...                                                    */
               Bblock
               Eblock
          ATes
               Bblock
               Test__CODE_ERREUR__ERREUR07;
               EGAL(mettre_un_fond,FAUX);
                                        /* En cas d'erreur, on supprime le fond, ce qui correspond a un fond 'NOIR'.                 */
               Eblock
          ETes
          Eblock
     ATes
          Bblock
          Eblock
     ETes

     GENERE(DEMI_FENETRE_BG_MULTIPLE,ImageA2,nom_imageAG);
     GENERE(DEMI_FENETRE_BD_MULTIPLE,ImageA2,nom_imageAD);
                                        /* Reduction primaire,                                                                       */

     INITIALISATION_ACCROISSEMENT_2D(translation,FZERO,_____lNORMALISE_OY(FRA4(dimY)));
                                        /* Definition d'une translation de centrage,                                                 */
     CALS(Itranslation(ImageR,ImageA2,ADRESSE(translation),FAUX,FAUX));
                                        /* Et enfin centrage du couple d'image...                                                    */

     CALi(Iupdate_image(nom_imageR,ImageR));
                                        /* Et rangement...                                                                           */

     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.