It is not a problem when using opencv to process images displayed on the qt label.
1. qimage must be used for display on QT.
Convert iplimage to qimage
Color Image Conversion
Iplimage * fram;
Qimage image (const uchar *) fram-> imagedata, fram-> width, fram-> height, qimage: format_rgb888 );
After using opencv binarization, you can switch it and find that multiple images and colors are displayed in the label.
At this time, you have to change the parameters.
Qimage resimg (uchar *) RES-> imagedata, res-> width, res-> height, qimage: format_indexed8 );
After the parameter is changed, qimage: format_indexed8 is used to convert the gray image.
2. Convert the data image collected by YUV camera to RGB to generate qimage. I want to convert it to lplimage format using opencv. At this time, I can write it like this.
// Convert the format qimage to iplimage
Width = frame-> width ();
Height = frame-> height ();
Size. Height = height;
Size. width = width;
Lplimage * image = cvcreateimage (size, ipl_depth_8u, 3 );
For (INT y = 0; y {
For (INT x = 0; x <width; ++ X)
{
Qrgb RGB = frame-> pixel (x, y );
Cvset2d (image, Y, X, cv_rgb (qred (RGB), qgreen (RGB), qblue (RGB )));
}
}
Finally, the image is in the iplimage format. You can encapsulate the above and directly call each time.
Using opencv in QT to process the conversion between image qimage and iplimage