AURobotServers  4
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
UCamDevGigE Class Reference

#include <ucamdevgige.h>

Inheritance diagram for UCamDevGigE:
Inheritance graph

Public Member Functions

void cameraEventCB (void *Context, tPvInterface Interface, tPvLinkEvent Event, unsigned long UniqueId)
 
virtual void closeDevice ()
 
virtual bool deviceExist ()
 
void frameDoneCB (tPvFrame *pFrame)
 
bool frameToImage (UImage *destination, tPvFrame *frame)
 
bool getCamFeatures ()
 
void getCamInfo ()
 
virtual int getFrameRate ()
 
virtual int getGain (bool probe, bool *dataValid=NULL, bool *isOnAuto=NULL)
 
virtual bool getImageSnapshot (UImage *image)
 
virtual int getShutter (bool probe, bool *dataValid=NULL, bool *isOnAuto=NULL)
 
virtual bool getWhiteBalance (bool probe, int *red=NULL, int *blue=NULL, int *mode=NULL)
 
virtual bool openDevice ()
 
virtual bool openDeviceDefault ()
 
bool setCamDeviceNode (int portNum, int camNum)
 
virtual bool setDevice (const int width, const int height, const int framesPerSec)
 
virtual bool setGain (int agc)
 
virtual bool setShutter (int value)
 
 UCamDevGigE ()
 
 ~UCamDevGigE ()
 
- Public Member Functions inherited from UCamDevBase
virtual void callGotNewDataWithObject ()
 
virtual void createVars ()
 
virtual int getBrightness (bool)
 
char * getCameraName ()
 
int getCamFd ()
 
virtual int getColour (bool)
 
virtual int getCompPref (bool)
 
virtual int getContour (bool)
 
virtual int getContrast (bool)
 
virtual int getDataChannel ()
 
virtual const char * getDataChannelName ()
 
int getDeviceNumber ()
 
virtual bool getExternalTrigger (bool *supported)
 
virtual int getGamma (bool)
 
unsigned int getHeight ()
 
unsigned long getImageNumber ()
 
bool getLockedNewImage (UImage **raw)
 
char * getName ()
 
double getPixelSize ()
 
int getWBModeFromString (const char *mode)
 
unsigned int getWidth ()
 
void gotNewImage (UImage *rgb)
 
void imageSizeChanged (double iResFactor)
 
void imgUpdated ()
 
bool isCameraOpen ()
 
bool isLog ()
 
bool isReplay ()
 
virtual bool isThisA (USupportedCamTypes thisType)
 
virtual bool makeTriggerPulse ()
 
bool needNewPushData ()
 
virtual bool setBrightness (int brightness)
 
void setCam (UCamBase *camRef)
 
virtual bool setColour (int colour)
 
virtual bool setCompPref (int value)
 
virtual bool setContour (int value=0x1000)
 
virtual bool setContrast (int contrast)
 
virtual bool setDataChannel (int)
 
void setDeviceNumber (int deviceNum)
 
virtual bool setExternalTrigger (bool, bool *supported)
 
virtual bool setGamma (int gamma)
 
void setImageNumber (unsigned long serial)
 
void setInitialized (bool value)
 
void setLog (bool value)
 
virtual void setPushBuffer (UImage *)
 
void setReplay (bool value)
 
void setTypeName (const char *newName)
 
void setVarPool (UVarPool *vpd)
 
virtual bool setVideoCap (int, int, int, int)
 
virtual bool setWhiteBalance (int, int, int)
 
 UCamDevBase ()
 
virtual ~UCamDevBase ()
 
- Public Member Functions inherited from ULock
bool lock ()
 
void lockInit ()
 
void post ()
 
bool tryLock ()
 
bool tryWait ()
 
 ULock ()
 
void unlock ()
 
bool wait ()
 
 ~ULock ()
 

Protected Member Functions

bool CameraStart (tCamera *Camera)
 
int getBayerPattern ()
 
int getGigEIdx ()
 
void resetTimestamp ()
 

Protected Attributes

tCamera Camera
 GigE camera info. More...
 
ULock captureDo
 
ULock captureDone
 
UImagecaptureImage
 
int frameFormat
 
unsigned int roiHeight
 
unsigned int roiLeft
 
unsigned int roiTop
 
unsigned int roiWidth
 
long unsigned int timestampFrequency
 
UTime timestampRefTime
 
bool whitebalAuto
 
int whitebalBlue
 
int whitebalRed
 
- Protected Attributes inherited from UCamDevBase
UCamBasecam
 
int cam_fd
 
bool cameraOpen
 
char camName [MAX_CAM_DEV_NAME_LENGTH]
 
USupportedCamTypes camType
 
int devNum
 file descriptor for camera device More...
 
int frameHeight
 
int frameRate
 
int frameWidth
 
unsigned long imageNumber
 
int imCnt
 
