浏览代码

allowing missing label information in imagergb mode -> setting 'background' label instead

Sven Sickert 9 年之前
父节点
当前提交
cfbf356bba
共有 1 个文件被更改,包括 7 次插入4 次删除
  1. 7 4
      cbaselib/LabeledFileList.cpp

+ 7 - 4
cbaselib/LabeledFileList.cpp

@@ -69,7 +69,8 @@ LocalizationResult *LabeledFileList::getLocalizationInfo ( const ClassNames & cl
     exit ( -1 );
   }
 
-  if ( ! FileMgt::fileExists ( lfile ) ) return NULL;
+  if ( ! FileMgt::fileExists ( lfile ) && format != "imagergb" )
+      return NULL;
   if ( debug_dataset )
   {
     fprintf ( stderr, "LabeledFileList: reading localization information %s\n", lfile.c_str() );
@@ -96,10 +97,12 @@ LocalizationResult *LabeledFileList::getLocalizationInfo ( const ClassNames & cl
     try {
       mask.read ( lfile );
     } catch ( ImageException &e ) {
-      fprintf ( stderr, "WARNING: unable to open file %s (no localization info provided)\n",
+      fprintf ( stderr, "WARNING: unable to open file %s (no localization info provided) - creating one with background class only!\n",
                 lfile.c_str() );
-      fprintf ( stderr, "Error: %s\n", e.what() );
-      return NULL;
+      //fprintf ( stderr, "Error: %s\n", e.what() );
+      //return NULL;
+      mask.read ( file );
+      mask.set(0,0,0);
     }
     lr = new LocalizationResult ( &classnames, mask );