Grayscale image as texture in qt3d
-
@QImage Mat2QImage(cv::Mat const& src)
{
cv::Mat temp; // make the same cv::Mat
//cv::cvtColor(src, temp,CV_BGR2RGB); // cvtColor Makes a copt, that what i need
cv::cvtColor(src,temp,CV_BGR2GRAY);
cv::imshow("hi",temp);
QImage dest((const uchar *) temp.data, temp.cols, temp.rows, temp.step, QImage::Format_RGB888);
dest.bits(); // enforce deep copy, see documentation
// of QImage::QImage ( const uchar * data, int width, int height, Format format )
return dest;
}cv::Mat mat=cv::imread("C:/Qt/qt-qt3d/tutorials/qt3d/cube4/bluecircle.jpg");
QImage image = Mat2QImage(mat);
//image.scaled(256,256,Qt::IgnoreAspectRatio);
logo.setImage(image);@When I use a color image to bind as a texture on the cube, i can see it. However, when i try to wrap a grayscale image, I see a black screen? Does qt3d does not accept grayscale images?