UImageimgBuff [RAW_IMAGEBUFFER_MAX_CNT]
 
int imgBuffNext
 
bool initialized
 
UVariablevarCamName
 camera name from camera More...
 
UVariablevarLog
 Variable for log flag. More...
 
UVariablevarReplay
 Variable for replay. More...
 
UVarPoolvars
 
int vbrightness
 
int vcolour
 
int vcompressionPref
 
int vcontour
 
int vcontrast
 
int vgain
 
int vgamma
 
int vshutter
 

Additional Inherited Members

- Public Types inherited from UCamDevBase
enum  camTypes {
  CAM_DEV_REPLAY, CAM_DEV_PWC, CAM_DEV_IEEE1394, CAM_DEV_GRAPPER,
  CAM_DEV_GIGE
}
 
typedef enum UCamDevBase::camTypes USupportedCamTypes
 
- Static Public Member Functions inherited from UCamDevBase
static char * getWBModeAsString (int mode, char *strBuff)
 
- Static Public Attributes inherited from UCamDevBase
static const int MAX_CAM_DEV_NAME_LENGTH = 100
 
static const int MAX_IMAGE_WIDTH = 640
 
- Static Protected Attributes inherited from UCamDevBase
static const int RAW_IMAGEBUFFER_MAX_CNT = 5
 

Detailed Description

Camera device type that controls GigE camera Device number is from 15 to 19 - defined in URob4/UCamPool

    @author Christian Andersen <jca@oersted.dtu.dk>

Constructor & Destructor Documentation

UCamDevGigE::UCamDevGigE ( )
UCamDevGigE::~UCamDevGigE ( )

Member Function Documentation

void UCamDevGigE::cameraEventCB ( void *  Context,
tPvInterface  Interface,
tPvLinkEvent  Event,
unsigned long  UniqueId 
)

callback called when the camera is plugged/unplugged

bool UCamDevGigE::CameraStart ( tCamera Camera)
protected

setup and start streaming

Referenced by deviceExist().

void UCamDevGigE::closeDevice ( )
virtual

close if the device is open

Reimplemented from UCamDevBase.

References UCamDevBase::cameraOpen, and UCamDevBase::getDeviceNumber().

Referenced by openDeviceDefault(), and ~UCamDevGigE().

bool UCamDevGigE::deviceExist ( )
virtual

Test if souch device exist and can be opened. If camera is available initialize to a state where it can be opened right away. true if device can be opened (a device exists).

Reimplemented from UCamDevBase.

References CameraGet(), UCamDevBase::cameraOpen, CameraSetup(), CameraStart(), CameraStop(), CameraUnsetup(), tCamera::Filename, getGigEIdx(), UCamDevBase::initialized, UCamDevBase::setTypeName(), and WaitForCamera().

void UCamDevGigE::frameDoneCB ( tPvFrame *  pFrame)

Call back function when frame is finished

bool UCamDevGigE::frameToImage ( UImage destination,
tPvFrame *  frame 
)

Copy this frame to the destination image.

Parameters
destinationis the image-pool image for the frame.
frameis the frame from the camera.
Returns
true if image is copied to destination,and false if source or destination is invalid.

References UImage::cam, UImage::camDevice, UImage::getBufferSize(), UImage::getData(), UImage::getDataSize(), UCamDevBase::getDeviceNumber(), UTime::getTimeAsString(), UCamDevBase::imageNumber, UImage::imageNumber, img, UImage::imgTime, PIX_PLANES_BGGR, PIX_PLANES_BGR, PIX_PLANES_BGRA, PIX_PLANES_BW, PIX_PLANES_BW16S, PIX_PLANES_GBRG, PIX_PLANES_GRBG, PIX_PLANES_RGB, PIX_PLANES_RGBA, PIX_PLANES_RGGB, PIX_PLANES_YUV, UImage::setColorType(), UImage::setSize(), timestampFrequency, timestampRefTime, and UImage::valid.

int UCamDevGigE::getBayerPattern ( )
protected

Get the bayer pattern from the camera. Result is one of the PIX_PLANEX_BGGR integers.

bool UCamDevGigE::getCamFeatures ( )

Get full camera feature set

void UCamDevGigE::getCamInfo ( )

Get basic camera info

int UCamDevGigE::getFrameRate ( )
virtual

Get current frame rate setting

Reimplemented from UCamDevBase.

References UCamDevBase::frameRate.

int UCamDevGigE::getGain ( bool  probe,
bool *  dataValid = NULL,
bool *  isOnAuto = NULL 
)
virtual

Set actual gain value (in the range -1 (auto) or manual 0..0xFFFF).

Returns
existing vaue is returned if 'probe' is false, if 'probe' is true, then the camera is asked for the most recent value. if this is not possible, then en error is reported and last value returned. If dataValid is set, then this is set false on error

Reimplemented from UCamDevBase.

References bool2str(), and UCamDevBase::vgain.

