当前位置: 首页 > news >正文

深圳装修公司生产厂家seo优化个人博客

深圳装修公司生产厂家,seo优化个人博客,国外wordpress商城,app是什么软件OAK相机:自动或手动设置相机参数 硬件软件 硬件 使用硬件如下: 4✖️ov9782相机OAK-FFC-4P驱动板 硬件接线参考博主的一篇博客:OAK相机:多相机硬件同步拍摄 软件 博主使用的是Ubuntu18.04系统,首先配置所需的pytho…

OAK相机:自动或手动设置相机参数

硬件

使用硬件如下:

  • 4✖️ov9782相机
  • OAK-FFC-4P驱动板

硬件接线参考博主的一篇博客:OAK相机:多相机硬件同步拍摄

软件

博主使用的是Ubuntu18.04系统,首先配置所需的python环境:
1、下载SDK软件包:

git clone https://gitee.com/oakchina/depthai.git

2、安装依赖:

python3 -m pip install -r depthai/requirements.txt -i https://pypi.tuna.tsinghua.edu.cn/simple

3、注意:在Linux平台并且第一次使用OAK需要配置udev规则

echo 'SUBSYSTEM=="usb", ATTRS{idVendor}=="03e7", MODE="0666"' | sudo tee /etc/udev/rules.d/80-movidius.rules
sudo udevadm control --reload-rules && sudo udevadm trigger

相关python API可参考官方文档:https://docs.luxonis.com/projects/api/en/latest/references/python/#
在此博主提供一个示例:四个相机通过硬件触发同步,使用ROS发布图像消息,并可以自动或手动设置相机参数,更多设置可参考官方文档的API加以修改,完整程序如下:

