27 #include <Base/Common/W32Compat.hh>
33 #include <VideoSource/VideoSource_Disk.hh>
34 #include "VideoSource_Disk_Bayer.hh"
35 #include <Base/Image/ImageIO.hh>
36 #include <Base/Image/ImageConvert.hh>
37 #include <Image/Camera.hh>
39 #include <Base/Common/BIASpragma.hh>
61 BIASDOUT(D_VSO_DISK,
"FileNames[0] : "<<FileNames[0]);
65 cout<<
"pwd: ";system(
"pwd");
66 BIASERR(
"unable to read "<<FileNames[0]);
79 for (vector<string>::const_iterator i = FileNames.begin();
80 i != FileNames.end();i++)
85 const char *fName2 =(*i).c_str();
88 if (i != FileNames.begin()){
91 BIASERR(
"VideoSource_Disk_Bayer::OpenDevice() Image is "<<*i<<
92 " different from first image in sequence");
140 BIASERR(
"So far this class is implemented to handle Bayer patterns only!");
149 BIASDOUT(D_VSO_DISK,
"VideoSource_Disk_Bayer::GrabSingle()");
152 BIASERR(
"VideoSource_Disk_Bayer: End of input. SetLoop(true) or Rewind()");
157 BIASERR(
"VideoSource_Disk_Bayer::GrabSingle(): VideoSource Object not active, use PreGrab()");
162 BIASERR(
"VideoSource_Disk_Bayer::GrabSingle(): VideoSource Object is already grabbing()");
173 BIASERR(
"VideoSource_Disk_Bayer::GrabSingle(): Unable to read image: "<<
FileNames_[ActiveFrame_]);
181 gettimeofday(&tv, NULL);
182 image.
SetTime(tv.tv_sec,tv.tv_usec);
189 BIASDOUT(D_VSO_DISK,
"GrabSingle() "<<ActiveFrame_<<
" "<<
206 BIASDOUT(D_VSO_DISK,
"GrabSingle() restarting with first file");
216 BIASDOUT(D_VSO_DISK,
"leaving GrabSingle()");
253 BIASDOUT(D_VSO_DISK,
"VideoSource_Disk_Bayer::GrabSingle()");
256 BIASERR(
"VideoSource_Disk_Bayer: End of input. SetLoop(true) or Rewind()");
261 BIASERR(
"VideoSource_Disk_Bayer::GrabSingle(): VideoSource Object not active, use PreGrab()");
266 BIASERR(
"VideoSource_Disk_Bayer::GrabSingle(): VideoSource Object is already grabbing()");
279 BIASERR(
"VideoSource_Disk_Bayer::GrabSingle(): Unable to read image: "<<
FileNames_[ActiveFrame_]);
287 gettimeofday(&tv, NULL);
288 image.
SetTime(tv.tv_sec,tv.tv_usec);
295 BIASDOUT(D_VSO_DISK,
"GrabSingle() "<<ActiveFrame_<<
" "<<
312 BIASDOUT(D_VSO_DISK,
"GrabSingle() restarting with first file");
322 BIASDOUT(D_VSO_DISK,
"leaving GrabSingle()");
358 #ifdef BUILD_IMAGE_USHORT
361 BIASDOUT(D_VSO_DISK,
"VideoSource_Disk_Bayer::GrabSingle()");
364 BIASERR(
"VideoSource_Disk_Bayer: End of input. SetLoop(true) or Rewind()");
369 BIASERR(
"VideoSource_Disk_Bayer::GrabSingle(): VideoSource Object not active, use PreGrab()");
374 BIASERR(
"VideoSource_Disk_Bayer::GrabSingle(): VideoSource Object is already grabbing()");
394 gettimeofday(&tv, NULL);
395 image.
SetTime(tv.tv_sec,tv.tv_usec);
402 BIASDOUT(D_VSO_DISK,
"GrabSingle() "<<
ActiveFrame_<<
" "<<
418 BIASDOUT(D_VSO_DISK,
"GrabSingle() restarting with first file");
427 BIASDOUT(D_VSO_DISK,
"leaving GrabSingle()");
464 BIASDOUT(D_VSO_DISK,
"VideoSource_Disk_Bayer::GrabSingle()");
467 BIASERR(
"VideoSource_Disk_Bayer: End of input. SetLoop(true) or Rewind()");
472 BIASERR(
"VideoSource_Disk_Bayer::GrabSingle(): VideoSource Object not active, use PreGrab()");
477 BIASERR(
"VideoSource_Disk_Bayer::GrabSingle(): VideoSource Object is already grabbing()");
491 BIASERR(
"VideoSource_Disk_Bayer::GrabSingle(): Unable to read image: "<<
FileNames_[ActiveFrame_]);
496 BIASDOUT(D_VSO_DISK,
"GrabSingle() "<<ActiveFrame_<<
" "<<
512 BIASDOUT(D_VSO_DISK,
"GrabSingle() restarting with first file");
521 BIASDOUT(D_VSO_DISK,
"leaving GrabSingle()");
EColorModel
These are the most often used color models.
Bayer_GRBG, 1 channel RGB image Bayer tile.
virtual int GrabSingle(BIAS::Camera< unsigned char > &image)
unsigned int GetDepth() const
returns the bytes per channel, which is the sizeof(StorageType) Should match GetSizeDepth(GetStorageT...
unsigned int ActiveFrame_
void SetColorModel(EColorModel Model)
Bayer_RGGB, 1 channel RGB image Bayer tile.
BIAS::ImageBase::EColorModel ColorMode_
Color mode used by camera.
float BytesPerPixel_
BytesPerPixel cannot be int (e.g. it is 1.5 for YUV420p)
unsigned int GetWidth() const
bool CompleteInitialized_
Complete_initialized_ is set when OpenDevice(), UseChannel() etc. are done.
Bayer_BGGR, 1 channel RGB image Bayer tile.
Bayer_GBRG, 1 channel RGB image Bayer tile.
class BIASImageBase_EXPORT Image
bool Grabbing_
Grabbing flag is set and unset in GrabSingle() methods.
virtual int OpenDevice()
selects the first available device to open (e.g.
float FramesPerSecond_
Capturing framerate.
unsigned int GetChannelCount() const
returns the number of Color channels, e.g.
color values, 3 channels, order: red,green,blue
bool FrameCounterAsTimeStamp_
unsigned int GetHeight() const
bool Active_
Active flag is set in PreGrab() und unset in PostGrab()
double GetRealTime() const
return real time (=wall time clock) in usec JW For Win32: real-time is measured differently from user...
void SetUID(const BIAS::UUID &id)
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...
std::vector< std::string > FileNames_
static int Convert(BIAS::ImageBase &source, BIAS::ImageBase &dest, enum BIAS::ImageBase::EColorModel targetColorModel, bool bPlanar=false)
main general conversion function, calls desired specialized functions, always initializes the destIma...
int SetColorMode(BIAS::ImageBase::EColorModel mode)
void SetTime(unsigned long long int sec, unsigned long long int usec)
Set time and ensure correct format (seconds and useconds after 'sec')
virtual ~VideoSource_Disk_Bayer()
This is the base class for images in BIAS.
static int ToRGB(const Image< StorageType > &source, Image< StorageType > &dest)
Create a RGB converted copy of source image in this.
int ParseMetaData(bool bUse2x64bitTS=true)
After ImageIO::Load() operated on AppData_, this method fills P_, Timestamp, DC_*, ...
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.