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

virtual int Impala::Application::SDash::ActivityReader::Read ( const std::string &  basePath,
std::map< int, std::vector< CameraEvent > > &  camEventSchedule 
) [inline, virtual]

Definition at line 60 of file ActivityReader.h.

References EMPTY_SEQUENCE, FRAME_RATE, Impala::Application::SDash::ActivityHandler::GetActivity(), Impala::Application::SDash::Sax2Reader::GetHandler(), Impala::Application::SDash::Sax2Reader::mFileToRead, Impala::Util::Read(), and TotalSequenceLength().

Referenced by Impala::Application::SDash::SurveillanceApp::ReadActivityEvents().

00061     {
00062         ActivityHandler* handler = (ActivityHandler*) GetHandler();
00063         int nrOfEventsFound = 0;
00064         int totalNrOfFrames = 0;
00065         int eventOffset = 17 * TotalSequenceLength(); // SK: ca. 30 minutes
00066         char buf[2048];
00067 
00068         static std::string sequenceNames[] = {"argument", "gesticulation", "pickpocketing"};
00069         static int sequenceSizes[] = {232, 80, 179};
00070 
00071 #ifdef RICHARD
00072     for (int seq = 2; seq < 3; seq++)
00073 #else
00074     for (int seq = 0; seq < 3; seq++)
00075 #endif
00076     {
00077         std::string prevActivity = "";
00078         for (int frameNr = 0; frameNr < sequenceSizes[seq]; frameNr++)
00079         {
00080 #ifdef RICHARD
00081             sprintf(buf, "%sHAR_%03d.xml", basePath.c_str(), frameNr);
00082 #else
00083             sprintf(buf, "%s%s/HAR_output%03d.xml", basePath.c_str(), sequenceNames[seq].c_str(), frameNr);
00084 #endif
00085             mFileToRead = std::string(buf);
00086 
00087             int rc = Sax2Reader::Read();
00088             if (rc != 0)
00089                 return rc;
00090 
00091             const std::string& activity = handler->GetActivity();
00092             if (activity != prevActivity)
00093             {
00094                 if (activity != "walking" && activity != "standing")
00095                 {
00096                     int cumFrameNr = totalNrOfFrames + frameNr;
00097                     int eventTime = (eventOffset + cumFrameNr) / FRAME_RATE;
00098                     //int videoId = 14;
00099                     int videoId = 12 + ((totalNrOfFrames + frameNr) % 3) + 1;
00100                     camEventSchedule[eventTime].push_back(CameraEvent(videoId, 2, cumFrameNr, activity));
00101                     nrOfEventsFound++;
00102                 }
00103                 prevActivity = activity;
00104             }
00105         }
00106         totalNrOfFrames += sequenceSizes[seq];
00107 #ifndef RICHARD
00108         totalNrOfFrames += EMPTY_SEQUENCE;
00109 #endif
00110     }
00111 
00112         std::cout << "activity events found: " << nrOfEventsFound << " (in " << totalNrOfFrames << " frames)" << std::endl;
00113         return 0;
00114     }

Here is the call graph for this function:


Generated on Thu Jan 13 09:15:56 2011 for ImpalaSrc by  doxygen 1.5.1