Android OpenCV Create Rect
Android OpenCV Create Rect
晚上好,需要一些帮助来获得 openCV 像素的正方形区域我试图从屏幕中央的 50x50 区域获取像素,但我没有得到任何成功。如果我使用输出,如果使用原始垫(图像),则不会获得任何其他像素,它会获得顶角请有人帮忙
@Override
public void onPreviewFrame(Mat image) {
int w = image.cols();
int h = image.rows();
Mat roi=new Mat(image, new Rect(h/2 , w/2 , 50, 50));
Mat output = roi.clone();
int rw=output.cols();
int rh=output.rows();
//double [] arrp = output.get(rh, rw);//if i use the output i dont get any pixel
double [] arrp = image.get(rh, rw);//if use original mat its getting the top corner
Log.i("",+(int)arrp[2]+" "+ (int)arrp[1]+" "+(int)arrp[0]);
}
我假设您可以使用copyTo
:
Mat output(50, 50, image.type());
image(Rect(h/2 , w/2 , output.size())).copyTo(output);
矩阵类有一个运算符(const Rect &roi),它返回一个子矩阵(没有深度数据复制)。 : http://docs.opencv.org/modules/core/doc/basic_structures.html#id6
编辑:
没看到它是针对安卓的。我认为没有运算符,所以你必须使用 submat
函数:
image.submat(Rect(h/2 , w/2 , output.size())).copyTo(output)
相关文章:
- Using C++ CryptAPI:CNG Create CSR
- 错误:(-210:不支持的格式或格式组合)功能'create'中的硬件视频解码器不支持视频源
- Firebase C++VS2018 SDL2-在Firebase::app::create(..)上执行异常处理
- QThread::create 似乎没有将参数传递给函数
- 为什么"non-standard syntax; use '&' to create a pointer to member"在 CTOR 中使用线程?
- QThread::create running on UI Thread
- OpenCV Rect x 和 y 表示 (column,row) 或 (row,column)
- 空指针(为缺少的输出数组调用的 create() 在 create,文件 /home/m/OpenCV/modules/
- 使用宏替换工厂模式样式 API 中的"create()"函数
- 错误:'create'不是 'cv::Tracker' 的成员
- Gtk::Main 和 Gtk::Application::create 有什么区别?
- 如果它被定义为 C++ 类中的成员函数,我得到了"non-standard syntax; use '&' to create a pointer to member"
- OpenCV断言对RECT ROI失败了
- 使 ShowHint 使用多个不同的 Rect 处理自定义控件,每个 Rect 都有自己的 Hint
- Qt QGraphicsScene::setSceneRect() 实际上并没有设置场景 rect
- libgit2:git_clone() 失败并出现"failed to create ssl object"错误
- 使用c_str时"Use & to create a pointer to a member"
- OGRE-找不到请求的发射极类型.在promentystemmanager中:: _ create -emitter
- Visual Studio 2015:获取"non standard syntax, use '&' to create a pointer to member"错误
- Android OpenCV Create Rect