Public Member Functions | Static Public Attributes

JAUS::VisualSensor Class Reference

This service provides a means to share image or video data captured from a camera or video device. More...

#include <visualsensor.h>

Inheritance diagram for JAUS::VisualSensor:
JAUS::Events::Child JAUS::Service

List of all members.

Public Member Functions

 VisualSensor (const bool sharedImage=true)
 Constructor.
 ~VisualSensor ()
 Destructor.
void SetCameraCount (const Byte cameraCount)
 Sets how many cameras are supported by this serivice so that subscribers can query video data.
bool SetCurrentFrame (const unsigned char *rawImage, const unsigned int width, const unsigned int height, const unsigned char channels, const Byte cameraID, const unsigned int frameNumber, const double frameRateHz)
 Sets the current frame from a camera.
bool SetCurrentFrameCompressed (const unsigned char *compImage, const unsigned int compImageSize, const unsigned int width, const unsigned int height, const unsigned char channels, const Byte cameraID, const unsigned int frameNumber, const double frameRateHz, const Image::Format format)
 Sets the current frame from a camera using an already compressed format.
bool SetCurrentFrame (const unsigned char *rawImage, const unsigned int width, const unsigned int height, const unsigned char channels, const Byte cameraID, const double frameRateHz)
 Sets the current frame from a camera.
virtual bool GenerateEvent (const Events::Subscription &info) const
 Generates an event for the given information.
virtual bool IsEventSupported (const Events::Type type, const double requestedPeriodicRate, const Message *queryMessage, double &confirmedPeriodicRate, std::string &errorMessage) const
 Checks if the event is supported by the Service.
virtual bool IsDiscoverable () const
virtual void Receive (const Message *message)
 Processes message received by the Service. If not supported, then message is passed to inheriting services.
virtual MessageCreateMessage (const UShort messageCode) const
 Attempts to create the message desired. Only message supported by this Service can be created by this Service.
bool SetCompressionQualityJPEG (const int quality)
 Sets quality for JPEG compression.

Static Public Attributes

static const std::string Name = "urn:jaus:jss:jpp:extras:VisualSensor"
 String name of the Service.

Detailed Description

This service provides a means to share image or video data captured from a camera or video device.

The Visual Sensor service is independent of the type of device the data comes from. It is up to the user to implement their own video capture software to get image data from a camera. This service only packages the data in a JAUS Message and transmits to subscribers.

This service currently only supports JPEG compression.

An example subscriber is the Video Subscriber service.

Definition at line 69 of file visualsensor.h.


Constructor & Destructor Documentation

VisualSensor::VisualSensor ( const bool  sharedImage = true )

Constructor.

Parameters:
[in]sharedImageIf true, images are shaved to a shared memory buffer, for sharing image data on a single host computer (e.g. VideoSubsriber, SharedImage).

Definition at line 59 of file visualsensor.cpp.

VisualSensor::~VisualSensor (  )

Destructor.

Definition at line 74 of file visualsensor.cpp.


Member Function Documentation

Message * VisualSensor::CreateMessage ( const UShort  messageCode ) const [virtual]

Attempts to create the message desired. Only message supported by this Service can be created by this Service.

This Service supports the following message: Query Image, Report Image

Parameters:
[in]messageCodeMessage to create.
Returns:
Pointer to newly allocated Message data, NULL if message is not supported by the Service.

Implements JAUS::Service.

Definition at line 522 of file visualsensor.cpp.

bool VisualSensor::GenerateEvent ( const Events::Subscription info ) const [virtual]

Generates an event for the given information.

