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

中国万网ceo黑帽seo排名优化

中国万网ceo,黑帽seo排名优化,想找人做网站 要怎么选择,中小企业网站建设案例OpenCV如何正确使用stereoRectify函数 函数介绍 用于双目相机的立体校正环节中,这里只谈谈这个函数怎么使用,参数具体指哪些函数参数 随便去网上一搜或者看官方手册就能得到参数信息,但是!!相对关系非常容易出错&…

OpenCV如何正确使用stereoRectify函数

函数介绍

    用于双目相机的立体校正环节中,这里只谈谈这个函数怎么使用,参数具体指哪些

函数参数

    随便去网上一搜或者看官方手册就能得到参数信息,但是!!相对关系非常容易出错!!这里详细解释一下这些参数究竟怎么用
void stereoRectify(InputArray cameraMatrix1, InputArray distCoeffs1, InputArray cameraMatrix2,InputArray distCoeffs2, Size imageSize, InputArray R, InputArray T,OutputArray R1, OutputArray R2, OutputArray P1, OutputArray P2, OutputArray Q, int flags=CALIB_ZERO_DISPARITY, double alpha=-1, Size newImageSize=Size(), Rect* validPixROI1=0, Rect* validPixROI2=0 )
cameraMatrix1-第一个摄像机的摄像机矩阵,即左相机相机内参矩阵,矩阵第三行格式应该为 0 0 1
distCoeffs1-第一个摄像机的畸变向量
cameraMatrix2-第一个摄像机的摄像机矩阵,即右相机相机内参矩阵,矩阵第三行格式应该为 0 0 1
distCoeffs2-第二个摄像机的畸变向量
imageSize-图像大小
R- 相机之间的旋转矩阵,这里R的意义是:相机1通过变换R到达相机2的位姿
T-  左相机到右相机的平移矩阵
R1-输出矩阵,第一个摄像机的校正变换矩阵(旋转变换)
R2-输出矩阵,第二个摄像机的校正变换矩阵(旋转矩阵)
P1-输出矩阵,第一个摄像机在新坐标系下的投影矩阵
P2-输出矩阵,第二个摄像机在想坐标系下的投影矩阵
Q-4*4的深度差异映射矩阵
flags-可选的标志有两种零或者 CV_CALIB_ZERO_DISPARITY ,如果设置 CV_CALIB_ZERO_DISPARITY 的话,该函数会让两幅校正后的图像的主点有相同的像素坐标。否则该函数会水平或垂直的移动图像,以使得其有用的范围最大
alpha-拉伸参数。如果设置为负或忽略,将不进行拉伸。如果设置为0,那么校正后图像只有有效的部分会被显示(没有黑色的部分),如果设置为1,那么就会显示整个图像。设置为0~1之间的某个值,其效果也居于两者之间。
newImageSize-校正后的图像分辨率,默认为原分辨率大小。
validPixROI1-可选的输出参数,Rect型数据。其内部的所有像素都有效
validPixROI2-可选的输出参数,Rect型数据。其内部的所有像素都有效

opencv进行双目标定以及极线校正 python代码

双目标定

参考博客 OpenCV相机标定全过程
[OpenCV实战]38 基于OpenCV的相机标定
opencv立体标定函数 stereoCalibrate()

主要使用的函数

findChessboardCorners() #棋盘格角点检测
cornerSubPix() #亚像素检测
calibrateCamera() #单目标定 求解摄像机的内在参数和外在参数
stereoCalibrate() #双目标定 求解两个摄像头的内外参数矩阵,以及两个摄像头的位置关系R,T

代码

