今天想用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. location对象属性

    <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8&quo ...

  2. Vue中使用matomo进行访问流量统计的实现

    Vue中使用matomo进行访问流量统计 原文链接 前言 之前做到了一个页面及接口访问流量统计的需求, 然后在网上找了很多帖子,发现有些有的但是写的都不是很详细,所以今天就整理了一下 正文 第一步 首 ...

  3. 为什么深度(Ubuntu)Linux挂载NTFS分区只读不可写?

      如前所述,经扩展,Dell Vostro 1520笔记本电脑拥有了两块硬盘. 本着旧物利用的心思,在其中一块256GiB固态盘上安装了深度linux,同时挂载另一块2TiB机械盘作为存储盘. 这块 ...

  4. 对深层嵌套对象进行取值&赋值

    需求如下: let obj = { foo: { bar: { name: 'biz' } } }; // 输出 'biz' this.getObj(obj, 'foo.bar.name'); obj ...

  5. 题解 CF375D 【Tree and Queries】

    首先,子树上的查询问题可以通过$DFS$序转为序列问题 再一看,没有修改,可以离线,这不就是莫队吗? 我们用$sum_i$表示出现次数$\geq i$的个数 用$val_i$表示第$i$种颜色的出现次 ...

  6. P3410 拍照

    漂亮小姐姐点击就送:https://www.luogu.org/problemnew/show/P3410 题目描述 小B有n个下属,现小B要带着一些下属让别人拍照. 有m个人,每个人都愿意付给小B一 ...

  7. epoll反应堆模型代码

    libevent函数库核心思想 /*** epoll_loop.c ***/ #include<stdio.h> #include<sys/epoll.h> #include& ...

  8. python3 pyinstaller 图标改变不了的问题

    命令 pyinstaller -F ./test.py --noconsole --icon=test.ico 在使用后可能发现新生成的图标仍然为默认图标,有以下解决方案: 将生成的exe文件复制到另 ...

  9. 下载MAMP

    下载https://www.mamp.info/en/downloads/ MAMP PRO will create copies of the MySQL databases located in ...

  10. C++ 利用指针和数组以及指针和结构体实现一个函数返回多个值

    C++ 利用指针和数组实现一个函数返回多个值demo1 #include <iostream> using namespace std; int* test(int,int,int); i ...