QImage Camera
::captureTrasholdedImage() {
IplImage* frame = cvQueryFrame( this->captureHandle );
IplImage* frameHSV = cvCreateImage(cvGetSize(frame), IPL_DEPTH_8U, 3);
cvCvtColor(frame, frameHSV, CV_BGR2HSV);
IplImage* trashold = cvCreateImage(cvGetSize(frame), IPL_DEPTH_8U, 1);
cvInRangeS(frame, cvScalar(170, 160, 160), cvScalar(180,256, 256), trashold);
QByteArray buff
(trashold
->imageData, trashold
->imageSize
);
int height = trashold->height;
int width = trashold->width;
pix.loadFromData(buff);
return pix.toImage();
}
QImage Camera::captureTrasholdedImage()
{
IplImage* frame = cvQueryFrame( this->captureHandle );
IplImage* frameHSV = cvCreateImage(cvGetSize(frame), IPL_DEPTH_8U, 3);
cvCvtColor(frame, frameHSV, CV_BGR2HSV);
IplImage* trashold = cvCreateImage(cvGetSize(frame), IPL_DEPTH_8U, 1);
cvInRangeS(frame, cvScalar(170, 160, 160), cvScalar(180,256, 256), trashold);
QByteArray buff(trashold->imageData, trashold->imageSize);
int height = trashold->height;
int width = trashold->width;
QPixmap pix(width, height);
pix.loadFromData(buff);
return pix.toImage();
}
To copy to clipboard, switch view to plain text mode
Bookmarks