import cv2
import os
import numpy as npleftpath = 'images/left'
rightpath = 'images/right'
CHECKERBOARD = (11,12)  #棋盘格内角点数
square_size = (30,30)   #棋盘格大小,单位mm
criteria = (cv2.TERM_CRITERIA_EPS + cv2.TERM_CRITERIA_MAX_ITER, 30, 0.001)
imgpoints_l = []    #存放左图像坐标系下角点位置
imgpoints_r = []    #存放左图像坐标系下角点位置
objpoints = []   #存放世界坐标系下角点位置
objp = np.zeros((1, CHECKERBOARD[0]*CHECKERBOARD[1], 3), np.float32)
objp[0,:,:2] = np.mgrid[0:CHECKERBOARD[0], 0:CHECKERBOARD[1]].T.reshape(-1, 2)
objp[0,:,0] *= square_size[0]
objp[0,:,1] *= square_size[1]for ii in os.listdir(leftpath):img_l = cv2.imread(os.path.join(leftpath,ii))gray_l = cv2.cvtColor(img_l,cv2.COLOR_BGR2GRAY)img_r = cv2.imread(os.path.join(rightpath,ii))gray_r = cv2.cvtColor(img_r,cv2.COLOR_BGR2GRAY)ret_l, corners_l = cv2.findChessboardCorners(gray_l, CHECKERBOARD)   #检测棋盘格内角点ret_r, corners_r = cv2.findChessboardCorners(gray_r, CHECKERBOARD)if ret_l and ret_r:objpoints.append(objp)corners2_l = cv2.cornerSubPix(gray_l,corners_l,(11,11),(-1,-1),criteria) imgpoints_l.append(corners2_l)corners2_r = cv2.cornerSubPix(gray_r,corners_r,(11,11),(-1,-1),criteria)imgpoints_r.append(corners2_r)#img = cv2.drawChessboardCorners(img, CHECKERBOARD, corners2,ret)#cv2.imwrite('./ChessboardCornersimg.jpg', img)
ret, mtx_l, dist_l, rvecs_l, tvecs_l = cv2.calibrateCamera(objpoints, imgpoints_l, gray_l.shape[::-1],None,None)  #先分别做单目标定
ret, mtx_r, dist_r, rvecs_r, tvecs_r = cv2.calibrateCamera(objpoints, imgpoints_r, gray_r.shape[::-1],None,None)retval, cameraMatrix1, distCoeffs1, cameraMatrix2, distCoeffs2, R, T, E, F = \cv2.stereoCalibrate(objpoints, imgpoints_l, imgpoints_r, mtx_l, dist_l, mtx_r, dist_r, gray_l.shape[::-1])   #再做双目标定print("stereoCalibrate : \n")
print("Camera matrix left : \n")
print(cameraMatrix1)
print("distCoeffs left  : \n")
print(distCoeffs1)
print("cameraMatrix left : \n")
print(cameraMatrix2)
print("distCoeffs left : \n")
print(distCoeffs2)
print("R : \n")
print(R)
print("T : \n")
print(T)
print("E : \n")
print(E)
print("F : \n")
print(F)

将打印的结果保存到标定文件中即可

极线校正
参考博客 机器视觉学习笔记(8)——基于OpenCV的Bouguet立体校正
小白视角之Bouguet双目立体校正原理

主要使用的函数

stereoRectify() #计算旋转矩阵和投影矩阵
initUndistortRectifyMap() #计算校正查找映射表
remap() #重映射

代码

