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


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

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


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

示例1: CFLoadImage

/*
	CFLoadImage
	Load image from path 
*/
CF_ERROR __EXPORT_TYPE CFLoadImage( CF_IMAGE hImage, char* path )
{
    CF_ERROR status = CF_SUCCESS;
    // преобразование типов.
    TLFImage* image = (TLFImage*)hImage;
    if(image == NULL)
    {
        status = CFF_INVALID_HANDLE;
        return status;
    }

    if(!image->LoadImage( path ))
    {
        status = CFF_CANNOT_LOAD_IMAGE;
        return status;
    }    
	return status;
}
开发者ID:hatc,项目名称:ekc,代码行数:22,代码来源:cfimage.cpp

示例2: GetFarFrr

void TLFDBLabeledImages::GetFarFrr(TLFDetectEngine& engine, double& Far, double& Frr, double overlap)
{
	Far = 0;
	Frr = 0;
	if (GetItemsCount() == 0)
		return;

	for (int i = 0; i < m_dataFiles.GetCount(); i++)
	{ 
		TLFDBSementicDescriptor* d = (TLFDBSementicDescriptor*)m_dataFiles.Get(i);
		string strImageName = d->GetImageFile();
		TLFImage img;
		img.LoadImage(strImageName.c_str());
		engine.SetSourceImage(&img, true);
		TLFSemanticImageDescriptor* d1 = engine.GetSemantic();
		Far += d1->Compare(d, overlap);
		Frr += d->Compare(d1, overlap);
		if (i % 100 == 0)
			printf(">");
	}
	printf("\n");
	Far /= GetItemsCount();
	Frr /= GetItemsCount();
}
开发者ID:telnykha,项目名称:VideoA,代码行数:24,代码来源:LFDatabase.cpp

示例3: _tmain

int _tmain(int argc, _TCHAR* argv[])
{
	if (argc < 2)
	{
		Usage();
		return 1;
	}

	// main program
	TiXmlDocument doc;
	if (!doc.LoadFile(argv[1]))
	{
		printf("error: cannot load configuration.\n");
		return 1;
	}

	TiXmlHandle hDoc(&doc);
	TiXmlElement* pElem = NULL;
	pElem = hDoc.FirstChildElement().Element();
	if (!pElem)
	{
		printf("error: invalid configuration file.\n");
		return 1;
	}
   const char* name = pElem->Value();
   if (strcmp(name, "resize") != 0)
	{
		printf("error: invalid configuration file.\n");
		return 1;
	}
	string path =  pElem->Attribute("in_database");
	string ext  =  pElem->Attribute("format");
	g_path      =  pElem->Attribute("out");
	pElem->QueryIntAttribute("width",  &g_width);
	pElem->QueryIntAttribute("height", &g_height);

	printf("params:\n");

	printf("input database: %s\n", path.c_str());
	printf("output database: %s\n", g_path.c_str());
	printf("output images format: %s\n", ext.c_str());
	printf("out width %i\n", g_width);
	printf("out height %i:\n",g_height);

	if (!LFDirExist(g_path.c_str()))
		LFCreateDir(g_path.c_str());

	_finddata_t filesInfo;
	int num_images = 0;
	long handle = 0;

	if ( (handle = _findfirst( (char*)((path+"*.awp").c_str()), &filesInfo)) != -1 )
	{
		do
		{
			string name = path + filesInfo.name;
			TLFImage image;
			if (!image.LoadImage((char*)name.c_str()))
			{
				printf("cannot load image %s \n", name.c_str());
				continue;
			}
			num_images++;
			awpImage* img = image.GetImage();
			awpResize(img, g_width, g_height);

			std::string FileName = g_path;
			FileName += LFIntToStr(num_images);
            FileName += ext;
			image.SaveImage(FileName.c_str());

			if (num_images % 100 == 0)
				printf(">");

		}while(!_findnext( handle, &filesInfo ));
	}
	_findclose( handle );

	printf("\nprocessed %i images\n", num_images);
	printf("done.\n");
	return 0;
}
开发者ID:telnykha,项目名称:VideoA,代码行数:82,代码来源:main.cpp

示例4: GetFarFrrHST

void TLFDBLabeledImages::GetFarFrrHST(TLFDetectEngine& engine, TLFHistogramm& far_hst, TLFHistogramm& frr_hst, int stage, bool all, double overlap)
{
	ILFObjectDetector* detector = engine.GetDetector();
	if (detector == NULL)
		return;
	if (stage < 0 || stage >= detector->GetStagesCount())
		return;

	ILFScanner* scanner = detector->GetScanner();
	if (scanner == NULL)
		return;
	TLFObjectList* strongs = detector->GetStrongs();
	if (strongs == NULL)
		return;
	ILFStrong*     classifier = (ILFStrong*)strongs->Get(stage);
	if (classifier == NULL)
		return;

	far_hst.Setup(32, 0, classifier->GetThreshold() * 2);
	frr_hst.Setup(32, 0, classifier->GetThreshold() * 2);
	for (int i = 0; i < m_dataFiles.GetCount(); i++)
	{
		TLFDBSementicDescriptor* d = (TLFDBSementicDescriptor*)m_dataFiles.Get(i);
		string strImageName = d->GetImageFile();
		TLFImage img;
		if (!img.LoadImage(strImageName.c_str()))
			continue;
		engine.SetSourceImage(&img, false);
		TLFImage* img1 = detector->GetImage();
		if (i % 100 == 0)
			printf(">");
		for (int j = 0; j < scanner->GetFragmentsCount(); j++)
		{
			double err = 0;
			double scale = 1;
			awpRect rect = scanner->GetFragmentRect(j);
			TLFRect lf_rect(rect);
			double overlap_det = d->Overlap(lf_rect);
			scale = (double)(rect.right - rect.left) / (double)scanner->GetBaseWidth();
			if (!all)
			{
				classifier->Setup(scale, scale, rect.left, rect.top);
				int result = classifier->Classify(img1, err);
			}
			else
			{
				for (int k = 0; k <= stage; k++)
				{
					ILFStrong* s = (ILFStrong*)strongs->Get(k);
					s->Setup(scale, scale, rect.left, rect.top);
					err = 0;
					if (s->Classify(img1, err) == 0)
					{
						if (k != stage)
							err = 0;
						break;
					}
				}
			}


			if (overlap_det > overlap)
			{
				frr_hst.AddElememt(err);
			}
			else if (overlap_det < overlap- 0.5)
			{
				far_hst.AddElememt(err);
			}
		}
	}

}
开发者ID:telnykha,项目名称:VideoA,代码行数:73,代码来源:LFDatabase.cpp

示例5: _tmain

 int _tmain(int argc, _TCHAR* argv[])
{
 	if (argc < 2)
	{
		Usage();
		return 1;
	}

	// main program
	TiXmlDocument doc;
	if (!doc.LoadFile(argv[1]))
	{
		printf("error: cannot load configuration.\n");
		return 1;
	}

	TiXmlHandle hDoc(&doc);
	TiXmlElement* pElem = NULL;
	pElem = hDoc.FirstChildElement().Element();
	if (!pElem)
	{
		printf("error: invalid configuration file.\n");
		return 1;
	}
   const char* name = pElem->Value();
   if (strcmp(name, "fvcccheck") != 0)
	{
		printf("error: invalid configuration file.\n");
		return 1;
	}

	string path 	     =  pElem->Attribute("in_database");
	string outName       =  pElem->Attribute("out_name");
	string tmplName      =  pElem->Attribute("tmpl_name");


	printf("params:\n");

	printf("input database: %s\n", path.c_str());
	printf("out name: %s\n", outName.c_str());
	printf("tmpl name: %s\n", tmplName.c_str());

	FvcTemplate* tmpl = NULL;
	if (fvcLoadTemplate(tmplName.c_str(), &tmpl) != FVC_OK)
	{
        printf("error: cannot load template.\n");
		return 1;
	}

	printf("template width %i:\n", tmpl->nVectorWidth);
	printf("template height %i:\n", tmpl->nVectorHeight);
	printf("template num vectors %i:\n", tmpl->nNumVectors);

	_finddata_t filesInfo;
	int num_images = 0;
	long handle = 0;
	FILE* f = fopen(outName.c_str(), "w+t");
	if ( (handle = _findfirst( (char*)((path+"*.awp").c_str()), &filesInfo)) != -1 )
	{
		do
		{
			string name = path + filesInfo.name;
			TLFImage image;
			if (!image.LoadImage((char*)name.c_str()))
			{
				printf("cannot load image %s \n", name.c_str());
				continue;
			}
			num_images++;
			double ro = 0;

			awpImage* img = image.GetImage();
			awpConvert(img, AWP_CONVERT_TO_FLOAT);
			fvcCompare(img, tmpl, &ro, FVC_COMPARE_EUCLID);
			float ro1 = ro;
			fprintf(f, "%s\t%f\n", filesInfo.name, ro1);
/*			awpImage* rec = NULL;
			if (fvcGetReconstruction(tmpl, img, &rec) != FVC_OK)
				printf("reconstruction error.\n");
			if (rec != NULL)
			{
				awpImage* norm = NULL;
				awpNormalize(rec, &norm, AWP_NORM_L2);
				awpConvert(norm, AWP_CONVERT_TO_FLOAT);
				//
				double ro = 0;
				if (awpDistance(img, rec, AWP_DIST_L2 ,&ro) != AWP_OK)
					printf("distance error.\n");
				float ro1 = ro;
				fprintf(f, "%s\t%f\n", filesInfo.name, ro1);
				awpReleaseImage(&rec);
				awpReleaseImage(&norm);
			}*/

			if (num_images % 100 == 0)
				printf(">");

		}while(!_findnext( handle, &filesInfo ));
	}
	_findclose( handle );
//.........这里部分代码省略.........
开发者ID:telnykha,项目名称:VideoA,代码行数:101,代码来源:main_fvcch.cpp


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