Definition at line 88 of file PointDescriptorIO.h. References ILOG_ERROR, ILOG_VAR, Impala::MakeString(), Impala::Core::Matrix::MatE(), Impala::Core::Matrix::MatNrCol(), Impala::Core::Matrix::MatNrRow(), and Impala::Util::IOBuffer::Write(). Referenced by Impala::Core::Feature::PointDescriptorTable::ExportToFile(). 00089 { 00090 ILOG_VAR(Core.Feature.PointDescriptorIO.WriteKOEN1ToBuffer); 00091 00092 using namespace Impala::Core::Matrix; 00093 /* Format KOEN version 1.0 00094 ----------------------- 00095 First line: KOEN1 (format version) 00096 Second line: Descriptor dimensionality count (0 if only interest items) 00097 Third line: Number of interest items 00098 */ 00099 buffer->Write("KOEN1\n", 6); 00100 int elementsPerPoint = MatNrCol(points); 00101 int dimensionCount = 0; 00102 int pointCount = MatNrRow(points); 00103 int bytesPerElement = 8; 00104 00105 if(descriptors) 00106 { 00107 if(MatNrRow(descriptors) > 0) 00108 { 00109 dimensionCount = MatNrCol(descriptors); 00110 if(MatNrRow(descriptors) != pointCount) 00111 { 00112 ILOG_ERROR("Dimension mismatch in points/descriptors: " << 00113 pointCount << " " << MatNrRow(descriptors)); 00114 } 00115 } 00116 } 00117 00118 String tmp = MakeString(dimensionCount) + "\n" + MakeString(pointCount) + "\n"; 00119 buffer->Write(tmp.c_str(), tmp.size()); 00120 00121 for(int i = 0; i < pointCount; i++) 00122 { 00123 String line = "<" + theDataType; 00124 for(int j = 0; j < elementsPerPoint; j++) 00125 { 00126 line += " " + MakeString(*MatE(points, i, j)); 00127 } 00128 line += ">;"; 00129 if(dimensionCount) 00130 { 00131 for(int j = 0; j < dimensionCount; j++) 00132 { 00133 line += " " + MakeString(*MatE(descriptors, i, j)); 00134 } 00135 } 00136 line += ";\n"; 00137 00138 buffer->Write(line.c_str(), line.size()); 00139 } 00140 }
Here is the call graph for this function:
|