Skip to content

Commit 905b3db

Browse files
committed
add test/test-match-template.test
1 parent 8682b42 commit 905b3db

File tree

2 files changed

+32
-2
lines changed

2 files changed

+32
-2
lines changed

launch/match_template.launch

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44
<arg name="use_camera_info" default="false" doc="Indicates that the camera_info topic should be subscribed to to get the default input_frame_id. Otherwise the frame from the image message will be used." />
55
<arg name="debug_view" default="false" doc="Specify whether the node displays a window to show edge image" />
66
<arg name="match_method" default="0" doc="Matching method. 0:CV_TM_SQDIFF 1:CV_TM_SQDIFF_NORMED 2:CV_TM_CCORR 3:CV_TM_CCORR_NORMED 4:CV_TM_CCOEFF 5:CV_TM_CCOEFF_NORMED" />
7+
<arg name="template_file" default="$(find opencv_apps)/template.png" doc="filename for template image"/>
8+
<arg name="mask_file" default="$(find opencv_apps)/mask.png" doc="filename for mask image"/>
79

810
<!-- match_template_nodelet.cpp -->
911
<node name="$(arg node_name)" pkg="opencv_apps" type="match_template" output="screen">
@@ -12,7 +14,7 @@
1214
<param name="debug_view" value="$(arg debug_view)" />
1315
<param name="match_method" value="$(arg match_method)" />
1416
<param name="use_mask" value="false" />
15-
<param name="template_file" value="$(find opencv_apps)/template.png" />
16-
<param name="mask_file" value="$(find opencv_apps)/mask.png" />
17+
<param name="template_file" value="$(arg template_file)" />
18+
<param name="mask_file" value="$(arg mask_file)" />
1719
</node>
1820
</launch>

test/test-match_template.test

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
<launch>
2+
<arg name="gui" default="true" />
3+
<node name="play_face_bag" pkg="rosbag" type="play" args="-l $(find opencv_apps)/test/face_detector_withface_test_diamondback.bag" />
4+
5+
<group ns="wide_stereo/left" >
6+
<node name="image_proc" pkg="image_proc" type="image_proc" />
7+
<node name="image_view" pkg="image_view" type="image_view" args="image:=image_rect_color" if="$(arg gui)" />
8+
9+
<!-- convex_hull.cpp -->
10+
<include file="$(find opencv_apps)/launch/match_template.launch" >
11+
<arg name="debug_view" value="$(arg gui)" />
12+
<arg name="image" value="image_rect" />
13+
<arg name="template_file" value="$(find opencv_apps)/test/template.png" />
14+
<arg name="mask_file" value="" />
15+
</include>
16+
17+
<!-- Test Codes -->
18+
<node name="match_template_saver" pkg="image_view" type="image_saver" args="image:=match_template/image" >
19+
<param name="filename_format" value="$(find opencv_apps)/test/match_template.png"/>
20+
</node>
21+
<param name="match_template_test/topic" value="match_template/matched_rectangle" /> <!-- opencv_apps/ContorArrayStamped -->
22+
<test test-name="match_template_test" pkg="rostest" type="hztest" name="match_template_test" >
23+
<param name="hz" value="20" />
24+
<param name="hzerror" value="15" />
25+
<param name="test_duration" value="5.0" />
26+
</test>
27+
</group>
28+
</launch>

0 commit comments

Comments
 (0)