I am attempting to use OpenCV to grab frames from a webcam and display them in a window using SFML.
VideoCapture returns frames in OpenCV\'s Mat format. To display t
OpenCV can do all job for you:
VideoCapture cap(0); Mat frame; cap >> frame; uchar* camData = new uchar[frame.total()*4]; Mat continuousRGBA(frame.size(), CV_8UC4, camData); cv::cvtColor(frame, continuousRGBA, CV_BGR2RGBA, 4); img.LoadFromPixels(frame.cols, frame.rows, camData);