So far, I've tried different methods for displaying my image. Note that raw formats I mean here is not the digital camera's RAW format. It's actually bytes of data (grayscale values) that I decoded.
I've tried openGl to display the images. glDrawPixel functions is slow, and if the images is large enough, u'll have a hard time to manipulate it. So I try to implement glTexture, the result is a whole lot faster. But the problem came when the images contains size not power of two, which texture can't be loaded properly.
So, I recheck back my QImage implementation, and after some time, I've found out I didn't setup the QImage properly, and didn't build up the neccesaly grayscale colormap. So far with some simple data I test, so far so good. However, the problem came when I try a large image with 2500*2048. Somehow the image become back to jerky again...
Here's my implementation
void pktDisplayWidget::setInternalImage()
{
m_Image
= new QImage(output, imgWidth, imgHeight,
QImage::Format_Indexed8);
//setup the grayscale color table
m_Image->setNumColors(256);
for (int i=0; i<256; i++)
m_Image->setColor(i, qRgb(i, i, i));
if (m_Image->isNull())
QMessageBox::warning(this, tr
("Error in pktDisplayWidget"),
tr("Unable to create the image object."));
if (swap)
m_Image
->invertPixels
(QImage::InvertRgb);
//pass the image to the label (this)
this
->setPixmap
(QPixmap::fromImage(*m_Image
));
this->adjustSize();
}
void pktDisplayWidget::setInternalImage()
{
m_Image = new QImage(output, imgWidth, imgHeight, QImage::Format_Indexed8);
//setup the grayscale color table
m_Image->setNumColors(256);
for (int i=0; i<256; i++)
m_Image->setColor(i, qRgb(i, i, i));
if (m_Image->isNull())
QMessageBox::warning(this, tr("Error in pktDisplayWidget"),
tr("Unable to create the image object."));
if (swap)
m_Image->invertPixels(QImage::InvertRgb);
//pass the image to the label (this)
this->setPixmap(QPixmap::fromImage(*m_Image));
this->adjustSize();
}
To copy to clipboard, switch view to plain text mode
Bookmarks