1

I am using opencv3.1.0 with Qt5.5.1 and i want to use an image that i have displayed with a Qpixmap in Qt and put it in a Mat type to be able to do some modification on it with opencv. here is how the code for displaying more than an image :

void Mainwindow::on_pushButton_pressed()
 {
    QStringList fileName = QFileDialog::getOpenFileNames(this,tr("Open Image"), "C:/qt-win-opensource-src-4.5.0/bin/",
                                                             tr("Image Files(*.png *.jpg *.bmp *.avi *.gif)"));
                           setMinimumSize(100,100);

                           QList<QPixmap> PixList;
                           for (int i=0;i<=fileName.size()-1;i++){
                           PixList.append(QPixmap(fileName.at(i)));
                           }
                           foreach(QPixmap pix, PixList){
                           // put the pixmaps one next to the other
                           PixLabel = new QLabel(this);
                           PixLabel->setScaledContents(true);
                           PixLabel->setPixmap(pix);
                           //PixLabel->setFixedHeight(120);
                           //PixLabel->setFixedWidth(120);
                           //PixLabel->setFixed
                           QSize sizeImage(400,500);
                           PixLabel->setFixedSize(sizeImage);
                           ui->horizontalLayout->addWidget(PixLabel);
                           PixLabel->repaint();
                           }
}

and here is how i call it in opencv

Mat   image1 = imread("C://images//PolarImage300915163358.bmp"); 
Mat img;
image1.convertTo(img, CV_64FC3, 1.0 / 255.0);
ner
  • 711
  • 3
  • 13
  • 30

0 Answers0