我是OpenCV的新手,我正在尝试使用OpenCV将像素缓冲区复制到屏幕的一部分。
我这样做:
//In the beginning I allocate the screen buffer and create a Mat for it
void initScreen(int screenWidth, int screenHeight) {
pixels = new uint8_t[screenWidth*screenHeight*BITS_PER_PIXEL];
screenMat = new Map(Size(screenWidth, screenHeight), PIXEL_FORMAT);
screenMat->data = pixels
}
// Here I'm getting the pixel data to display on screen and coords where they should be displayed
void onDisplayPixels(int l, int t, int w, int h, void* newPixels)
{
// So I set a ROI at my screen Map
Mat roi(screenMat, cv::Rect(l, t, w, h));
// And I create a new Mat for the new pixels
Mat newPixelsMat(Size(w, h), newPixels, PIXELS_FMT);
// Now I need to copy newPixelsMat to roi
**But how do I do that??**
}