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. how to generate image from raw pixel data
Forum Updated to NodeBB v4.3 + New Features

how to generate image from raw pixel data

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

    hi
    how to generate image from raw pixel data .
    at present i am using this

                int pixel=0;
                for (int y = 0; y < height; y++)
                {
                   for (int x = 0; x < width; x++)
                   {
    
                        QRgb value = qRgb((Auto_image_RGBdata[pixel] >> 22 & 0x000000ff),(Auto_image_RGBdata[pixel] >> 12 & 0x000000ff), (Auto_image_RGBdata[pixel]>>2  & 0x000000ff));
                        pixel+=1;
                        img.setPixel(x,y,value);
                   }
                }
                ui->port_2->setPixmap(QPixmap::fromImage(img.scaled(781,351,Qt::IgnoreAspectRatio,Qt::SmoothTransformation)));
                ui->port_2->setScaledContents(true);
    

    is there any faster method than this?

    J.HilkJ 1 Reply Last reply
    0
    • S swansorter

      hi
      how to generate image from raw pixel data .
      at present i am using this

                  int pixel=0;
                  for (int y = 0; y < height; y++)
                  {
                     for (int x = 0; x < width; x++)
                     {
      
                          QRgb value = qRgb((Auto_image_RGBdata[pixel] >> 22 & 0x000000ff),(Auto_image_RGBdata[pixel] >> 12 & 0x000000ff), (Auto_image_RGBdata[pixel]>>2  & 0x000000ff));
                          pixel+=1;
                          img.setPixel(x,y,value);
                     }
                  }
                  ui->port_2->setPixmap(QPixmap::fromImage(img.scaled(781,351,Qt::IgnoreAspectRatio,Qt::SmoothTransformation)));
                  ui->port_2->setScaledContents(true);
      

      is there any faster method than this?

      J.HilkJ Online
      J.HilkJ Online
      J.Hilk
      Moderators
      wrote on last edited by
      #2

      @swansorter said in how to generate image from raw pixel data:

      is there any faster method than this?

      of course
      reading the documentation yields:
      df81ba30-01a7-4fee-b1c1-8fd53c902713-image.png


      Be aware of the Qt Code of Conduct, when posting : https://forum.qt.io/topic/113070/qt-code-of-conduct


      Q: What's that?
      A: It's blue light.
      Q: What does it do?
      A: It turns blue.

      1 Reply Last reply
      1

      • Login

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