realsense+dlib目标检测

本文档介绍了在win7+ubuntu18.04双系统环境下,利用ROS Melodic、librealsense、opencv和dlib进行目标检测的步骤。首先,详细讲解了ROS Melodic的安装,接着阐述了librealsense、opencv和dlib的安装过程。然后,指导如何使用imglab创建数据集,并用dlib训练及测试模型。最后,提供了现有模型的资源链接。
摘要由CSDN通过智能技术生成

realsense+dlib目标检测

1.环境

2.训练自己的模型

  1. imglab制作数据集:https://github.com/davisking/dlib/tree/master/tools/imglab
  2. 训练及测试:https://github.com/davisking/dlib/blob/master/python_examples/train_object_detector.py
  3. 现有模型:https://github.com/davisking/dlib-models

3.代码

#!/usr/bin/python
import pyrealsense2 as rs
import numpy as np
import cv2
import time
import darknet as dn
import dlib
import rospy
from cv_bridge import CvBridge
import sensor_msgs
from object_msgs.msg import ObjectsInBoxes,ObjectInBox
import geometry_msgs
 
# Declare pointcloud object, for calculating pointclouds and texture mappings
pc = rs.pointcloud()
# We want the points object to be persistent so we can display the last cloud when a frame drops
points = rs.points()

 
pipeline = rs.pipeline()
config = rs.config()
config.enable_stream(rs.stream.depth, 640, 480, rs.format.z16, 15)
config.enable_stream(rs.stream.color, 640, 480, rs.format.bgr8, 15)
 
# Start streaming
pipe_profile = pipeline.start(config)
 
# Create an align object
# rs.align allows us to perform alignment of depth frames to others frames
# The "align_to" is the stream type to which we plan to align depth frames.
align_to = rs.stream.color
align = rs
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值