我正在使用带有Qt5.5.1的opencv3.1.0,我想使用我在Qt中用Qpixmap显示的图像,并将其放在Mat类型中,以便能够使用opencv对其进行一些修改。 这里是显示多个图像的代码:
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();
}
}
以下是我在opencv中的称呼方式
Mat image1 = imread("C://images//PolarImage300915163358.bmp");
Mat img;
image1.convertTo(img, CV_64FC3, 1.0 / 255.0);