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


C++ Patch::getId方法代码示例

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


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

示例1: loadMVS

void FileLoader::loadMVS(const char *fileName, MVS &mvs) {
	vector<Camera>  &cameras = mvs.cameras;
	map<int, Patch> &patches = mvs.patches;

	// reset container
	cameras.clear();
	patches.clear();

	// open mvs file
	ifstream file(fileName, ifstream::in | ifstream::binary);

	if ( !file.is_open() ) {
		printf("Can't open MVS file: %s\n", fileName);
		return;
	}

	char *strip = NULL;
	char strbuf[STRING_BUFFER_LENGTH];
	int num;
	bool loadCamera = false;
	bool loadPatch  = false;
	while ( !file.eof() ) {

		file.getline(strbuf, STRING_BUFFER_LENGTH);
		strip = strtok(strbuf, DELIMITER);

		if (strip == NULL) continue; // skip blank line

		// start load camera
		if (strcmp(strip, "MVS_V2") == 0) {
			loadCamera = true;
			continue;
		}

		// set config and start load camera
		if (strcmp(strip, "MVS_V3") == 0) {
			MvsConfig config = loadMvsConfig(file);
			mvs.setConfig(config);
			loadCamera = true;
			continue;
		}

		if (loadCamera) {
			strip = strtok(NULL, DELIMITER);
			num = atoi(strip);
			for (int i = 0; i < num; ++i) {
				printf("\rloading cameras: %d / %d", i+1, num);
				cameras.push_back( loadMvsCamera(file) );
			}
			printf("\n");
			loadCamera = false;
			loadPatch  = true;
			continue;
		}

		if (loadPatch) {
			strip = strtok(NULL, DELIMITER);
			num = atoi(strip);
			for (int i = 0; i < num; ++i) {
				printf("\rloading patches: %d / %d", i+1, num);
				Patch pth = loadMvsPatch(file);
				patches.insert( pair<int, Patch>(pth.getId(), pth) );
			}
			printf("\n");
			loadPatch = false;
		}
	}

	file.close();
}
开发者ID:yuhuangintel,项目名称:pais-mvs,代码行数:70,代码来源:fileloader.cpp

示例2: file

void FileLoader::loadNVM2(const char *fileName, MVS &mvs) {
	vector<Camera>  &cameras = mvs.cameras;
	map<int, Patch> &patches = mvs.patches;

	// reset container
	cameras.clear();
	patches.clear();

	// open nvm file
	ifstream file(fileName, ifstream::in);

	if ( !file.is_open() ) {
		printf("Can't open NVM2 file: %s\n", fileName);
		return;
	}

	// get file path
	char filePath [MAX_FILE_NAME_LENGTH];
	getDir(fileName, filePath);

	char *strip = NULL;
	char strbuf[STRING_BUFFER_LENGTH];
	int num;
	bool loadCamera = false;
	bool loadPatch  = false;

	while ( !file.eof() ) {

		file.getline(strbuf, STRING_BUFFER_LENGTH);
		strip = strtok(strbuf, DELIMITER);

		if (strip == NULL) continue; // skip blank line

		// start load camera
		if (strcmp(strip, "NVM_V3") == 0) {
			loadCamera = true;
			continue;
		}

		if (loadCamera) {
			// get number of cameras
			strip = strtok(strbuf, DELIMITER);
			num = atoi(strip);

			cameras.reserve(num);
			for (int i = 0; i < num; i++) {
				printf("\rloading cameras: %d / %d", i+1, num);
				cameras.push_back( loadNvm2Camera(file, filePath) );
			}
			printf("\n");
			loadCamera = false;
			loadPatch  = true;

			continue;
		}

		if (loadPatch) {
			// get number of points
			strip = strtok(strbuf, DELIMITER);
			num = atoi(strip);

			for (int i = 0; i < num; i++) {
				printf("\rloading patches: %d / %d", i+1, num);
				Patch p = loadNvmPatch(file, mvs);
				patches.insert( pair<int, Patch>(p.getId(), p) );
			}
			printf("\n");
			loadPatch = false;

			break;
		}
	}

	file.close();
}
开发者ID:yuhuangintel,项目名称:pais-mvs,代码行数:75,代码来源:fileloader.cpp


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