1. 凸显黄色
vector<Mat> channels;
split(ImSrc,channels);
Mat b = channels.at(0);
Mat g = channels.at(1);
Mat r = channels.at(2);
//Mat R = r-(g+b)/2;
//Mat G = g-(r+b)/2;
//Mat yellow = R-G;
Mat yellow = (g-b)/2+(r-b)/2;
2.Eigen
Eigen是一个C++线性运算的模板库:他可以用来完成矩阵,向量,数值解等相关的运算。(Eigen is a C++ template library for linear algebra: matrices, vectors, numerical solvers, and related algorithms.),Eigen库下载: http://eigen.tuxfamily.org/index.php?title=Main_Page,Eigen库的使用相当方便,将压缩包中的Eigen文件夹拷贝到项目目录下,直接包含其中的头文件即可使用,省去了使用Cmake进行编译的烦恼。Eigen官网有快速入门的参考文档:http://eigen.tuxfamily.org/dox/group__QuickRefPage.html
#include <Eigen/Dense>
Matrix<double, 3, 3> A; // Fixed rows and cols. Same as Matrix3d.
Matrix<double, 3, Dynamic> B; // Fixed rows, dynamic cols.
Matrix<double, Dynamic, Dynamic> C; // Full dynamic. Same as MatrixXd.
Matrix<double, 3, 3, RowMajor> E; // Row major; default is column-major.
Matrix3f P, Q, R; // 3x3 float matrix.
Vector3f x, y, z; // 3x1 float matrix.
RowVector3f a, b, c; // 1x3 float matrix.
VectorXd v; // Dynamic column vector of doubles
// Eigen // Matlab // comments
x.size() // length(x) // vector size
C.rows() // size(C,1) // number of rows
C.cols() // size(C,2) // number of columns
x(i) // x(i+1) // Matlab is 1-based
C(i,j) // C(i+1,j+1) //
https://www.cnblogs.com/rainbow70626/p/8819119.html
针对向量还提供”[]”操作符,注意矩阵则不可如此使用。