本文整理汇总了C++中vecI::clear方法的典型用法代码示例。如果您正苦于以下问题:C++ vecI::clear方法的具体用法?C++ vecI::clear怎么用?C++ vecI::clear使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类vecI
的用法示例。
在下文中一共展示了vecI::clear方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: divisores
void divisores(int n)
{
mv.clear();
int a;
while(a!=n)
{
if(n%a == 0)
{
mv.push_back(a);
a++;
}
}
}
示例2: loadBBoxes
bool DataSetVOC::loadBBoxes(CStr &nameNE, vector<Vec4i> &boxes, vecI &clsIdx)
{
string fName = format(_S(annoPathW), _S(nameNE));
FileStorage fs(fName, FileStorage::READ);
FileNode fn = fs["annotation"]["object"];
boxes.clear();
clsIdx.clear();
if (fn.isSeq()){
for (FileNodeIterator it = fn.begin(), it_end = fn.end(); it != it_end; it++)
loadBox(*it, boxes, clsIdx);
}
else
loadBox(fn, boxes, clsIdx);
return true;
}
示例3: predictBBoxSI
void Objectness::predictBBoxSI(CMat &img3u, ValStructVec<float, Vec4i> &valBoxes, vecI &sz, int NUM_WIN_PSZ, bool fast)
{
const int numSz = _svmSzIdxs.size();
const int imgW = img3u.cols, imgH = img3u.rows;
valBoxes.reserve(10000);
sz.clear();
sz.reserve(10000);
for (int ir = numSz - 1; ir >= 0; ir--) {
int r = _svmSzIdxs[ir];
int height = cvRound(pow(_base, r/_numT + _minT)), width = cvRound(pow(_base, r%_numT + _minT));
if (height > imgH * _base || width > imgW * _base)
continue;
height = min(height, imgH), width = min(width, imgW);
Mat im3u, matchCost1f, mag1u;
resize(img3u, im3u, Size(cvRound(_W*imgW*1.0/width), cvRound(_W*imgH*1.0/height)));
gradientMag(im3u, mag1u);
matchCost1f = _tigF.matchTemplate(mag1u);
ValStructVec<float, Point> matchCost;
nonMaxSup(matchCost1f, matchCost, _NSS, NUM_WIN_PSZ, fast);
// Find true locations and match values
double ratioX = width/_W, ratioY = height/_W;
int iMax = min(matchCost.size(), NUM_WIN_PSZ);
for (int i = 0; i < iMax; i++) {
float mVal = matchCost(i);
Point pnt = matchCost[i];
Vec4i box(cvRound(pnt.x * ratioX), cvRound(pnt.y*ratioY));
box[2] = cvRound(min(box[0] + width, imgW));
box[3] = cvRound(min(box[1] + height, imgH));
box[0] ++;
box[1] ++;
valBoxes.pushBack(mVal, box);
sz.push_back(ir);
}
}
//exit(0);
}
示例4: MergeLM
void CBuild::MergeLM()
{
vecDefl Layer;
vecDefl deflNew;
vecDefl SEL;
Status("Processing...");
for (u32 light_layer=0; light_layer<pBuild->lights.size(); light_layer++)
{
// Select all deflectors, which contain this light-layer
Layer.clear ();
b_light* L_base = pBuild->lights[light_layer].original;
for (int it=0; it<(int)g_deflectors.size(); it++)
{
if (g_deflectors[it].bMerged) continue;
if (0==g_deflectors[it].GetLayer(L_base)) continue;
Layer.push_back (g_deflectors[it]);
}
if (Layer.empty()) continue;
// Resort layer
// Merge this layer
while (Layer.size())
{
// Sort layer (by material and distance from "base" deflector)
Deflector = Layer[0];
std::sort (Layer.begin()+1,Layer.end(),cmp_defl);
// Select first deflectors which can fit
int maxarea = lmap_size*lmap_size*6; // Max up to 6 lm selected
int curarea = 0;
for (it=1; it<(int)Layer.size(); it++)
{
int defl_area = Layer[it]->GetLayer(L_base)->Area();
if (curarea + defl_area > maxarea) break;
curarea += defl_area;
SEL.push_back(Layer[it]);
}
if (SEL.empty())
{
// No deflectors found to merge
// Simply transfer base deflector to _new list
deflNew.push_back(Deflector);
g_deflectors.erase(g_deflectors.begin());
} else {
// Transfer rects
SEL.push_back(Deflector);
for (int K=0; K<(int)SEL.size(); K++)
{
_rect T;
T.a.set (0,0);
T.b.set (SEL[K]->lm.dwWidth+2*BORDER-1, SEL[K]->lm.dwHeight+2*BORDER-1);
T.iArea = SEL[K]->iArea;
selected.push_back (T);
perturb.push_back (K);
}
// Sort by size decreasing and startup
std::sort (perturb.begin(),perturb.end(),cmp_rect);
InitSurface ();
int id = perturb[0];
_rect &First = selected[id];
_rect_register (First,SEL[id],FALSE);
best.push_back (First);
best_seq.push_back (id);
brect.set (First);
// Process
collected.reserve (SEL.size());
for (int R=1; R<(int)selected.size(); R++)
{
int ID = perturb[R];
if (_rect_place(selected[ID],SEL[ID]))
{
brect.Merge (collected.back());
best.push_back (collected.back());
best_seq.push_back (ID);
}
Progress(float(R)/float(selected.size()));
}
R_ASSERT (brect.a.x==0 && brect.a.y==0);
// Analyze resuls
clMsg("%3d / %3d - [%d,%d]",best.size(),selected.size(),brect.SizeX(),brect.SizeY());
CDeflector* pDEFL = new CDeflector();
pDEFL->lm.bHasAlpha = FALSE;
pDEFL->lm.dwWidth = lmap_size;
pDEFL->lm.dwHeight = lmap_size;
for (K = 0; K<(int)best.size(); K++)
{
int iRealIndex = best_seq [K];
_rect& Place = best [K];
_point& Offset = Place.a;
BOOL bRotated;
b_texture& T = SEL[iRealIndex]->lm;
int T_W = (int)T.dwWidth + 2*BORDER;
int T_H = (int)T.dwHeight + 2*BORDER;
if (Place.SizeX() == T_W) {
//.........这里部分代码省略.........