YOLOv7+双目测距(python)

这篇具有很好参考价值的文章主要介绍了YOLOv7+双目测距(python)。希望对大家有所帮助。如果存在错误或未考虑完全的地方,请大家不吝赐教,您也可以点击"举报违法"按钮提交疑问。

1. YOLOv5+双目测距
2. zed+yolov5实现双目测距(直接调用,免标定)
3. zed+yolov4实现双目测距(直接调用,免标定)
4. 本文具体实现效果已在Bilibili发布,点击跳转
5. 如有需要,可以参考我上边的几篇文章进行对比👆👆👆

yolov7直接调用zed相机的代码也已经实现,可以运行10秒左右,会报cuda空间不足的错误,博主gpu为6G,可能是内存太小了。

1. 实验效果

经过一系列实验,结果表明yolov7结合双目实现测距效果不如yolov5,具体参数如下:
yolov5— 每帧速度:100-200ms
yolov7(不加多线程)— inference速度:400ms左右 NMS速度:1200-1500ms
yolov7(加多线程)— inference速度:400ms左右 NMS速度:200ms左右

inference:推理速度,指预处理之后的图像输入模型到模型输出结果的时间
NMS :你可以理解为后处理时间,对模型输出结果经行转换等

2. 相关配置:

电脑系统:win10 (linux及Ubuntu同样适配)
Python版本:3.6
相机型号:zed2i (普通双目也可用)
所用分辨率:2560x720 (这个可以自己调节)

3. 测距原理

测距原理详见:双目三维测距(python)

4. 实验流程

yolov7实验步骤和yolov5一样,大致流程: 双目标定→双目校正→立体匹配→结合yolov7→深度测距
找到目标识别源代码中输出物体坐标框的代码段
找到双目测距代码中计算物体深度的代码段
将步骤2与步骤1结合,计算得到目标框中物体的深度
找到目标识别网络中显示障碍物种类的代码段,将深度值添加到里面,进行显示

5.相关代码

5.1 双目相机参数stereoconfig.py

双目相机标定误差越小越好,我这里误差为0.1,尽量使误差在0.2以下

import numpy as np
# 双目相机参数
class stereoCamera(object):
    def __init__(self):

        self.cam_matrix_left = np.array([[1101.89299, 0, 1119.89634],
                                         [0, 1100.75252, 636.75282],
                                         [0, 0, 1]])
        self.cam_matrix_right = np.array([[1091.11026, 0, 1117.16592],
                                          [0, 1090.53772, 633.28256],
                                          [0, 0, 1]])

        self.distortion_l = np.array([[-0.08369, 0.05367, -0.00138, -0.0009, 0]])
        self.distortion_r = np.array([[-0.09585, 0.07391, -0.00065, -0.00083, 0]])

        self.R = np.array([[1.0000, -0.000603116945856524, 0.00377055351856816],
                           [0.000608108737333211, 1.0000, -0.00132288199083992],
                           [-0.00376975166958581, 0.00132516525298933, 1.0000]])

        self.T = np.array([[-119.99423], [-0.22807], [0.18540]])
        self.baseline = 119.99423  

5.2 图像处理

以下是stereo.py里对图像进行处理的代码
这些都是网上现成的,直接套用就可以

