核心功能
-
The Core Functionality (core module)
Here you will learn the about the basic building blocks of the library. A must read and know for understanding how to manipulate the images on a pixel level.
傅里叶分离变换 (DFT)
-
Compatibility: > OpenCV 2.0
Author: Bernát Gábor
You will see how and why use the Discrete Fourier transformation with OpenCV.
了解傅里叶变换
了解OpenCV如何使用它
数学上 我们可以将二维图像转化为一维的数列,然后通过傅里叶变换将数列转换到频域
表达式(cosx表示该点的实部,isinx表示虚部):
步骤简要说明:
Expand the image to an optimal size:
拓展图片的大小(貌似是为了变换时能有足够的画布存下临时数据,比较理想的是拓展两倍,使用cv::getOptimalDFTSize() 获取具体尺寸,cv::copyMakeBorder() 进行拓展)
Make place for both the complex and the real values.
将拓展出来的区域填充上0;
Make the Discrete Fourier Transform
进行dft变换
Transform the real and complex values to magnitude.
求出变换结果的值M(由虚数转换为该虚数代表的某种值magnitude),虚数的两部分被分别存于原先的Mat部分和拓展部分,最后的结果被放于原有部分。
Switch to a logarithmic scale
对数形式表达M,因为直接用M来表示太大了。
Crop and rearrange
据描述是用来剔除扩展部分的
Normalize
将求出M后的图像拓展到可视化的范围(大概是三色0~255)
这些比较抽象,有兴趣的童鞋可以找相关资料仔细研究,不适合略读。
XML格式IO
-
File Input and Output using XML and YAML files
Compatibility: > OpenCV 2.0
Author: Bernát Gábor
You will see how to use the cv::FileStorage data structure of OpenCV to write and read data to XML or YAML file format.
string filename = "I.xml";
FileStorage fs(filename, FileStorage::WRITE);
//...
fs.open(filename, FileStorage::READ);
fs.release();
基本的打开关闭操作
Input and Output of text and numbers
键值对io
fs << "iterationNr" << 100;
int itNr;
fs["iterationNr"] >> itNr;
itNr = (int) fs["iterationNr"];
Input/Output of OpenCV Data structures
Mat作为值进行键值对io
Mat R = Mat_<uchar >::eye (3, 3),
T = Mat_<double>::zeros(3, 1);
fs << "R" << R; // Write cv::Mat
fs << "T" << T;
fs["R"] >> R; // Read cv::Mat
fs["T"] >> T;
Input/Output of vectors (arrays) and associative maps.
字符串、map io 略
Read and write your own data structures
自定义数据结构io 记得编写对应的write read方法