0
OpenCV를 처음 접했고 OpenCV를 사용하여 화면의 일부로 픽셀 버퍼를 복사하려고합니다. 내가 같이 할매트를 ROI로 복사하는 방법은 무엇입니까?
은 다음과 같습니다
는//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??**
}
오 감사합니다! –