class stereo_dd:
    def __init__(self,imgl,imgr):
        self.left  = imgl
        self.right = imgr
    
    # 预处理
    def preprocess(self, img1, img2):
        # 彩色图->灰度图
        if(img1.ndim == 3):#判断为三维数组
            img1 = cv2.cvtColor(img1, cv2.COLOR_BGR2GRAY)  # 通过OpenCV加载的图像通道顺序是BGR
        if(img2.ndim == 3):
            img2 = cv2.cvtColor(img2, cv2.COLOR_BGR2GRAY)

        # 直方图均衡
        img1 = cv2.equalizeHist(img1)
        img2 = cv2.equalizeHist(img2)
        return img1, img2

    '''
    # 消除畸变
    def undistortion(self, image, camera_matrix, dist_coeff):
        undistortion_image = cv2.undistort(image, camera_matrix, dist_coeff)
        return undistortion_image
    '''
    # 消除畸变
    def undistortion(self, imagleft,imagright, camera_matrix_left, camera_matrix_right, dist_coeff_left,dist_coeff_right):
        undistortion_imagleft  = cv2.undistort(imagleft,  camera_matrix_left,  dist_coeff_left )
        undistortion_imagright = cv2.undistort(imagright, camera_matrix_right, dist_coeff_right)
        return undistortion_imagleft, undistortion_imagright

    # 畸变校正和立体校正
    def rectifyImage(self, image1, image2, map1x, map1y, map2x, map2y):
        rectifyed_img1 = cv2.remap(image1, map1x, map1y, cv2.INTER_AREA)
        rectifyed_img2 = cv2.remap(image2, map2x, map2y, cv2.INTER_AREA)
        return rectifyed_img1, rectifyed_img2
        
    # 立体校正检验----画线
    def draw_line(self, image1, image2):
        # 建立输出图像
        height = max(image1.shape[0], image2.shape[0])
        width = image1.shape[1] + image2.shape[1]

        output = np.zeros((height, width, 3), dtype=np.uint8)
        output[0:image1.shape[0], 0:image1.shape[1]] = image1
        output[0:image2.shape[0], image1.shape[1]:] = image2

        # 绘制等间距平行线
        line_interval = 50  # 直线间隔:50
        for k in range(height // line_interval):
            cv2.line(output, (0, line_interval * (k + 1)), (2 * width, line_interval * (k + 1)), (0, 255, 0), thickness=2, lineType=cv2.LINE_AA)

        return output

    # 视差计算
    def stereoMatchSGBM(self, left_image, right_image, down_scale=False):
        # SGBM匹配参数设置
        if left_image.ndim == 2:
            img_channels = 1
        else:
            img_channels = 3
        blockSize = 3
        paraml = {'minDisparity': 0,
                 'numDisparities': 128,
                 'blockSize': blockSize,
                 'P1': 8 * img_channels * blockSize ** 2,
                 'P2': 32 * img_channels * blockSize ** 2,
                 'disp12MaxDiff': -1,
                 'preFilterCap': 63,
                 'uniquenessRatio': 10,
                 'speckleWindowSize': 100,
                 'speckleRange': 1,
                 'mode': cv2.STEREO_SGBM_MODE_SGBM_3WAY
                 }

        # 构建SGBM对象
        left_matcher = cv2.StereoSGBM_create(**paraml)
        paramr = paraml
        paramr['minDisparity'] = -paraml['numDisparities']
        right_matcher = cv2.StereoSGBM_create(**paramr)

        # 计算视差图
        size = (left_image.shape[1], left_image.shape[0])
        if down_scale == False:
            disparity_left = left_matcher.compute(left_image, right_image)
            disparity_right = right_matcher.compute(right_image, left_image)

        else:
            left_image_down = cv2.pyrDown(left_image)
            right_image_down = cv2.pyrDown(right_image)
            factor = left_image.shape[1] / left_image_down.shape[1]
            
            disparity_left_half = left_matcher.compute(left_image_down, right_image_down)
            disparity_right_half = right_matcher.compute(right_image_down, left_image_down)
            disparity_left = cv2.resize(disparity_left_half, size, interpolation=cv2.INTER_AREA)
            disparity_right = cv2.resize(disparity_right_half, size, interpolation=cv2.INTER_AREA)
            disparity_left = factor * disparity_left
            disparity_right = factor * disparity_right
            
        trueDisp_left = disparity_left.astype(np.float32) / 16.
        trueDisp_right = disparity_right.astype(np.float32) / 16.
        return trueDisp_left, trueDisp_right

5.3 测距代码

if save_img or view_img:  # Add bbox to image
    label = f'{names[int(cls)]} {conf:.2f}'
    plot_one_box(xyxy, im0, label=label, color=colors[int(cls)], line_thickness=1)
    x = (xyxy[0] + xyxy[2]) / 2
    y = (xyxy[1] + xyxy[3]) / 2
    if (x <= 1280):
        t3 = time_synchronized()
        p = num

        height_0, width_0 = im0.shape[0:2]
        iml = im0[0:int(height_0), 0:int(width_0 / 2)]
        imr = im0[0:int(height_0), int(width_0 / 2):int(width_0)]

        height, width = iml.shape[0:2]
        config = stereoconfig.stereoCamera()
        map1x, map1y, map2x, map2y, Q = getRectifyTransform(height, width, config)
        iml_rectified, imr_rectified = rectifyImage(iml, imr, map1x, map1y, map2x, map2y)

        line = draw_line(iml_rectified, imr_rectified)
        iml = undistortion(iml, config.cam_matrix_left, config.distortion_l)
        imr = undistortion(imr, config.cam_matrix_right, config.distortion_r)
        iml_, imr_ = preprocess(iml, imr)
        iml_rectified_l, imr_rectified_r = rectifyImage(iml_, imr_, map1x, map1y, map2x, map2y)

        disp, _ = stereoMatchSGBM(iml_rectified_l, imr_rectified_r, True)
        points_3d = cv2.reprojectImageTo3D(disp, Q)
        dis = ((points_3d[int(y), int(x), 0] ** 2 + points_3d[int(y), int(x), 1] ** 2 + points_3d[
                                int(y), int(x), 2] ** 2) ** 0.5) / 10

5.4 主代码

import argparse
import time
from pathlib import Path
import gol
import cv2
import torch
import torch.backends.cudnn as cudnn
from numpy import random
from models.experimental import attempt_load
from utils.datasets import LoadStreams, LoadImages
from utils.general import check_img_size, check_requirements, check_imshow, non_max_suppression, apply_classifier, \
    scale_coords, xyxy2xywh, strip_optimizer, set_logging, increment_path
from utils.plots import plot_one_box
from utils.torch_utils import select_device, load_classifier, time_synchronized, TracedModel
from stereo.dianyuntu_yolo import getRectifyTransform
from stereo import stereoconfig
from stereo.stereo import stereo_threading, MyThread
import threading
def detect(save_img=False):
    source, weights, view_img, save_txt, imgsz, trace = opt.source, opt.weights, opt.view_img, opt.save_txt, opt.img_size, not opt.no_trace
    save_img = not opt.nosave and not source.endswith('.txt')  # save inference images
    webcam = source.isnumeric() or source.endswith('.txt') or source.lower().startswith(
        ('rtsp://', 'rtmp://', 'http://', 'https://'))

    # Directories
    save_dir = Path(increment_path(Path(opt.project) / opt.name, exist_ok=opt.exist_ok))  # increment run
    (save_dir / 'labels' if save_txt else save_dir).mkdir(parents=True, exist_ok=True)  # make dir

    # Initialize
    set_logging()
    device = select_device(opt.device)
    half = device.type != 'cpu'  # half precision only supported on CUDA

    # Load model
    model = attempt_load(weights, map_location=device)  # load FP32 model
    stride = int(model.stride.max())  # model stride
    imgsz = check_img_size(imgsz, s=stride)  # check img_size

    if trace:
        model = TracedModel(model, device, opt.img_size)

    if half:
        model.half()  # to FP16

    # Second-stage classifier
    classify = False
    if classify:
        modelc = load_classifier(name='resnet101', n=2)  # initialize
        modelc.load_state_dict(torch.load('weights/resnet101.pt', map_location=device)['model']).to(device).eval()

    # Set Dataloader
    vid_path, vid_writer = None, None
    if webcam:
        view_img = check_imshow()
        cudnn.benchmark = True  # set True to speed up constant image size inference
        dataset = LoadStreams(source, img_size=imgsz, stride=stride)
    else:
        dataset = LoadImages(source, img_size=imgsz, stride=stride)

    # Get names and colors
    names = model.module.names if hasattr(model, 'module') else model.names
    colors = [[random.randint(0, 255) for _ in range(3)] for _ in names]

    # Run inference
    if device.type != 'cpu':
        model(torch.zeros(1, 3, imgsz, imgsz).to(device).type_as(next(model.parameters())))  # run once
    old_img_w = old_img_h = imgsz
    old_img_b = 1

    t0 = time.time()
    for path, img, im0s, vid_cap in dataset:
        img = torch.from_numpy(img).to(device)
        img = img.half() if half else img.float()  # uint8 to fp16/32
        img /= 255.0  # 0 - 255 to 0.0 - 1.0
        if img.ndimension() == 3:
            img = img.unsqueeze(0)

        # Warmup
        if device.type != 'cpu' and (old_img_b != img.shape[0] or old_img_h != img.shape[2] or old_img_w != img.shape[3]):
            old_img_b = img.shape[0]
            old_img_h = img.shape[2]
            old_img_w = img.shape[3]
            for i in range(3):
                model(img, augment=opt.augment)[0]

        # Inference
        t1 = time_synchronized()
        with torch.no_grad():   # Calculating gradients would cause a GPU memory leak
            pred = model(img, augment=opt.augment)[0]
        t2 = time_synchronized()

        # Apply NMS
        pred = non_max_suppression(pred, opt.conf_thres, opt.iou_thres, classes=opt.classes, agnostic=opt.agnostic_nms)
        t3 = time_synchronized()

        # Apply Classifier
        if classify:
            pred = apply_classifier(pred, modelc, img, im0s)

        # Process detections
        for i, det in enumerate(pred):  # detections per image
            if webcam:  # batch_size >= 1
                p, s, im0, frame = path[i], '%g: ' % i, im0s[i].copy(), dataset.count
            else:
                p, s, im0, frame = path, '', im0s, getattr(dataset, 'frame', 0)

            p = Path(p)  # to Path
            save_path = str(save_dir / p.name)  # img.jpg
            txt_path = str(save_dir / 'labels' / p.stem) + ('' if dataset.mode == 'image' else f'_{frame}')  # img.txt
            gn = torch.tensor(im0.shape)[[1, 0, 1, 0]]  # normalization gain whwh
            if len(det):
                # Rescale boxes from img_size to im0 size
                det[:, :4] = scale_coords(img.shape[2:], det[:, :4], im0.shape).round()

                # Print results
                for c in det[:, -1].unique():
                    n = (det[:, -1] == c).sum()  # detections per class
                    s += f"{n} {names[int(c)]}{'s' * (n > 1)}, "  # add to string

                # Write results
                for *xyxy, conf, cls in reversed(det):
                    if save_txt:  # Write to file
                        xywh = (xyxy2xywh(torch.tensor(xyxy).view(1, 4)) / gn).view(-1).tolist()  # normalized xywh
                        line = (cls, *xywh, conf) if opt.save_conf else (cls, *xywh)  # label format
                        with open(txt_path + '.txt', 'a') as f:
                            f.write(('%g ' * len(line)).rstrip() % line + '\n')

                    if save_img or view_img:  # Add bbox to image
                        label = f'{names[int(cls)]} {conf:.2f}'
                        plot_one_box(xyxy, im0, label=label, color=colors[int(cls)], line_thickness=1)
                        x = (xyxy[0] + xyxy[2]) / 2
                        y = (xyxy[1] + xyxy[3]) / 2
                        if (x <= 1280):
                            t3 = time_synchronized()
                            p = num

                            height_0, width_0 = im0.shape[0:2]
                            iml = im0[0:int(height_0), 0:int(width_0 / 2)]
                            imr = im0[0:int(height_0), int(width_0 / 2):int(width_0)]

                            height, width = iml.shape[0:2]
                            config = stereoconfig.stereoCamera()
                            map1x, map1y, map2x, map2y, Q = getRectifyTransform(height, width, config)
                            iml_rectified, imr_rectified = rectifyImage(iml, imr, map1x, map1y, map2x, map2y)

                            line = draw_line(iml_rectified, imr_rectified)
                            iml = undistortion(iml, config.cam_matrix_left, config.distortion_l)
                            imr = undistortion(imr, config.cam_matrix_right, config.distortion_r)
                            iml_, imr_ = preprocess(iml, imr)
                            iml_rectified_l, imr_rectified_r = rectifyImage(iml_, imr_, map1x, map1y, map2x, map2y)

                            disp, _ = stereoMatchSGBM(iml_rectified_l, imr_rectified_r, True)
                            points_3d = cv2.reprojectImageTo3D(disp, Q)

                            text_cxy = "*"
                            cv2.putText(im0, text_cxy, (int(x), int(y)), cv2.FONT_ITALIC, 1.2, (0, 0, 255), 3)

                            print('点 (%d, %d) 的三维坐标 (x:%.1fcm, y:%.1fcm, z:%.1fcm)' % (
                            int(x), int(y), points_3d[int(y), int(x), 0] / 10, points_3d[int(y), int(x), 1] / 10,
                            points_3d[int(y), int(x), 2] / 10))

                            dis = ((points_3d[int(y), int(x), 0] ** 2 + points_3d[int(y), int(x), 1] ** 2 + points_3d[
                                int(y), int(x), 2] ** 2) ** 0.5) / 10
                            print('点 (%d, %d) 的 %s 距离左摄像头的相对距离为 %0.1f cm' % (x, y, label, dis))

                            text_x = "x:%.1fcm" % (points_3d[int(y), int(x), 0] / 10)
                            text_y = "y:%.1fcm" % (points_3d[int(y), int(x), 1] / 10)
                            text_z = "z:%.1fcm" % (points_3d[int(y), int(x), 2] / 10)
                            text_dis = "dis:%.1fcm" % dis

                            cv2.rectangle(im0, (int(xyxy[0] + (xyxy[2] - xyxy[0])), int(xyxy[1])),
                                          (int(xyxy[0] + (xyxy[2] - xyxy[0]) + 5 + 220), int(xyxy[1] + 150)),
                                          colors[int(cls)], -1)
                            cv2.putText(im0, text_x, (int(xyxy[0] + (xyxy[2] - xyxy[0]) + 5), int(xyxy[1] + 30)),
                                        cv2.FONT_ITALIC, 1.2, (255, 255, 255), 3)
                            cv2.putText(im0, text_y, (int(xyxy[0] + (xyxy[2] - xyxy[0]) + 5), int(xyxy[1] + 65)),
                                        cv2.FONT_ITALIC, 1.2, (255, 255, 255), 3)
                            cv2.putText(im0, text_z, (int(xyxy[0] + (xyxy[2] - xyxy[0]) + 5), int(xyxy[1] + 100)),
                                        cv2.FONT_ITALIC, 1.2, (255, 255, 255), 3)
                            cv2.putText(im0, text_dis, (int(xyxy[0] + (xyxy[2] - xyxy[0]) + 5), int(xyxy[1] + 145)),
                                        cv2.FONT_ITALIC, 1.2, (255, 255, 255), 3)

                            t4 = time_synchronized()
                            print(f'Done. ({t4 - t3:.3f}s)')

                    print(f'{s}Done. ({t2 - t1:.3f}s)')

            # Print time (inference + NMS)
            print(f'{s}Done. ({(1E3 * (t2 - t1)):.1f}ms) Inference, ({(1E3 * (t3 - t2)):.1f}ms) NMS')

            # Save results (image with detections)
            if save_img:
                if dataset.mode == 'image':
                    cv2.imwrite(save_path, im0)
                    print(f" The image with the result is saved in: {save_path}")
                else:  # 'video' or 'stream'
                    if vid_path != save_path:  # new video
                        vid_path = save_path
                        if isinstance(vid_writer, cv2.VideoWriter):
                            vid_writer.release()  # release previous video writer
                        if vid_cap:  # video
                            fps = vid_cap.get(cv2.CAP_PROP_FPS)
                            w = int(vid_cap.get(cv2.CAP_PROP_FRAME_WIDTH))
                            h = int(vid_cap.get(cv2.CAP_PROP_FRAME_HEIGHT))
                        else:  # stream
                            fps, w, h = 30, im0.shape[1], im0.shape[0]
                            save_path += '.mp4'
                        vid_writer = cv2.VideoWriter(save_path, cv2.VideoWriter_fourcc(*'mp4v'), fps, (w, h))
                    vid_writer.write(im0)
                    cv2.namedWindow("Video", cv2.WINDOW_NORMAL)
                    cv2.resizeWindow("Video", 1280, 480)
                    cv2.moveWindow("Video", 0, 0)
                    cv2.imshow("Video", im0)
                    cv2.waitKey(1)

    if save_txt or save_img:
        s = f"\n{len(list(save_dir.glob('labels/*.txt')))} labels saved to {save_dir / 'labels'}" if save_txt else ''
        #print(f"Results saved to {save_dir}{s}")

    print(f'Done. ({time.time() - t0:.3f}s)')


if __name__ == '__main__':
    parser = argparse.ArgumentParser()
    parser.add_argument('--weights', nargs='+', type=str, default='yolov7.pt', help='model.pt path(s)')
    parser.add_argument('--source', type=str, default='inference/a5.mp4', help='source')  # file/folder, 0 for webcam
    parser.add_argument('--img-size', type=int, default=640, help='inference size (pixels)')
    parser.add_argument('--conf-thres', type=float, default=0.25, help='object confidence threshold')
    parser.add_argument('--iou-thres', type=float, default=0.45, help='IOU threshold for NMS')
    parser.add_argument('--device', default='', help='cuda device, i.e. 0 or 0,1,2,3 or cpu')
    parser.add_argument('--view-img', action='store_true', help='display results')
    parser.add_argument('--save-txt', action='store_true', help='save results to *.txt')
    parser.add_argument('--save-conf', action='store_true', help='save confidences in --save-txt labels')
    parser.add_argument('--nosave', action='store_true', help='do not save images/videos')
    parser.add_argument('--classes', nargs='+', type=int, help='filter by class: --class 0, or --class 0 2 3')
    parser.add_argument('--agnostic-nms', action='store_true', help='class-agnostic NMS')
    parser.add_argument('--augment', action='store_true', help='augmented inference')
    parser.add_argument('--update', action='store_true', help='update all models')
    parser.add_argument('--project', default='runs/detect', help='save results to project/name')
    parser.add_argument('--name', default='exp', help='save results to project/name')
    parser.add_argument('--exist-ok', action='store_true', help='existing project/name ok, do not increment')
    parser.add_argument('--no-trace', action='store_true', help='don`t trace model')
    opt = parser.parse_args()
    print(opt)
    #check_requirements(exclude=('pycocotools', 'thop'))

    with torch.no_grad():
        if opt.update:  # update all models (to fix SourceChangeWarning)
            for opt.weights in ['yolov7.pt']:
                detect()
                strip_optimizer(opt.weights)
        else:
            detect()

6.实验结果

效果图如下:
YOLOv7+双目测距(python)

检测视频

源代码
链接:https://pan.baidu.com/s/1t1YS0U8JI0dfWqTbEk1URQ?pwd=4k0b
提取码:4k0b

如需要更快检测速度多线程代码,请私信我…文章来源地址https://www.toymoban.com/news/detail-459186.html

到了这里,关于YOLOv7+双目测距(python)的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处: 如若内容造成侵权/违法违规/事实不符,请点击违法举报进行投诉反馈,一经查实,立即删除!

领支付宝红包 赞助服务器费用

相关文章

  • yolov8/yolov7/yolov5-车辆测距+前车碰撞预警(追尾预警)+车辆检测识别+车辆跟踪测速(算法-毕业设计)

    本项目效果展示视频: https://www.bilibili.com/video/BV14d4y177vE/?spm_id_from=333.999.0.0vd_source=8c532ded7c7c9041f04e35940d11fdae 1、本项目通过yolov8/yolov7/yolov5和deepsort实现了一个自动驾驶领域的追尾前车碰撞预警系统,可为一些同学的课设、大作业等提供参考。分别实现了自行车、汽车、摩托车

    2024年02月04日
    浏览(65)
  • 双目测距--3 双目标定

    目录 -1 流程说明: 0 几个重要 函数 1、calibrateCamera()函数 2、stereoCalibrate() 3、findChessboardCorners() 棋盘格角点检测 4、stereoRectify() 5、initUndistortRectifyMap() 6、remap()  1、用于标定的图像  2、标定前 3、OpenCV进行双目标定 单目标定 calibration.h 双目标定 doule--camera--calibration.h 主函数

    2024年02月09日
    浏览(53)
  • OpenCV C++双目三维重建:双目摄像头实现双目测距

    目录 OpenCV C++双目三维重建:双目摄像头实现双目测距 1.目录结构 2.依赖库  (1) Ubuntu 18.04配置开发环境  (2) Windows配置开发环境 3.双目相机标定  (1)双目相机标定-Python版  (2)双目相机标定-Matlab版 4.相机参数配置 5. 双目测距 6. 运行Demo 7.双目测距的误差说明 8. 双目三维重建项

    2024年02月02日
    浏览(66)
  • 使用opencv做双目测距(相机标定+立体匹配+测距)

    最近在做双目测距,觉得有必要记录点东西,所以我的第一篇博客就这么诞生啦~ 双目测距属于立体视觉这一块,我觉得应该有很多人踩过这个坑了,但网上的资料依旧是云里雾里的,要么是理论讲一大堆,最后发现还不知道怎么做,要么就是直接代码一贴,让你懵逼。 所以

    2024年01月20日
    浏览(37)
  • 双目相机测距原理

    双目相机测距是一种常用的计算机视觉技术,它利用两个摄像头同时拍摄同一场景,通过测量两个摄像头视野中同一物体在图像上的像素差异,从而计算出物体距离的方法。 具体原理如下: 双目相机的构成 双目相机由两个摄像头组成,通常摆放在一定距离内,这个距离称为

    2024年02月05日
    浏览(55)
  • YOLOv5+单目测距(python)

    相关链接 1. YOLOV7 + 单目测距(python) 2. YOLOV5 + 单目跟踪(python) 3. YOLOV7 + 单目跟踪(python) 4. YOLOV5 + 双目测距(python) 5. YOLOV7 + 双目测距(python) 6. 具体实现效果已在Bilibili发布,点击跳转 本篇博文工程源码下载 链接1:https://download.csdn.net/download/qq_45077760/87708260 链接2:

    2024年02月05日
    浏览(103)
  • yolov8直接调用zed相机实现三维测距(python)

    相关链接 此项目直接调用zed相机实现三维测距,无需标定,相关内容如下: 1.yolov5直接调用zed相机实现三维测距(python) 2. yolov4直接调用zed相机实现三维测距 3. Windows+YOLOV8环境配置 4.具体实现效果已在哔哩哔哩发布,点击此链接跳转 本篇博文工程源码下载(麻烦github给个星

    2024年04月11日
    浏览(41)
  • YOLOv7+单目测量门窗尺寸(python)

    相关链接 1. YOLOV5 + 单目测距(python)

    2024年02月03日
    浏览(29)
  • 基于Raspberry Pi和双目摄像头的无人机目标识别、跟踪与实时测距系统开发

    硬件选择: Raspberry Pi 4: 它是一款功能强大的微型计算机,可以轻松地与各种传感器和摄像头配合使用。 双目摄像头: 例如选择Raspberry Pi相容的Arducam双目摄像头,双目摄像头可以捕捉到两个略有差异的图像,这对于空间测距非常重要。 算法: 使用**立体视觉(Stereo Vision)**算法

    2024年02月12日
    浏览(49)
  • 基于YOLOv8/YOLOv7/YOLOv6/YOLOv5的动物识别系统(Python+PySide6界面+训练代码)

    摘要:本博客文章深入解析了基于深度学习的动物识别系统的完整代码,并展示了采用领先的YOLOv8算法的实现代码。该系统与YOLOv7、YOLOv6、YOLOv5等早期版本的性能进行了比较,可以从静态图像到实时视频流的各种媒介中识别动物的高效性和准确性。文章不仅详尽地阐释了YOL

    2024年03月27日
    浏览(50)

觉得文章有用就打赏一下文章作者

支付宝扫一扫打赏

博客赞助

微信扫一扫打赏

请作者喝杯咖啡吧~博客赞助

支付宝扫一扫领取红包,优惠每天领

二维码1

领取红包

二维码2

领红包