Hi all,
I am displaying Image that i get from camera on QLabel as QImage,
How to make sure that the size of QImage is exactly the size i want in Pixel?
Printable View
Hi all,
I am displaying Image that i get from camera on QLabel as QImage,
How to make sure that the size of QImage is exactly the size i want in Pixel?
Erm... i did tried this.
Code:
frame=cvQueryFram(cam); cloneFrame=cvCloneImage(frame); image=Qimage((const uchar*)cloneFrame->imageData,cloneFrame->width,cloneFrame->height,QImage::Format_RGB888),rgbSwapped(); image = image.scaled(ui->original->size(), Qt::KeepAspectRatio, Qt::SmoothTransformation); // my QLabel size is (320,240) qPainter = newQPainter(&image); qPainter -> begin(this); qPainter->drawRect(0,0,319,239); //can't see the box since (319,239), qPainter->end(); ui->original->setPixmap(qPixmap::fromImage(image));
I can't see my box out of (319,239)
I guess thats why
line 1) - painter will draw on image
line 2) - now painter will draw on current widget, probably outside of paintEvent so you can't see the result