27 #include <Base/Common/W32Compat.hh>
34 #include "VideoSource_DiskZessPMD.hh"
35 #include <Base/Image/ImageIO.hh>
36 #include <Image/Camera.hh>
38 #include <Base/Common/BIASpragma.hh>
39 #include <Base/Common/FileHandling.hh>
56 BIASERR(
"use OpenDevice(const vector<string> &FileNames)");
64 BIASDOUT(D_VSO_DISK,
"FileNames[0] : "<<FileNames[0]);
66 BIASERR(
"unable to read "<<FileNames[0]);
76 for (vector<string>::const_iterator i = FileNames.begin();
77 i != FileNames.end();i++){
78 FileNames_.push_back(*i);
81 CompleteInitialized_ =
true;
90 BIASDOUT(D_VSO_DISK,
"VideoSource_DiskPMD::GrabSingle()");
93 BIASERR(
"VideoSource_Disk::GrabSingle(): VideoSource Object not active, use PreGrab()");
98 BIASERR(
"VideoSource_Disk::GrabSingle(): VideoSource Object is already grabbing()");
103 if (FileNames_.size() == 0) {
104 if (ActiveFrame_ == FileNames_.size()){
105 BIASERR(
"VideoSource_DISK: End of input. SetLoop(true) or Rewind()");
109 if (ActiveFrame_ == FileNames_.size()) {
110 BIASERR(
"VideoSource_DISK: End of input. SetLoop(true) or Rewind()");
121 DepthImg_.SetUID(image.
GetUID());
122 ModCoeffImg_.SetUID(image.
GetUID());
125 if (FrameCounterAsTimeStamp_) image.
SetTime(ActiveFrame_,0);
128 gettimeofday(&tv, NULL);
129 image.
SetTime(tv.tv_sec,tv.tv_usec);
131 if(ActiveFrame_<FileNames_.size()-1){
132 BIASDOUT(D_VSO_DISK,
"GrabSingle() "<<ActiveFrame_<<
" "<<
133 FileNames_[ActiveFrame_]);
138 BIASDOUT(D_VSO_DISK,
"GrabSingle() restarting with first file");
140 else ActiveFrame_+=3;
143 BIASDOUT(D_VSO_DISK,
"leaving GrabSingle()");
145 double secPerFrame=1.0/FramesPerSecond_;
152 while (timer_.GetRealTime()<=(1E06*secPerFrame)) {
unsigned int GetDepth() const
returns the bytes per channel, which is the sizeof(StorageType) Should match GetSizeDepth(GetStorageT...
virtual int GrabSingle(Camera< unsigned char > &image)
Returns the 2D image, and reads depth and modulation coefficients.
unsigned int GetWidth() const
const BIAS::UUID & GetUID() const
returns the UUID of the image
virtual int OpenDevice()
selects the first available device to open (e.g.
virtual ~VideoSource_DiskZessPMD()
VideoSource_DiskZessPMD()
unsigned int GetChannelCount() const
returns the number of Color channels, e.g.
unsigned int GetHeight() const
void SetUID(const BIAS::UUID &id)
enum EColorModel GetColorModel() const
static int Load(const std::string &FileName, ImageBase &img)
first tries a call to Read MIP image and if that fails, tries to Import Image with all other availabl...
void SetTime(unsigned long long int sec, unsigned long long int usec)
Set time and ensure correct format (seconds and useconds after 'sec')
static UUID GenerateUUID(const bool &consecutively=DEFAULT_UUID_CONSECUTIVELY)
static function which simply produces a uuid and returns
This class simulates a video device by loading images from disk.