1 #ifndef GAZEBO_NOISY_DEPTH_CAMERA_POSTRENDERIMAGENOISE_H
2 #define GAZEBO_NOISY_DEPTH_CAMERA_POSTRENDERIMAGENOISE_H
4 #include <gazebo/msgs/image.pb.h>
5 #include <gazebo/common/Image.hh>
17 public:
virtual void ApplyFloat(
float* _buffer,
size_t _width,
size_t _height,
size_t _depth,
const std::string& _pixelFormat)
19 throw std::runtime_error(
"Not implemented");
22 public:
virtual void ApplyByte(
unsigned char* _buffer,
size_t _width,
size_t _height,
size_t _depth,
const std::string& _pixelFormat)
24 throw std::runtime_error(
"Not implemented");
31 public:
virtual void Apply(msgs::Image& image)
33 switch (image.pixel_format())
35 case common::Image::R_FLOAT32:
36 this->
ApplyFloat(
reinterpret_cast<float*
>(image.mutable_data()), image.width(), image.height(), 1,
"FLOAT32");
38 case common::Image::RGB_INT8:
39 this->
ApplyByte(
reinterpret_cast<unsigned char*
>(image.mutable_data()), image.width(), image.height(), 3,
"R8G8B8");
41 case common::Image::BGR_INT8:
42 this->
ApplyByte(
reinterpret_cast<unsigned char*
>(image.mutable_data()), image.width(), image.height(), 3,
"B8G8R8");
44 case common::Image::L_INT8:
45 this->
ApplyByte(
reinterpret_cast<unsigned char*
>(image.mutable_data()), image.width(), image.height(), 1,
"L8");
47 case common::Image::BAYER_RGGB8:
48 this->
ApplyByte(
reinterpret_cast<unsigned char*
>(image.mutable_data()), image.width(), image.height(), 1,
"BAYER_RGGB8");
50 case common::Image::BAYER_GBRG8:
51 this->
ApplyByte(
reinterpret_cast<unsigned char*
>(image.mutable_data()), image.width(), image.height(), 1,
"BAYER_GBRG8");
53 case common::Image::BAYER_GRBG8:
54 this->
ApplyByte(
reinterpret_cast<unsigned char*
>(image.mutable_data()), image.width(), image.height(), 1,
"BAYER_GRBG8");
57 throw std::runtime_error(
"Unknown pixel format " + std::to_string(image.pixel_format()));
65 #endif //GAZEBO_NOISY_DEPTH_CAMERA_POSTRENDERIMAGENOISE_H