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. Converting image to RGB16 in array
Forum Updated to NodeBB v4.3 + New Features

Converting image to RGB16 in array

Scheduled Pinned Locked Moved Unsolved General and Desktop
6 Posts 2 Posters 390 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.
  • K Offline
    K Offline
    Kris Revi
    wrote on last edited by
    #1

    Code

    void MainWindow::selectedImageDisplay(QString img)
    {
        QImage imageObject;    // Make a new imageObject
        imageObject.load(img); // Load the image from path
    
        imageObject = imageObject.convertToFormat(QImage::Format_RGB16);
    
        QJsonArray RGB565;
        for(int y = 0; y < 128; y++)
        {
            const quint16 *line = reinterpret_cast<const quint16*>(imageObject.constScanLine(y));
            for(int x = 0; x < 128; x++)
            {
                RGB565 << *(line++);
            }
        }
        socket.sendCommandStrip(QStringLiteral("pixArt"), RGB565);
    }
    

    Question
    Is it possible to make this smaller in size?
    the reason for this is the ESP32 does not have enough memory for this... when i send this over and use ArduinoJson lib to deserializeJson i end up with error DeserializationError::NoMemory

    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi,

      How much memory do you have available on that device ?

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      K 1 Reply Last reply
      0
      • SGaistS SGaist

        Hi,

        How much memory do you have available on that device ?

        K Offline
        K Offline
        Kris Revi
        wrote on last edited by
        #3

        @SGaist

        Free Heap Size Befor Matrix : 330604
        *** ESP32-HUB75-MatrixPanel-I2S-DMA: Memory Allocations Complete ***        
        Total memory that was reserved: 132 kB.
        ... of which was used for the DMA Linked List(s): 4 kB.
        Heap Memory Available: 192340 bytes total. Largest free block: 113792 bytes.
        General RAM Available: 123968 bytes total. Largest free block: 113792 bytes.
        Free Heap Size after Matrix : 192196
        [WIFI][STATUS] Connecting to WiFi..
        [WIFI][STATUS] Connected
        Free Heap Size after Wifi : 135128
        Free Heap Size after Socket : 135008
        

        Free Heap Size after Socket : 135008 is what im left with

        this does not include DynamicJsonDocument inData(128*128); (and i belive even 128*128 is not even big enough)
        and
        uint16_t pixelArt[128*128] = { }; i copy the array from json into this and then over to the Matrix Display

        1 Reply Last reply
        0
        • SGaistS Offline
          SGaistS Offline
          SGaist
          Lifetime Qt Champion
          wrote on last edited by
          #4

          You might need to send your image in smaller chunks and process these chunks on your device.

          Interested in AI ? www.idiap.ch
          Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

          1 Reply Last reply
          0
          • K Offline
            K Offline
            Kris Revi
            wrote on last edited by
            #5

            Never done that befor

            1 Reply Last reply
            0
            • SGaistS Offline
              SGaistS Offline
              SGaist
              Lifetime Qt Champion
              wrote on last edited by
              #6

              Never done what ?

              Interested in AI ? www.idiap.ch
              Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

              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