我正在学习GrabCut in OpenCV (c++),我坚持这句话
coefs = model.ptr<double>(0);
mean = coefs + componentsCount;
cov = mean + 3*componentsCount;哪里
模型为矩阵
厨师,平均,和cov是双倍*
componentsCount是一个常量整数
我想知道什么是厨师?是RGB值还是其他什么的?(以下代码的结果)
model.ptr<double>(0);会发生什么事
cov = mean + 3*componentsCount;谢谢你的答覆:)
发布于 2015-11-20 17:39:35
Mat model不是彩色图像,而是高斯混合模型的模型。
全球监测团有以下几个私人备忘录:
Mat model;
double* coefs;
double* mean;
double* cov;model单通道双矩阵(CV64FC1),其一行数和列数等于modelSize*componentsCount,其中
componentsCount = 5 // line 60
modelSize = 13 // 3/*mean*/ + 9/*covariance*/ + 1/*component weight*/ // line 89此数据存储在具有此布局的矩阵model中:
cw0, cw1, cw4, m00, m01, m02, m10, ..., m42, c00, c11, ...
^ ^ ^
coefs = model.ptr<double>(0) ^
mean + 3*componentsCount
^
^
coefs + componentsCount其中:
cw<i> is the weight of the i-th component
m<i><j> is the j-th dimension mean of the i-th component
c<i><j> is the j-th dimension covariance of the i-th component 所以:
coefs = model.ptr<double>(0); // points at the start of the weights into model
mean = coefs + componentsCount; // points at the start of the means into model
cov = mean + 3*componentsCount; // points at the start of the covariances into modelptr<double>()只是在第0行的开头返回一个double*,即数据进入矩阵的开始。它相当于(double*)model.data。
基本上,coefs、mean和cov只是将适当的数据输入model的捷径。
https://stackoverflow.com/questions/33828741
复制相似问题