Bonsoir à tous,

Je vous présente mon problème :

J'ai ma classe Histogram :

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
 
 
 typedef unsigned long int ulong;
    typedef unsigned short int ushort;
    typedef unsigned char ubyte;
    typedef unsigned int uint;
 
    #include "Image.h"
    #include <iostream>
 
 
    class Histogram
    {
        static const ushort NB_MAX = 256;
        uint histo[NB_MAX];
        uint grisMax;
 
    public:
 
        Histogram(const GrayImage &gi);
        GrayImage* draw() const;
    };
 
    const ushort Histogram::NB_MAX;
 
    /* END OF CLASS */

Et ma classe Image :

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
 
     #ifndef TP3_C___Image_h
    #define TP3_C___Image_h
 
 
    #include <iostream>
    #include <cstdlib>
    #include <sstream>
    #include <stdexcept>
    #include <vector>
    #include <stdio.h>
    #include <algorithm>
 
    extern "C" {
    #include <jpeglib.h> /* Ce sont des déclarations relatives à des fonctions C ! */
    }
 
    #include "Color.h"
 
    #include <cmath>
 
    typedef unsigned short int ushort;
    typedef unsigned long int ulong;
    typedef unsigned char ubyte;
    typedef unsigned int uint;
 
 
    template <typename T>
    class Image
    {
        friend class Histogram;
 
        /**
         * Longueur et largeur
         */
        ushort width, height;
 
        /**
         * Tableau d'images
         */
        T *array;
 
 
    public:
 
        /**
         * Constructeur de la classe
         */
        Image(const ushort &w,const ushort &h);
 
 
        /**
         * Constructeur de copie
         */
        Image(const Image<T> &img);
 
        /**
         * Destructeur
         */
        ~Image();
 
 
    /**
     * Méthode renvoyant une réference sur le pixel de
     * coordonnée x,y
     */
    T &pixel(ushort, ushort);
 
    /**
     * Méthode renvoyant le niveau de gris
     * correspondant au pixel de coordonée x,y
     */
    const T& pixel(ushort x, ushort y) const;
 
    /* ETC .. */
 
    Image<Color>* bilinearScale(ushort, ushort) const;
    Image<ubyte>* threshold(ubyte thresh= 128) const;
    Image<ubyte>* randomDither() const;
};
 
     typedef Image<ubyte> GrayImage;
     typedef Image<Color> ColorImage;
Ceci est un morceau du main :

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
 
  #include <iostream>
         #include <iomanip>
    #include <fstream>
    #include <memory>
    #include <cmath>
    #include "Image.h"
    #include "Histogram.h"
 
    using namespace std;
 
    typedef Image<ubyte> GrayImage;
    typedef Image<Color> ColorImage;
 
 
    int main()
    {
        try
        {
            //========================================
            // Pour créer un rectangle vide et plein
            //========================================
 
            GrayImage gi(200,400); /* Une image en gris */
            ofstream os("rectangle.pgm", ios::binary);
            gi.clear(100);
            gi.fillRectangle(0, 0, 2,2, 244);
            gi.rectangle(0, 52, 50, 100, 244);
            gi.writePGM(os);
 
 
            //=========================================================
            // Pour lire une image, écrire par dessus et l'enregistrer
            //=========================================================
 
            ifstream ifsPgm("chat.pgm", ios::binary);
            auto_ptr<GrayImage> ptrGray(GrayImage::readPGM(ifsPgm)); /* Une image en gris */
            ptrGray->fillRectangle(0, 0, 50,100, 222);
            ptrGray->rectangle(70, 70, 50, 100, 244);
            ofstream chatOutPut("chatWrite.pgm", ios::binary);
            ptrGray->writePGM(chatOutPut);
 
 
            //=================================================
            // Pour lire une image et déssiner son histogramme
            //=================================================
 
            ifstream ifsHisto("chat.pgm", ios::binary);
            ofstream histogramOutPut("histogram.pgm", ios::binary);
            ptrGray.reset(GrayImage::readPGM(ifsHisto)); 
            if(ptrGray.get()) {
            	Histogram histo(*ptrGray);
            	auto_ptr<GrayImage> myHisto(histo.draw());
                myHisto->writePGM(histogramOutPut);
}

Donc voilà, en compilant, je me retrouve avec cette erreur :

error: variable ‘Histogram histo’ has initializer but incomplete type
J'ai fais énormément de recherches sur le net et aucune ne marche ..

Quelqu'un saurait-il m'éclairer ?