今天想用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. 入门指引之查看accesstoken

    1. 测试工具查看 https://mp.weixin.qq.com/debug/ 2. 代码获取: # -*- coding: utf-8 -*- # filename: basic.py impo ...

  2. Linux gdb分析core dump文件

    文章目录1. coredump1.1 coredump简介1.2 coredump的文件存储路径1.3 coredump产生的条件1.4 coredump产生原因2. 测试生成coredump1. c ...

  3. 剖析生产系统的I/O模式

    剖析生产系统的I/O模式 2019/02/13 vmunix 了解I/O的特点对于优化系统性能非常重要,I/O是顺序的还是随机的,是读操作还是写操作,读写的比例是多少,I/O数据块的大小,这些都是影响 ...

  4. python 调用未绑定的超类构造方法

    class Bird: def __init__(self): self.hungry = True def eat(self): if self.hungry: print('Aaaaah') se ...

  5. Codeforces Round #591

    目录 Contest Info Solutions A. Save the Nature B. Sequence Sorting C. Paint the Tree D. Stack Extermin ...

  6. P1833 樱花

    题目背景 <爱与愁的故事第四弹·plant>第一章. 题目描述 爱与愁大神后院里种了n棵樱花树,每棵都有美学值Ci.爱与愁大神在每天上学前都会来赏花.爱与愁大神可是生物学霸,他懂得如何欣赏 ...

  7. html5、手机端 input 单独打开相机、摄像头、录音功能

    相机:<input type="file" name="image" accept="image/*" capture="u ...

  8. Elasticsearch6.4.0-windows环境部署安装

    Elasticsearch可以轻松的实现全文检索,本文主要介绍Elasticsearch(ES)环境的安装部署,该文及后续使用的ES版本为6.4.0.希望能够帮助到大家. 一.安装Elasticsea ...

  9. GDPR全文翻译(一)

    General Data Protection Regulation <一般数据保护法案>全文翻译(一) 编者按 2016年4月14日,欧洲议会投票通过了商讨四年的<一般数据保护法案 ...

  10. 监控、日志、APM整个监控体系思考 我为峰2014 简书作者 4.6092018-11-19 11:39打开App 序言

    监控.日志.APM整个监控体系思考 我为峰2014 简书作者 4.6092018-11-19 11:39打开App 序言