Problèmes de fonction c++

wolfmajid Messages postés 11 Date d'inscription   Statut Membre Dernière intervention   -  
wolfmajid Messages postés 11 Date d'inscription   Statut Membre Dernière intervention   -
Bonjour,

Le programme doit lire deux fichiers différents, f1 qui sert de référence et f2
qui est le fichier à comparer. La structure de données à utiliser pour stocker le
contenu des fichiers est un tableau unidimensionnel (voir le squelette). Il faut
faire une comparaison pixel par pixel. Cette comparaison doit déterminer le
nombre de pixels identiques, le nombre de pixels différents, le coefficient de
ressemblance et identifier les pixels différents. Le nombre de pixels identiques,
le nombre de pixels différents et le coefficient de ressemblance doivent être
affichés et les pixels différents identifiés doivent être écrits dans un fichier. Ces
opérations ne sont à réaliser que si les images sont de même taille. Dans le cas
contraire, un message indiquant l'incompatibilité de taille devra être affiché.
Le coefficient de ressemblance peut être vu comme le pourcentage de pixels
identiques. La formule est :

c=1-(nd/nt)=ni/nt


où c est le coefficient de ressemblance, ni est le nombre de pixels identiques,
nd est le nombre total de pixels différents et nt est le nombre total de pixels de
l'image de référence.
// 
// APP 2 
// Fichier source 
// 
// Auteur:  
// Nom: Abdel Majid Rezki 
// CIP:reza2202 
// Matricule: 09-048-372 
//  

// 
// Zone1 : quelques lignes de C++  (maximum 25 lines) 
// 
#include <iostream>     
#include <cmath>        
#include <fstream>      
#include <cstring>      
using namespace std;    
// 
// Fin de la Zone 1 
// 
void Init(); // f1  
void LoadImg(const char fileName[],int aRef,int cRowRef,int cColRef); // f2 
void LoadImg(const char fileName[],int aApp,int cRowApp,int cColApp); // f2 
bool DimMatch(int cColRef,int cRowRef,int cColApp,int cRowApp) // f3 
void Fail(); //f4 
void PrintImg(int aRef,int cRowRef,int cColRef); // f5 
int DiffImg(int aRef,int aApp,int aDif,int cRowRef,int cColRef); // f6 
int ComputeTotal(int cRowRef,int cColRef); // f7 
void PrintResults(int cIP,int  cTotal); // f8 
void SaveImg(const char fileName[],char aDif,int cRowRef,int cColRef); // f9 
void Finish(); // f10  
// 
// ZONE INTERDITE (AUCUNE MODIFICATION PERMISE) 
// 

int main() 
{ 
    int r = 0; 

    int aRef[MAX_SIZE*MAX_SIZE] = {0}; 
    int cRowRef = 0, cColRef = 0; 

    int aApp[MAX_SIZE*MAX_SIZE] = {0}; 
    int cRowApp = 0, cColApp = 0; 

    char aDif[MAX_SIZE*MAX_SIZE] = {0}; 
    int cIP = 0, cTotal = 0; 

    Init(); // f1  

    LoadImg("ref.img", aRef, cRowRef, cColRef); // f2 
    LoadImg("app.img", aApp, cRowApp, cColApp); // f2 
     
    if (!DimMatch(cColRef, cRowRef, cColApp, cRowApp)) // f3 
    { 
        Fail(); // f4 
        r = 1; 
    } 
    else 
    { 
        cout << "Reference:" << endl; 
        PrintImg(aRef, cRowRef, cColRef); // f5 

        cout << "Image:" << endl; 
        PrintImg(aApp, cRowApp, cColApp); // f5 

        cIP = DiffImg(aRef, aApp, aDif, cRowRef, cColRef); // f6 
        cTotal = ComputeTotal(cRowRef, cColRef); // f7 

        PrintResults(cIP, cTotal); // f8 

        SaveImg("diff.img", aDif, cRowRef, cColRef); // f9 

        Finish(); // f10  
    } 

    return r; 
} 

// 
// Fin de la ZONE INTERDITE 
//  


// 
// Zone2 : vous pouvez mettre vos fonctions ici 
// 


void Init() // f1  
{ 
 cout << "Image analysis is starting..." <<endl; 
} 
void LoadImg(const char fileName[],int aRef,int &cRowRef,int &cColRef) // f2 
{ 
 } 
bool DimMatch(int cColRef,int cRowRef,int cColApp,int cRowApp) // f3 
{ 
 cColRef==cColApp || cRowRef==cRowApp; 
} 
void Fail() //f4 
{ 
    cout<<" ABORT: Sizes do not match! "<< endl; 
} 
void PrintImg(int aRef,int cRowRef,int cColRef) // f5 
{ 
 } 
int DiffImg(int aRef,int aApp,char aDif,int cRowRef,int cColRef) // f6 
{ 

} 
int ComputeTotal(int cRowRef,int cColRef) // f7 
{ 

} 
void PrintResults(int cIP,int cTotal) // f8 
{ 
  
} 
void SaveImg(const char fileName[],char aDif,int cRowRef,int cColRef) // f9 
{ 


} 
void Finish() // f10  
{ 
 cout << "Image analysis is done." << endl; 
} 

// 
// Fin de la zone2 
// 




A voir également:

2 réponses

Char Snipeur Messages postés 9813 Date d'inscription   Statut Contributeur Dernière intervention   1 299
 
et ?
0
wolfmajid Messages postés 11 Date d'inscription   Statut Membre Dernière intervention  
 
Salut tu peut m aide a le terminer (Fonction svp)
0