Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Grayscale image as texture in qt3d
Forum Updated to NodeBB v4.3 + New Features

Grayscale image as texture in qt3d

Scheduled Pinned Locked Moved General and Desktop
1 Posts 1 Posters 489 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S Offline
    S Offline
    sunil.nair
    wrote on last edited by
    #1

    @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?

    1 Reply Last reply
    0

    • Login

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Get Qt Extensions
    • Unsolved