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

void Impala::Application::SDash::RoiExtractor::Extract (  )  [inline]

Definition at line 86 of file RegionOfInterestExtractor.cpp.

References Impala::Util::DatabaseReadStrings(), Impala::Application::SDash::FRAME_LIST_POSTFIX, Impala::Application::SDash::FRAME_LISTS_PATH, Impala::Application::SDash::FRAMES_PER_VIDEO, Impala::Util::Database::GetInstance(), Impala::Application::SDash::RegionsOfInterestInfo::GetRois(), Impala::Application::SDash::INDIV_FRAME_FOLDERS, mRois, Impala::Application::SDash::ROIS_PER_VIDEO, Impala::Application::SDash::VIDEO_BASE_PATH, Impala::Application::SDash::VIDEO_COUNT, and Impala::Core::Array::WriteJpg().

Referenced by main().

00087     {
00088         Array2dVec3UInt8 *frameData = 0;
00089 
00090         for (int video = 0; video < VIDEO_COUNT; video++)
00091         {
00092             std::cout << "processing video #" << video << std::endl;
00093 
00094             std::string frameListFile = FRAME_LISTS_PATH + INDIV_FRAME_FOLDERS[video] + FRAME_LIST_POSTFIX;
00095             std::vector<std::string> frameFileNames;
00096             Util::DatabaseReadStrings(frameFileNames, frameListFile,
00097                                       &Util::Database::GetInstance());
00098             int nrOfFrames = frameFileNames.size();
00099             if (nrOfFrames != FRAMES_PER_VIDEO[video])
00100                 std::cerr << "incorrect frame count for video #" << video << ": " << nrOfFrames << " vs. " << FRAMES_PER_VIDEO[video] << std::endl;
00101 
00102             int roisForVideo = 0;
00103             for (int frame = 0; frame < nrOfFrames; frame++)
00104             {
00105                 if (frame % 1000 == 0)
00106                     std::cout << "  processing frame #" << frame << std::endl;
00107 
00108                 const std::vector<Rectangle>& rois = mRois.GetRois(video, frame);
00109                 if (rois.empty())
00110                     continue;
00111 
00112                 // retrieve frame
00113                 std::string frameFile = frameFileNames[frame];
00114                 //std::string framePath = VIDEO_BASE_PATH + frameFile; // SK: op laptop
00115                 std::string framePath = VIDEO_BASE_PATH + INDIV_FRAME_FOLDERS[video] + "/" + frameFile; // op UvA
00116                 Core::Array::ReadFile<Array2dVec3UInt8>(frameData, framePath);
00117 
00118                 // extract rois of interest from frame
00119                 int nrOfRegions = rois.size();
00120                 for (int seqNr = 0; seqNr < nrOfRegions; seqNr++)
00121                 {
00122                     Rectangle region(rois[seqNr]);
00123 
00124                     // create jpg for region
00125                     Array2dVec3UInt8 *roi = Core::Array::MakeRoi<Array2dVec3UInt8>(frameData, region);
00126 
00127                     // write region jpg to archive
00128                     // ... not yet implemented.
00129 
00130                     // write region jpg as single file
00131                     std::ostringstream regionFile;
00132                     regionFile << "roi/video" << video << "/roi_" << video << '_' << frame<< '_' << seqNr << ".jpg";
00133                     Core::Array::WriteJpg(roi, regionFile.str());
00134                 }
00135                 roisForVideo += nrOfRegions;
00136             }
00137             if (roisForVideo != ROIS_PER_VIDEO[video])
00138                 std::cerr << "incorrect roi count for video #" << video << ": " << roisForVideo << " vs. " << ROIS_PER_VIDEO[video] << std::endl;
00139         }
00140 
00141         // release frame data
00142         delete frameData;
00143         frameData = 0;
00144     }

Here is the call graph for this function:


Generated on Thu Jan 13 09:16:06 2011 for ImpalaSrc by  doxygen 1.5.1