opencv的python接口尽管可以用了,仍然不觉得那么好用… 比如cvMat cv.IplImage等,为什么不用python原生的数据结构呢?

好,我就来检查下opencv中的各种数据结构、类型间的关系。

CvPoint

2D point with integer coordinates (usually zero-based).

2D point, represented as a tuple (x, y) , where x and y are integers.

CvPoint2D32f

2D point with floating-point coordinates

2D point, represented as a tuple (x, y) , where x and y are floats.

CvPoint3D32f

3D point with floating-point coordinates

3D point, represented as a tuple (x, y, z) , where x, y and z are floats.

CvPoint2D64f

2D point with double precision floating-point coordinates

2D point, represented as a tuple (x, y) , where x and y are floats.

CvPoint3D64f

3D point with double precision floating-point coordinates

3D point, represented as a tuple (x, y, z) , where x, y and z are floats.

由此看到,Point相关的传tuple,这是很容易理解的

CvSize

Pixel-accurate size of a rectangle.

Size of a rectangle, represented as a tuple (width, height) , where width and height are integers.

CvSize2D32f

Sub-pixel accurate size of a rectangle.

Size of a rectangle, represented as a tuple (width, height) , where width and height are floats.

CvRect

Offset (usually the top-left corner) and size of a rectangle.

Rectangle, represented as a tuple (x, y, width, height) , where all are integers.

CvScalar

A container for 1-,2-,3- or 4-tuples of doubles.

CvScalar is always represented as a 4-tuple.

>>> import cv
>>> cv.Scalar(1, 2, 3, 4)
(1.0, 2.0, 3.0, 4.0)
>>> cv.ScalarAll(7)
(7.0, 7.0, 7.0, 7.0)
>>> cv.RealScalar(7)
(7.0, 0.0, 0.0, 0.0)
>>> cv.RGB(17, 110, 255)
(255.0, 110.0, 17.0, 0.0)

CvTermCriteria

Termination criteria for iterative algorithms.

Represented by a tuple (type, max_iter, epsilon) .

type
CV_TERMCRIT_ITER , CV_TERMCRIT_EPS or CV_TERMCRIT_ITER | CV_TERMCRIT_EPS
max_iter
Maximum number of iterations
epsilon
Required accuracy
(cv.CV_TERMCRIT_ITER, 10, 0)                         # terminate after 10 iterations
(cv.CV_TERMCRIT_EPS, 0, 0.01)                        # terminate when epsilon reaches 0.01
(cv.CV_TERMCRIT_ITER | cv.CV_TERMCRIT_EPS, 10, 0.01) # terminate as soon as either condition is met

------------------------------分割--------------------------------------

CvMat

A multi-channel 2D matrix. Created by CreateMat , LoadImageM , CreateMatHeader , fromarray .

type
A CvMat signature containing the type of elements and flags, int
step
Full row length in bytes, int
rows
Number of rows, int
cols
Number of columns, int
tostring() → str
Returns the contents of the CvMat as a single string.

CvMatND

Multi-dimensional dense multi-channel array.

type
A CvMatND signature combining the type of elements and flags, int
tostring() → str
Returns the contents of the CvMatND as a single string.

IplImage

The IplImage object was inherited from the Intel Image Processing Library, in which the format is native. OpenCV only supports a subset of possible IplImage formats.

nChannels
Number of channels, int.
width
Image width in pixels
height
Image height in pixels
depth

Pixel depth in bits. The supported depths are:

IPL_DEPTH_8U
Unsigned 8-bit integer
IPL_DEPTH_8S
Signed 8-bit integer
IPL_DEPTH_16U
Unsigned 16-bit integer
IPL_DEPTH_16S
Signed 16-bit integer
IPL_DEPTH_32S
Signed 32-bit integer
IPL_DEPTH_32F
Single-precision floating point
IPL_DEPTH_64F
Double-precision floating point
origin
0 - top-left origin, 1 - bottom-left origin (Windows bitmap style)
tostring() → str
Returns the contents of the CvMatND as a single string.

CvArr

Arbitrary array

CvArr is used only as a function parameter to specify that the parameter can be:

  • an IplImage
  • a CvMat
  • any other type that exports the array interface 即要有__array_interface__属性

于此看来,point size color scaler 啥的用tuple就可以了,而mat iplimage 啥的要用opencv上定义的,但有一个疑惑是有次需要传mat的时候,我传入了一个list竟然没有出问题。有人能帮忙解释下么?

转载于:https://www.cnblogs.com/justin_s/archive/2010/12/28/1918723.html

