Problem in displaying RGB32 data
Code:
void Custom_window::display()
{
if(i<5){
printf("\n Calling Capture function\n");
uchar* data = (uchar*)function(); //data is in bgr32 bit format
// Frame display
label->setPixmap(p->fromImage(*image));
textmessage->append("The path of the file is");
i++;
}
else
i=0;
}
Unable to display the image. Need help
Re: Problem in displaying RGB32 data
Your code is basically correct, although you could change it to:
Code:
uchar* data = (uchar*)function(); //data is in bgr32 bit format
// Frame display
label
->setPixmap
(QPixmap::fromImage(image
));
Of course you have to be certain that function() returns a pointer to 640*480*4 bytes of data which remain valid until after setPixmap has been called.
So, what do you see? is anything displayed?
Re: Problem in displaying RGB32 data
Sorry, but I just realized that the above code needs data to remain valid for a longer time.
A safer way would be to copy the image data.
Code:
memcpy(image.bits(), data, 640*480*4);
label
->setPixmap
(QPixmap::fromImage(image
));