24 #ifndef __BIASVIDEOSOURCE_HH__
25 #define __BIASVIDEOSOURCE_HH__
27 #include <bias_config.h>
29 #include <Base/Image/Image.hh>
30 #include <Base/Common/BIASpragmaStart.hh>
31 #include <Image/VideoStream.hh>
35 #define D_VSO_DISK (1<<2)
36 #define D_DCAM_F7 (1<<3)
38 #define D_VS_WHITEB (1<<5)
46 template <
class T>
class BIASVideoSource_EXPORT
Camera;
66 foo = new VideoSource_DCAM;
69 // the default colormode depends on the used Camera(kind of VideoSource)
71 // set a image size for grabbing foo->SetSize(width,height)
72 foo->SetSize(768,576);
82 // do last preparations
88 // stop enetually running things (isochronous transfers for example)
104 virtual int OpenDevice();
107 virtual int OpenDevice(
const char *device);
110 virtual int OpenDevice(
int device);
113 virtual int OpenDevice(std::string Prefix, std::string Postfix,
114 int DigitCount,
int PictureCount,
int StartCount=0);
117 virtual int OpenDevice(
const std::vector<std::string> &FileNames);
119 virtual int CloseDevice();
121 virtual int GetAllDevices(std::vector<std::string> &devices);
125 #ifdef BUILD_IMAGE_CHAR
128 #ifdef BUILD_IMAGE_SHORT
131 #ifdef BUILD_IMAGE_INT
134 #ifdef BUILD_IMAGE_USHORT
137 #ifdef BUILD_IMAGE_UINT
140 #ifdef BUILD_IMAGE_DOUBLE
144 virtual int PreGrab();
147 virtual int PostGrab();
155 virtual void SetSize(
int w,
int h,
int bytesperpixel=1);
175 void SetFPS(
float fps) { FramesPerSecond_ = fps; }
205 virtual int AutoMode(
int a,
bool b);
206 inline int GetID()
const {
return ID_; }
214 virtual int SetFeature(
int feature,
unsigned int value);
217 virtual unsigned int GetFeature(
int feature);
223 virtual float GetShutter();
225 virtual int SetShutter(
float exptime);
227 virtual bool GetAutoShutter() { BIASERR(
"Please overload function!");
return false; }
229 min = minShutter_; max = maxShutter_;
233 virtual float GetGain();
235 virtual int SetGain(
float g);
236 virtual void SetAutoGain(
bool b) { BIASERR(
"Please overload function!"); }
237 virtual bool GetAutoGain() { BIASERR(
"Please overload function!");
return false; }
239 min = minGain_; max = maxGain_;
243 virtual float GetBrightness() { BIASERR(
"Please overload function!");
return 0.0f; }
245 virtual int SetBrightness(
float g) { BIASERR(
"Please overload function!");
return 0; }
249 min = minBrightness_; max = maxBrightness_;
253 virtual float GetContrast() { BIASERR(
"Please overload function!");
return 0.0f; }
255 virtual int SetContrast(
float g) { BIASERR(
"Please overload function!");
return 0; }
257 virtual bool GetAutoContrast() { BIASERR(
"Please overload function!");
return false; }
259 min = minContrast_; max = maxContrast_;
267 virtual int OnePushAuto(
int feature);
270 virtual int SetWhiteBalance(
float rvalue,
float bvalue);
272 virtual int GetWhiteBalance(
float &rvalue,
float &bvalue);
275 virtual int SoftwareWhiteBalance();
281 int SetDirectToDisk(
const std::string &filename);
293 inline virtual void SetWaitForNew(
bool waitForNew) { WaitForNew_ = waitForNew; }
297 int WriteDirect_(
const unsigned char *data,
const BIAS::UUID &uuid,
298 const long int &sec,
const long int &usec);
374 #include <Base/Common/BIASpragmaEnd.hh>
EColorModel
These are the most often used color models.
virtual void GetShutterRange(double &min, double &max)
virtual bool GetAutoBrightness()
void SetFPS(float fps)
Set frame per second for image capturing.
virtual void SetAutoContrast(bool b)
Defines a common interface to different devices.
char * DtDBuffer_
512 byte aligned buffer, contains VSImageHeader and image data
BIAS::VideoStream::VSImageHeader * DtDImageHeader_
Pointer to the beginning of DtDBuffer_.
void SetDeviceChannel(int channel)
Use channel to select one of many cameras on the same.
virtual bool GetAutoShutter()
bool IsControllable_
Must be initialized be the derived classes.
extends the Image by MetaData support (e.g.
char * DtDStartOfImage_
Pointer into DtDBuffer after VSImageHeader.
virtual void SetExternalTrigger(bool trigger=true)
Specify if there is an external trigger to be used.
virtual bool GetAutoGain()
const char * DefaultDevice_
Device name.
virtual void GetBrightnessRange(double &min, double &max)
virtual bool HasControlBrightness()
BIAS::ImageBase::EColorModel ColorMode_
Color mode used by camera.
int DeviceChannel_
Device channel.
bool WaitForNew_
Wait for new frames in GrabSingle()
virtual void SetAutoShutter(bool b)
float BytesPerPixel_
BytesPerPixel cannot be int (e.g. it is 1.5 for YUV420p)
int GetColorChannels() const
virtual int SetContrast(float g)
Set contrast as value in interval [0, 100]. */.
bool CompleteInitialized_
Complete_initialized_ is set when OpenDevice(), UseChannel() etc. are done.
virtual void GetContrastRange(double &min, double &max)
virtual bool HasControlContrast()
std::string Identifier_
Verbose camera descriptor.
bool Grabbing_
Grabbing flag is set and unset in GrabSingle() methods.
virtual void SetWaitForNew(bool waitForNew)
Specify if grab should wait for new frames.
void SetBytesPerPixel(unsigned char bpp)
std::string GetIdentifier() const
float FramesPerSecond_
Capturing framerate.
virtual void GetGainRange(double &min, double &max)
double minContrast_
Feature ranges.
bool IsControllable()
Specify if SetShutter(), SetGain() ... would work for this camera.
virtual float GetBrightness()
Get brightness as value in interval [0, 100]. */.
virtual void EnsureLatestFrame(const bool b)
The image template class for specific storage types.
bool DirectToDisk_
Write directly to disk.
bool bExternalTrigger_
External trigger flag.
float GetBytesPerPixel() const
unsigned int DtDBufferSize_
Buffer size must be multiple of 512.
bool Active_
Active flag is set in PreGrab() und unset in PostGrab()
virtual bool HasControlGain()
virtual void ResetPanTiltZoom()
Reset digital zoom, pan, and tilt to defaults to ensure compliance with calibration.
virtual void SetAutoBrightness(bool b)
virtual void SetAutoGain(bool b)
virtual bool HasControlWhiteBalance()
virtual bool GetAutoContrast()
unsigned int ImageSize_
Image size, useful for allocating and copying memory.
BIAS::ImageBase::EColorModel GetColorModel() const
Checks for VideoSource capabilities.
int DtDFd_
File descriptor for direct-to-disk mode.
virtual void GetDeviceChannelNames(std::vector< std::string > &names)
If more than one channel is present, names can be returned here.
interface class for producing/storing Universally Unique IDentifiers
This is the base class for images in BIAS.
virtual int SetBrightness(float g)
Set brightness as value in interval [0, 100]. */.
virtual bool HasControlShutter()
virtual float GetContrast()
Get contrast as value in interval [0, 100]. */.