Parameters:
[in]infoThe event information (ID, Sequence #, etc.) for generation.
Returns:
True if event generated, otherwise false.

Implements JAUS::Events::Child.

Definition at line 373 of file visualsensor.cpp.

virtual bool JAUS::VisualSensor::IsDiscoverable (  ) const [inline, virtual]

Implements JAUS::Service.

Definition at line 113 of file visualsensor.h.

bool VisualSensor::IsEventSupported ( const Events::Type  type,
const double  requestedPeriodicRate,
const Message queryMessage,
double &  confirmedPeriodicRate,
std::string &  errorMessage 
) const [virtual]

Checks if the event is supported by the Service.

Parameters:
[in]typeThe event type (Periodic/EveryChange).
[in]requestedPeriodicRateIf type == Periodic, then this is the desired update rate.
[in]queryMessageThe query message associated with the event.
[out]confirmedPeriodicRateThis is the confirmed periodic rate supported by the Service.
[out]errorMessageIf not supported, this is an optional error message.
Returns:
True if event supported, otherwise false.

Implements JAUS::Events::Child.

Definition at line 417 of file visualsensor.cpp.

void VisualSensor::Receive ( const Message message ) [virtual]

Processes message received by the Service. If not supported, then message is passed to inheriting services.

This Service supports the following message: Query Image, Report Image

Parameters:
[in]messageMessage data to process.

Reimplemented from JAUS::Service.

Definition at line 469 of file visualsensor.cpp.

void VisualSensor::SetCameraCount ( const Byte  cameraCount )

Sets how many cameras are supported by this serivice so that subscribers can query video data.

Parameters:
[in]cameraCountNumber of cameras connected to Visual Sensor service.

Definition at line 97 of file visualsensor.cpp.

bool VisualSensor::SetCompressionQualityJPEG ( const int  quality )

Sets quality for JPEG compression.

By default, quality is -1 or best.

Parameters:
[in]qualityThe compression quality. Set to -1 for default, 0 worst and 100 best (but larger size).
Returns:
True on success, false on failure.

Definition at line 559 of file visualsensor.cpp.

bool VisualSensor::SetCurrentFrame ( const unsigned char *  rawImage,
const unsigned int  width,
const unsigned int  height,
const unsigned char  channels,
const Byte  cameraID,
const unsigned int  frameNumber,
const double  frameRateHz 
)

Sets the current frame from a camera.

Parameters:
[in]rawImageRaw image data in BGR format with 0,0 being the top left corner of the image.
[in]widthWidth of image in pixels.
[in]heightHeight of the image in pixels.
[in]channelsNumber of channels in the image.
[in]cameraIDThe camera ID number.
[in]frameNumberThe frame sequence number.
[in]frameRateHzThe update frequency of the camera.
Returns:
True on success, false on failure.

Definition at line 159 of file visualsensor.cpp.

bool VisualSensor::SetCurrentFrame ( const unsigned char *  rawImage,
const unsigned int  width,
const unsigned int  height,
const unsigned char  channels,
const Byte  cameraID,
const double  frameRateHz 
)

Sets the current frame from a camera.

Parameters:
[in]rawImageRaw image data in BGR format with 0,0 being the top left corner of the image.
[in]widthWidth of image in pixels.
[in]heightHeight of the image in pixels.
[in]channelsNumber of channels in the image.
[in]cameraIDThe camera ID number.
[in]frameRateHzThe update frequency of the camera.
Returns:
True on success, false on failure.

Definition at line 118 of file visualsensor.cpp.

bool VisualSensor::SetCurrentFrameCompressed ( const unsigned char *  compImage,
const unsigned int  compImageSize,
const unsigned int  width,
const unsigned int  height,
const unsigned char  channels,
const Byte  cameraID,
const unsigned int  frameNumber,
const double  frameRateHz,
const Image::Format  format 
)

Sets the current frame from a camera using an already compressed format.

Parameters:
[in]compImageCompressed image data.
[in]compImageSizeCompressed image size in bytes.
[in]widthWidth of image in pixels.
[in]heightHeight of the image in pixels.
[in]channelsNumber of channels in the image.
[in]cameraIDThe camera ID number.
[in]frameNumberThe frame sequence number.
[in]frameRateHzThe update frequency of the camera.
[in]formatCompressed image format.
Returns:
True on success, false on failure.

Definition at line 272 of file visualsensor.cpp.


Member Data Documentation

const std::string VisualSensor::Name = "urn:jaus:jss:jpp:extras:VisualSensor" [static]

String name of the Service.

Definition at line 72 of file visualsensor.h.


The documentation for this class was generated from the following files:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines