This service provides a means to share image or video data captured from a camera or video device. More...
#include <visualsensor.h>
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 Message * | CreateMessage (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. |
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.
VisualSensor::VisualSensor | ( | const bool | sharedImage = true ) |
Constructor.
[in] | sharedImage | If 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.
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
[in] | messageCode | Message to create. |
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.
[in] | info | The event information (ID, Sequence #, etc.) for generation. |
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.
[in] | type | The event type (Periodic/EveryChange). |
[in] | requestedPeriodicRate | If type == Periodic, then this is the desired update rate. |
[in] | queryMessage | The query message associated with the event. |
[out] | confirmedPeriodicRate | This is the confirmed periodic rate supported by the Service. |
[out] | errorMessage | If not supported, this is an optional error message. |
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
[in] | message | Message 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.
[in] | cameraCount | Number 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.
[in] | quality | The compression quality. Set to -1 for default, 0 worst and 100 best (but larger size). |
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.
[in] | rawImage | Raw image data in BGR format with 0,0 being the top left corner of the image. |
[in] | width | Width of image in pixels. |
[in] | height | Height of the image in pixels. |
[in] | channels | Number of channels in the image. |
[in] | cameraID | The camera ID number. |
[in] | frameNumber | The frame sequence number. |
[in] | frameRateHz | The update frequency of the camera. |
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.
[in] | rawImage | Raw image data in BGR format with 0,0 being the top left corner of the image. |
[in] | width | Width of image in pixels. |
[in] | height | Height of the image in pixels. |
[in] | channels | Number of channels in the image. |
[in] | cameraID | The camera ID number. |
[in] | frameRateHz | The update frequency of the camera. |
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.
[in] | compImage | Compressed image data. |
[in] | compImageSize | Compressed image size in bytes. |
[in] | width | Width of image in pixels. |
[in] | height | Height of the image in pixels. |
[in] | channels | Number of channels in the image. |
[in] | cameraID | The camera ID number. |
[in] | frameNumber | The frame sequence number. |
[in] | frameRateHz | The update frequency of the camera. |
[in] | format | Compressed image format. |
Definition at line 272 of file visualsensor.cpp.
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.