今天想用CV2 截个ROI ( Region Of Interest ) 的时候,

是这样写的

结果,

发现是截取img 那句出了错

应该为:

先纵后横

这样就OK了

cv2.selectROI 用法:

selectROI(windowName, img, showCrosshair=None, fromCenter=None)

selectROI(windowName, img[, showCrosshair[, fromCenter]]) -> retval . @brief Selects ROI on the given image. . Function creates a window and allows user to select a ROI using mouse. . Controls: use space or enter to finish selection, use key c to cancel selection (function will return the zero cv::Rect). . . @param windowName name of the window where selection process will be shown. . @param img image to select a ROI. . @param showCrosshair if true crosshair of selection rectangle will be shown. . @param fromCenter if true center of selection will match initial mouse position. In opposite case a corner of . selection rectangle will correspont to the initial mouse position. . @return selected ROI or empty rect if selection canceled. . . @note The function sets it's own mouse callback for specified window using cv::setMouseCallback(windowName, ...). . After finish of work an empty callback will be set for the used window.

selectROI(img[, showCrosshair[, fromCenter]]) -> retval . @overload

就是这样, ┏(^0^)┛

[Python[CV2]] -- 352: error -- 来自截取图片的更多相关文章

  1. python cv2截取不规则区域图片

    知识掌握 cv2.threshold()函数: 设置固定级别的阈值应用于多通道矩阵,将灰度图像变换二值图像,或去除指定级别的噪声,或过滤掉过小或者过大的像素点. Python: cv2.thresho ...

  2. 机器学习进阶-图片基本处理-ROI区域 1.img[0:200, 0:200]截取图片 2.cv2.split(对图片的颜色通道进行拆分) 3. cv2.merge(将颜色通道进行合并) 4 cur_img[:, :, 0] = 0 使得b通道的颜色数值为0

    1. 截取图片的部分区域img[0:200, 0:200], 读入的图片是ndarray格式 2. b, g, r = cv2.split(img)  # 对图片的颜色通道进行拆分 3.img = c ...

  3. python工具-将视频按帧截取图片(附代码)

    描述:将一个视频流按帧数截取大量的图片 用途:AI的数据集制作,得到大量的图片,之后将其打标签 更改的地方 1.default--间隔的帧数   2.input/output--输入视频的路径.存放截 ...

  4. python cv2展示网络图片、图片编解码、及与base64转换

    从网络读取图像数据并展示 需要使用cv2.imdecode()函数,从指定的内存缓存中读取数据,并把数据转换(解码)成图像格式:主要用于从网络传输数据中恢复出图像. # -*- coding: utf ...

  5. c#截取图片

    简单的保存数据流 <input name="upImg" style="width: 350px; height: 25px;" size="3 ...

  6. 使用Python爬虫爬取网络美女图片

    代码地址如下:http://www.demodashi.com/demo/13500.html 准备工作 安装python3.6 略 安装requests库(用于请求静态页面) pip install ...

  7. [ATL/WTL]_[0基础]_[CBitmap复制图片-截取图片-平铺图片]

    场景: 1.当你须要截取图片部分区域作为某个控件的背景. 2.须要平铺图片到一个大区域让他自己主动放大时. 3.或者须要合并图片时. 代码: CDC sdc; CDC ddc; sdc.CreateC ...

  8. Unity 截取图片并且显示出来

    Unity 截取图片并且显示出来 近期用到了unity的截图,并且把他显示出来,摸索了很多! 讲解一个东西,android可以存储一些文件在本地,比如配置文件等! 对于不同的系统,方法不一! if ( ...

  9. arp协议分析&python编程实现arp欺骗抓图片

    arp协议分析&python编程实现arp欺骗抓图片 序 学校tcp/ip协议分析课程老师布置的任务,要求分析一种网络协议并且研究安全问题并编程实现,于是我选择了研究arp协议,并且利用pyt ...

随机推荐

  1. MyBatis 接口注解方式代替mapper.xml

    https://blog.csdn.net/m0_38068812/article/details/86566929 spring boot(8)-mybatis三种动态sql  或者 这个 1. 代 ...

  2. 新的log4j2.xml

    <?xml version="1.0" encoding="UTF-8"?> <!-- OFF < FATAL < ERROR & ...

  3. OpenJudge 1.5.14 人口增长问题

    描述 我国现有x亿人口,按照每年0.1%的增长速度,n年后将有多少人? 输入一行,包含两个整数x和n,分别是人口基数和年数,以单个空格分隔.输出输出最后的人口数,以亿为单位,保留到小数点后四位.1 & ...

  4. hive --metastore三种模式

    在官网上对于这几种模式的介绍如下: 按Metastore数据库位置分: 1.本地/嵌入式Metastore数据库(Derby) 2.远程Metastore数据库(其他的关系型数据库,像mysql.or ...

  5. zabbix (二)安装

    一.centos7源码安装zabbix3.x 1.安装前环境搭建 下载最新的yum源 #wget -P /etc/yum.repos.d http://mirrors.aliyun.com/repo/ ...

  6. 切换node版本,node-sass安装报错

    一.问题 经常在开发过程中,会遇到切换node环境的情况,这时候切换之后,npm安装不了node-sass,有可能是之前把node-sass安装地址修改了,导致翻墙翻不了,所以安装不了. 二.解决 1 ...

  7. PhpStorm 增加Swoole智能提示

    下载https://github.com/eaglewu/swoole-ide-helper的源码 git clone https://github.com/eaglewu/swoole-ide-he ...

  8. Django 测试开发5 unittest测试用例

    Django测试用例 Django默认Python的标准库unittest编写测试用例.Django的单元测试类django.test.TestCase 从unittest.TestCase继承而来. ...

  9. Mybatis xml mapper 特殊写法总结

    项目告一段落,业务代码也写得差不多了,框架仍然用的是 ssm ,为了省去单表数据库操作的代码编写,继续用 mybatis generator 生成单表对应的实体类.dao层映射关联及配置文件,私下还尝 ...

  10. Python-文件读写及修改

    文件的读写有三种形式:读.写和追加. 一.读模式 r 和读写模式 r+ 1.读模式 r 读模式r特点:(1)只能读,不能写:(2)文件不存在时会报错. (1)例:读取当前目录下的books.txt文件 ...