|
62 | 62 | "import matplotlib.pyplot as plt\n",
|
63 | 63 | "from skimage.io import imread\n",
|
64 | 64 | "\n",
|
65 |
| - "# Util function for loading point clouds\n", |
| 65 | + "# Util function for loading point clouds|\n", |
66 | 66 | "import numpy as np\n",
|
67 | 67 | "\n",
|
68 | 68 | "# Data structures and functions for rendering\n",
|
|
187 | 187 | "plt.axis(\"off\");"
|
188 | 188 | ]
|
189 | 189 | },
|
| 190 | + { |
| 191 | + "cell_type": "markdown", |
| 192 | + "metadata": {}, |
| 193 | + "source": [ |
| 194 | + "We will now modify the **renderer** to use **alpha compositing** with a set background color. " |
| 195 | + ] |
| 196 | + }, |
| 197 | + { |
| 198 | + "cell_type": "code", |
| 199 | + "execution_count": null, |
| 200 | + "metadata": {}, |
| 201 | + "outputs": [], |
| 202 | + "source": [ |
| 203 | + "renderer = PointsRenderer(\n", |
| 204 | + " rasterizer=PointsRasterizer(cameras=cameras, raster_settings=raster_settings),\n", |
| 205 | + " # Pass in background_color to the alpha compositor, setting the background color \n", |
| 206 | + " # to the 3 item tuple, representing rgb on a scale of 0 -> 1, in this case blue\n", |
| 207 | + " compositor=AlphaCompositor(background_color=(0, 0, 1))\n", |
| 208 | + ")\n", |
| 209 | + "images = renderer(point_cloud)\n", |
| 210 | + "plt.figure(figsize=(10, 10))\n", |
| 211 | + "plt.imshow(images[0, ..., :3].cpu().numpy())\n", |
| 212 | + "plt.grid(\"off\")\n", |
| 213 | + "plt.axis(\"off\");" |
| 214 | + ] |
| 215 | + }, |
190 | 216 | {
|
191 | 217 | "cell_type": "markdown",
|
192 | 218 | "metadata": {},
|
|
234 | 260 | "plt.grid(\"off\")\n",
|
235 | 261 | "plt.axis(\"off\");"
|
236 | 262 | ]
|
| 263 | + }, |
| 264 | + { |
| 265 | + "cell_type": "markdown", |
| 266 | + "metadata": {}, |
| 267 | + "source": [ |
| 268 | + "We will now modify the **renderer** to use **weighted compositing** with a set background color. " |
| 269 | + ] |
| 270 | + }, |
| 271 | + { |
| 272 | + "cell_type": "code", |
| 273 | + "execution_count": null, |
| 274 | + "metadata": {}, |
| 275 | + "outputs": [], |
| 276 | + "source": [ |
| 277 | + "renderer = PointsRenderer(\n", |
| 278 | + " rasterizer=PointsRasterizer(cameras=cameras, raster_settings=raster_settings),\n", |
| 279 | + " # Pass in background_color to the norm weighted compositor, setting the background color \n", |
| 280 | + " # to the 3 item tuple, representing rgb on a scale of 0 -> 1, in this case red\n", |
| 281 | + " compositor=NormWeightedCompositor(background_color=(1,0,0))\n", |
| 282 | + ")\n", |
| 283 | + "images = renderer(point_cloud)\n", |
| 284 | + "plt.figure(figsize=(10, 10))\n", |
| 285 | + "plt.imshow(images[0, ..., :3].cpu().numpy())\n", |
| 286 | + "plt.grid(\"off\")\n", |
| 287 | + "plt.axis(\"off\");" |
| 288 | + ] |
237 | 289 | }
|
238 | 290 | ],
|
239 | 291 | "metadata": {
|
|
0 commit comments