Skip to content

Commit c6c5941

Browse files
committed
add sample for getting image and pointcloud from camera sensor
1 parent ad3dc8e commit c6c5941

File tree

1 file changed

+36
-0
lines changed

1 file changed

+36
-0
lines changed

irteus/demo/sample-camera-model.l

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
;; create camera and camera viewer
2+
(setq *camera-model*
3+
(make-camera-from-param :pwidth 640 :pheight 360
4+
:fx 400 :fy 400
5+
:cx 319.5 :cy 179.5 :name "camtest"
6+
:create-viewer t))
7+
;; move camera
8+
(send *camera-model* :translate #f(0 100 0) :world)
9+
(send *camera-model* :rotate 0.25 :x :world)
10+
11+
;; make objects
12+
(setq *obj1* (make-cube 100 100 100))
13+
(send *obj1* :translate #f(-50 0 235))
14+
(send *obj1* :set-color #f(0 0 1))
15+
(setq *obj2* (make-cube 100 100 100))
16+
(send *obj2* :translate #f(50 0 265))
17+
(send *obj2* :set-color #f(1 0 0))
18+
(setq *obj3* (make-cube 100 100 100))
19+
(send *obj3* :translate #f(0 100 250))
20+
(send *obj3* :set-color #f(0 1 0))
21+
(objects (list *obj1* *obj2* *obj3* *camera-model*))
22+
23+
24+
;; draw objects on camera viewer
25+
(send *camera-model* :draw-objects (list *obj1* *obj2* *obj3*))
26+
27+
;; get image and point cloud
28+
(let ((ret (send *camera-model* :get-image :with-points t :with-colors t)))
29+
(setq *image* (car ret))
30+
(setq *points* (cdr ret))
31+
)
32+
33+
;; transform origin of point cloud
34+
(send *points* :transform (send *camera-model* :worldcoords))
35+
36+
(objects (list *points* *camera-model*))

0 commit comments

Comments
 (0)