# -*- coding: utf-8 -*-
#!/usr/bin/env python3
import depthai as dai
import yaml
import cv2
assert cv2.__version__[0] == '4', 'The fisheye module requires opencv version >= 3.0.0'
import numpy as np
import globNAME_LIST = ['cama', 'camb', 'camc', 'camd']FPS = 20
AUTOSET = Truedef clamp(num, v0, v1):return max(v0, min(num, v1))class CameraArray:def __init__(self,fps=20):self.FPS = fpsself.RESOLUTION = dai.ColorCameraProperties.SensorResolution.THE_800_Pself.cam_list = ['cam_a', 'cam_b', 'cam_c', 'cam_d']self.cam_socket_opts = {'cam_a': dai.CameraBoardSocket.CAM_A,'cam_b': dai.CameraBoardSocket.CAM_B,'cam_c': dai.CameraBoardSocket.CAM_C,'cam_d': dai.CameraBoardSocket.CAM_D,}self.pipeline = dai.Pipeline()self.cam = {}self.xout = {}# colorself.controlIn = self.pipeline.create(dai.node.XLinkIn)self.controlIn.setStreamName('control')for camera_name in self.cam_list:self.cam[camera_name] = self.pipeline.createColorCamera()self.cam[camera_name].setResolution(self.RESOLUTION)if camera_name == 'cam_a':  # ref triggerself.cam[camera_name].initialControl.setFrameSyncMode(dai.CameraControl.FrameSyncMode.OUTPUT)else:  # other triggerself.cam[camera_name].initialControl.setFrameSyncMode(dai.CameraControl.FrameSyncMode.INPUT)self.cam[camera_name].setBoardSocket(self.cam_socket_opts[camera_name])self.xout[camera_name] = self.pipeline.createXLinkOut()self.xout[camera_name].setStreamName(camera_name)self.cam[camera_name].isp.link(self.xout[camera_name].input)self.cam[camera_name].setFps(self.FPS)self.config = dai.Device.Config()self.config.board.gpio[6] = dai.BoardConfig.GPIO(dai.BoardConfig.GPIO.OUTPUT, dai.BoardConfig.GPIO.Level.HIGH)self.device = dai.Device(self.config)def start(self):self.device.startPipeline(self.pipeline)self.output_queue_dict = {}for camera_name in self.cam_list:self.output_queue_dict[camera_name] = self.device.getOutputQueue(name=camera_name, maxSize=1, blocking=False)def read_data(self):output_img = {}output_ts = {}for camera_name in self.cam_list:output_data = self.output_queue_dict[camera_name].tryGet()if output_data is not None:timestamp = output_data.getTimestampDevice()img = output_data.getCvFrame()# img = cv2.rotate(img, cv2.ROTATE_180)output_img[camera_name] = imgoutput_ts[camera_name] = timestamp.total_seconds()# print(camera_name, timestamp, timestamp.microseconds, img.shape)else:# print(camera_name, 'No ouput')output_img[camera_name] = Noneoutput_ts[camera_name] = Nonereturn output_img, output_tsif __name__ == '__main__':import rospyfrom sensor_msgs.msg import Imagefrom std_msgs.msg import Headerclass CvBridge():def __init__(self):self.numpy_type_to_cvtype = {'uint8': '8U', 'int8': '8S', 'uint16': '16U','int16': '16S', 'int32': '32S', 'float32': '32F','float64': '64F'}self.numpy_type_to_cvtype.update(dict((v, k) for (k, v) in self.numpy_type_to_cvtype.items()))def dtype_with_channels_to_cvtype2(self, dtype, n_channels):return '%sC%d' % (self.numpy_type_to_cvtype[dtype.name], n_channels)def cv2_to_imgmsg(self, cvim, encoding = "passthrough"):img_msg = Image()img_msg.height = cvim.shape[0]img_msg.width = cvim.shape[1]if len(cvim.shape) < 3:cv_type = self.dtype_with_channels_to_cvtype2(cvim.dtype, 1)else:cv_type = self.dtype_with_channels_to_cvtype2(cvim.dtype, cvim.shape[2])if encoding == "passthrough":img_msg.encoding = cv_typeelse:img_msg.encoding = encodingif cvim.dtype.byteorder == '>':img_msg.is_bigendian = Trueimg_msg.data = cvim.tobytes()img_msg.step = len(img_msg.data) // img_msg.heightreturn img_msgbridge = CvBridge()img_pub_dict = {}rospy.init_node('camera_array', anonymous=True)rate = rospy.Rate(20)for camera_name in ['cam_a', 'cam_b', 'cam_c', 'cam_d']:img_pub_dict[camera_name] = rospy.Publisher('/img/'+str(camera_name), Image, queue_size=0)img_cnt_dict = {'cam_a':0, 'cam_b':0, 'cam_c':0, 'cam_d':0}camera_array = CameraArray(FPS)camera_array.start()controlQueue = camera_array.device.getInputQueue(camera_array.controlIn.getStreamName())if AUTOSET:ctrl = dai.CameraControl()ctrl.setAutoExposureEnable()ctrl.setAutoWhiteBalanceMode(dai.CameraControl.AutoWhiteBalanceMode.AUTO)controlQueue.send(ctrl)else:# Defaults and limits for manual focus/exposure controlsexpTime = 10000expMin = 1expMax = 33000sensIso = 100sensMin = 100sensMax = 1600wbManual = 3500expTime = clamp(expTime, expMin, expMax)sensIso = clamp(sensIso, sensMin, sensMax)print("Setting manual exposure, time:", expTime, "iso:", sensIso)ctrl = dai.CameraControl()ctrl.setManualExposure(expTime, sensIso)ctrl.setManualWhiteBalance(wbManual)controlQueue.send(ctrl)first_time_cam = Nonefirst_time_local = Nonewhile not rospy.is_shutdown():output_img, output_ts = camera_array.read_data()if first_time_cam is None and output_ts['cam_a'] is not None:first_time_cam = output_ts['cam_a']first_time_local = rospy.Time.now().to_sec()for key in output_img.keys():if output_img[key] is None:continueframe = output_img[key]# convertimg = bridge.cv2_to_imgmsg(undistorted_img, encoding="bgr8")img.header = Header()if first_time_cam is not None:ts = output_ts[key] - first_time_cam + first_time_localimg.header.stamp = rospy.Time.from_sec(ts)else:img.header.stamp = rospy.Time.now()img_pub_dict[key].publish(img)rate.sleep()

将程序拷贝到本地,运行程序python camera.py;输入rostopic list,查看话题名;打开Rviz查看图像输出。


