OpenCV 2.3: Convert Mat to RGBA pixel array
问题 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 the frames, SFML requires a 1D array of pixels in its uint8 format, which (as far as I can tell) is interchangeable with uchar. This array is expected to represent 32 bits per pixel RGBA. So, I have a uchar array, and I'm looping over the Mat data and copying each pixel: VideoCapture cap(0); Mat frame; cap >> frame; uchar* camData =