I want to be able to display an image in a Graphics view using opencv and QT creator. This way that I am posting does work but not exactly what I am looking for. Instead of reading in a already saved image, I want to skip and just pass save_img into the graphics view. Unfortunately doing this causes the image to look distorted and not correct. How could I get around this?
Mat save_img; video >> save_img;
// Save the frame into a file
imwrite("test.bmp", save_img);
Mat test_read = imread("test.bmp");
QGraphicsScene* scene1 = new QGraphicsScene(this);
ui->graphicsView_2->setScene(scene1);
scene1->addPixmap(QPixmap::fromImage(QImage(test_read.data, test_read.cols, test_read.rows, QImage::Format_RGB888)));