摄像头Camera 标定Calibration原理Theory
摄像头Camera 标定Calibration原理Theory
cv2.cameraCalibration
Pinhole camera calibration calls camera vision from 3D objects in the real world and transforms them into a 2D image.
摄像头标定这里指利用常规(小孔成像)摄像头观察真实三位物体对二维图像的矫正转换。

We named points from objects as objects point and points in image as image points.
3D的点被叫做物体点,而2D的图像点被叫做图像点。
To calibrate camera, we need to undistort radial distortion and tangential distortion.
Radial Distortion: Radial Distortion is the most common type that affects the images, In which when a camera captured pictures of straight lines appeared slightly curved or bent.
Tangential distortion: Tangential distortion occurs mainly because the lens is not parallely aligned to the imaging plane, that makes the image to be extended a little while longer or tilted, it makes the objects appear farther away or even closer than they actually are.
摄像头标定矫正主要解决径向畸变和切向畸变。
径向畸变是图像像素点以畸变中心为中心点,沿着径向产生的位置偏差,从而导致图像中所成的像发生形变。
图像径向畸变是成像过程中最主要的畸变,同时也是对成像效果影响最大的畸变,广角或者鱼眼的畸变效果,

矫正算法采用多项式拟合:

切向畸变,这是由于透镜与成像平面不可能绝对平行造成的。
这种畸变会造成图像中的某些点看上去的位置会比我们认为的位置要近一些。


Five Distortion Coefficients 五个畸变系数:


In math, the Transformation from 3D object points, P of X, Y and Z to X and Y is done by a transformative matrix called the camera matrix(C), we’ll be using this to calibrate the camera.
max = 摄像机矩阵 = 摄像机的内部参数(焦距和光学中心)
内部参数是摄像机本身具有的,包括的信息有焦距(f x ,f y ),光学中心(c x ,c y )。

dist = 外部参数(旋转和变换向量)
外部参数与旋转和变换向量相对应,它可以将 3D 点的坐标转换到坐标系统中。
It’s recommended to use at least 20 images to get a reliable calibration, For this, we have a lot of images here, each chess board has eight by six corners to detect
于是必须要提供一些包含明显图案模式的样本棋盘图片,一般至少需要 10 个(部分中文资料)建议20个这样的图案模式。

or

where
(X, Y, Z) are the coordinates of a 3D point in the world coordinate space
(u, v) are the coordinates of the projection point in pixels
A is a camera matrix, or a matrix of intrinsic parameters
(cx, cy) is a principal point that is usually at the image center
fx, fy are the focal lengths expressed in pixel units.
A chessboard is great for calibration because it's regular, high contrast pattern makes it easy to detect automatically. And we know how an undistorted flat chessboard looks like. So, if we use our camera to take pictures of Chessboard at different angles
棋盘主要是通过角点来计算畸变,

