Home || Architecture || Video Search || Visual Search || Scripts || Applications || Important Messages || OGL || Src

void Impala::Sandbox::Koen::WriteRegionsToStreamFormatKoen ( std::ostream &  fs,
InterestPointList &  outputPointList,
bool  writeDescriptors,
int  borderOffset 
)

Definition at line 23 of file InterestPointListIO.h.

References ILOG_ERROR, and ILOG_VAR.

Referenced by WritePointListToFile().

00024 {
00025     ILOG_VAR(Sandbox.koen.WriteRegionsToStreamFormatKoen);
00026     /* Format KOEN version 1.0
00027        -----------------------
00028        First line:  KOEN1 (format version)
00029        Second line: Descriptor dimensionality count (0 if only interest items)
00030        Third line:  Number of interest items
00031     */
00032     int dimensionCount = -1;
00033     fs << "KOEN1\n";
00034     if(writeDescriptors)
00035     {
00036         if(outputPointList.size() == 0)
00037         {
00038             dimensionCount = 0;
00039         }
00040         else
00041         {
00042             dimensionCount = (*(outputPointList.begin()))->mDescriptor.size();
00043         }
00044         fs << dimensionCount << "\n";
00045     }
00046     else
00047     {
00048         fs << "0\n";
00049     }
00050     fs << outputPointList.size() << "\n";
00051     for(InterestPointList::iterator iter = outputPointList.begin(); iter != outputPointList.end(); iter++)
00052     {
00053         InterestPoint* point = *iter;
00054         // shift by 1 for consistency with the public file format (which uses 1..n instead of 0..n-1)
00055         // make coordinates equal to the original image, without the borders removed
00056         fs << point->Serialize(borderOffset+1, borderOffset+1);
00057         if(writeDescriptors)
00058         {
00059             if(point->mDescriptor.size() != dimensionCount)
00060             {
00061                 ILOG_ERROR("Your code has created descriptors with variable length!");
00062                 throw "Dimension mismatch!";
00063             }
00064             for(int i = 0; i < dimensionCount; i++)
00065             {
00066                 fs << " " << point->mDescriptor[i];
00067             }
00068         }
00069         fs << ";\n";
00070     }
00071 }


Generated on Fri Mar 19 11:38:53 2010 for ImpalaSrc by  doxygen 1.5.1