之前已经已经熟悉了怎么读取保存图片,加载视频,摄像头。接下来介绍下OpenCV中基础知识。
- 常见数据类型
-
Vec对象类型
Lesson3-1.jpg
其命名格式为Vec+维度+数据类型。如Vec3f表示维度是3,数据类型是float
-
Point对象类型
Lesson3-2.jpg
命名格式:Point+维度+数据类型,Point默认是Point2i。
-
Size对象类型
Lesson3-3.jpg -
Rect对象类型
Lesson3-4.jpg
-
- matrix的基本运算
此处部详解,具体参照线性代数即可。 - 基本数据存储
OpenCV中内置的FileStorage提供了文件的读取写入,支持的格式如下
//
// 摘要:
// File storage mode
[Flags]
public enum Mode
{
//
// 摘要:
// The storage is open for reading
Read = 0,
//
// 摘要:
// flag, auto format
FormatAuto = 0,
//
// 摘要:
// The storage is open for writing
Write = 1,
//
// 摘要:
// The storage is open for appending
Append = 2,
//
// 摘要:
// flag, read data from source or write data to the internal buffer (which is returned
// by FileStorage::release)
Memory = 4,
//
// 摘要:
// flag, XML format
FormatXml = 8,
//
// 摘要:
// flag, YAML format
FormatYaml = 16,
//
// 摘要:
// flag, write rawdata in Base64 by default. (consider using WRITE_BASE64)
Base64 = 64,
//
// 摘要:
// flag, enable both WRITE and BASE64
WriteBase64 = 65
}
yaml相对比较常见。