Ask Your Question

fifth_quadrant's profile - activity

2013-10-02 21:19:02 -0600 received badge  Editor (source)
2013-10-02 21:17:56 -0600 asked a question returning captured frame

I am trying to create this function

void videoHandler::getNextFrame(Mat& frame){

vf* tempFrame=new vf();
VideoCapture capture;
capture.open(0);
capture.set(CV_CAP_PROP_FRAME_WIDTH,640);
capture.set(CV_CAP_PROP_FRAME_HEIGHT,480);
capture.read(frame);}

but as the compilers exits and the Mat pointer is accessed I get an access violation error as if the frame info was destroyed. I tried using

tempFrame->setImage(frame);

which sets the image and It only works when I use copyto() or clone() functions but slows down the compilation alot. I tried return frame; static declarations; so unless a copy is made the frame is lost when the compiler goes out of scope. any suggestions for an alternative or better way to do it.