void Dialog::createCam()
{
cam = cvCaptureFromCAM(-1);
if(cam==NULL)
qDebug()<<"error";
timer->start(0);
connect(timer,SIGNAL(timeout()),this,SLOT(getFrame()));
connect(timer,SIGNAL(timeout()),this,SLOT(prcFrame()));
}
void Dialog::getFrame()
{
frame = cvQueryFrame(cam);
QImage image
= QImage ((const uchar
*)frame
->imageData,frame
->width,frame
->height,
QImage::Format_RGB888).
rgbSwapped();
//rgbSwapped() make color better ui
->original
->setPixmap
(QPixmap::fromImage(image
));
}
void Dialog::prcFrame() //threshold,not used yet
{
/*IplImage *imgHSV= cvCreateImage(cvSize(frame->width,frame->height),IPL_DEPTH_8U,3);
cvCvtColor(frame,imgHSV,CV_BGR2HSV);
IplImage *imgFilter= cvCreateImage(cvSize(frame->width,frame->height),IPL_DEPTH_8U,1);
//threshed , get value from slider value*/
cvCloneImage(frame);
cvCvtColor(frame,frame,CV_BGR2HSV);
IplImage *imgFilter= cvCreateImage(cvSize(frame->width,frame->height),IPL_DEPTH_8U,1);
cvInRangeS(frame,cvScalar(ui->hueSlide1->value(),ui->satSlide1->value(),ui->lumSlide1->value(),0),cvScalar(ui->hueSlide2->value(),ui->satSlide2->value(),ui->lumSlide2->value(),0),imgFilter);
QImage imgThresdhed
= QImage ((const uchar
*)imgFilter
->imageData,imgFilter
->width,imgFilter
->height,
QImage::Format_Indexed8).
rgbSwapped();
ui
->filter
->setPixmap
(QPixmap::fromImage(imgThresdhed
));
}
Dialog::~Dialog()
{
timer->stop();
cvReleaseCapture(&cam);
cvReleaseImage(&imgFilter);
delete ui;
}
void Dialog::createCam()
{
timer = new QTimer(this);
cam = cvCaptureFromCAM(-1);
if(cam==NULL)
qDebug()<<"error";
timer->start(0);
connect(timer,SIGNAL(timeout()),this,SLOT(getFrame()));
connect(timer,SIGNAL(timeout()),this,SLOT(prcFrame()));
}
void Dialog::getFrame()
{
frame = cvQueryFrame(cam);
QImage image = QImage ((const uchar*)frame->imageData,frame->width,frame->height,QImage::Format_RGB888).rgbSwapped();//rgbSwapped() make color better
ui->original->setPixmap(QPixmap::fromImage(image));
}
void Dialog::prcFrame() //threshold,not used yet
{
/*IplImage *imgHSV= cvCreateImage(cvSize(frame->width,frame->height),IPL_DEPTH_8U,3);
cvCvtColor(frame,imgHSV,CV_BGR2HSV);
IplImage *imgFilter= cvCreateImage(cvSize(frame->width,frame->height),IPL_DEPTH_8U,1);
//threshed , get value from slider value*/
cvCloneImage(frame);
cvCvtColor(frame,frame,CV_BGR2HSV);
IplImage *imgFilter= cvCreateImage(cvSize(frame->width,frame->height),IPL_DEPTH_8U,1);
cvInRangeS(frame,cvScalar(ui->hueSlide1->value(),ui->satSlide1->value(),ui->lumSlide1->value(),0),cvScalar(ui->hueSlide2->value(),ui->satSlide2->value(),ui->lumSlide2->value(),0),imgFilter);
QImage imgThresdhed = QImage ((const uchar*)imgFilter->imageData,imgFilter->width,imgFilter->height,QImage::Format_Indexed8).rgbSwapped();
ui->filter->setPixmap(QPixmap::fromImage(imgThresdhed));
}
Dialog::~Dialog()
{
timer->stop();
cvReleaseCapture(&cam);
cvReleaseImage(&imgFilter);
delete ui;
}
To copy to clipboard, switch view to plain text mode
OpenCV Error: Bad argument (unrecognized or unsupported array type) in cvReleaseData, file /home/pi/OpenCV-2.4.2/modules/core/src/array.cpp, line 996
terminate called after throwing an instance of 'cv::Exception'
what(): /home/pi/OpenCV-2.4.2/modules/core/src/array.cpp:996: error: (-5) unrecognized or unsupported array type in function cvReleaseData
The program has unexpectedly finished.
/home/pi/qt/getCam/getCam exited with code 0
OpenCV Error: Bad argument (unrecognized or unsupported array type) in cvReleaseData, file /home/pi/OpenCV-2.4.2/modules/core/src/array.cpp, line 996
terminate called after throwing an instance of 'cv::Exception'
what(): /home/pi/OpenCV-2.4.2/modules/core/src/array.cpp:996: error: (-5) unrecognized or unsupported array type in function cvReleaseData
The program has unexpectedly finished.
/home/pi/qt/getCam/getCam exited with code 0
To copy to clipboard, switch view to plain text mode
Bookmarks