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.