Ignition Rendering

API Reference

6.0.1
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 
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  {
52  protected: Ogre2SegmentationCamera();
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
71  ConnectNewSegmentationFrame(
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
86  public: void LabelMapFromColoredBuffer(
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
Ogre2.x implementation of the scene class.
Definition: Ogre2Scene.hh:57
Definition: BaseSegmentationCamera.hh:34
STL class.
Represents a render-target to which cameras can render images.
Definition: RenderTarget.hh:37
Segmentation camera used to label each pixel with a label id. Supports Semantic / Panoptic Segmentati...
Definition: Ogre2SegmentationCamera.hh:48