raisim::RGBCamera
class · #include <raisim/sensors/RGBSensor.hpp>
Inherits: raisim::Sensor
Color camera sensor. RaiSim stores the camera configuration and an image buffer but does not render images itself: the buffer must be written by user code or an in-process renderer (e.g. rayrai's Camera::getRawImage()), so the measurement source must stay MANUAL.
Nested classes
structRGBCameraProperties — Configuration of an RGBCamera. Change it with setProperties().
Constructors & destructor
RGBCamera
RGBCamera(
const RGBCameraProperties &prop,
class ArticulatedSystem *as,
const Vec<3> &pos,
const Mat<3, 3> &rot)Create an RGB camera and allocate its width * height * 4 byte image buffer. The measurement source is MANUAL.
Parameters
| Parameter | Description |
|---|---|
prop (in) | Camera properties (validated; invalid values cause a fatal error). |
as (in) | Owning articulated system. |
pos (in) | Sensor position relative to the body (link) it is defined on. |
rot (in) | Sensor orientation relative to the body (link) it is defined on. |
Public member functions
serializeProp
server::BoundedWriter serializeProp(server::BoundedWriter data) const finalUsed by the server. Do not use it if you don't know what it does. It serializes the sensor properties
Parameters
| Parameter | Description |
|---|---|
data (in) | where the property is written; throws server::SerializationError if it does not fit |
Returns where the next data should be written
getProperties
const RGBCameraProperties &getProperties() constReturn immutable camera properties.
Returns camera properties
setProperties
void setProperties(const RGBCameraProperties &prop)Replace camera properties transactionally and resize the dependent image buffer. Invalid properties leave the camera unchanged. The image contents are reset to zero.
Parameters
| Parameter | Description |
|---|---|
prop (in) | New properties. name and full_name must match the current ones (fatal error otherwise). |
getImageBuffer
const std::vector<char> &getImageBuffer() constImage buffer of width * height * 4 bytes (4 bytes per pixel, rows contiguous). RaiSim does not synthesize RGB images or interpret the channel order; user code or an in-process renderer must write this buffer manually. rayrai's Camera::getRawImage() writes BGRA.
Returns The image data in char vector
std::vector<char> &getImageBuffer()Mutable access to the image buffer (same layout as the const overload); use it to write MANUAL measurements in place. Keep its size at width * height * 4 bytes.
Returns The image data in char vector
setImageBuffer
void setImageBuffer(const std::vector<char> &rgbaIn)Replace the image buffer. Useful on the real robot or for renderer output.
Parameters
| Parameter | Description |
|---|---|
rgbaIn (in) | 4-byte-per-pixel image of exactly width * height * 4 bytes (fatal error otherwise), in the same layout as getImageBuffer() |
applyNoise
void applyNoise()Apply one simulated exposure's noise in place. Alpha is preserved. Manual setters do not add noise; Rayrai capture and the RaiSim server call this after writing a clean image.
void applyNoise(char *image, size_t size)Apply noise to a custom four-channel image with exactly width * height * 4 bytes.
Parameters
| Parameter | Description |
|---|---|
image (in, out) | RGBA or BGRA image in top-left row order. |
size (in) | Image size in bytes. |
void applyNoise(char *image, size_t size, bool topLeftOrigin)Apply the same exposure to top-left (true) or bottom-left (false) row storage. The seed always assigns noise to physical pixels in top-left image order.
resetNoise
void resetNoise() noexceptRestart the stream from the sensor seed, identity, owner id and World environment seed.
update
void update(class World &world) finalAlways a fatal error: RaiSim cannot produce RGB measurements (use MeasurementSource::MANUAL).
Parameters
| Parameter | Description |
|---|---|
world (in) | unused |
Static member functions
getType static
static Type getType()Returns Sensor::Type::RGB.
Inherited members
From raisim::Sensor: getArticulatedSystem, getFrameId, getFrameOrientation, getFramePosition, getFullName, getMeasurementSource, getName, getOrientation, getOriInSensorFrame, getPosInSensorFrame, getPosition, getSensorSetModel, getSerialNumber, getUpdateRate, getUpdateTimeStamp, isUpdateDue, lock, lockMutex, MeasurementSource, serializeMeasurements, setAttachmentFrame, setMeasurementSource, setSerialNumber, setUpdateRate, setUpdateTimeStamp, try_lock, Type, unlock, unlockMutex, updatePose