嵌入式设备比如tx2的视觉

很棒的语义分割大全集
tx2可以用的网络
tx2官网
1、嵌入式语义分割ShuffleSeg
2、opencv车道线检测

import cv2
import utils
import matplotlib.pyplot as plt
import numpy as np



def processing(img,object_points,img_points,M,Minv):
    #camera calibration, image distortion correction 摄像机校准,图像失真校正
    undist = utils.cal_undistort(img,object_points,img_points)
    #get the thresholded binary image
    thresholded =utils.hls_select(undist, channel='s', thresh=(180, 255))
    # thresholded = thresholding(undist)
    #perform perspective  transform 执行透视变换
    thresholded_wraped = cv2.warpPerspective(thresholded, M, img.shape[1::-1], flags=cv2.INTER_LINEAR)
    left_fit, right_fit, left_lane_inds, right_lane_inds = utils.find_line(thresholded_wraped)

    # #perform detection 执行检测
    # if left_line.detected and right_line.detected:
    #     left_fit, right_fit, left_lane_inds, right_lane_inds = utils.find_line_by_previous(thresholded_wraped,left_line.current_fit,right_line.current_fit)
    # else:
    #
    # left_line.update(left_fit)
    # right_line.update(right_fit)

    #draw the detected laneline and the information
    area_img = utils.draw_area(undist,thresholded_wraped,Minv,left_fit, right_fit)
    curvature,pos_from_center = utils.calculate_curv_and_pos(thresholded_wraped,left_fit, right_fit)
    result = utils.draw_values(area_img,curvature,pos_from_center)

    return result

#获取棋盘格图片
cal_imgs = utils.get_images_by_dir('camera_cal')
object_points,img_points = utils.calibrate(cal_imgs,grid=(9,6))

#test_imgs = utils.get_images_by_dir('test_images')
test_imgs = utils.get_images_by_dir('new_test')



img=cv2.imread('./test_images/straight_lines1.jpg',1)
# 校正测试图片
dist = utils.cal_undistort(img, object_points, img_points)
# # cv2.imshow('fck1',org_img)
M, Minv = utils.get_M_Minv()
result = processing(img, object_points, img_points, M, Minv)

cv2.imshow('fck', result)
cv2.waitKey(0)
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值