AURobotServers
4
|
#include <ucomcam.h>
Public Member Functions | |
virtual void | clear () |
const char * | getSaturationModeStr (int mode) |
const char * | getWhiteModeStr (int mode) |
void | print (const char *prestring) |
bool | setCamDevice (UCamDevBase *dev) |
bool | setFromCam (UCamDevBase *dev, bool probe, bool clientInCtrl) |
UComCam () | |
bool | unpack (unsigned char *buff) |
virtual | ~UComCam () |
Structure to hold camera settings information and communicate this on a binary packed serial device.
UComCam::UComCam | ( | ) |
Constructor clears all vaid flags.
|
virtual |
Destructor
|
virtual |
Peek the device number without unpacking the whole message. Returns -1 if device number is invalid, else a device number in range 0 to 31 is returned. Clear all the valid flags.
Reimplemented in UComCamSml.
References AU_WB_AUTO, brightnessValue, channelName, channelNumber, channelNumberValid, cmdUse, cmdValid, colourValue, compressionValid, compressionValue, contourValid, contourValue, contrastValue, deviceValid, deviceValue, fpsValid, fpsValue, gainAutomatic, gainValid, gainValue, gammaValue, hdrMode, hdrValid, imageNumber, imageNumberValid, inCtrlValid, inCtrlValue, ledOn, ledValid, name, nameValid, openValid, openValue, saturationCtrlMode, saturationCtrlValid, shutterAutomatic, shutterValid, shutterValue, sizeHeight, sizeValid, sizeWidth, streamFps, streamOn, streamValid, videoValid, whiteBalGainBlue, whiteBalGainRed, whiteBalMode, and whiteBalValid.
Referenced by UComCamSml::clear(), and setFromCam().
const char * UComCam::getSaturationModeStr | ( | int | mode | ) |
Returns saturation mode as string
Referenced by print().
const char * UComCam::getWhiteModeStr | ( | int | mode | ) |
Get white ballance mode as string
References AU_WB_AUTO, AU_WB_FL, AU_WB_INDOOR, AU_WB_MANUAL, and AU_WB_OUTDOOR.
Referenced by print().
void UComCam::print | ( | const char * | prestring | ) |
Print all states to console
References bool2str(), brightnessValue, channelName, channelNumber, channelNumberValid, colourValue, compressionValid, compressionValue, contourValid, contourValue, contrastValue, deviceValid, deviceValue, fpsValid, fpsValue, gainAutomatic, gainValid, gainValue, gammaValue, getSaturationModeStr(), getWhiteModeStr(), hdrMode, hdrValid, imageNumber, imageNumberValid, inCtrlValid, inCtrlValue, ledOn, ledValid, name, nameValid, openValid, openValue, saturationCtrlMode, saturationCtrlValid, shutterAutomatic, shutterValid, shutterValue, sizeHeight, sizeValid, sizeWidth, streamFps, streamOn, streamValid, videoValid, whiteBalGainBlue, whiteBalGainRed, whiteBalMode, and whiteBalValid.
bool UComCam::setCamDevice | ( | UCamDevBase * | dev | ) |
Set camera from valid values. Camera is assumed to be the right device and in-control is assumed to be checked before the call. If the settings are to be maintained the 'openValid' and openValue should both be true. Returns true if data is assumed implemented
References brightnessValue, channelNumber, channelNumberValid, UCamDevBase::closeDevice(), colourValue, compressionValid, compressionValue, contourValid, contourValue, contrastValue, fpsValid, fpsValue, gainAutomatic, gainValid, gainValue, gammaValue, imageNumber, imageNumberValid, UCamDevBase::isCameraOpen(), UCamDevBase::openDevice(), openValid, openValue, UCamDevBase::setCompPref(), UCamDevBase::setContour(), UCamDevBase::setDataChannel(), UCamDevBase::setDevice(), UCamDevBase::setGain(), UCamDevBase::setImageNumber(), UCamDevBase::setShutter(), UCamDevBase::setVideoCap(), UCamDevBase::setWhiteBalance(), shutterAutomatic, shutterValid, shutterValue, sizeHeight, sizeValid, sizeWidth, videoValid, whiteBalGainBlue, whiteBalGainRed, whiteBalMode, and whiteBalValid.
Referenced by UComCamSml::setCamDevice().
bool UComCam::setFromCam | ( | UCamDevBase * | dev, |
bool | probe, | ||
bool | clientInCtrl | ||
) |
Set values from camera. if probe is true, then some values are requested from camera.
References absi(), brightnessValue, channelName, channelNumber, channelNumberValid, clear(), colourValue, compressionValid, compressionValue, contourValid, contourValue, contrastValue, deviceValid, deviceValue, fpsValid, fpsValue, gainAutomatic, gainValid, gainValue, gammaValue, UCamDevBase::getBrightness(), UCamDevBase::getCameraName(), UCamDevBase::getColour(), UCamDevBase::getCompPref(), UCamDevBase::getContour(), UCamDevBase::getContrast(), UCamDevBase::getDataChannel(), UCamDevBase::getDataChannelName(), UCamDevBase::getDeviceNumber(), UCamDevBase::getFrameRate(), UCamDevBase::getGain(), UCamDevBase::getGamma(), UCamDevBase::getHeight(), UCamDevBase::getImageNumber(), UCamDevBase::getShutter(), UCamDevBase::getWhiteBalance(), UCamDevBase::getWidth(), imageNumber, imageNumberValid, inCtrlValid, inCtrlValue, UCamDevBase::isCameraOpen(), ledValid, UCamDevBase::MAX_CAM_DEV_NAME_LENGTH, MAX_CHANNEL_NAME_LENGTH, name, nameValid, UCamDevBase::openDeviceDefault(), openValid, openValue, shutterAutomatic, shutterValid, shutterValue, sizeHeight, sizeValid, sizeWidth, videoValid, whiteBalGainBlue, whiteBalGainRed, whiteBalMode, and whiteBalValid.
Referenced by UCamPool::findDevices(), and UComCamSml::setFromCam().
bool UComCam::unpack | ( | unsigned char * | buff | ) |
Pack camera settings to string. Packs all valid values into the string and returns the number of bytes used. The format do not set byte at buff[2], as this is reserved to message serial number and must be set by communication part. if toCamServer the type is MSG_CAM_SET_CAMERA_STATE else it is information from camera server and the message type is set to MSG_CAM_CAMERA_STATE. Unpack the information from the buffer if the valid flags in the message for the individual data subjects are not valid, then the related valid flag is not changed. That is these may be left valid with value from before the call. If however it is importent to find the changes, then clear all the Valid flags first. Returns true if a buffer is provided and the camera name has a valid length (if valid)
unsigned int UComCam::brightnessValue |
Video brightness adjustment in camera. Normal value is 0x8000. Range is [0 .. 0xFFF0] a returned value of 0xFFFF probably meand 'unsupported feature'.
Referenced by clear(), UComCamSml::pack(), print(), setCamDevice(), setFromCam(), and UComCamSml::unpack().
char UComCam::channelName[MAX_CHANNEL_NAME_LENGTH+1] |
Channel name
Referenced by clear(), UComCamSml::pack(), print(), and setFromCam().
int UComCam::channelNumber |
Video/tuner data channel, may be any number, but most likely not supported (webcams) or 4 channels (TV-card) TV-card: 0 = TV, 2 = video, 1,3=unknown.
Referenced by clear(), UComCamSml::pack(), print(), setCamDevice(), setFromCam(), and UComCamSml::unpack().
bool UComCam::channelNumberValid |
Is data channel numnber vaid
Referenced by clear(), UComCamSml::pack(), print(), setCamDevice(), setFromCam(), and UComCamSml::unpack().
bool UComCam::cmdUse |
Is command to be executed at every new image?
Referenced by clear().
bool UComCam::cmdValid |
Command at every new image - valid?
Referenced by clear().
unsigned int UComCam::colourValue |
Video colour sturation adjustment in camera. Normal value is 0x8000. Range is [0 .. 0xFFF0] a returned value of 0xFFFF probably meand 'unsupported feature'.
Referenced by clear(), UComCamSml::pack(), print(), setCamDevice(), setFromCam(), and UComCamSml::unpack().
bool UComCam::compressionValid |
Compression level used in image transfer. Is info valid.
Referenced by clear(), print(), setCamDevice(), and setFromCam().
unsigned int UComCam::compressionValue |
Compression is needed in some image sizes and is optional in others. This value is the preferred cmpression if bandwidth allows.
Referenced by clear(), print(), setCamDevice(), and setFromCam().
bool UComCam::contourValid |
Video gain contour control - is info valid
Referenced by clear(), UComCamSml::pack(), print(), setCamDevice(), setFromCam(), and UComCamSml::unpack().
unsigned int UComCam::contourValue |
Video gain contour - lead filter. Enhances edges in horizontal lines. Value is from 0 to 0xFFFF, but only some of the MSBs are implemented. The value 0 means no enhancement.
Referenced by clear(), UComCamSml::pack(), print(), setCamDevice(), setFromCam(), and UComCamSml::unpack().
unsigned int UComCam::contrastValue |
Video contrast adjustment in camera. Normal value is 0x8000. Range is [0 .. 0xFFF0] a returned value of 0xFFFF probably meand 'unsupported feature'.
Referenced by clear(), UComCamSml::pack(), print(), setCamDevice(), setFromCam(), and UComCamSml::unpack().
bool UComCam::deviceValid |
Video device number - usually means directly the '/dev/video0' device number series.
Referenced by clear(), UFunctionCam::handleCamGetCommand(), UFunctionCam::handleCamSetCommand(), UComCamSml::pack(), print(), setFromCam(), and UComCamSml::unpack().
int UComCam::deviceValue |
Video device number - usually means directly the '/dev/video0' device number series (0..32).
Referenced by clear(), UFunctionCam::handleCamGetCommand(), UFunctionCam::handleCamSetCommand(), UComCamSml::pack(), print(), setFromCam(), and UComCamSml::unpack().
bool UComCam::fpsValid |
Framerate in images per second
Referenced by clear(), UComCamSml::pack(), print(), setCamDevice(), setFromCam(), and UComCamSml::unpack().
int UComCam::fpsValue |
Framerate in images per second from camera.
Referenced by clear(), UComCamSml::pack(), print(), setCamDevice(), setFromCam(), and UComCamSml::unpack().
bool UComCam::gainAutomatic |
Camera gain is set to automatic
Referenced by clear(), UComCamSml::pack(), print(), setCamDevice(), setFromCam(), and UComCamSml::unpack().
bool UComCam::gainValid |
Camera position relative to robot center
Referenced by clear(), UComCamSml::pack(), print(), setCamDevice(), setFromCam(), and UComCamSml::unpack().
unsigned int UComCam::gainValue |
Camera gain value: Manual gain values are in range from to 0xFFFF. Only some (typically 6 bit) of the MSB bits are actually implemented in camera.
Referenced by clear(), UComCamSml::pack(), print(), setCamDevice(), setFromCam(), and UComCamSml::unpack().
unsigned int UComCam::gammaValue |
Video Gamma correction value can change the the number of intensity bits used in the dark part of the image. A preliminary analysis suggests that a value of 0 means linear relation from intensity to coding in the 8-bit image. a higher value (up to 0xFFFF) makes the intensity coding non-linear compressing the bright parts and expanding the darker part. A value of 0x8000 is the default setting (TV-style gamma correction
Referenced by clear(), UComCamSml::pack(), print(), setCamDevice(), setFromCam(), and UComCamSml::unpack().
unsigned int UComCam::hdrMode |
High Dynamic range mode is number of images with increasing shutter and gain settings, plus one with closed shutter to get a black level image. p.t. only 3 images are supported, i.e. ine image with current gain and shutter setting, one with increased values and one with closed shutter and nominal gain (dark level). NB! the mode requires that gain and shutter is set to manual or is in no-saturation mode. 0 means hdr is OFF and 3 that it is on. Other values are equal to off.
Referenced by clear(), UComCamSml::pack(), print(), and UComCamSml::unpack().
bool UComCam::hdrValid |
High dynamic range mode - e.g. takes 3 images and combine as a set. is hdrSetting valid.
Referenced by clear(), UComCamSml::pack(), print(), and UComCamSml::unpack().
unsigned long UComCam::imageNumber |
Image number setting (serial number for used images) A long positive number increased for every used image frame, and placed in image meta data.
Referenced by clear(), UComCamSml::pack(), print(), setCamDevice(), setFromCam(), and UComCamSml::unpack().
bool UComCam::imageNumberValid |
Image number setting (serial number for used images) is info valid.
Referenced by clear(), UComCamSml::pack(), print(), setCamDevice(), setFromCam(), and UComCamSml::unpack().
bool UComCam::inCtrlValid |
Is client in control of camera - or take control
Referenced by clear(), UFunctionCam::handleCamSetCommand(), UComCamSml::pack(), print(), setFromCam(), and UComCamSml::unpack().
bool UComCam::inCtrlValue |
Is client in control of camera - or take control
Referenced by clear(), print(), and setFromCam().
bool UComCam::ledOn |
Camera led value - true if on.
Referenced by clear(), UComCamSml::pack(), print(), and UComCamSml::unpack().
bool UComCam::ledValid |
Camera LED (on/off control) is info valid.
Referenced by clear(), UComCamSml::pack(), print(), setFromCam(), and UComCamSml::unpack().
char UComCam::name[UCamDevBase::MAX_CAM_DEV_NAME_LENGTH+1] |
Camera name
Referenced by clear(), UComCamSml::pack(), print(), and setFromCam().
bool UComCam::nameValid |
Camera name valid
Referenced by clear(), UComCamSml::pack(), print(), setFromCam(), and UComCamSml::unpack().
bool UComCam::openValid |
Camera device open/closed is valis or not
Referenced by clear(), UComCamSml::pack(), print(), setCamDevice(), setFromCam(), and UComCamSml::unpack().
bool UComCam::openValue |
Camera device is open/closed
Referenced by clear(), UComCamSml::pack(), print(), setCamDevice(), setFromCam(), and UComCamSml::unpack().
unsigned int UComCam::saturationCtrlMode |
Saturation mode setting. Value 0 is no saturation control. Value > 0 is one of the modes selected by UCamDevice.
Referenced by clear(), UComCamSml::pack(), print(), and UComCamSml::unpack().
bool UComCam::saturationCtrlValid |
No saturation mode is a computer controlled adaptive gain where every 3rd image are analyzed for intensity and the brightest pixel is attempted to be at a desired intensity level (Y = 220). - is setting valid.
Referenced by clear(), UComCamSml::pack(), print(), and UComCamSml::unpack().
bool UComCam::shutterAutomatic |
Is shutter set to automatic. NB! if automatic, then no values are available for actual setting.
Referenced by clear(), UComCamSml::pack(), print(), setCamDevice(), setFromCam(), and UComCamSml::unpack().
bool UComCam::shutterValid |
Shutter control - is value valid.
Referenced by clear(), UComCamSml::pack(), print(), setCamDevice(), setFromCam(), and UComCamSml::unpack().
unsigned int UComCam::shutterValue |
Shutter control value in range 0 to 0xFFFF, where the most significant (typically 5 bits) are implemented only.
Referenced by clear(), UComCamSml::pack(), print(), setCamDevice(), setFromCam(), and UComCamSml::unpack().
unsigned int UComCam::sizeHeight |
Frame size from camera - height in pixels
Referenced by clear(), UComCamSml::pack(), print(), setCamDevice(), setFromCam(), and UComCamSml::unpack().
bool UComCam::sizeValid |
Frame size from camera - is info valid
Referenced by clear(), UFunctionCam::handleCamGetCommand(), UComCamSml::pack(), print(), setCamDevice(), setFromCam(), and UComCamSml::unpack().
unsigned int UComCam::sizeWidth |
Frame size from camera - width in pixels
Referenced by clear(), UComCamSml::pack(), print(), setCamDevice(), setFromCam(), and UComCamSml::unpack().
int UComCam::streamFps |
bool UComCam::streamValid |
bool UComCam::videoValid |
Gamma correction - is info valid.
Referenced by clear(), UComCamSml::pack(), print(), setCamDevice(), setFromCam(), and UComCamSml::unpack().
unsigned int UComCam::whiteBalGainBlue |
Referenced by clear(), UComCamSml::pack(), print(), setCamDevice(), setFromCam(), and UComCamSml::unpack().
unsigned int UComCam::whiteBalGainRed |
The white ballance gain can in some modes be moditored and can be set in manual mode. The values are gain in the red and blue channel (compared to the green). The range is 0 to 0x7FFF - but only a few of the MSBs are impelmented. A value of 0x4000 is assumed to be neutral (gain == 1.0), a higher value increases the gain.
Referenced by clear(), UComCamSml::pack(), print(), setCamDevice(), setFromCam(), and UComCamSml::unpack().
unsigned int UComCam::whiteBalMode |
White ballance can be set to automatic, a few stanrd settings and a manual value, the following values may be used:. PWC_WB_AUTO: Automatic PWC_WB_MANUAL: Manual PWC_WB_INDOOR: Indoor setting using high temperature wolfram light PWC_WB_OUTDOOR: An outdoor setting. PWC_WB_FL: Fluorcent lightning The values are defined in <pwc-ioctl.h> (in /usr/src/linux/drivers/usb(/media)
Referenced by clear(), UComCamSml::pack(), print(), setCamDevice(), setFromCam(), and UComCamSml::unpack().
bool UComCam::whiteBalValid |
White ballance - is info valid.
Referenced by clear(), UComCamSml::pack(), print(), setCamDevice(), setFromCam(), and UComCamSml::unpack().