In any way:

QImage::QImage(uchar <../qtcore/qtglobal.html#uchar-typedef>*data, intwidth, intheight, Format <qimage.html#Format-enum>format, QImageCleanupFunction <qimage.html#QImageCleanupFunction-typedef>cleanupFunction= Q_NULLPTR, void*cleanupInfo= Q_NULLPTR)

Constructs an image with the given width, height and format, that uses an existing memory buffer, data. The width and height must be specified in pixels, data must be 32-bit aligned, and each scanline of data in the image must also be 32-bit aligned.

The buffer must remain valid throughout the life of the QImage <qimage.html> and all copies that have not been modified or otherwise detached from the original buffer. The image does not delete the buffer at destruction. You can provide a function pointer cleanupFunction along with an extra pointer cleanupInfo that will be called when the last copy is destroyed.

If format is an indexed color format, the image color table is initially empty and must be sufficiently expanded with setColorCount <qimage.html#setColorCount>() or setColorTable <qimage.html#setColorTable>() before the image is used.

On 01.08.2016 17:24, Nilesh Kokane wrote:
Hello,

I've a function as follows. With this I get QImage: out of memory,
returning null image, I dont allocate heap to QImage anywhere.
but the crash happens at QImage img(cdata, 288, 352,
QImage::Format_RGB888). Any clue.
If the QImage is allocating the memory to the heap internally how to free that?



void AddToQueue(/*param*/)
{

    /*
..
    */

     QImage ampl_image = convertImageWithImageAdjust(/*param*/);
     QImage dist_image = convertImageWithImageAdjust(/*param*/);
     emit imageReceived(ampl_image, dist_image, FPS);

}

QImage convertImageWithImageAdjust(/*param*/)
{
   /*

..

   */
     QImage img(cdata, 288, 352, QImage::Format_RGB888);
     img = img.scaled(QSize(288*1.5,352*1.5));
     delete[] cdata;
     return img;
}


void GestureCamCorder::onImageReceived(const QImage &amplImage, const
QImage &distImage)
{
     QPixmap tempImage = QPixmap::fromImage(amplImage);
     ui->amplImage->setPixmap(tempImage);

}
_______________________________________________
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest

Reply via email to