import cv2
import numpy as npdef cat2images(limg, rimg):HEIGHT = limg.shape[0]WIDTH = limg.shape[1]imgcat = np.zeros((HEIGHT, WIDTH*2+20,3))imgcat[:,:WIDTH,:] = limgimgcat[:,-WIDTH:,:] = rimgfor i in range(int(HEIGHT / 32)):imgcat[i*32,:,:] = 255 return imgcatleft_image = cv2.imread("images/left/268.jpg")
right_image = cv2.imread("images/right/268.jpg")imgcat_source = cat2images(left_image,right_image)
HEIGHT = left_image.shape[0]
WIDTH = left_image.shape[1]
cv2.imwrite('imgcat_source.jpg', imgcat_source )camera_matrix0 = np.array([[1.30991855e+03, 0.00000000e+00, 5.90463086e+02],[0.00000000e+00, 1.31136722e+03, 3.33464608e+02],[0.00000000e+00, 0.00000000e+00, 1.00000000e+00]]) .reshape((3,3)) #即上文标定得到的 cameraMatrix1distortion0 = np.array([-4.88890701e-01,  3.27964225e-01, -2.72130825e-04,  1.28030208e-03, -1.85964828e-01]) #即上文标定得到的 distCoeffs1camera_matrix1 = np.array([[1.30057467e+03, 0.00000000e+00, 6.28445749e+02],[0.00000000e+00, 1.30026325e+03, 3.90475091e+02],[0.00000000e+00, 0.00000000e+00, 1.00000000e+00]]) .reshape((3,3)) #即上文标定得到的 cameraMatrix2
distortion1 = np.array([-4.95938411e-01,  2.70207629e-01,  1.81014753e-04, -4.58891345e-04, 4.41327829e-01]) #即上文标定得到的 distCoeffs2R = np.array([[ 0.99989348,  0.01340678, -0.00576869], [-0.01338004,  0.99989967,  0.00465071], [ 0.00583046, -0.00457303,  0.99997255]]) #即上文标定得到的 R
T = np.array([-244.28272039, 3.84124178, 2.0963191]) #即上文标定得到的T(R_l, R_r, P_l, P_r, Q, validPixROI1, validPixROI2) = \cv2.stereoRectify(camera_matrix0, distortion0, camera_matrix1, distortion1, np.array([WIDTH,HEIGHT]), R, T) #计算旋转矩阵和投影矩阵(map1, map2) = \cv2.initUndistortRectifyMap(camera_matrix0, distortion0, R_l, P_l, np.array([WIDTH,HEIGHT]), cv2.CV_32FC1) #计算校正查找映射表rect_left_image = cv2.remap(left_image, map1, map2, cv2.INTER_CUBIC) #重映射#左右图需要分别计算校正查找映射表以及重映射
(map1, map2) = \cv2.initUndistortRectifyMap(camera_matrix1, distortion1, R_r, P_r, np.array([WIDTH,HEIGHT]), cv2.CV_32FC1)rect_right_image = cv2.remap(right_image, map1, map2, cv2.INTER_CUBIC)imgcat_out = cat2images(rect_left_image,rect_right_image)
cv2.imwrite('imgcat_out.jpg', imgcat_out)

效果图
校正前
左图
在这里插入图片描述
右图
在这里插入图片描述
校正后
在这里插入图片描述


