opencv/python标定时用到的几个函数意义

①criteria:迭代停止的模式选择,这是一个含有三个元素的元组型数。格式为(type,max_iter,epsilon)
其中,type又有两种选择:
—–cv2.TERM_CRITERIA_EPS :精确度(误差)满足epsilon停止。
—- cv2.TERM_CRITERIA_MAX_ITER:迭代次数超过max_iter停止。
—-cv2.TERM_CRITERIA_EPS+cv2.TERM_CRITERIA_MAX_ITER,两者合体,任意一个满足结束

如果对角点的精度有更高的要求,可以用cornerSubPix()函数将角点定位到子像素,从而取得亚像素级别的角点检测效果

cv2.cornerSubPix(image, corners, winSize, zeroZone, criteria)

函数参数说明如下:

image:输入图像

corners:输入角点的初始坐标以及精准化后的坐标用于输出。

winSize:搜索窗口边长的一半,例如如果winSize=Size(5,5),则一个大小为的搜索窗口将被使用。

 

zeroZone:搜索区域中间的dead region边长的一半,有时用于避免自相关矩阵的奇异性。如果值设为(-1,-1)则表示没有这个区域。
criteria:角点精准化迭代过程的终止条件。也就是当迭代次数超过criteria.maxCount,或者角点位置变化小于criteria.epsilon时,停止迭代过程。

Python:
retval, corners  =  cv.findChessboardCorners(image, patternSize, corners, flags)

Parameters
imageSource chessboard view. It must be an 8-bit grayscale or color image.
patternSize   Number of inner corners per a chessboard row and column ( patternSize = cvSize(points_per_row,points_per_colum) = cvSize(columns,rows)).
cornersOutput array of detected corners.
flagsVarious operation flags that can be zero or a combination of the following values:
  • CALIB_CB_ADAPTIVE_THRESH Use adaptive thresholding to convert the image to black and white, rather than a fixed threshold level (computed from the average image brightness).
  • CALIB_CB_NORMALIZE_IMAGE Normalize the image gamma with equalizeHist before applying fixed or adaptive thresholding.
  • CALIB_CB_FILTER_QUADS Use additional criteria (like contour area, perimeter, square-like shape) to filter out false quads extracted at the contour retrieval stage.
  • CALIB_CB_FAST_CHECK Run a fast check on the image that looks for chessboard corners, and shortcut the call if none is found. This can drastically speed up the call in the degenerate condition when no chessboard is observed.

numpy.zeros(shape, dtype=float, order='C')

Return a new array of given shape and type, filled with zeros.

Parameters:

shape : int or sequence of ints

Shape of the new array, e.g., (2, 3) or 2.

dtype : data-type, optional

The desired data-type for the array, e.g., numpy.int8. Default is numpy.float64.

order : {‘C’, ‘F’}, optional

Whether to store multidimensional data in C- or Fortran-contiguous (row- or column-wise) order in memory.

Returns:

out : ndarray

Array of zeros with the given shape, dtype, and order.

See also

zeros_like

Return an array of zeros with shape and type of input.

ones_like

Return an array of ones with shape and type of input.

empty_like

Return an empty array with shape and type of input.

ones

Return a new array setting values to one.

empty

Return a new uninitialized array.

⑤mgrid[ ]

⑥append()

⑦destroyAllwindows()

⑧wait()

OpenCV是一个开源的计算机视觉库,提供了丰富的图像处理和计算机视觉算法。在Python中使用OpenCV进行相机标定,可以使用圆形标定板来获取相机的内参和畸变参数。 相机标定是指确定相机的内参(如焦距、主点坐标)和畸变参数(如径向畸变、切向畸变)的过程。圆形标定板是一种常用的标定板,它由一系列等距离排列的圆形格点组成。 在进行相机标定,需要采集一组包含圆形标定板的图像。通过检测图像中的圆心和圆周,可以计算出每个圆的像素坐标。然后,利用这些像素坐标和已知的实际世界坐标,可以使用OpenCV提供的函数进行相机标定。 以下是使用OpenCV进行相机标定的步骤: 1. 准备圆形标定板:选择合适大小的圆形标定板,并确保每个圆的直径和间距都已知。 2. 采集图像:使用相机拍摄包含圆形标定板的多张图像。 3. 检测圆心和圆周:对每张图像进行处理,使用OpenCV函数检测圆心和圆周,并获取每个圆的像素坐标。 4. 设置实际世界坐标:为每个圆设置对应的实际世界坐标,可以使用标定板的尺寸和间距来计算。 5. 进行相机标定:使用OpenCV函数,将像素坐标和实际世界坐标传入,进行相机标定。 6. 获取相机参数:标定完成后,可以获取相机的内参和畸变参数,用于后续的图像处理和计算机视觉任务。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值