draw_color_body_frame_with_hands   xtlang


Defined in:  https://github.com/digego/extempore/tree/v0.8.9/examples/contrib/orbbec_test.xtm

Implementation

(bind-func draw_color_body_frame_with_hands
  (let ((num:i64 1))
    (lambda (frame:astra_colorizedbodyframe_t hands:astra_handpoint_X* numhands:i32 mlres:i8* vid:ocv_VideoWriter* record:i1)
      (letz ((bytes:i32 0) (i:i32 0) (hand:astra_handpoint_X* null)
             (dat:i8* (salloc))
             (sizesqr:i32 128))
        ;; (astra_colorframe_get_data_ptr frame (ref dat) (ref bytes))
        (astra_colorizedbodyframe_get_data_ptr frame (convert (ref dat)) (ref bytes))
        ;; (println "size:" bytes)
        (if (= bytes (* 640 480 4))
            (let ((img (ocv_cvtColor (ocv_Mat 480 640 (CV_MAKE_TYPE CV_8U 4) dat) ocv_COLOR_RGBA2BGR))
                  (grey (ocv_cvtColor (ocv_Mat 480 640 (CV_MAKE_TYPE CV_8U 4) dat) ocv_COLOR_RGBA2GRAY))
                  (rect (ocv_Rect_val 0 0 0 0))
                  (point (ocv_Point_val 0 0))
                  (foundHand #f)
                  (scalar (ocv_Scalar_val 0.0 255.0 0.0 0.0)))
              (tfill! (ref rect)
                      (clamp (- 320 (/ sizesqr 2)) 0 (- 640 sizesqr))
                      (clamp (- 240 (/ sizesqr 2)) 0 (- 480 sizesqr))
                      sizesqr sizesqr)
              (tfill! (ref point) 20 60)
              (dotimes (i numhands)
                (set! hand (pref-ptr hands i))
                (if (and (> (tref hand 0) 0) (= (tref hand 1) 2))
                    (begin
                      (set! num (+ num 1))
                      (tfill! (ref rect)
                              (clamp (- (tref (tref hand 2) 0) (/ sizesqr 2)) 0 (- 640 sizesqr))
                              (clamp (- (tref (tref hand 2) 1) (- (/ sizesqr 2) 5)) 0 (- 480 sizesqr))
                              sizesqr sizesqr)
                      (set! foundHand #t)
                      (if record
                          (ocv_imwrite (cat 'data/image_' (toString num) '.png') (ocv_region grey (convert (ref rect)))))
                      (ocv_rectangle img (convert (ref rect)) (convert (ref scalar)) 2))))
              ; (set! num (+ num 1))
              ; (tfill! (ref rect) 250 200 sizesqr sizesqr)
              ;; (ocv_imwrite (cat 'data/null/image_' (toString num) '.png') (ocv_region grey (convert (ref rect))))
              ;; (ocv_rectangle img (convert (ref rect)) (convert (ref scalar)) 2)
              ;; (println "write out image")
              (ocv_imwrite 'data/image.png' (ocv_region grey (convert (ref rect))))
              (if foundHand
                  (ocv_puttext img mlres (convert (ref point)) 0 2.0 (convert (ref scalar)) 2)
                  (ocv_puttext img "None" (convert (ref point)) 0 2.0 (convert (ref scalar)) 2))
              ;; (println "draw image to screen")
              (ocv_write vid img)
              (ocv_imshow 'Body' img)))
        void))))


Back to Index

Similar Entries

  • CefColorGetA    xtlang
  • CefColorGetB    xtlang
  • CefColorGetG    xtlang
  • CefColorGetR    xtlang
  • CefColorSetARGB    xtlang
  • FBO_color_texture    xtlang
  • FBO_create_with_textures    xtlang
  • NVGcolor_hex    xtlang
  • VAO_bind_and_draw_arrays    xtlang
  • Widget_with_cb    xtlang
  • ai_color4_to_float4    xtlang
  • astra_start_body    xtlang
  • bindfunc_with_docstring    xtlang
  • bindfunc_with_zone_size    xtlang
  • bindfunc_with_zone_size_and_docstring    xtlang
  • cairo_draw_image    xtlang
  • call-with-input-file    scheme
  • call-with-output-file    scheme
  • curl_request_with_auth    xtlang
  • curl_request_with_header    xtlang
  • define-with-return    macro
  • draw    xtlang
  • draw    xtlang
  • draw-skeleton    xtlang
  • draw_a_circle    xtlang
  • draw_a_circle    xtlang
  • draw_a_line    xtlang
  • draw_a_line    xtlang
  • draw_barplot    xtlang
  • draw_color_body_frame    xtlang
  • draw_frame    xtlang
  • draw_frame    xtlang
  • draw_frame    xtlang
  • draw_quad    xtlang
  • draw_rgb_frame    xtlang
  • draw_scatterplot    xtlang
  • draw_scene    xtlang
  • draw_seg    xtlang
  • draw_spectral_bar    xtlang
  • draw_spectrum_key    xtlang
  • dv_draw_axes_2D    xtlang
  • dv_draw_axis_labels_2D    xtlang
  • dv_draw_bars    xtlang
  • dv_draw_line    xtlang
  • dv_draw_line_segments    xtlang
  • dv_draw_scatter_points    xtlang
  • dv_draw_scatter_points    xtlang
  • dv_draw_title    xtlang
  • fill_buffer_with_file    xtlang
  • get_focused_frame    xtlang
  • get_frame    xtlang
  • get_frame_byident    xtlang
  • get_frame_count    xtlang
  • get_frame_identifiers    xtlang
  • get_frame_names    xtlang
  • get_main_frame    xtlang
  • ghttp_copy_request_body_into_buffer    xtlang
  • ghttp_perform_request_with_setup_fn    xtlang
  • ghttp_print_request_body    xtlang
  • ghttp_request_body_as_json    xtlang
  • gl-draw    xtlang
  • gl_draw    xtlang
  • gl_draw    xtlang
  • gl_draw    xtlang
  • gl_draw    xtlang
  • gl_draw    xtlang
  • gl_draw    xtlang
  • gl_draw    xtlang
  • gl_draw    xtlang
  • gl_draw    xtlang
  • gl_draw    xtlang
  • gl_draw    xtlang
  • gl_draw_arrows    xtlang
  • gl_draw_loop    xtlang
  • gl_draw_loop    xtlang
  • gl_draw_loop    xtlang
  • gl_draw_loop    xtlang
  • gl_draw_loop    xtlang
  • gl_draw_loop    xtlang
  • gl_draw_loop    xtlang
  • gl_draw_loop    xtlang
  • gl_draw_loop    xtlang
  • gl_draw_loop    xtlang
  • gl_draw_loop    xtlang
  • gl_draw_loop    xtlang
  • gl_draw_loop    xtlang
  • gl_draw_loop    xtlang
  • gl_draw_particles    xtlang
  • gl_print_error_with_msg    xtlang
  • glfw_get_framebuffer_height    xtlang
  • glfw_get_framebuffer_width    xtlang
  • godot_color_get_r    xtlang
  • godot_color_new_rgb    xtlang
  • godot_color_set_r    xtlang
  • godot_variant_new_color    xtlang
  • gui_draw_circle    xtlang
  • gui_draw_rect    xtlang
  • gui_draw_text_in_bounds    xtlang
  • gui_find_widget_with_id    xtlang
  • gui_set_monokai_color_theme    xtlang
  • impc:compiler:print-bad-type-error-with-ast    scheme
  • impc:ir:compiler:heap-alloc-with-size    scheme
  • impc:ir:compiler:heap-alloc-without-size    scheme
  • impc:ir:compiler:stack-alloc-with-size    scheme
  • impc:ir:compiler:stack-alloc-without-size    scheme
  • impc:ir:compiler:zone-alloc-with-size    scheme
  • impc:ir:compiler:zone-alloc-without-size    scheme
  • impc:ti:get-closure-body    scheme
  • impc:ti:initialize-closure-with-new-zone    scheme
  • impc:ti:set-closure-body    scheme
  • init_draw_quad    xtlang
  • ipc:proc-name-with-mapping    scheme
  • kinect_print_body    xtlang
  • kinect_update_body    xtlang
  • make-list-with-proc    scheme
  • make-vector-with-proc    scheme
  • nvg_draw_loop    xtlang
  • nvg_draw_loop    xtlang
  • nvg_draw_loop    xtlang
  • nvg_draw_loop    xtlang
  • nvg_draw_text    xtlang
  • ocv_cvtColor    xtlang
  • pm_device_with_id    xtlang
  • pm_input_device_with_name    xtlang
  • pm_output_device_with_name    xtlang
  • print-with-colors    macro
  • psystem_draw    xtlang
  • psystem_draw    xtlang
  • qr_create_with_level    xtlang
  • read_and_write_frame    xtlang
  • return_ptr_gv_first_with_docstring    xtlang
  • return_ptr_gv_second_with_docstring    xtlang
  • set_cairo_source_with_colour    xtlang
  • sf_frames    xtlang
  • sf_frames_from_file    xtlang
  • sf_set_frames    xtlang
  • shader_prepare_draw    xtlang
  • shader_prepare_draw    xtlang
  • shader_prepare_draw    xtlang
  • shader_prepare_draw    xtlang
  • shader_prepare_draw    xtlang
  • store_frame_OLA    xtlang
  • store_frame_PV    xtlang
  • store_frame_iPL    xtlang
  • store_frame_sPL    xtlang
  • sys:with-noisy-compiler    macro
  • sys:with-quiet-compiler    macro
  • thread_native_call_with_zone    xtlang
  • unzip1-with-cdr    scheme
  • unzip1-with-cdr-iterative    scheme
  • vcframe    scheme
  • with-input-from-file    scheme
  • with-input-output-from-to-files    scheme
  • with-output-to-file    scheme
  • xtm_color32_alpha    xtlang
  • xtm_color32_blue    xtlang
  • xtm_color32_green    xtlang
  • xtm_color32_red    xtlang
  • xtm_draw_arc    xtlang
  • xtm_draw_arc_fill    xtlang
  • xtm_draw_arc_fill    xtlang
  • xtm_draw_arc_fill    xtlang
  • xtm_draw_arc_fill    xtlang
  • xtm_draw_arc_fill    xtlang
  • xtm_draw_arc_fill    xtlang
  • xtm_draw_arc_fill    xtlang
  • xtm_draw_arc_fill    xtlang
  • xtm_draw_arc_stroke    xtlang
  • xtm_draw_arc_stroke    xtlang
  • xtm_draw_arc_stroke    xtlang
  • xtm_draw_arc_stroke    xtlang
  • xtm_draw_arc_stroke    xtlang
  • xtm_draw_arc_stroke    xtlang
  • xtm_draw_arc_stroke    xtlang
  • xtm_draw_arc_stroke    xtlang
  • xtm_draw_arcd    xtlang
  • xtm_draw_bezier_fill    xtlang
  • xtm_draw_bezier_fill    xtlang
  • xtm_draw_bezier_fill    xtlang
  • xtm_draw_bezier_fill    xtlang
  • xtm_draw_bezier_stroke    xtlang
  • xtm_draw_bezier_stroke    xtlang
  • xtm_draw_bezier_stroke    xtlang
  • xtm_draw_bezier_stroke    xtlang
  • xtm_draw_circle_fill    xtlang
  • xtm_draw_circle_fill    xtlang
  • xtm_draw_circle_fill    xtlang
  • xtm_draw_circle_fill    xtlang
  • xtm_draw_circle_stroke    xtlang
  • xtm_draw_circle_stroke    xtlang
  • xtm_draw_circle_stroke    xtlang
  • xtm_draw_circle_stroke    xtlang
  • xtm_draw_ellipse    xtlang
  • xtm_draw_ellipse_fill    xtlang
  • xtm_draw_ellipse_fill    xtlang
  • xtm_draw_ellipse_fill    xtlang
  • xtm_draw_ellipse_fill    xtlang
  • xtm_draw_ellipse_stroke    xtlang
  • xtm_draw_ellipse_stroke    xtlang
  • xtm_draw_ellipse_stroke    xtlang
  • xtm_draw_ellipse_stroke    xtlang
  • xtm_draw_ellipsed    xtlang
  • xtm_draw_line    xtlang
  • xtm_draw_line    xtlang
  • xtm_draw_line    xtlang
  • xtm_draw_line    xtlang
  • xtm_draw_line    xtlang
  • xtm_draw_lined    xtlang
  • xtm_draw_mesh    xtlang
  • xtm_draw_mesh    xtlang
  • xtm_draw_model    xtlang
  • xtm_draw_model    xtlang
  • xtm_draw_path    xtlang
  • xtm_draw_path_keep    xtlang
  • xtm_draw_poly    xtlang
  • xtm_draw_polyd    xtlang
  • xtm_draw_quad    xtlang
  • xtm_draw_quad_fill    xtlang
  • xtm_draw_quad_fill    xtlang
  • xtm_draw_quad_fill    xtlang
  • xtm_draw_quad_fill    xtlang
  • xtm_draw_quad_stroke    xtlang
  • xtm_draw_quad_stroke    xtlang
  • xtm_draw_quad_stroke    xtlang
  • xtm_draw_quad_stroke    xtlang
  • xtm_draw_quadd    xtlang
  • xtm_draw_rect    xtlang
  • xtm_draw_rect_fill    xtlang
  • xtm_draw_rect_fill    xtlang
  • xtm_draw_rect_fill    xtlang
  • xtm_draw_rect_fill    xtlang
  • xtm_draw_rect_stroke    xtlang
  • xtm_draw_rect_stroke    xtlang
  • xtm_draw_rect_stroke    xtlang
  • xtm_draw_rect_stroke    xtlang
  • xtm_draw_rectd    xtlang
  • xtm_draw_round_rect    xtlang
  • xtm_draw_round_rectd    xtlang
  • xtm_draw_rounded_rect_fill    xtlang
  • xtm_draw_rounded_rect_fill    xtlang
  • xtm_draw_rounded_rect_fill    xtlang
  • xtm_draw_rounded_rect_fill    xtlang
  • xtm_draw_rounded_rect_stroke    xtlang
  • xtm_draw_rounded_rect_stroke    xtlang
  • xtm_draw_rounded_rect_stroke    xtlang
  • xtm_draw_rounded_rect_stroke    xtlang
  • xtm_draw_rounded_rect_varying_fill    xtlang
  • xtm_draw_rounded_rect_varying_fill    xtlang
  • xtm_draw_rounded_rect_varying_fill    xtlang
  • xtm_draw_rounded_rect_varying_fill    xtlang
  • xtm_draw_rounded_rect_varying_stroke    xtlang
  • xtm_draw_rounded_rect_varying_stroke    xtlang
  • xtm_draw_rounded_rect_varying_stroke    xtlang
  • xtm_draw_rounded_rect_varying_stroke    xtlang
  • xtm_draw_tex    xtlang
  • xtm_draw_tex    xtlang
  • xtm_draw_tex    xtlang
  • xtm_draw_tex    xtlang
  • xtm_draw_tex    xtlang
  • xtm_draw_tex    xtlang
  • xtm_draw_tex    xtlang
  • xtm_draw_tri    xtlang
  • xtm_draw_tri_fill    xtlang
  • xtm_draw_tri_fill    xtlang
  • xtm_draw_tri_fill    xtlang
  • xtm_draw_tri_fill    xtlang
  • xtm_draw_tri_stroke    xtlang
  • xtm_draw_tri_stroke    xtlang
  • xtm_draw_tri_stroke    xtlang
  • xtm_draw_tri_stroke    xtlang
  • xtm_draw_trid    xtlang
  • xtm_draw_vao    xtlang
  • xtm_draw_vao    xtlang
  • xtm_draw_vgimage    xtlang
  • xtm_frame_data_to_tex    xtlang
  • xtm_paint_set_color    xtlang
  • xtm_scale_and_draw_vgimage    xtlang
  • xtm_scale_and_draw_vgimaged    xtlang
  • xtm_set_color32    xtlang
  • xtm_set_color32_alpha    xtlang
  • xtm_set_color32_blue    xtlang
  • xtm_set_color32_green    xtlang
  • xtm_set_color32_red    xtlang
  • xtmtest-result-body    scheme
  • xtmtest-result-body    scheme
  • xtmtest-with-fixture    macro
  • xtmtest-with-fixture-body    scheme
  • xtmtest-with-fixture-body    scheme