c++ - Fastest method to convert IplImage IPL_DEPTH_32S to QImage Format_RGB32 -
what fastest method convert iplimage ipl_depth_32s qimage format_rgb32?
i need catch pictures cam , show on form frequency 30 frames in second. tried use qimage constructor:
qimage qimage((uchar *) image->imagedata, image->width, image->height, qimage::format_rgb32);
but image corrupted after this. so, how can fast (i think putting pixel pixel qimage not decision)?
before start, opencv uses bgr format default. not rgb! before creating qimage
need convert iplimage
rgb with:
cvtcolor(image, image, cv_bgr2rgb);
then can:
qimage qimage((uchar*) image->imagedata, image->width, image->height, qimage::format_rgb32);
note the constructor above doesn't copy data might thinking, docs states:
the buffer must remain valid throughout life of qimage
so if having performance issues not because of conversion procedure. caused drawing method using (which wasn't shared in question). summarize lot of blah blah blah, should render qimage
opengl texture , let video card drawing you.
your question bit misleading because primary objective not find fastest conversion method, 1 works since yours don't.
another important thing keep in mind, when said:
image corrupted after this
you must know vague, , doesn't @ because there number of causes effect, , without source code impossible tell certainty doing wrong. sharing original , corrupted image might gives clues problem is.
that's now. luck.
Comments
Post a Comment