00001 #ifndef Impala_Core_VideoSet_VisSemTrain_h
00002 #define Impala_Core_VideoSet_VisSemTrain_h
00003
00004 #include "Core/Feature/VisSem.h"
00005 #include "Core/VideoSet/Reporter.h"
00006
00007 namespace Impala
00008 {
00009 namespace Core
00010 {
00011 namespace VideoSet
00012 {
00013
00014
00015 class VisSemTrain : public Listener
00016 {
00017 typedef Array::Array2dScalarReal64 Array2dScalarReal64;
00018
00019 public:
00020
00021 VisSemTrain(Reporter* reporter, String name, CmdOptions& options)
00022 {
00023 mReporter = reporter;
00024 mFeature = new Feature::VisSem(name, options);
00025 }
00026
00027 virtual void
00028 HandleNewFile(VideoSet* vs, int fileId, Stream::RgbDataSrc* src,
00029 int bookmarkNr, Geometry::VxRectangle vr)
00030 {
00031 mFeature->ClearAnnoAccu();
00032 }
00033
00034 virtual void
00035 HandleDoneFile(VideoSet* vs, int fileId, Stream::RgbDataSrc* src,
00036 int bookmarkNr, Geometry::VxRectangle vr)
00037 {
00038 mFeature->AddAccuToAnnoTable(bookmarkNr, vr.mAnno);
00039 }
00040
00041 virtual void
00042 HandleNewFrame(VideoSet* vs, int fileId, Stream::RgbDataSrc* src,
00043 Geometry::Rectangle rect, String anno)
00044 {
00045 Array::Array2dVec3UInt8* im = Array::ArrayCreate<Array::Array2dVec3UInt8>
00046 (src->FrameWidth(), src->FrameHeight(), 0, 0, src->DataPtr(), true);
00047 mFeature->AddImageToAccu(im, rect);
00048 delete im;
00049 }
00050
00051 virtual void
00052 HandleDoneWalk(VideoSet* vs, int nrBookmarks)
00053 {
00054 mFeature->WriteProtoFeatureTableSet(vs);
00055 }
00056
00057 private:
00058
00059 Reporter* mReporter;
00060 Feature::VisSem* mFeature;
00061
00062 };
00063
00064 }
00065 }
00066 }
00067
00068 #endif