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. How could I handle gray bitmap raw data? Could you help me please?

How could I handle gray bitmap raw data? Could you help me please?

Scheduled Pinned Locked Moved General and Desktop
3 Posts 2 Posters 2.8k 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.
  • A Offline
    A Offline
    awesomesean
    wrote on last edited by
    #1

    Dear guys,

    I am receiving gray bitmap raw data from device to *void value. Then I need to show bitmap data using label control.

    I will show you code.
    @
    typedef enum tagIBScanUImageFormat
    {
    IBSU_IMG_FORMAT_GRAY, ///< Gray scale image
    IBSU_IMG_FORMAT_RGB24, ///< 24 bit RGB color image
    IBSU_IMG_FORMAT_RGB32, ///< True color RGB image
    IBSU_IMG_FORMAT_UNKNOWN ///< Format not set or unknown
    }
    IBSU_ImageFormat;

    /// Container to hold image data together with meta information.
    typedef struct tagIBSU_ImageData
    {
    void* Buffer; ///< Pointer to image buffer
    DWORD Width; ///< Image horizontal size
    DWORD Height; ///< Image vertical size
    double ResolutionX; ///< Horizontal image resolution (in PPI)
    double ResolutionY; ///< Vertical image resolution (in PPI)
    double FrameTime; ///< Image acquisition time (in seconds)\n
    ///< This value contains the time taken for acquisition
    ///< from device (excluding processing time).
    int Pitch; ///< Image line pitch (in Bytes).\n
    /// Positive values indicate top down line order,
    /// Negative values mean bottom up line order
    BYTE BitsPerPixel; ///< Number of Bits per pixel
    IBSU_ImageFormat Format; ///< Image color format
    BOOL IsFinal; ///< Marks image as finally processed\n
    /// A value of "FALSE" disqualifies image for further processing.
    /// (e.g. interim or preprocessed result images)
    // int PollingTimeForGetImag; /// For Polling time for getting image

    }
    IBSU_ImageData;
    @
    Above is struct for image data from device.
    And
    @
    void* Buffer;
    @
    is buffer for raw data from device.

    Then, I used c++ library to get raw data from device.

    So, how could I see this gray bitmap raw data at label control?

    I used "StretchDIBits" function in my other MFC appliction.
    Is there any function like a "StretchDIBits" function?

    Thanks,

    1 Reply Last reply
    0
    • H Offline
      H Offline
      hipersayan_x
      wrote on last edited by
      #2

      It's easy. supposing that each pixel has a 24 bits depth, then you can do:

      @
      pixmap = QPixmap::fromImage(QImage((const uchar *) IBSU_ImageData.Buffer,
      IBSU_ImageData.ResolutionX,
      IBSU_ImageData.ResolutionX,
      QImage::Format_RGB888));

      label.setPixmap(pixmap);
      @

      1 Reply Last reply
      0
      • A Offline
        A Offline
        awesomesean
        wrote on last edited by
        #3

        Thank you!!

        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