PostRenderImageNoise.h
Go to the documentation of this file.
1 #ifndef GAZEBO_NOISY_DEPTH_CAMERA_POSTRENDERIMAGENOISE_H
2 #define GAZEBO_NOISY_DEPTH_CAMERA_POSTRENDERIMAGENOISE_H
3 
4 #include <gazebo/msgs/image.pb.h>
5 #include <gazebo/common/Image.hh>
6 
7 namespace gazebo
8 {
9 namespace sensors
10 {
11 
16 {
17  public: virtual void ApplyFloat(float* _buffer, size_t _width, size_t _height, size_t _depth, const std::string& _pixelFormat)
18  {
19  throw std::runtime_error("Not implemented");
20  }
21 
22  public: virtual void ApplyByte(unsigned char* _buffer, size_t _width, size_t _height, size_t _depth, const std::string& _pixelFormat)
23  {
24  throw std::runtime_error("Not implemented");
25  }
26 
31  public: virtual void Apply(msgs::Image& image)
32  {
33  switch (image.pixel_format())
34  {
35  case common::Image::R_FLOAT32:
36  this->ApplyFloat(reinterpret_cast<float*>(image.mutable_data()), image.width(), image.height(), 1, "FLOAT32");
37  break;
38  case common::Image::RGB_INT8:
39  this->ApplyByte(reinterpret_cast<unsigned char*>(image.mutable_data()), image.width(), image.height(), 3, "R8G8B8");
40  break;
41  case common::Image::BGR_INT8:
42  this->ApplyByte(reinterpret_cast<unsigned char*>(image.mutable_data()), image.width(), image.height(), 3, "B8G8R8");
43  break;
44  case common::Image::L_INT8:
45  this->ApplyByte(reinterpret_cast<unsigned char*>(image.mutable_data()), image.width(), image.height(), 1, "L8");
46  break;
47  case common::Image::BAYER_RGGB8:
48  this->ApplyByte(reinterpret_cast<unsigned char*>(image.mutable_data()), image.width(), image.height(), 1, "BAYER_RGGB8");
49  break;
50  case common::Image::BAYER_GBRG8:
51  this->ApplyByte(reinterpret_cast<unsigned char*>(image.mutable_data()), image.width(), image.height(), 1, "BAYER_GBRG8");
52  break;
53  case common::Image::BAYER_GRBG8:
54  this->ApplyByte(reinterpret_cast<unsigned char*>(image.mutable_data()), image.width(), image.height(), 1, "BAYER_GRBG8");
55  break;
56  default:
57  throw std::runtime_error("Unknown pixel format " + std::to_string(image.pixel_format()));
58  }
59  }
60 };
61 
62 }
63 }
64 
65 #endif //GAZEBO_NOISY_DEPTH_CAMERA_POSTRENDERIMAGENOISE_H
gazebo::sensors::PostRenderImageNoise::ApplyFloat
virtual void ApplyFloat(float *_buffer, size_t _width, size_t _height, size_t _depth, const std::string &_pixelFormat)
Definition: PostRenderImageNoise.h:17
gazebo
gazebo::sensors::PostRenderImageNoise
Definition: PostRenderImageNoise.h:15
gazebo::sensors::PostRenderImageNoise::ApplyByte
virtual void ApplyByte(unsigned char *_buffer, size_t _width, size_t _height, size_t _depth, const std::string &_pixelFormat)
Definition: PostRenderImageNoise.h:22
gazebo::sensors::PostRenderImageNoise::Apply
virtual void Apply(msgs::Image &image)
Apply this noise to the image.
Definition: PostRenderImageNoise.h:31


gazebo_noisy_depth_camera
Author(s): Martin Pecka
autogenerated on Thu Nov 21 2024 03:07:22