Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

色抽出の仕方 #494

Open
ayamiya opened this issue Dec 15, 2016 · 0 comments
Open

色抽出の仕方 #494

ayamiya opened this issue Dec 15, 2016 · 0 comments

Comments

@ayamiya
Copy link

ayamiya commented Dec 15, 2016

1)カメラをたちあげる。
camera.launch

<launch>
  <arg name="device" default="/dev/video1" />
  <node pkg="uvc_camera" type="uvc_camera_node" name="camera_driver" >
    <param name="device" value="$(arg device)" />
  </node>
  <node pkg="image_proc" type="image_proc" name="image_proc">
    <remap from="image" to="image_raw" />
  </node>
  <node pkg="image_view" type="image_view" name="image_view" >
    <remap from="image" to="image_rect_color" />
  </node>
</launch>

roslaunch camera.launch 

として立ち上げる。

roslaunch camera.launch  device:=/dev/video0

とすると、ノートPCの組み込みのカメラをつかう。

  1. 画像処理ノードの立ち上げ
roslaunch opencv_apps camshift.launch image:=image_raw

画面をドラッグして対象を選択。対象のヒストグラムはrosparam get /camshift/histogram
結果は、rostopic echo /camshift/track_box で調べる。

  1. 結果をeuslispでよむ
(ros::load-ros-manifest "opencv_apps")
(ros::roseus "camshift_client")

(defun camshift-cb (msg)
  (let ()
    (format t "x:~A, y:~A, area:~A~%"
	    (send msg :rect :center :x)  (send msg :rect :center :y)
	    (* (send msg :rect :size :width) (send msg :rect :size :height)))
    ))
(ros::subscribe "/camshift/track_box" opencv_apps::RotatedRectStamped
		#'camshift-cb)

(ros::spin)
rostopic info /camshift/track_box

で、このトピック opencv_apps::RotatedRectStamped の名前がわかる。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant