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


C++ Args::GetTrainFolderPath方法代码示例

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


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

示例1:

DetectByPose::DetectByPose(const ColorImg ProbeImg, const GrayImg BkImg, const vector<ProbImg> ProbImgs, const ContourMap& Segments,  const Args& args):Detect(ProbeImg, BkImg, Segments, args)
{

	Init_Members(ProbeImg.GetImagePath(), args.GetTrainFolderPath(), ProbImgs );
	LoadAllPoseFeatures(args.GetTrainFolderPath() );

}
开发者ID:hnkulkarni,项目名称:DetectCarriedObjs-PerfEval,代码行数:7,代码来源:DetectByPose.cpp

示例2: SaveChipMap

/*******************************************************************
 * Function Name: SaveChipMap
 * Return Type 	: int
 * Created On	: Nov 3, 2013
 * Created By 	: hrushi
 * Comments		: Save a map of chips
 * Arguments	: const mp_Str_vStr& mp
 *******************************************************************/
int AlgoTrain::SaveChipMap( const mp_Str_vStr& mp, const Args& args) const
{
	cv::FileStorage fsLblChips;

	string TrainFldrPath = args.GetTrainFolderPath();

	if( TrainFldrPath.length() == 0)
	{
		TrainFldrPath = args.GetSearchFolderPath();
	}

	const string LblPath = TrainFldrPath + CHIP_FILE_LIST;
	fsLblChips.open(LblPath, cv::FileStorage::WRITE);

	vector<string> vCat;
	for(mp_Str_vStr::const_iterator itr = mp.begin(); itr != mp.end(); itr++ )
	{
		vCat.push_back(itr->first);
		fsLblChips << itr->first << itr->second;
	}

	fsLblChips << "Categories" << vCat;
	fsLblChips.release();

	return EXIT_SUCCESS;
}
开发者ID:hnkulkarni,项目名称:DetectCarriedObjs-PerfEval,代码行数:34,代码来源:AlgoTrain.cpp

示例3: CalculateLocationPriorProbs

/*******************************************************************
 * Function Name: CalculateLocationPriorProbs
 * Return Type 	: ProbImg
 * Created On	: Jul 15, 2013
 * Created By 	: hrushi
 * Comments		: Calculates the prior probability of an
 * Arguments	: const vector<ProbImg>& vPrbImgs, const Args& args
 *******************************************************************/
int PriorProb::CalculateLocationPriorProbs( const vector<ProbImg>& vPrbImgs, const Args& args )
{
	ProbImg CombinedProbImg = vPrbImgs.at(0) + vPrbImgs.at(1);
	CombinedProbImg = CombinedProbImg + vPrbImgs.at(2);

	m_LocationPriorProb = CombinedProbImg;
	m_LocationPriorProb.Display(DISP_DELAY);

	string FolderPath = args.GetTrainFolderPath();
	if( FolderPath.length() == 0 )
	{
		FolderPath = args.GetSearchFolderPath();
	}
	const string ImgPath = FolderPath + LOC_PRIOR_PROB_IMGNAME;
	m_LocationPriorProb.SetImagePath(ImgPath);
	m_LocationPriorProb.Write( ImgPath );

	return EXIT_SUCCESS;
}
开发者ID:hnkulkarni,项目名称:DetectCarriedObjs-PerfEval,代码行数:27,代码来源:PriorProb.cpp

示例4: LoadChipMap

/*******************************************************************
 * Function Name: LoadChipMap
 * Return Type 	: mp_Str_vStr
 * Created On	: Nov 4, 2013
 * Created By 	: hrushi
 * Comments		: Save the chips
 * Arguments	: const Args& args
 *******************************************************************/
mp_Str_vStr AlgoTrain::LoadChipMap( const Args& args) const
{
	mp_Str_vStr Retmp;

	cv::FileStorage fsLblChips2;
	vector<string> Categories, ImPaths;

	string TrainFldrPath = args.GetTrainFolderPath();

	if( TrainFldrPath.length() == 0)
	{
		TrainFldrPath = args.GetSearchFolderPath();
	}

	const string LblPath = TrainFldrPath + CHIP_FILE_LIST;
	cout << "Reading " << LblPath << endl;

	if(!fs::exists(LblPath))
	{
		cerr << "File Path " << LblPath << " Not found" << endl;
		throw ERR_INVALID_PATH;
	}


	fsLblChips2.open(LblPath, cv::FileStorage::READ);

	fsLblChips2["Categories"] >> Categories;


	for(UINT i = 0;  i < Categories.size(); i++ )
	{
		vector<string> vImgNames;
		fsLblChips2[Categories.at(i)] >> vImgNames;
		Retmp[Categories.at(i)] = vImgNames;
	}

	fsLblChips2.release();

	return Retmp;
}
开发者ID:hnkulkarni,项目名称:DetectCarriedObjs-PerfEval,代码行数:48,代码来源:AlgoTrain.cpp

