Skip to content

Commit

Permalink
face_detection: fix for opencv4 (jammy/noble)
Browse files Browse the repository at this point in the history
  • Loading branch information
k-okada committed Feb 14, 2025
1 parent 867244c commit b6f31aa
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
10 changes: 8 additions & 2 deletions launch/face_detection.launch
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,15 @@
<arg if="$(arg use_opencv4)"
name="eyes_cascade_name" default="/usr/share/opencv4/haarcascades/haarcascade_eye_tree_eyeglasses.xml" doc="Eye dtection cascade Filename" />

<arg unless="$(arg use_opencv3)"
<!-- if all use_opencv3 is true, but all other variable is false, then use /usr/share/opencv -->
<arg if="$(eval use_opencv3 and not use_opencv3_1 and not use_opencv3_2 and not use_opencv3_3 and not use_opencv4)"
name="face_cascade_name" default="/usr/share/opencv/haarcascades/haarcascade_frontalface_alt.xml" doc="Face dtection cascade Filename" />
<arg unless="$(arg use_opencv3)"
<arg if="$(eval use_opencv3 and not use_opencv3_1 and not use_opencv3_2 and not use_opencv3_3 and not use_opencv4)"
name="eyes_cascade_name" default="/usr/share/opencv/haarcascades/haarcascade_eye_tree_eyeglasses.xml" doc="Eye dtection cascade Filename" />
<!-- if all use_opencv* variable is false, then use /usr/share/opencv -->
<arg unless="$(eval use_opencv3 or use_opencv3_1 or use_opencv3_2 or use_opencv3_3 or use_opencv4)"
name="face_cascade_name" default="/usr/share/opencv/haarcascades/haarcascade_frontalface_alt.xml" doc="Face dtection cascade Filename" />
<arg unless="$(eval use_opencv3 or use_opencv3_1 or use_opencv3_2 or use_opencv3_3 or use_opencv4)"
name="eyes_cascade_name" default="/usr/share/opencv/haarcascades/haarcascade_eye_tree_eyeglasses.xml" doc="Eye dtection cascade Filename" />

<!-- face_detection.cpp -->
Expand Down
5 changes: 4 additions & 1 deletion test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -80,9 +80,12 @@ elseif(OpenCV_VERSION VERSION_LESS "3.2")
elseif(OpenCV_VERSION VERSION_LESS "3.3")
add_rostest(test-face_detection.test ARGS gui:=false use_opencv3:=true use_opencv3_2:=true)
add_rostest(test-face_recognition.test ARGS gui:=false use_opencv3:=true use_opencv3_2:=true)
else()
elseif(OpenCV_VERSION VERSION_LESS "3.4")
add_rostest(test-face_detection.test ARGS gui:=false use_opencv3:=true use_opencv3_3:=true)
add_rostest(test-face_recognition.test ARGS gui:=false use_opencv3:=true use_opencv3_3:=true)
else()
add_rostest(test-face_detection.test ARGS gui:=false use_opencv4:=true)
add_rostest(test-face_recognition.test ARGS gui:=false use_opencv4:=true)
endif()
add_rostest(test-goodfeature_track.test ARGS gui:=false)
add_rostest(test-corner_harris.test ARGS gui:=false)
Expand Down

0 comments on commit b6f31aa

Please sign in to comment.