Gazebo Rendering

API Reference

6.6.4
gz/rendering/ogre2/Ogre2SegmentationCamera.hh
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2021 Open Source Robotics Foundation
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  *
16 */
17 
18 #ifndef IGNITION_RENDERING_OGRE2_OGRE2SEGMENTATIONCAMERA_HH_
19 #define IGNITION_RENDERING_OGRE2_OGRE2SEGMENTATIONCAMERA_HH_
20 
21 #ifdef _WIN32
22  // Ensure that Winsock2.h is included before Windows.h, which can get
23  // pulled in by anybody (e.g., Boost).
24  #include <Winsock2.h>
25 #endif
26 
27 #include <memory>
28 #include <string>
29 
30 #include <ignition/common/Console.hh>
31 #include <ignition/common/Event.hh>
32 
36 
37 namespace ignition
38 {
39  namespace rendering
40  {
41  inline namespace IGNITION_RENDERING_VERSION_NAMESPACE {
42  //
43  // Forward declaration
44  class Ogre2SegmentationCameraPrivate;
45 
48  class IGNITION_RENDERING_OGRE2_VISIBLE Ogre2SegmentationCamera :
49  public BaseSegmentationCamera<Ogre2Sensor>
50  {
53 
55  public: virtual ~Ogre2SegmentationCamera();
56 
57  // Documentation inherited
58  public: virtual void Init() override;
59 
60  // Documentation inherited
61  public: virtual void Destroy() override;
62 
63  // Documentation inherited
64  public: virtual void PreRender() override;
65 
66  // Documentation inherited
67  public: virtual void PostRender() override;
68 
69  // Documentation inherited
70  public: virtual ignition::common::ConnectionPtr
72  std::function<void(const uint8_t *, unsigned int, unsigned int,
73  unsigned int, const std::string &)> _subscriber) override;
74 
75  // Documentation inherited
76  public: virtual void Render() override;
77 
80  protected: virtual RenderTargetPtr RenderTarget() const override;
81 
82  // Documentation inherited
83  public: void SetBackgroundLabel(int _label) override;
84 
85  // Documentation inherited
87  uint8_t * _labelBuffer) const override;
88 
90  protected: void CreateCamera();
91 
93  protected: virtual void CreateRenderTexture();
94 
95  // Documentation inherited
96  protected: virtual void CreateSegmentationTexture() override;
97 
99  protected: Ogre::Camera *ogreCamera = nullptr;
100 
104 
106  private: friend class Ogre2Scene;
107  };
108  }
109  }
110 }
111 #endif
Definition: gz/rendering/base/BaseSegmentationCamera.hh:38
Ogre2.x implementation of the scene class.
Definition: gz/rendering/ogre2/Ogre2Scene.hh:59
Segmentation camera used to label each pixel with a label id. Supports Semantic / Panoptic Segmentati...
Definition: gz/rendering/ogre2/Ogre2SegmentationCamera.hh:50
void LabelMapFromColoredBuffer(uint8_t *_labelBuffer) const override
Convert the colored map stored in the internal buffer to label IDs map, so users get both the colored...
virtual RenderTargetPtr RenderTarget() const override
Get a pointer to the render target.
virtual void PreRender() override
Prepare this object and any of its children for rendering. This should be called for each object in a...
virtual void PostRender() override
Preforms any necessary final rendering work. Once rendering is complete the camera will alert any lis...
virtual void Destroy() override
Destroy any resources associated with this object. Invoking any other functions after destroying an o...
void SetBackgroundLabel(int _label) override
Set label for background & unlabeled items in the semantic map.
virtual void CreateSegmentationTexture() override
Create a texture which will hold the segmentation data.
virtual void Render() override
Renders the current scene using this camera. This function assumes PreRender() has already been calle...
virtual void CreateRenderTexture()
Create render texture.
virtual ignition::common::ConnectionPtr ConnectNewSegmentationFrame(std::function< void(const uint8_t *, unsigned int, unsigned int, unsigned int, const std::string &)> _subscriber) override
Connect to the new Segmentation image event.