my code:
//change 16 bit gray scale to 8 bit gray scale
for(int i=0;i<IMAGE_WIDTH*IMAGE_HEIGHT;i++)
imageBuffer[i]= (*((uint16_t *)(imageBuffer+2*i)))/4;
//get QImage object from the buffer, this might be wrong
QImage image
(imageBuffer,IMAGE_WIDTH,IMAGE_HEIGHT,
QImage::Format_Indexed8);
//rescale the image
QImage smallImg
=image.
scaled(600,
300);
//use QLabel object to show the image
labelImage
->setPixmap
(QPixmap::fromImage(smallImg
));
//change 16 bit gray scale to 8 bit gray scale
for(int i=0;i<IMAGE_WIDTH*IMAGE_HEIGHT;i++)
imageBuffer[i]= (*((uint16_t *)(imageBuffer+2*i)))/4;
//get QImage object from the buffer, this might be wrong
QImage image(imageBuffer,IMAGE_WIDTH,IMAGE_HEIGHT,QImage::Format_Indexed8);
//rescale the image
QImage smallImg=image.scaled(600,300);
//use QLabel object to show the image
labelImage->setPixmap(QPixmap::fromImage(smallImg));
To copy to clipboard, switch view to plain text mode
Bookmarks