Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
#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
You can’t perform that action at this time.