示例5: GetImageChips

/*******************************************************************
 * Function Name: GetImageChips
 * Return Type 	: int
 * Created On	: Nov 1, 2013
 * Created By 	: hrushi
 * Comments		: Get image chips
 * Arguments	: const Args& args
 *******************************************************************/
mp_Str_vStr AlgoTrain::GetImageChips( const Args& args, const std::map<string, string>& TrkMskMap ) const
{
	static Labels Lbl(args, ALL_LABEL_FILENAME);
	Lbl.Read(args);
	tdef_LabelMap lMap = Lbl.GetLabelMap();

	string TrainFolderPath = args.GetTrainFolderPath();

	if(TrainFolderPath.length() == 0 )
	{
		TrainFolderPath = args.GetSearchFolderPath();
	}

	const string ChipPath = TrainFolderPath + CHIP_FILE_LIST;

	std::map<UINT, string> mpChips = CreateFolders(TrainFolderPath);

	UINT uiPersonChipCnt(0), uiDragCnt(0), uiWornCnt(0);
	vector<string> vPersonImgs, vDragImgs, vWornImgs;

	for (tdef_LabelMap::const_iterator itr = lMap.begin(); itr != lMap.end(); itr++)
	{
		fs::path ImagePath 	= itr->first;
		int MarkLabel		= Lbl.AlreadyPresent(itr->first);
		string CmplImgPath 	  =  Lbl.GetComplateImgFilePath(itr->first);

		//---------- Skip the loop if the image is not present ---------- //
		if(!fs::exists(CmplImgPath))
		{
			continue;
		}

		string sMaskImagePath = "";

		try
		{
			sMaskImagePath = TrkMskMap.at(CmplImgPath);
		}
		catch(const std::out_of_range& oor)
		{
			cerr << "Skip the loop as " << sMaskImagePath << " Not present" << endl;
		}

		ColorImg ProbeImg = ColorImg(CmplImgPath);
		GrayImg MskImg    = GrayImg( sMaskImagePath );

		ContourMap Segments = Detect::GetSegments(ProbeImg, MskImg , false, args);

		//---------- Get type of label. Possible optimization over here. Label files are read again and again ---------- //
		UINT LabelType = Detect::GetType(itr->first, args);

		string FldrPath = mpChips.at(LabelType);

		//Starting from iCntr = 1; Because, iCntr = 0 is Background Contour
		for( int iCntr = 1; iCntr < (int)Segments.AllContourMap.size(); iCntr++ )
		{
			Contour Ctr = Segments.AllContourMap.at(iCntr);
			ColorImg ChipImg = Ctr.GetImgChip(ProbeImg);

			cv::SIFT sift;
			vector<cv::KeyPoint> vkeypoints;
			Mat descriptors;
			Mat WorkImg = ChipImg.GetDataRef().clone();
			sift(WorkImg, Mat(), vkeypoints, descriptors);


			if(0) // Draw keypoints, not used, as it takes a lot of time.
			{
				Mat DispMat;
				cv::drawKeypoints(WorkImg, vkeypoints, DispMat);

				ColorImg DispImg;
				DispImg.SetImage(DispMat);
				DispImg.Display(DISP_DELAY);

				cout << "#Keypoints: " << vkeypoints.size() << endl;

				//---------- Skip the chip if the number of keypoints are less than the number of clusters. ---------- //
				if( vkeypoints.size() < BOW_CLUSERS )
				{
					continue;
				}

			}


			std::stringstream ss;
			if( ( LabelType == DRAG_CARRY_LABEL) && ( Ctr.GetLabel() == (UINT)MarkLabel ))
			{
				FldrPath = mpChips.at(DRAG_CARRY_LABEL);
				ss << FldrPath << "/";
				ss << DRAG << std::setfill('0') << std::setw(4) << uiDragCnt << IMG_EXT_PNG;
//.........这里部分代码省略.........
开发者ID:hnkulkarni,项目名称:DetectCarriedObjs-PerfEval,代码行数:101,代码来源:AlgoTrain.cpp


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