int UCamDevGigE::getGigEIdx ( )
inlineprotected

Get index of gige cameras

References FIRST_GIGE_DEVICE_NUMBER, MAX_GIGE_DEVS, maxi(), and mini().

Referenced by deviceExist(), and ~UCamDevGigE().

bool UCamDevGigE::getImageSnapshot ( UImage image)
virtual

Get new image - the newest available to the provided image buffer. if 'image' == NULL, then get and discard an image.

Returns
true if an image could be captured.

Reimplemented from UCamDevBase.

References bool2str(), captureDo, captureDone, captureImage, UCamDevBase::devNum, UCamDevBase::isCameraOpen(), openDevice(), ULock::post(), ULock::tryWait(), UImage::valid, and Wait().

int UCamDevGigE::getShutter ( bool  probe,
bool *  dataValid = NULL,
bool *  isOnAuto = NULL 
)
virtual

Set actual gain value.

Returns
existing vaue is returned if 'probe' is false, if 'probe' is true, then the camera is asked for the most recent value. if this is not possible, then en error is reported and last value returned. If dataValid is set, then this is set false on error

Reimplemented from UCamDevBase.

References bool2str(), and UCamDevBase::vshutter.

bool UCamDevGigE::getWhiteBalance ( bool  probe,
int *  red = NULL,
int *  blue = NULL,
int *  mode = NULL 
)
virtual

Get white balance values if 'probe' the the camera is asked, otherwise previous value is returned unchecked. If one or more of the following pointers are non-zero the integer value is returned.

Reimplemented from UCamDevBase.

References AU_WB_AUTO, AU_WB_MANUAL, bool2str(), whitebalAuto, whitebalBlue, and whitebalRed.

virtual bool UCamDevGigE::openDevice ( )
inlinevirtual

Open devise to get default camera parameters. Returns true iff successful.

Reimplemented from UCamDevBase.

Referenced by getImageSnapshot().

bool UCamDevGigE::openDeviceDefault ( )
virtual
void UCamDevGigE::resetTimestamp ( )
protected

reset timestamp - and time reference

Referenced by openDeviceDefault().

bool UCamDevGigE::setCamDeviceNode ( int  portNum,
int  camNum 
)

Set camera node info

bool UCamDevGigE::setDevice ( const int  width,
const int  height,
const int  framesPerSec 
)
virtual

implement these settings and leave the device open.

Reimplemented from UCamDevBase.

References UCamDevBase::frameHeight, UCamDevBase::frameRate, UCamDevBase::frameWidth, UCamDevBase::imageSizeChanged(), UCamDevBase::MAX_IMAGE_WIDTH, maxi(), and mini().

bool UCamDevGigE::setGain ( int  agc)
virtual

Set gain value. A negative value (-1) sets automatic gain. A positive value in range 0..0xFFFF is video gain in camera. 0 is low gain (but not zero). true if set successful - i.e. the function is supported by camera.

Reimplemented from UCamDevBase.

bool UCamDevGigE::setShutter ( int  value)
virtual

Set shutter value. A negative value (-1) sets automatic gain. A positive value in range 0..0xFFFF is shutter setting in camera. 0 is short gain (but not zero). true if set successful - i.e. the function is supported by camera.

Reimplemented from UCamDevBase.

Member Data Documentation

tCamera UCamDevGigE::Camera
protected

GigE camera info.

ULock UCamDevGigE::captureDo
protected

Capture lock to be unlocked (posted) when a snapshot image is needed. Should be posted by the thread needing the image, and will be accepted (locked by a tryPost() or tryLock()) by the frame read thread.

Referenced by getImageSnapshot(), and UCamDevGigE().

ULock UCamDevGigE::captureDone
protected

Capture finished post, posted by the read thread and the thread needing the image may wait on this lock.

Referenced by getImageSnapshot(), and UCamDevGigE().

UImage* UCamDevGigE::captureImage
protected

Image pointer for single image capture

Referenced by getImageSnapshot().

int UCamDevGigE::frameFormat
protected

Format of last received frame

Referenced by UCamDevGigE().

unsigned int UCamDevGigE::roiHeight
protected
unsigned int UCamDevGigE::roiLeft
protected
unsigned int UCamDevGigE::roiTop
protected
unsigned int UCamDevGigE::roiWidth
protected

ROI settings

long unsigned int UCamDevGigE::timestampFrequency
protected

Timestamp frequency

Referenced by frameToImage().

UTime UCamDevGigE::timestampRefTime
protected

Time stamp reference

Referenced by frameToImage().

bool UCamDevGigE::whitebalAuto
protected

White balance mode

Referenced by getWhiteBalance().

int UCamDevGigE::whitebalBlue
protected

White ballance blue

Referenced by getWhiteBalance().

int UCamDevGigE::whitebalRed
protected

White balance red

Referenced by getWhiteBalance().


The documentation for this class was generated from the following files: