Created
February 14, 2018 19:04
Star
You must be signed in to star a gist
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include "mainwindow.h" | |
#include "ui_mainwindow.h" | |
#include<opencv2/core/core.hpp> | |
#include<opencv2/ml/ml.hpp> | |
#include<opencv/cv.h> | |
#include<opencv2/imgproc/imgproc.hpp> | |
#include<opencv2/highgui/highgui.hpp> | |
#include<opencv2/video/background_segm.hpp> | |
#include<opencv2/videoio.hpp> | |
#include<opencv2/imgcodecs.hpp> | |
#include "mat2qimage.h" | |
#include <QFileDialog> | |
using namespace cv; | |
MainWindow::MainWindow(QWidget *parent) : | |
QMainWindow(parent), | |
ui(new Ui::MainWindow) | |
{ | |
ui->setupUi(this); | |
//Mat IMG1 = imread("hola.jpg"); | |
//Mat ImagenFiltrada; | |
//GaussianBlur(IMG1,ImagenFiltrada,Size(3,3),0,0,0); | |
} | |
MainWindow::~MainWindow() | |
{ | |
delete ui; | |
} | |
void MainWindow::on_pushButton_clicked() | |
{ | |
QString nombreImagen = QFileDialog::getOpenFileName(this, tr("Abrir imagen"), "/home/", tr("Imagenes (*.png *.jpg *.bmp)")); | |
Mat IMAGEN = imread(nombreImagen.toUtf8().constData()); | |
Mat IMAGENchica; | |
Mat IMAGENborrosa; | |
cv::resize(IMAGEN,IMAGENchica,Size(250,250)); | |
GaussianBlur(IMAGENchica,IMAGENborrosa,Size(33,33),0,0,0); | |
QImage qImage = Mat2QImage(IMAGENchica); | |
QPixmap pixmap = QPixmap::fromImage(qImage); | |
ui->label->clear(); | |
ui->label->setPixmap(pixmap); | |
qImage = Mat2QImage(IMAGENborrosa); | |
pixmap = QPixmap::fromImage(qImage); | |
ui->label_2->clear(); | |
ui->label_2->setPixmap(pixmap); | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment