[Qt-interest] grayscale image looks faded
caius ligarius
caius9090 at gmail.com
Thu Apr 29 01:50:31 CEST 2010
Hi,
I am new to Qt and am trying to display an 8Bit grayscale image using
QGraphicsScene/QGraphicsView. I finally got some image to be displayed in
the viewport but the image looks faded (or it's dynamic range seems low).
Below is the code I use.
1) My original image is in 1D 'int' array (rbf.heData) so I first convert to
uchar array (pDataB)
2) After this I create a QImage and pass it as a pixmap to QGraphicsScene
3) QGraphicsView is then used to set the above QGraphicsScene
******************************
BYTE* pDataB = new BYTE[rbf.heData->rows*rbf.heData->cols];
for(i = 0;i < rbf.heData->rows*rbf.heData->cols; i++)
{
BYTE tempchar[1]={0};
_itoa(rbf.heData->pData[i],(char*)tempchar,10);
pDataB[i] = tempchar[0];
}
QImage qi(pDataB, rbf.heData->cols, rbf.heData->rows,
QImage::Format_Indexed8);
QGraphicsScene* scene = new QGraphicsScene;
scene->setItemIndexMethod(QGraphicsScene::NoIndex);
scene->addPixmap(QPixmap::fromImage(qi));
ui.graphicsView->setScene(scene);
ui.graphicsView->show();
***********************************
1) Why does the image appear faded?
2) I also need to display a 16BIt Image, how will the above code change for
this?
Thanks,
Caius
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20100428/c9680ccc/attachment.html
More information about the Qt-interest-old
mailing list