如何复制垫ROI
How to copy a Mat to ROI?
我是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??**
}
就像这样使用Mat::copyTo():
newPixelsMat.copyTo(roi);
相关文章:
- C++17复制构造函数,在std::unordereded_map上进行深度复制
- 在C++程序中输入的文本文件将不起作用,除非文本被复制和粘贴
- 使用strcpy将char数组的元素复制到另一个数组
- 是否可以初始化不可复制类型的成员变量(或基类)
- 为什么在C++中使用私有复制构造函数与删除复制构造函数
- C++ Windows 驱动程序MSB3030无法复制该文件,因为它找不到
- 复制列表初始化的隐式转换的等级是多少
- 当从函数参数中的临时值调用复制构造函数时
- 有可能在Armadillo中复制MATLAB circshift方法吗
- 复制几乎为空的数组的最快方法
- 以下示例中如何避免代码复制?C++/库达
- 如果有一个模板构造函数只有一个泛型参数,为什么我必须有一个复制构造函数
- 为什么需要复制构造函数,在哪些情况下它们非常有用
- 不能将复制初始化与隐式转换的多个步骤一起使用
- 当有分配器意识的容器被复制/移动时,反弹分配器是否被复制/移走
- 为什么复制而不是移动数据元素?
- 从Eigen::SparseMatrix中提取块/ROI而不进行复制
- 如何复制垫ROI
- OpenCV复制到图像边界处剪切的ROI的规范方式
- (OpenCV 2.4.6)将一个 Mat's roi 的标头复制到另一个 Mat's roi