Definition at line 182 of file InterestPointListIO.h. References Impala::Util::StringParser::GetDouble(), Impala::Util::StringParser::GetInt(), Impala::Util::StringParser::GetString(), ILOG_DEBUG, ILOG_ERROR, and ILOG_VAR. Referenced by ReadPointListFromFile(), and ReadRegionsFromStreamFormatKoen(). 00183 { 00184 ILOG_VAR(Sandbox.koen.ReadRegionsFromStreamFormatKoen); 00185 //note: this function will probably not work on Windows due to line ending problems 00186 00187 /* Format KOEN version 1.0 00188 ----------------------- 00189 First line: KOEN1 (format version) 00190 Second line: Descriptor dimensionality count (0 if only interest items) 00191 Third line: Number of interest items 00192 */ 00193 00194 Util::StringParser sp(content); 00195 //std::cout << content << "x" << fileSize << std::endl; 00196 00197 // first line: KOEN1 00198 String header = sp.GetString('\n'); 00199 if(header != String("KOEN1")) 00200 { 00201 ILOG_ERROR("Unsupported region format: " << header); 00202 return; 00203 } 00204 00205 // second line: dimensionality 00206 int dimensionCount = sp.GetInt('\n'); 00207 int regionCount = sp.GetInt('\n'); 00208 ILOG_DEBUG("Reading file; dimensionCount = " << dimensionCount << "; regionCount = " << regionCount); 00209 for(int i = 0; i < regionCount; i++) 00210 { 00211 InterestPoint* point = 0; 00212 00213 String line = sp.GetString('\n'); 00214 Util::StringParser sp2(line); 00215 String region = sp2.GetString(';'); 00216 if(region.substr(0, 8) == "<CIRCLE ") 00217 { 00218 // shift by 1 for consistency with the public file format (which uses 1..n instead of 0..n-1) 00219 // make coordinates equal to the original image, without the borders removed 00220 point = new InterestCircle(region, borderOffset+1, borderOffset+1); 00221 } 00222 else 00223 { 00224 ILOG_ERROR("Unsupported region: " << region); 00225 throw "Unsupported serialization type!"; 00226 } 00227 00228 if(readDescriptors) 00229 { 00230 String descriptor = sp2.GetString(';'); 00231 Util::StringParser sp3(descriptor); 00232 if(dimensionCount > 0) 00233 { 00234 point->mDescriptor.reserve(dimensionCount); 00235 for(int j = 0; j < dimensionCount; j++) 00236 { 00237 point->mDescriptor.push_back(sp3.GetDouble()); 00238 } 00239 } 00240 } 00241 if(point) 00242 { 00243 outputPointList.push_back(point); 00244 } 00245 } 00246 }
Here is the call graph for this function:
|