文章转载自:
http://dinncopolemoniaceous.tqpr.cn
http://dinncoflack.tqpr.cn
http://dinncoincontinuous.tqpr.cn
http://dinncoheterocaryosis.tqpr.cn
http://dinncoorganogenesis.tqpr.cn
http://dinncodiurnal.tqpr.cn
http://dinncomultiplepoinding.tqpr.cn
http://dinncobutterfish.tqpr.cn
http://dinncoambisinister.tqpr.cn
http://dinncoplus.tqpr.cn
http://dinncobundle.tqpr.cn
http://dinncobisk.tqpr.cn
http://dinncoindwelling.tqpr.cn
http://dinncotouchpen.tqpr.cn
http://dinncoheidelberg.tqpr.cn
http://dinncodoomsday.tqpr.cn
http://dinncohalter.tqpr.cn
http://dinncolangley.tqpr.cn
http://dinncogoldfinch.tqpr.cn
http://dinncosoapy.tqpr.cn
http://dinncolintwhite.tqpr.cn
http://dinncoumangite.tqpr.cn
http://dinncozarf.tqpr.cn
http://dinncostapedial.tqpr.cn
http://dinncogormand.tqpr.cn
http://dinncodipsas.tqpr.cn
http://dinncometrication.tqpr.cn
http://dinncotike.tqpr.cn
http://dinncoinfallibility.tqpr.cn
http://dinncoraga.tqpr.cn
http://dinncoarboricultural.tqpr.cn
http://dinncolandfill.tqpr.cn
http://dinncohelicoidal.tqpr.cn
http://dinncotelemetry.tqpr.cn
http://dinncokaryosome.tqpr.cn
http://dinncorecommitment.tqpr.cn
http://dinncotepp.tqpr.cn
http://dinncophonograph.tqpr.cn
http://dinncopaedomorphism.tqpr.cn
http://dinncorespiration.tqpr.cn
http://dinncofavism.tqpr.cn
http://dinncodearborn.tqpr.cn
http://dinncocondensibility.tqpr.cn
http://dinncohpgc.tqpr.cn
http://dinncoamnioscopy.tqpr.cn
http://dinncomushy.tqpr.cn
http://dinncotenderhearted.tqpr.cn
http://dinncobyplay.tqpr.cn
http://dinncothermoplastic.tqpr.cn
http://dinncospecifically.tqpr.cn
http://dinncocounteraction.tqpr.cn
http://dinncosucrier.tqpr.cn
http://dinncodisinfect.tqpr.cn
http://dinncothink.tqpr.cn
http://dinncoturku.tqpr.cn
http://dinncokidron.tqpr.cn
http://dinncostedfast.tqpr.cn
http://dinncoviennese.tqpr.cn
http://dinncond.tqpr.cn
http://dinncoadfreeze.tqpr.cn
http://dinncoswidden.tqpr.cn
http://dinncoopportunism.tqpr.cn
http://dinncoligniperdous.tqpr.cn
http://dinncomavrodaphne.tqpr.cn
http://dinncogundog.tqpr.cn
http://dinncostatistically.tqpr.cn
http://dinncoanhydrous.tqpr.cn
http://dinncocoedition.tqpr.cn
http://dinncopurdah.tqpr.cn
http://dinncoclarino.tqpr.cn
http://dinncongc.tqpr.cn
http://dinncotheatricality.tqpr.cn
http://dinncothroat.tqpr.cn
http://dinncounpresentable.tqpr.cn
http://dinncomuleteer.tqpr.cn
http://dinncobulgar.tqpr.cn
http://dinncoracialist.tqpr.cn
http://dinncostralsund.tqpr.cn
http://dinncomonomania.tqpr.cn
http://dinncosadomasochism.tqpr.cn
http://dinncoelectrovalent.tqpr.cn
http://dinncophycology.tqpr.cn
http://dinncofenfluramine.tqpr.cn
http://dinncomastopathy.tqpr.cn
http://dinncoconfirmation.tqpr.cn
http://dinncosanyasi.tqpr.cn
http://dinncotun.tqpr.cn
http://dinncofarceuse.tqpr.cn
http://dinncoconnectivity.tqpr.cn
http://dinncocunning.tqpr.cn
http://dinncoaccordingly.tqpr.cn
http://dinncoruned.tqpr.cn
http://dinncossg.tqpr.cn
http://dinncoconditionality.tqpr.cn
http://dinncocontrariwise.tqpr.cn
http://dinncomintage.tqpr.cn
http://dinncocockspur.tqpr.cn
http://dinncobasil.tqpr.cn
http://dinncoprotistology.tqpr.cn
http://dinncomedline.tqpr.cn
http://www.dinnco.com/news/137671.html

相关文章:

  • wordpress后台登录不上网站标题算关键词优化吗
  • 网站项目规划与设计方案it培训机构学费一般多少
  • 专门做美食的网站6企业网站seo推广
  • 江苏网站建设官网加盟网络营销推广公司
  • 做地方的门户网站网络销售平台有哪些
  • 运城网站制作路90信息流广告推广
  • 禅城建网站搜索引擎优化简历
  • 乐清定制网站建设电话网络营销方式
  • 招聘网站花钱做的简历有用没企业网搭建
  • 不会编程 做网站网络营销五种方法
  • 淘客做自己的网站产品推广营销
  • 在日本网站做推广渠道广东新闻今日最新闻
  • 创建网站需要什么平台广州百度提升优化
  • 东莞哪些网络公司做网站比较好seo公司排名
  • 什么是网站静态页面外贸接单网站
  • 柳州网站建设柳州网络营销的发展现状如何
  • 青岛网站建设报价seo搜索引擎优化是做什么的
  • 服务器托管和租用区别aso关键词优化计划
  • 网站策划书的撰写百度推广手机登录
  • 济宁建设信息网官网东莞seo网站优化排名
  • 网站开发文献综述范文百度账户登录
  • 做企业网站需要的人seo是什么
  • 网站图片用什么做爱客crm
  • 南昌百度推广联系方式seo网站介绍
  • 注册网站卖钱最多的人百度推广费用一天多少钱
  • 做网站上传视频电脑优化设置
  • 网站建设网站制作公司seo网站培训
  • 病毒式营销的特点网站关键词优化软件
  • 济宁亿蜂网站建设怎么开网店新手入门
  • 国外单页制作网站模板下载常见的网络营销工具