import numpy as np
import cv2, glob
calibrate_source_path = './data/camera_cal/*.jpg'
calibrate_test_path = './data/test_image.jpg'
# define
objpoints = []
imgpoints = []
nx = 8
ny = 6
objp = np.zeros((ny*nx,3),np.float32)
objp[:,:2] = np.mgrid[0:nx,0:ny].T.reshape(-1,2)
# chessboard
for path in glob.glob(calibrate_source_path):
gray = cv2.cvtColor(cv2.imread(path),cv2.COLOR_BGR2GRAY)
ret,corners = cv2.findChessboardCorners(gray,(nx,ny))
if ret:
objpoints.append(objp)
imgpoints.append(corners);
# gray = cv2.drawChessboardCorners(gray, (nx,ny), corners, ret)
# execute
img = cv2.imread(calibrate_test_path)
ret, mtx, dist, rvecs, tvecs = cv2.calibrateCamera(objpoints, imgpoints, img.shape[1:], None, None)
dst = cv2.undistort(img, mtx, dist, None, mtx)
# display
cv2.imshow(None, cv2.pyrDown(np.hstack((img,dst))))
cv2.waitKey(0); cv2.destroyAllWindows()
摄像头Camera 标定Calibration原理Theory的更多相关文章
- Android中直播视频技术探究之---采集摄像头Camera视频源数据进行推流(采用金山云SDK)
一.前言 在之前已经详细介绍了Android中的一种视频数据源:Camera,不了解的同学可以点击进入:Android中Camera使用详解 ,在这篇文章中我们介绍了如何采集摄像头的每一帧数据,然后进 ...
- Android中直播视频技术探究之---摄像头Camera视频源数据采集解析
一.前言 在视频直播中一般都是两种视频数据源,一个是摄像头数据,一个是录制桌面数据,而一般来说美女妹子直播都是来自于摄像头数据,游戏直播都是录制桌面数据的,那么今天就来看看第一个数据源数据采集分析,A ...
- Camera Calibration 相机标定:原理简介(五)
5 基于2D标定物的标定方法 基于2D标定物的标定方法,原理与基于3D标定物相同,只是通过相机对一个平面进行成像,就可得到相机的标定参数,由于标定物为平面,本身所具有的约束条机,相对后者标定更为简单. ...
- Camera Calibration 相机标定:原理简介(一)
1 相机标定常见方法 广义来说,相机标定不单包括成像过程的几何关系标定,还包括辐射关系的标定,本文只探讨几何关系.相机标定是3D计算机视觉(Computer Vision)里从2D图像中提取量测信息的 ...
- Camera Calibration 相机标定:原理简介(四)
4 基于3D标定物的标定方法 使用基于3D标定物进行相机标定,是一种传统且常见的相机标定法.3D标定物在不同应用场景下不尽相同,摄影测量学中,使用的3D标定物种类最为繁杂,如图-1的室内控制场,由多条 ...
- Camera Calibration 相机标定:原理简介(二)
2 针孔相机模型 常见的相机标定中,使用的相机多为针孔相机(Pinhole camera),也就是大家熟知的小孔成像理论.将其中涉及的坐标系之间的相互转换抽离出来,即为针孔相机模型的核心. 上图所示的 ...
- Camera Calibration 相机标定:原理简介(三)
3 绝对圆锥曲线 在进一步了解相机标定前,有必要了解绝对圆锥曲线(Absolute Conic)这一概念. 对于一个3D空间的点x,其投影空间的坐标为:x~=[x1,x2,x3,x4]T.我们定义无穷 ...
- android摄像头(camera)之 v4l2的c测试代码【转】
转自:https://blog.csdn.net/ldswfun/article/details/8745577 在移植android hal的过程中,移植的首要任务是要确保驱动完好,camera是属 ...
- android摄像头(camera)之buffer管理
一,V4L2驱动申请buffer 视频应用可以通过两种方式从V4L2驱动申请buffer 1. V4L2_MEMORY_USERPTR方式, 顾名思义是用户空间指针的意思,应用层负责分配需要的内存空间 ...
随机推荐
- odoo字段属性列举
罗列一些Odoo中的字段属性,基本包含大部分的属性. 常用字段属性 平平无奇常用字段属性 string:字段的标题,在UI视图标签中使用.它是可选项,如未设置,会通过首字母大写及将空格替换成为下划线来 ...
- 5-tcp套接字服务端编程
import socket 1.创建套接字 sockfd= socket.socket(socket_family = AF_INIT,socket_type=SOCK_STREAM,proto) 功 ...
- php自定义配置文件简单写法
1 <?php 2 header("Content-type:text/html;charset=utf-8"); 3 4 $q = getconfig('rr'); 5 e ...
- mac系统 PHP Nginx环境变量修改
场景:php默认的环境变量不是我们实际工作中想要的 执行命令:which php 查看默认的php指向的目录 : /usr/bin/php 修改· ~/.bash_profile 文件 添加php环 ...
- hdu 1814 字典序最小的2sat(暴力深搜)
题意: 题意就是最基础的2sat,关系只有矛盾关系,然后二选一,关键是这个题目是输出字典序最小的那组解. 思路: 输出字典序最小,用强连通那个实现不了(起码没看到有人实现),其实我 ...
- hdu4450 不错的贪心
题意: 卡片游戏 Time Limit: 3000/1000 MS (Java/Others) Memory Limit: 65535/32768 K (Java/Others) Total S ...
- Hydra暴力破解工具的用法
目录 Hydra 常见参数 破解SSH 破解FTP 破解HTTP 破解3389远程登录 Kali自带密码字典 dirb dirbuster fern-wifi metasploit wfuzz Hyd ...
- UVA11997求前k个和,多路归并问题
题意: 给你一个二维矩阵,n*n的,每次从每一行中拿出来一个,然后加起来组成一个和,一共可以得到n^n个和,要求求出这n^n个和中最小的那n个和. 思路: 多路归并问题,先说下多路 ...
- Windows下包管理工具Bower的安装和使用
目录 安装Bower Bower的使用 安装Bower Windows下安装Bower之前,先安装好 nodejs 和 msysgit 环境 然后我们就可以使用npm包管理工具下载并全局安装bower ...
- Node-RESTful
//获取用户列表------------------------------------------------- var express = require('express'); var app ...