Possible Duplicate:
Fastest method to convert IplImage IPL_DEPTH_32S to QImage Format_RGB32
I am facing a weird problem in displaying image with Qt...I read a video frame using OpenCV and convert it into RGB from BGR.
video >> frameOrg;
cvtColor(frameOrg,frameOrg,CV_BGR2RGB);
then I select a ROI on the image using crop style..
frame = frameOrg(roi);
I send the selected ROI over signal/slot to a widget for display..the paintEvent()
of the display uses
image = QImage((const unsigned char*)frame.data,frame.cols,
frame.rows,QImage::Format_RGB888);
QRectF target(0.0,0.0,image.width(),image.height());
QRectF source(0.0,0.0,image.width(),image.height());
QPainter painter(this);
painter.drawImage(target,image,source);
But whenever I choose some combination of odd valued width and height of the ROI I get a weird display as shown below... ORIGINAL IMAGE
IMAGE OF THE ROI SELECTED
Do I need to do some modifications? Is windows 7 having some problem in displaying? The same ROI when displayed with imshow()
displays correctly...any one help me..thanx in advance...
ACTUAL CODE WHICH WORKS
image = QImage((const unsigned char*)frame.data,frame.cols,
frame.rows,frame.step,QImage::Format_RGB888);