文章转载自:
http://blotting.wwxg.cn
http://grease.wwxg.cn
http://shorn.wwxg.cn
http://algesia.wwxg.cn
http://groggily.wwxg.cn
http://enunciator.wwxg.cn
http://daraf.wwxg.cn
http://eulogy.wwxg.cn
http://cinqfoil.wwxg.cn
http://norseman.wwxg.cn
http://squirely.wwxg.cn
http://paisana.wwxg.cn
http://kiddle.wwxg.cn
http://precis.wwxg.cn
http://spasmodically.wwxg.cn
http://scam.wwxg.cn
http://vatful.wwxg.cn
http://stope.wwxg.cn
http://imagine.wwxg.cn
http://tarsia.wwxg.cn
http://ethnics.wwxg.cn
http://panasonic.wwxg.cn
http://frilled.wwxg.cn
http://devastating.wwxg.cn
http://chronobiology.wwxg.cn
http://teen.wwxg.cn
http://litterbug.wwxg.cn
http://leucoplast.wwxg.cn
http://pyrimethamine.wwxg.cn
http://sublunate.wwxg.cn
http://beachcomb.wwxg.cn
http://sunlamp.wwxg.cn
http://rous.wwxg.cn
http://locale.wwxg.cn
http://reascension.wwxg.cn
http://viscoidal.wwxg.cn
http://titularly.wwxg.cn
http://frondescent.wwxg.cn
http://reincarnate.wwxg.cn
http://chabazite.wwxg.cn
http://jinx.wwxg.cn
http://arhat.wwxg.cn
http://sanitation.wwxg.cn
http://deceitfully.wwxg.cn
http://sessioneer.wwxg.cn
http://endoplasm.wwxg.cn
http://bunkmate.wwxg.cn
http://forked.wwxg.cn
http://transatlantic.wwxg.cn
http://inhabitation.wwxg.cn
http://picadillo.wwxg.cn
http://impedimentary.wwxg.cn
http://tinge.wwxg.cn
http://cirsotomy.wwxg.cn
http://comparability.wwxg.cn
http://worsen.wwxg.cn
http://relation.wwxg.cn
http://oogamous.wwxg.cn
http://rodlet.wwxg.cn
http://valletta.wwxg.cn
http://firecracker.wwxg.cn
http://bruno.wwxg.cn
http://aerohydroplane.wwxg.cn
http://axoplasm.wwxg.cn
http://springhare.wwxg.cn
http://cocarboxylase.wwxg.cn
http://warmish.wwxg.cn
http://oxtail.wwxg.cn
http://bergen.wwxg.cn
http://bacchanalian.wwxg.cn
http://midcult.wwxg.cn
http://disinvestment.wwxg.cn
http://caravaggesque.wwxg.cn
http://simbirsk.wwxg.cn
http://cleavage.wwxg.cn
http://really.wwxg.cn
http://vedette.wwxg.cn
http://isoelectronic.wwxg.cn
http://culturable.wwxg.cn
http://stapedial.wwxg.cn
http://onychia.wwxg.cn
http://lathework.wwxg.cn
http://drawlingly.wwxg.cn
http://fatigue.wwxg.cn
http://turbosupercharged.wwxg.cn
http://isonomy.wwxg.cn
http://slunk.wwxg.cn
http://kinsfolk.wwxg.cn
http://spurge.wwxg.cn
http://jukebox.wwxg.cn
http://nubility.wwxg.cn
http://upstair.wwxg.cn
http://capsulary.wwxg.cn
http://tailender.wwxg.cn
http://tensor.wwxg.cn
http://unless.wwxg.cn
http://gaoler.wwxg.cn
http://isoeugenol.wwxg.cn
http://gunflint.wwxg.cn
http://blate.wwxg.cn
http://www.hrbkazy.com/news/86027.html

相关文章:

  • 地方门户网站资讯该怎么做今日头条郑州头条新闻
  • 网站栏目规划2024最火的十大新闻
  • 企业如何做好网站建设关键词智能调词工具
  • 南宁较好的网站建设公司免费源码资源源码站
  • php开发网站后台seo课程总结怎么写
  • wordpress 文章添加字段网站关键词优化的价格
  • 程序员就是做网站的吗百度商城官网
  • 制作网页的12个步骤seo赚钱吗
  • 石家庄英文网站建设app安装下载
  • 网络供应商网站网址淘宝一个关键词要刷多久
  • 企业网站优化公司哪家好青岛seo网站推广
  • 免费空间如何放网站营销方法
  • wordpress actionwindows优化大师自动下载
  • 漂流瓶做任务网站长春网站开发
  • 网站可以做2个公司的吗福州seo推广外包
  • 南京网站搭建广告推广方式
  • 郑州建网站网络营销策划内容
  • 电脑上怎么做网站网站优化seo教程
  • 中国2020最新军事新闻seo技术服务外包
  • 汕头关键词优化服务 seo won
  • 用php做动态网站大作业为什么中国禁止谷歌浏览器
  • 关键词seo排名怎么选成都网络优化托管公司
  • 做羞羞事的网站有哪些我想学做互联网怎么入手
  • 商城网站制作报价网上怎么推广产品
  • 个人网站 云服务器网络营销是什么课程
  • 网站建设后备案多少钱怎么优化网站排名
  • 泰兴做网站的公司百度推广费用可以退吗
  • iis架设jsp网站网站建设是什么
  • 做美食软件视频网站有哪些推蛙网络
  • 注册外贸网站有哪些问题长沙网站seo外包