本文整理汇总了C++中CImgList::at方法的典型用法代码示例。如果您正苦于以下问题:C++ CImgList::at方法的具体用法?C++ CImgList::at怎么用?C++ CImgList::at使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CImgList
的用法示例。
在下文中一共展示了CImgList::at方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: GetNumberVideoFrames
CImgList<uint8_t>* ph_getKeyFramesFromVideo(const char *filename){
long N = GetNumberVideoFrames(filename);
if (N < 0){
return NULL;
}
float frames_per_sec = 0.5*fps(filename);
if (frames_per_sec < 0){
return NULL;
}
int step = (int)(frames_per_sec + ROUNDING_FACTOR(frames_per_sec));
long nbframes = (long)(N/step);
float *dist = (float*)malloc((nbframes)*sizeof(float));
if (!dist){
return NULL;
}
CImg<float> prev(64,1,1,1,0);
VFInfo st_info;
st_info.filename = filename;
st_info.nb_retrieval = 100;
st_info.step = step;
st_info.pixelformat = 0;
st_info.pFormatCtx = NULL;
st_info.width = -1;
st_info.height = -1;
CImgList<uint8_t> *pframelist = new CImgList<uint8_t>();
if (!pframelist){
return NULL;
}
int nbread = 0;
int k=0;
do {
nbread = NextFrames(&st_info, pframelist);
if (nbread < 0){
delete pframelist;
free(dist);
return NULL;
}
unsigned int i = 0;
while ((i < pframelist->size()) && (k < nbframes)){
CImg<uint8_t> current = pframelist->at(i++);
CImg<float> hist = current.get_histogram(64,0,255);
float d = 0.0;
dist[k] = 0.0;
cimg_forX(hist,X){
d = hist(X) - prev(X);
d = (d>=0) ? d : -d;
dist[k] += d;
prev(X) = hist(X);
}
k++;
}
pframelist->clear();
} while ((nbread >= st_info.nb_retrieval)&&(k < nbframes));