#ifndef FENETREPRINCIPALE_H
#define FENETREPRINCIPALE_H
#include <QtWidgets>
#include "traitement.h"
{
Q_OBJECT
public :
FenetrePrincipale();
public slots :
void ouvrir();
void traiter();
void traiterOtsu();
private:
};
#endif // FENETREPRINCIPALE_H
#ifndef FENETREPRINCIPALE_H
#define FENETREPRINCIPALE_H
#include <QtWidgets>
#include "traitement.h"
class FenetrePrincipale : public QMainWindow
{
Q_OBJECT
public :
FenetrePrincipale();
public slots :
void ouvrir();
void traiter();
void traiterOtsu();
private:
QString nomFichier;
QWidget fentroi;
QWidget fenSec;
};
#endif // FENETREPRINCIPALE_H
To copy to clipboard, switch view to plain text mode
#include "traitement.h"
#include "otsu.h"
#include "fenetreprincipale.h"
{
QMenu *menuFichier
= menuBar
()->addMenu
("Fichier");
menuFichier->addAction(actionOuvrir);
menuFichier->addAction(actionQuitter);
QMenu *menuTraitement
= menuBar
()->addMenu
("Traitement");
menuTraitement->addAction(actionBinarisation);
QObject::connect(actionOuvrir,
SIGNAL(triggered
(bool)),
this,
SLOT(ouvrir
()));
QObject::connect(actionQuitter,
SIGNAL(triggered
(bool)),
this,
SLOT(close
()));
QObject::connect(actionBinarisation,
SIGNAL(triggered
(bool)),
this,
SLOT(traiterOtsu
()));
QObject::connect(this,
SIGNAL(changer
()),
this,
SLOT(afficher
()));
}
void FenetrePrincipale::ouvrir()
{
nomFichier
= QFileDialog::getOpenFileName(this, tr
("Open File"),
"C:/Users/amine/Downloads");
label->setGeometry(100,100,400,400);
pixmap.convertFromImage(image1);
label->setPixmap(pixmap);
fentroi.show(); // fentroi (fenetre qui affiche l'image) attribut de fenetre principale
label->update();
}
void FenetrePrincipale::traiterOtsu()
{
OtsuAlgo traitement(nomFichier);
traitement.binarisation();
label->setGeometry(100,100, 400, 400);
label
->setPixmap
(QPixmap::fromImage(*im
));
lcd->move(70,70);
lcd->display(traitement.getSeuil());
fenSec.show();
}
#include "traitement.h"
#include "otsu.h"
#include "fenetreprincipale.h"
FenetrePrincipale::FenetrePrincipale(): QMainWindow()
{
QMenu *menuFichier = menuBar()->addMenu("Fichier");
QAction *actionOuvrir = new QAction("Ouvrir", this);
QAction *actionQuitter = new QAction("Quitter", this);
menuFichier->addAction(actionOuvrir);
menuFichier->addAction(actionQuitter);
QMenu *menuTraitement = menuBar()->addMenu("Traitement");
QAction *actionBinarisation = new QAction("Binarisation", this);
menuTraitement->addAction(actionBinarisation);
QObject::connect(actionOuvrir, SIGNAL(triggered(bool)), this, SLOT(ouvrir()));
QObject::connect(actionQuitter, SIGNAL(triggered(bool)), this, SLOT(close()));
QObject::connect(actionBinarisation, SIGNAL(triggered(bool)), this, SLOT(traiterOtsu()));
QObject::connect(this, SIGNAL(changer()), this, SLOT(afficher()));
}
void FenetrePrincipale::ouvrir()
{
nomFichier = QFileDialog::getOpenFileName(this, tr("Open File"),"C:/Users/amine/Downloads");
QLabel *label =new QLabel(&fentroi);
label->setGeometry(100,100,400,400);
QImage image1(nomFichier);
QPixmap pixmap;
pixmap.convertFromImage(image1);
label->setPixmap(pixmap);
fentroi.show(); // fentroi (fenetre qui affiche l'image) attribut de fenetre principale
label->update();
}
void FenetrePrincipale::traiterOtsu()
{
OtsuAlgo traitement(nomFichier);
traitement.binarisation();
QImage *im = new QImage(traitement.getImage());
QLabel *label = new QLabel(&fenSec);
label->setGeometry(100,100, 400, 400);
label->setPixmap(QPixmap::fromImage(*im));
QLCDNumber *lcd = new QLCDNumber(&fenSec);
lcd->move(70,70);
lcd->setSegmentStyle(QLCDNumber::Flat);
lcd->display(traitement.getSeuil());
fenSec.show();
}
To copy to clipboard, switch view to plain text mode
please if someone can help me and thanks
Bookmarks