mirror of
https://github.com/Jieshoudaxue/ros_senior.git
synced 2026-08-29 16:40:44 +08:00
[feat] init face_detector
This commit is contained in:
@@ -163,7 +163,7 @@ include_directories(
|
||||
## Mark executable scripts (Python etc.) for installation
|
||||
## in contrast to setup.py, you can choose the destination
|
||||
catkin_install_python(PROGRAMS
|
||||
scripts/cv_bridge_test.py
|
||||
scripts/cv_bridge_test.py scripts/face_detector.py
|
||||
DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION}
|
||||
)
|
||||
|
||||
|
||||
@@ -46,5 +46,7 @@ def main():
|
||||
|
||||
rospy.spin()
|
||||
|
||||
cv2.destroyAllWindows()
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
@@ -0,0 +1,32 @@
|
||||
#! /usr/bin/env python3
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
import rospy
|
||||
import cv2
|
||||
import numpy as np
|
||||
from functools import partial
|
||||
from cv_bridge import CvBridge, CvBridgeError
|
||||
from sensor_msgs.msg import Image, RegionOfInterest
|
||||
|
||||
|
||||
def image_cb(msg, cv_bridge, image_pub):
|
||||
pass
|
||||
|
||||
def main():
|
||||
rospy.init_node("face_detector")
|
||||
rospy.loginfo("starting face_detector node")
|
||||
|
||||
bridge = CvBridge()
|
||||
image_pub = rospy.Publisher("/cv_bridge_image", Image, queue_size=1)
|
||||
|
||||
bind_image_cb = partial(image_cb, cv_bridge=bridge, image_pub=image_pub)
|
||||
|
||||
rospy.Subscriber("/usb_cam/image_raw", Image, bind_image_cb)
|
||||
|
||||
|
||||
rospy.spin()
|
||||
|
||||
cv2.destroyAllWindows()
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
Reference in New Issue
Block a user