Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Mobile and Embedded
  4. depth to color mapping

depth to color mapping

Scheduled Pinned Locked Moved Unsolved Mobile and Embedded
2 Posts 2 Posters 705 Views
  • 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.
  • hjparkH Offline
    hjparkH Offline
    hjpark
    wrote on last edited by
    #1

    Hi Guys,

    I am developing an application what display depth datas from depth camera( 3D camera)..
    This camera put depth datas for each pixels of 320x240 image into the "unsigned short *m_pCameraBuf[2]".

    if I draw this raw data without color mapping, I can see some pictures but I want to convert depth data to fantastic color data with a mapping table.

    this is my code to print raw depth data but it is just experimental.. please advice me what's the best code to draw depth data with QT5.

    QImage image( (uchar*) m_pCameraBuf[DATA_DEPTH], imageWidth, imageHeight, imageWidth * bytesPerPixel, QImage::Format_RGB16, Q_NULLPTR, Q_NULLPTR);
    

    Thanks a lot..

    1 Reply Last reply
    0
    • M Offline
      M Offline
      mvuori
      wrote on last edited by
      #2

      Why don't you first try in some way what told you want to do. You only seem to have a possibly working call to construct a QImage. It will build a 16 bit color image, which seems funny - why not go to the 32 bit formats, which have 8 bits per color for eac channel (R,G, B). You should probably first create just the image without your data and fill it in the next step.

      Of course you need the mapping table or mapping function. That is the core of things - how to represent depth with an RGB pixel. Once you figure that out (and that is not a Qt issue), you can just loop through your image (for x = 0; x < 320; x++ and so on) and create each pixel:
      QRgb myPixel = conversionFunctionToGetColorOfDepth(myDepth[x, y]);
      myImage.setPixel(QPoint(x, y), myPixel());

      SetPixel is slow, but you need to start with that to understand what you are doing and the code can be refactored later for efficiency, if needed.

      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