void Locus
::getImages(QFile* file, Mat
& matImg
) {
if(file->exists())
{
//get byteArray from raw data file
file
->open
(QFile::ReadOnly);
imagesData = file->readAll();
file->close();
//Create qimage
QImage img
((const uchar
*)imagesData.
data(),WIDTH,HEIGHT,
QImage::Format_RGB16);
//create mat image from qimage
matImg = this->qImage2Mat(img);
imshow("window",matImg);
waitKey();
}
}
Mat Locus::qImage2Mat(const QImage& src)
{
Mat tmp(src.height(),src.width(), CV_8UC3,(uchar*)src.bits(),src.bytesPerLine());
Mat res;
cvtColor(tmp, res,CV_RGB2GRAY);
return res;
}
void Locus::getImages(QFile* file, Mat& matImg)
{
QByteArray imagesData;
if(file->exists())
{
//get byteArray from raw data file
file->open(QFile::ReadOnly);
imagesData = file->readAll();
file->close();
//Create qimage
QImage img((const uchar*)imagesData.data(),WIDTH,HEIGHT,QImage::Format_RGB16);
//create mat image from qimage
matImg = this->qImage2Mat(img);
imshow("window",matImg);
waitKey();
}
}
Mat Locus::qImage2Mat(const QImage& src)
{
Mat tmp(src.height(),src.width(), CV_8UC3,(uchar*)src.bits(),src.bytesPerLine());
Mat res;
cvtColor(tmp, res,CV_RGB2GRAY);
return res;
}
To copy to clipboard, switch view to plain text mode
Bookmarks