当前位置: 首页>>代码示例>>C++>>正文


C++ TLFImage::CalcLnSum方法代码示例

本文整理汇总了C++中TLFImage::CalcLnSum方法的典型用法代码示例。如果您正苦于以下问题:C++ TLFImage::CalcLnSum方法的具体用法?C++ TLFImage::CalcLnSum怎么用?C++ TLFImage::CalcLnSum使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在TLFImage的用法示例。


在下文中一共展示了TLFImage::CalcLnSum方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: Features

//-------------------------------TLFEmptyAverageNNPredictor----------------------
TLFDblVector* TLFEmptyAverageNNPredictor::Features(ILFDetectEngine* engine, TLFRect* rect, int id)
{
	if (engine == NULL || rect == NULL)
		return NULL;
	ILFObjectDetector* d = engine->GetDetector(0);
	if (d == NULL)
		return NULL;
	TLFImage* img = d->GetImage();
	if (img == NULL)
		return NULL;
	TLFDblVector* data = new TLFDblVector(id);
	double w = (double)rect->Width() / 8;
	double h = (double)rect->Height() /8;
	double s = w*h;
	for (int y = 0; y < 8; y++)
	{
		int yy = (int)floor(rect->Top() + y*w + 0.5);
		for (int x = 0; x < 8 ; x++)
		{
			int xx = (int)floor(rect->Left() + x*w + 0.5);
			double value = img->CalcLnSum(xx, yy, (int)w, (int)h)/s;
			data->AddValue(value);
		}
	}
	return data;
}
开发者ID:telnykha,项目名称:VideoA,代码行数:27,代码来源:LFPredictors.cpp

示例2: Predict

TLFRect* TLFIntegralImagePredictor::Predict(ILFDetectEngine* engine)
{
	TLFFGEngine* e = dynamic_cast<TLFFGEngine*>(engine);
	if (e == NULL)
		return NULL;
	if (m_pPredicted != NULL)
	{
		delete m_pPredicted;
		m_pPredicted = NULL;
	}
	TLFImage* fg = e->GetForegroundImage();
	double max_s = 0;
	double value;
	double overlap;
	double s;
	int idx = -1;
	for (int i = 0; i < m_scanner->GetFragmentsCount(); i++)
	{
		awpRect rect = m_scanner->GetFragmentRect(i);
		s  = (rect.right - rect.left)*(rect.bottom - rect.top);

		overlap = m_rect.RectOverlap(rect);
		if (overlap > 0.5)
		{
			value = pow(1.1,overlap)*fg->CalcLnSum(rect.left, rect.top, rect.right - rect.left, rect.bottom - rect.top) /s;
			if (value > max_s)
			{
				max_s = value;
				idx = i;
			}
		}
	}
	if (idx < 0)
	{
		m_pPredicted = NULL;
		return NULL;
	}
	else
	{
		TLFRect* r_result = new TLFRect();
		r_result->SetRect(m_scanner->GetFragmentRect(idx));
		awpRect rr = r_result->GetRect();
		//awpFillRect(e->GetForeground(), &rr, 0, 0);
		m_pPredicted = r_result;
		m_rect.SetRect(r_result->GetRect());
		return r_result;
	}
}
开发者ID:telnykha,项目名称:VideoA,代码行数:48,代码来源:LFPredictors.cpp

示例3: Features

TLFDescriptor* TLFAverageNNTracker::Features(ILFDetectEngine* engine, TLFRect* rect, int id)
{
	if (engine == NULL || rect == NULL)
		return NULL;
	TSCObjectDetector* d = dynamic_cast<TSCObjectDetector*>(engine->GetDetector(0));
	if (d == NULL)
		return NULL;
	TLFImage* img = d->GetImage();
	if (img == NULL || img->GetImage() == NULL)
		return NULL;

	//
	int idx = d->GetStagesCount() - 1;
	TLFObjectList* stages = d->GetStrongs();

	TCSStrong* s = dynamic_cast<TCSStrong*>(stages->Get(idx));
	if (s == NULL)
		return NULL;
	double* data = (double*)malloc(s->GetCount()*sizeof(double));
	int width = rect->Width();
	double scale_coef = (double)width / (double)d->GetBaseWidth();
	TLFRect fragment;

	for (int i = 0; i < s->GetCount(); i++)
	{
		ILFWeak  * weak = s->GetWeak(i);
		if (weak != NULL)
		{
			TCSSensor* sensor = dynamic_cast<TCSSensor*>(weak->Fetaure());
			awpRect Fragment = sensor->GetRect();

			fragment.SetRect(Fragment);
			fragment.Scale(scale_coef);
			fragment.Shift(rect->Left(), rect->Top());

			Fragment = fragment.GetRect();
			double s = fragment.Width()*fragment.Height();
			double value = img->CalcLnSum(Fragment.left, Fragment.top, fragment.Width(), fragment.Height());
			value /= s;
			data[i] = value;

		}
	}
	TLFDescriptor* dscr = new TLFDescriptor(s->GetCount(), id, data);
	free(data);
	return dscr;
}
开发者ID:telnykha,项目名称:VideoA,代码行数:47,代码来源:TrackResearch.cpp


注:本文中的TLFImage::CalcLnSum方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。