opencv中roi嵌套
来源:互联网 发布:windows10的编程软件 编辑:程序博客网 时间:2024/05/21 09:08
问题:在opencv中,取一幅图像src的子区间roi,在该roi里面分析,得到子区间roi的子区间roi2。如何把子区间里面的roi2的坐标还原到src。
解决:函数在下面给出,相关主函数自行添加
void RoiTest(){char filename[100];int count=1;Mat src;Mat subsrc;Rect grinder_test_roi;Rect sub_test_roi;Rect dst_test_roi;sprintf(filename,"D:/frame3/%04d.jpg",count);src=imread(filename);if(!src.data){return;}grinder_test_roi.y=cvRound(src.rows/2.5);//行起始点坐标grinder_test_roi.x=0;//列起始点坐标grinder_test_roi.height=src.rows-grinder_test_roi.y;grinder_test_roi.width=cvRound(src.cols/2);rectangle(src, grinder_test_roi.tl(), grinder_test_roi.br(), Scalar(0,255,0), 3);//imshow("grinderRoi",src);subsrc=src(grinder_test_roi);sub_test_roi.y=cvRound(subsrc.rows/2.5);sub_test_roi.x=0;sub_test_roi.height=subsrc.rows-sub_test_roi.y;sub_test_roi.width=cvRound(subsrc.cols/2);rectangle(subsrc, sub_test_roi.tl(), sub_test_roi.br(), Scalar(0,0,255), 3);imshow("subRoi",subsrc);dst_test_roi.y=sub_test_roi.y+grinder_test_roi.y;//坐标还原过程dst_test_roi.x=sub_test_roi.x+grinder_test_roi.x;dst_test_roi.height=sub_test_roi.height;dst_test_roi.width=sub_test_roi.width;rectangle(src, dst_test_roi.tl(), dst_test_roi.br(), Scalar(255,0,0), 3);imshow("grinderRoi",src);waitKey();}
0 0
- opencv中roi嵌套
- OpenCV中ROI 总结
- OpenCV中ROI 总结
- OpenCV中ROI 总结
- OpenCV中ROI
- OpenCV中图像设置ROI
- opencv roi
- opencv ROI
- opencv:ROI
- OpenCV中关于感兴趣的区域ROI
- OpenCV中关于感兴趣的区域ROI
- opencv中获取任意方向的ROI
- OPENCV不规则ROI-圆形ROI
- OpenCV中取ROI区域RGB的均值,求方差,ROI区域颜色是否明显区分
- OpenCV中图像及子图像ROI之间的复制
- OpenCV中Mat类的图像如何设置ROI
- openCV中Mat类的图像如何设置ROI
- OpenCV中图像及子图像ROI之间的复制
- 获取请求头和响应头
- 磁盘阵列初步图文教程【在软RAID下设置的】
- [Android基础知识] 之六:Intent.Action的各种常见应用
- 黑马程序员_JavaAPI
- 如何实现用户自定义Word模板
- opencv中roi嵌套
- CCClinppingNode将图片裁剪出圆形
- 零编码制作报表?
- poj 2255 二叉树遍历
- visual assist X快捷键
- Sphinx在windows下的安装
- hdoj 2791 The Seven Percent Solution 水过~
- NYOJ 题目2 括号配对问题
- oracle学习之体系结构1