opencv处理不规则多边形ROI
来源:互联网 发布:算法第四版pdf 图灵 编辑:程序博客网 时间:2024/04/29 11:24
使用到的opencv函数
- fillpoly函数
- polylines函数
程序实例
#include <opencv2/opencv.hpp>#include <iostream>using namespace std;using namespace cv;int main(){ Mat img = imread("1.png"); Point root_points[1][6]; root_points[0][0] = Point(5,5); root_points[0][1] = Point(img.cols,5); root_points[0][2] = Point(img.cols,225); root_points[0][3] = Point(465,225); root_points[0][4] = Point(215,220); root_points[0][5] = Point(5,220); const Point* ppt[1] = {root_points[0]}; int npt[] = {6}; polylines(img, ppt, npt, 1, 1, Scalar(255),1,8,0); //imshow("Test", img); // waitKey(); fillPoly(img, ppt, npt, 1, Scalar(255,255,255)); ///////////对下方的区域外的像素进行赋值为0 Point root_points_1[1][8]; root_points_1[0][0] = Point(5,220); root_points_1[0][1] = Point(215,220); root_points_1[0][2] = Point(235,465); root_points_1[0][3] = Point(466,450); root_points_1[0][4] = Point(460,225); root_points_1[0][5] = Point(img.cols,225); root_points_1[0][6] = Point(img.cols,img.rows); root_points_1[0][7] = Point(0,img.rows); const Point* ppt_1[1] = {root_points_1[0]}; int npt_1[] = {8}; polylines(img, ppt_1, npt_1, 1, 1, Scalar(255),1,8,0); //imshow("Test", img); // waitKey(); fillPoly(img, ppt_1, npt_1, 1, Scalar(255,255,255)); imshow("Test_img", img); waitKey(); //imshow("img",img); //waitKey(0); return 0;}
处理结果
总结
对特定区域像素值保持原状,特定区域之外像素值变化。
0 0
- opencv处理不规则多边形ROI
- opencv处理不规则多边形ROI 之二
- opencv只操作不规则多边形roi
- OPENCV不规则ROI-圆形ROI
- Opencv提取不规则ROI
- opencv不规则ROI——圆形ROI
- 利用OpenCV设定不规则ROI区域
- OpenCV生成不规则ROI另一法
- 不规则ROI
- 不规则roi
- 不规则ROI
- opencv-视频处理--画感兴趣区域(ROI)
- opencv roi
- opencv ROI
- opencv:ROI
- OpenCV2.4.13 中 选取roi区域,任意形状(矩形,不规则多边形,圆形,椭圆,手动指定形状)
- 利用鼠标绘制不规则ROI
- 求不规则多边形面积
- NavigationView
- 大数据博客,资源汇总
- 60. Permutation Sequence
- 异或门的一点学习
- C语言编写一个程序,可以一直接收键盘字符,如果是小写字符就输出对应的大写字符,如果接收的是大写字符,就输出对应的小写字符,如果是数字不输出。
- opencv处理不规则多边形ROI
- 51nod 1043 幸运号码
- 51nod 1046 A^B Mod C
- 数据结构实验之二叉树四:还原二叉树
- OpenGL系列1:OpenGL概述
- Intellij IDEA 快捷键大全
- NYOJ 1103 区域赛系列一多边形划分(卡特兰数)
- Pixhawk开发环境搭建之PX4固件编译
- 说上一说话