MCPcopy Create free account
hub / github.com/BerkeleyAutomation/meshrender / render

Method render

meshrender/scene.py:172–212  ·  view source on GitHub ↗

Render raw images of the scene. Parameters ---------- render_color : bool If True, both a color and a depth image are returned. If False, only a depth image is returned. front_and_back : bool If True, all surface normals are treat

(self, render_color=True, front_and_back=False)

Source from the content-addressed store, hash-verified

170 self._renderer = None
171
172 def render(self, render_color=True, front_and_back=False):
173 """Render raw images of the scene.
174
175 Parameters
176 ----------
177 render_color : bool
178 If True, both a color and a depth image are returned.
179 If False, only a depth image is returned.
180
181 front_and_back : bool
182 If True, all surface normals are treated as if they're facing the camera.
183
184 Returns
185 -------
186 tuple of (h, w, 3) uint8, (h, w) float32
187 A raw RGB color image with pixel values in [0, 255] and a depth image
188 with true depths expressed as floats. If render_color was False,
189 only the depth image is returned.
190
191 Raises
192 ------
193 ValueError
194 If the scene has no set camera.
195
196 Note
197 -----
198 This function can be called repeatedly, regardless of changes to the scene
199 (i.e. moving SceneObjects, adding and removing lights, moving the camera).
200 However, adding or removing objects causes a new OpenGL context to be created,
201 so put all the objects in the scene before calling it.
202
203 Note
204 ----
205 Values listed as 0.0 in the depth image are actually at infinity
206 (i.e. no object present at that pixel).
207 """
208 if self._camera is None:
209 raise ValueError('scene.camera must be set before calling render()')
210 if self._renderer is None:
211 self._renderer = OpenGLRenderer(self)
212 return self._renderer.render(render_color, front_and_back=front_and_back)
213
214 def wrapped_render(self, render_modes, front_and_back=False):
215 """Render images of the scene and wrap them with Image wrapper classes

Callers 2

wrapped_renderMethod · 0.95
test_viewer.pyFile · 0.45

Calls 1

OpenGLRendererClass · 0.85

Tested by

no test coverage detected