本文整理汇总了C++中vecI::resize方法的典型用法代码示例。如果您正苦于以下问题:C++ vecI::resize方法的具体用法?C++ vecI::resize怎么用?C++ vecI::resize使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类vecI
的用法示例。
在下文中一共展示了vecI::resize方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: S_BinInf
// src3f are BGR, color3f are 1xBinDim matrix represent color fore each histogram bin
int CmColorQua::S_BinInf(CMat& idx1i, Mat &color3f, vecI &colorNum, int method, CMat &src3f)
{
int totalBinNum = 0;
CV_Assert(idx1i.data != NULL && idx1i.type() == CV_32S && method >= 0 && method < S_Q_NUM);
// Find colors for each bin
color3f = Mat::zeros(1, binNum[method], CV_32FC3);
Vec3f* color = (Vec3f*)(color3f.data);
vector<Vec3d> colorD(color3f.cols, 0);
colorNum.resize(color3f.cols, 0);
if (src3f.size() != Size() && src3f.data != NULL) {
for (int r = 0; r < idx1i.rows; r++) {
const int *idx = idx1i.ptr<int>(r);
const Vec3f *src = src3f.ptr<Vec3f>(r);
for (int c = 0; c < idx1i.cols; c++) {
colorD[idx[c]] += src[c];
colorNum[idx[c]] ++;
}
}
}
S_RECOVER_FUNC SR_Function = srFuns[method];
for (int i = 0; i < color3f.cols; i++) {
if (colorNum[i] == 0)
(*SR_Function)(i, color[i]);
else
totalBinNum += colorNum[i];
}
if (method == 1)
cvtColor(color3f, color3f, CV_HSV2BGR);
else if (method == 2)
cvtColor(color3f, color3f, CV_Lab2BGR);
for (int i = 0; i < color3f.cols; i++)
if (colorNum[i] > 0)
color[i] = Vec3f((float)(colorD[i][0]/colorNum[i]), (float)(colorD[i][1]/colorNum[i]), (float)(colorD[i][2]/colorNum[i]));
return totalBinNum;
}