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


C++ ImageData::GetBaseName方法代码示例

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


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

示例1: LoadImageNamesFromFile

/*
   Load a list of image names from a file.  Appears to also populate
   some of the meta-info about where to get key files from/dump them 
   to.
*/
void BaseApp::LoadImageNamesFromFile(FILE *f)
{
// m_image_names.clear();
m_image_data.clear();

char buf[256];
int idx = 0;

while (fgets(buf, 256, f)) 
 {
  ImageData data;
  data.InitFromString(buf, m_image_directory, m_fisheye);

  // Try to find a keypoint file in key directory, or in current directory.
  if (strcmp(m_key_directory, ".") != 0) 
   {
    char key_buf[256];
    data.GetBaseName(key_buf);

    char key_path[512];
    sprintf(key_path, "%s/%s.key", m_key_directory, key_buf);
    data.m_key_name = strdup(key_path);
   } 
  else 
   {
    // FIXME: I think this causes a memory leak 
    // TODO:  Assumes that filename related to data.m_name.
    char key_buf[256];
    strcpy(key_buf, data.m_name);
    int len = strlen(key_buf);
    key_buf[len - 3] = 'k';
    key_buf[len - 2] = 'e';
    key_buf[len - 1] = 'y';
    data.m_key_name = strdup(key_buf);
   }

  m_image_data.push_back(data);
  idx++;
 }

// Create an empty match table
m_matches = MatchTable(GetNumImages());
RemoveAllMatches();

m_matches_computed = true;
m_num_original_images = GetNumImages();

if (m_use_intrinsics)
  ReadIntrinsicsFile();
}
开发者ID:ioannis6,项目名称:Bundler,代码行数:55,代码来源:BundleIO.cpp

示例2: LoadImageNamesFromFile

/* Load a list of image names from a file */
void BaseApp::LoadImageNamesFromFile(FILE *f)
{
    // m_image_names.clear();
    m_image_data.clear();

    char buf[256];
    int idx = 0;

    while (fgets(buf, 256, f)) {
	ImageData data;
	data.InitFromString(buf, m_image_directory, m_fisheye);

        /* Try to find a keypoint file */

        if (strcmp(m_key_directory, ".") != 0) {
            char key_buf[256];
            data.GetBaseName(key_buf);

            char key_path[512];
            sprintf(key_path, "%s/%s.key", m_key_directory, key_buf);
            data.m_key_name = strdup(key_path);
        } else {
            /* FIXME: I think this causes a memory leak */
            char key_buf[256];
            strcpy(key_buf, data.m_name);
            int len = strlen(key_buf);
            key_buf[len - 3] = 'k';
            key_buf[len - 2] = 'e';
            key_buf[len - 1] = 'y';

            // char key_path[512];
            // sprintf(key_path, "%s/%s", m_key_directory, key_buf);
            data.m_key_name = strdup(key_buf);
        }

        // printf("Keyname: %s\n", data.m_key_name);

#if 0
	if (log != NULL) {
	    log->AppendText("  ");
	    log->AppendText(buf);
	    log->AppendText("\n");
	}
#endif

#if 0
	/* Eat the newline */
	if (buf[strlen(buf)-1] == '\n')
	    buf[strlen(buf)-1] = 0;

	if (buf[strlen(buf)-1] == '\r')
	    buf[strlen(buf)-1] = 0;

	/* Split the buffer into tokens */
        std::string str(buf);
	std::vector<std::string> toks;
        Tokenize(str, toks, " ");

#if 0
	wxStringTokenizer t(str, wxT(" "));

	while (t.HasMoreTokens()) {
	    wxString tok = t.GetNextToken();
	    toks.push_back(tok);
	}
#endif

#if 0
	if (log != NULL) {
	    log->AppendText("  ");
	    log->AppendText(buf);
	    log->AppendText("\n");
	}
#endif


	int num_toks = (int) toks.size();

	bool fisheye = m_fisheye; // false;
	if (num_toks >= 2) {
	    fisheye = (atoi(toks[1].c_str()) == 1);
	}

	bool has_init_focal = false;
	double init_focal = 0.0;
	if (num_toks >= 3) {
	    has_init_focal = true;
	    init_focal = atof(toks[2].c_str());
	}

	ImageData data;

	// m_imgs.push_back(img);
	// printf("Adding image %s\n", toks[0].c_str());
        char buf[512];
        sprintf(buf, "%s/%s", m_image_directory, toks[0].c_str());

	data.m_name = strdup(buf);
	data.m_img = NULL;
//.........这里部分代码省略.........
开发者ID:DDT4,项目名称:bundler_sfm,代码行数:101,代码来源:BundleIO.cpp


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