OpenCV python Calibration相关推荐

  1. OpenCV+python:Canny边缘检测算法

    1,边缘处理 图像边缘信息主要集中在高频段,通常说图像锐化或检测边缘,实质就是高频滤波.我们知道微分运算是求信号的变化率,具有加强高频分量的作用. 在空域运算中来说,对图像的锐化就是计算微分.由于数字 ...

  2. OpenCV Python在计算机视觉中的应用

    OpenCV Python教程 在这篇文章中,我们将使用Python中的OpenCv来涵盖计算机视觉的各个方面.OpenCV长期以来一直是软件开发的重要组成部分. 什么是计算机视觉? 我们考虑一个场景 ...

  3. OpenCV Python教程(2、图像元素的访问、通道分离与合并)

    OpenCV Python教程之图像元素的访问.通道分离与合并 转载请详细注明原作者及出处,谢谢! 访问像素 像素的访问和访问numpy中ndarray的方法完全一样,灰度图为: [python] v ...

  4. python中import cv2遇到的错误及安装方法_独家利用OpenCV,Python和Ubidots来构建行人计数器程序(附代码amp;解析)...

    作者:Jose Garcia 翻译:吴振东 校对:张一豪 本文约4000字,建议阅读14分钟. 本文将利用OpenCV,Python和Ubidots来编写一个行人计数器程序,并对代码进行了较为详细的讲 ...

  5. 如何把OpenCV Python获取的图像传递到C层处理

    原文:https://blog.csdn.net/yushulx/article/details/52788051 用OpenCV Python来开发,如果想要用到一些C/C++的图像处理库,就需要创 ...

  6. openCV—Python(6)—— 图像算数与逻辑运算

    openCV-Python(6)-- 图像算数与逻辑运算 一.函数简介 1.add-图像矩阵相加 函数原型:add(src1, src2, dst=None, mask=None, dtype=Non ...

  7. opencv python 图像去噪

    opencv python 图像去噪 文章目录: https://blog.csdn.net/Annihilation7/article/details/82718470 https://segmen ...

  8. opencv python 中cv2.putText()函数的用法

    opencv python 中cv2.putText()函数的用法 文章目录: 一.快速使用 二.官方文档 三.使用举例 虽然用啦很多次,还是决定记录一下 一.快速使用 cv2.putText(ima ...

  9. opencv python全屏显示、置窗口大小和位置

    opencv python全屏显示.设置窗口大小和位置 文章目录: 一.全屏显示图片或视频 二.设置窗口的大小和位置 1.设置窗口的大小 2.设置窗口的位置 一.全屏显示图片或视频 有时我们需要显示图 ...

  10. opencv python 从摄像头获取视频、帧率、分辨率等属性设置和使用

    opencv python 从摄像头获取视频.帧率.分辨率等属性设置和使用 文章目录: 1,为了获取视频,你应该创建一个 VideoCapture 对象.他的参数可以是设备的索引号,或者是一个视频文件 ...

最新文章

  1. Facebook:易于解释的神经元可能会阻碍深度神经网络的学习
  2. LINUX的20练习题
  3. Nodejs--url模块
  4. 数据库系统实训——实验八——数据库维护
  5. Python PIL(图像处理库)使用方法
  6. 【支付宝服务窗】JEECG支付宝服务窗平台指南
  7. 剑指Offer:面试题33——把数组排成最小的数(java实现)(未完待续)
  8. 解决python2.7.9以下版本requests访问https的问题
  9. bin和sbin区别
  10. ae制h5文字动画_绝对干货!H5动画制作方法全揭秘!
  11. Linux复制文件到某路径并重命名
  12. 把照片改成指定像素基于PS(证件照修改为制定像素大小)
  13. php控制wifi上网时长,腾达路由器家长控制功能怎么控制孩子上网时间
  14. 更改电脑本地用户名,将中文用户名给为英文名称
  15. python金融分析-计算对数收益率及其波动率并画图
  16. 基于 AHB 总线的 SRAM 控制器设计
  17. JDK8 stream流的骚操作
  18. python lib库_python标准库pathlib常见操作
  19. linux怎么进入bios界面,联想怎么进入bios界面,详细教您进入联想电脑怎么进入bios界面...
  20. 小鹏G3 XPilot ---APA自动泊车系统

热门文章

  1. 【一分钟论文】Deep Biaffine Attention for Neural Dependency Parsing
  2. 谷歌高频面试题-较小的三数之和
  3. 论文赏析[EMNLP19]如何在Transformer中融入句法树信息?这里给出了一种解决方案
  4. 金融评分卡项目—3.流失预警模型中的数据预处理与特征衍生
  5. numpy - np.reshape:将二维数组转变三维数组
  6. 时间序列-N_LSTM
  7. CSDNamp;amp;《程序员》杂志创始人——蒋涛 推荐
  8. 《我也能做CTO之程序员职业规划》和《.NET软件设计新思维——像搭积木一样搭建软件》新书发布会 回顾
  9. 敏捷无敌(11)之兵不厌诈
  10. 深度学习:自然语言生成-集束/柱搜索beam search和随机搜索random search