|
15 | 15 | "id": "pinholepose-intro" |
16 | 16 | }, |
17 | 17 | "source": [ |
18 | | - "A `PinholePose` couples a camera `Pose3` with a fixed calibration model. It is useful when the calibration is known ahead of time and fixed during optimization. This is different from `PinholeCamera`, which also optimizes the calibration itself. For simplicity, this guide demonstrates the `Cal3_S2` variant of `PinholePose` (`PinholePoseCal3_S2` in Python), though many other calibration models are supported:\n", |
| 18 | + "A `PinholePose` couples a camera `Pose3` with a fixed calibration model. It is useful when the calibration is known ahead of time and fixed during optimization. This is different from `PinholeCamera`, which also optimizes the calibration itself. `PinholePose` is compatible with several calibration models:\n", |
19 | 19 | "\n", |
20 | 20 | "- `Cal3_S2`\n", |
21 | 21 | "- `Cal3Bundler`\n", |
|
30 | 30 | "id": "pinholepose-understanding" |
31 | 31 | }, |
32 | 32 | "source": [ |
33 | | - "## Understanding the Pinhole Pose\n", |
34 | | - "A *pinhole pose* packages the camera's pose in the world with a **fixed** calibration. ", |
35 | | - "Conceptually it acts like a `PinholeCamera` with constant intrinsics. ", |
36 | | - "When the intrinsics are known from a prior calibration step, optimizing only the pose can simplify many problems. ", |
| 33 | + "A `PinholePose` packages the camera's pose in the world with a **fixed** calibration. Conceptually it acts like a `PinholeCamera` with constant intrinsics. \n", |
| 34 | + "When the intrinsics are known from a prior calibration step, optimizing only the pose can simplify many problems. \n", |
37 | 35 | "Throughout this notebook we will refer to `PinholePoseCal3_S2`, which pairs a `Pose3` with a `Cal3_S2` instance." |
38 | 36 | ] |
39 | 37 | }, |
|
48 | 46 | }, |
49 | 47 | { |
50 | 48 | "cell_type": "code", |
51 | | - "execution_count": 2, |
| 49 | + "execution_count": 1, |
52 | 50 | "metadata": { |
53 | 51 | "id": "pinholepose-pip-install" |
54 | 52 | }, |
|
67 | 65 | }, |
68 | 66 | { |
69 | 67 | "cell_type": "code", |
70 | | - "execution_count": 3, |
| 68 | + "execution_count": 2, |
71 | 69 | "metadata": { |
72 | 70 | "id": "pinholepose-imports" |
73 | 71 | }, |
|
96 | 94 | }, |
97 | 95 | { |
98 | 96 | "cell_type": "code", |
99 | | - "execution_count": 4, |
| 97 | + "execution_count": 3, |
100 | 98 | "metadata": { |
101 | 99 | "id": "pinholepose-init-code" |
102 | 100 | }, |
|
137 | 135 | }, |
138 | 136 | { |
139 | 137 | "cell_type": "code", |
140 | | - "execution_count": 5, |
| 138 | + "execution_count": 4, |
141 | 139 | "metadata": {}, |
142 | 140 | "outputs": [ |
143 | 141 | { |
|
180 | 178 | }, |
181 | 179 | { |
182 | 180 | "cell_type": "code", |
183 | | - "execution_count": 15, |
| 181 | + "execution_count": 5, |
184 | 182 | "metadata": {}, |
185 | 183 | "outputs": [ |
186 | 184 | { |
|
189 | 187 | "dtype('float64')" |
190 | 188 | ] |
191 | 189 | }, |
192 | | - "execution_count": 15, |
| 190 | + "execution_count": 5, |
193 | 191 | "metadata": {}, |
194 | 192 | "output_type": "execute_result" |
195 | 193 | } |
|
200 | 198 | }, |
201 | 199 | { |
202 | 200 | "cell_type": "code", |
203 | | - "execution_count": 21, |
| 201 | + "execution_count": 6, |
204 | 202 | "metadata": { |
205 | 203 | "id": "pinholepose-named-code" |
206 | 204 | }, |
|
252 | 250 | }, |
253 | 251 | { |
254 | 252 | "cell_type": "code", |
255 | | - "execution_count": 22, |
| 253 | + "execution_count": 7, |
256 | 254 | "metadata": { |
257 | 255 | "id": "pinholepose-prop-code" |
258 | 256 | }, |
|
301 | 299 | }, |
302 | 300 | { |
303 | 301 | "cell_type": "code", |
304 | | - "execution_count": 23, |
| 302 | + "execution_count": 8, |
305 | 303 | "metadata": { |
306 | 304 | "id": "pinholepose-project" |
307 | 305 | }, |
|
330 | 328 | }, |
331 | 329 | { |
332 | 330 | "cell_type": "code", |
333 | | - "execution_count": 24, |
| 331 | + "execution_count": 9, |
334 | 332 | "metadata": { |
335 | 333 | "id": "pinholepose-backproject" |
336 | 334 | }, |
|
359 | 357 | }, |
360 | 358 | { |
361 | 359 | "cell_type": "code", |
362 | | - "execution_count": 25, |
| 360 | + "execution_count": 10, |
363 | 361 | "metadata": { |
364 | 362 | "id": "pinholepose-range" |
365 | 363 | }, |
|
395 | 393 | }, |
396 | 394 | { |
397 | 395 | "cell_type": "code", |
398 | | - "execution_count": 26, |
| 396 | + "execution_count": 11, |
399 | 397 | "metadata": { |
400 | 398 | "id": "pinholepose-manifold-code" |
401 | 399 | }, |
|
422 | 420 | "source": [ |
423 | 421 | "## Example: Using PinholePose in a Factor Graph\n", |
424 | 422 | "\n", |
425 | | - "When camera intrinsics are known, `PinholePose` can serve as the variable representing a camera pose. ", |
| 423 | + "When camera intrinsics are known, `PinholePose` can serve as the variable representing a camera pose. \n", |
426 | 424 | "The snippet below builds a minimal factor graph with one `GenericProjectionFactorCal3_S2`." |
427 | 425 | ] |
428 | 426 | }, |
429 | 427 | { |
430 | 428 | "cell_type": "code", |
431 | | - "execution_count": null, |
| 429 | + "execution_count": 12, |
432 | 430 | "metadata": { |
433 | 431 | "id": "pinholepose-factor-code" |
434 | 432 | }, |
435 | | - "outputs": [], |
| 433 | + "outputs": [ |
| 434 | + { |
| 435 | + "name": "stdout", |
| 436 | + "output_type": "stream", |
| 437 | + "text": [ |
| 438 | + "Graph has 1 factor(s) and 2 variable(s)\n" |
| 439 | + ] |
| 440 | + } |
| 441 | + ], |
436 | 442 | "source": [ |
437 | 443 | "graph = gtsam.NonlinearFactorGraph()\n", |
438 | 444 | "initial = gtsam.Values()\n", |
|
451 | 457 | "print(f'Graph has {graph.size()} factor(s) and {initial.size()} variable(s)')" |
452 | 458 | ] |
453 | 459 | }, |
454 | | - { |
455 | | - "cell_type": "markdown", |
456 | | - "metadata": { |
457 | | - "id": "pinholepose-additional-resources" |
458 | | - }, |
459 | | - "source": [ |
460 | | - "## Additional Resources\n", |
461 | | - "\n", |
462 | | - "- [Pinhole camera model (Wikipedia)](https://en.wikipedia.org/wiki/Pinhole_camera_model)\n", |
463 | | - "- [GTSAM Visual SLAM examples](https://github.com/borglab/gtsam/tree/develop/python/gtsam/examples)\n" |
464 | | - ] |
465 | | - }, |
466 | 460 | { |
467 | 461 | "cell_type": "markdown", |
468 | 462 | "metadata": { |
|
0 commit comments