CN118657841B - Camera calibration method, device and electronic equipment - Google Patents
Camera calibration method, device and electronic equipment Download PDFInfo
- Publication number
- CN118657841B CN118657841B CN202411140630.9A CN202411140630A CN118657841B CN 118657841 B CN118657841 B CN 118657841B CN 202411140630 A CN202411140630 A CN 202411140630A CN 118657841 B CN118657841 B CN 118657841B
- Authority
- CN
- China
- Prior art keywords
- marking
- calibration plate
- point
- camera
- image
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Active
Links
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T7/00—Image analysis
- G06T7/80—Analysis of captured images to determine intrinsic or extrinsic camera parameters, i.e. camera calibration
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T3/00—Geometric image transformations in the plane of the image
- G06T3/02—Affine transformations
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T2207/00—Indexing scheme for image analysis or image enhancement
- G06T2207/10—Image acquisition modality
- G06T2207/10004—Still image; Photographic image
-
- Y—GENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
- Y02—TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
- Y02P—CLIMATE CHANGE MITIGATION TECHNOLOGIES IN THE PRODUCTION OR PROCESSING OF GOODS
- Y02P90/00—Enabling technologies with a potential contribution to greenhouse gas [GHG] emissions mitigation
- Y02P90/30—Computing systems specially adapted for manufacturing
Landscapes
- Engineering & Computer Science (AREA)
- Physics & Mathematics (AREA)
- General Physics & Mathematics (AREA)
- Theoretical Computer Science (AREA)
- Computer Vision & Pattern Recognition (AREA)
- Length Measuring Devices By Optical Means (AREA)
Abstract
本申请涉及一种相机标定方法、装置和电子设备。其通过获取与作业平台对应的标定板,并获取各待标定相机采集的对应视野范围内的第一图像,根据第一图像中部分圆环标记区域的像素坐标确定标定板的中心点的像素位置,基于标定板的中心点的像素位置提取部分标记点区域中每个标记点的像素坐标,并确定每个标记点位于标定板中的行列坐标信息,根据每个标记点的像素坐标以及位于标定板中的行列坐标信息,确定相应待标定相机的标定参数。其通过利用标定板中的圆环标记确定标定板中心点在图像拓展区域中的像素位置,并据此确定相机的标定参数,整个流程无需人工干预,不仅能够提高标定效率,且避免了因人工操作所导致的错误。
The present application relates to a camera calibration method, device and electronic device. It obtains a calibration plate corresponding to the working platform, and obtains the first image within the corresponding field of view collected by each camera to be calibrated, determines the pixel position of the center point of the calibration plate according to the pixel coordinates of the partial circular ring mark area in the first image, extracts the pixel coordinates of each marking point in the partial marking point area based on the pixel position of the center point of the calibration plate, and determines the row and column coordinate information of each marking point in the calibration plate, and determines the calibration parameters of the corresponding camera to be calibrated according to the pixel coordinates of each marking point and the row and column coordinate information in the calibration plate. It determines the pixel position of the center point of the calibration plate in the image expansion area by using the circular ring mark in the calibration plate, and determines the calibration parameters of the camera accordingly. The entire process does not require manual intervention, which not only improves the calibration efficiency, but also avoids errors caused by manual operation.
Description
技术领域Technical Field
本申请涉及相机标定技术领域,特别是涉及一种相机标定方法、装置和电子设备。The present application relates to the technical field of camera calibration, and in particular to a camera calibration method, device and electronic equipment.
背景技术Background Art
在现代工业生产中,自动化视觉模块的应用越来越广泛,尤其是在非标准自动化机台中,视觉模块的标定工作尤为重要。视觉模块的标定是指通过一定的方法和算法,将摄像机获取的图像信息转化为实际的物理空间信息,以便于进行后续的测量和控制。在这个过程中,需要对视觉模块进行精确的参数设置和校准,以确保其能够准确地获取和处理图像信息。In modern industrial production, the application of automated vision modules is becoming more and more widespread, especially in non-standard automated machines, where the calibration of vision modules is particularly important. The calibration of vision modules refers to the process of converting the image information acquired by the camera into actual physical space information through certain methods and algorithms, so as to facilitate subsequent measurement and control. In this process, the vision module needs to be accurately parameterized and calibrated to ensure that it can accurately acquire and process image information.
传统技术中,视觉模块的标定通常需要由专业的校准人员进行长时间的操作和监督。首先需要通过校准人员手动设置视觉模块的各种参数,然后通过大量的数据进行人工验证,以确保标定的准确性。这种方法虽然可以得到较为准确的标定结果,但是耗时耗力,效率低下,且对校准人员的专业技能和经验要求较高。In traditional technology, the calibration of vision modules usually requires long-term operation and supervision by professional calibrators. First, the calibrators need to manually set various parameters of the vision module, and then manually verify through a large amount of data to ensure the accuracy of the calibration. Although this method can obtain relatively accurate calibration results, it is time-consuming, labor-intensive, inefficient, and requires high professional skills and experience from the calibrators.
发明内容Summary of the invention
基于此,有必要针对上述技术问题,提供一种能够自动标定的相机标定方法、装置、电子设备、计算机可读存储介质和计算机程序产品。Based on this, it is necessary to provide a camera calibration method, device, electronic device, computer-readable storage medium and computer program product that can automatically calibrate in order to solve the above technical problems.
第一方面,本申请提供了一种相机标定方法,所述方法用于无重叠视野的多台相机的自动标定,所述多台相机相对于作业平台环形布局,所述方法包括:In a first aspect, the present application provides a camera calibration method, the method being used for automatic calibration of multiple cameras with non-overlapping fields of view, the multiple cameras being arranged in a ring relative to a work platform, the method comprising:
获取与所述作业平台对应的标定板,所述标定板上包括标记点区域和设置在所述标记点区域外圈的圆环标记,所述圆环标记的环心与所述标定板的中心点重合,所述标记点区域设置有行列均匀排布的多个标记点;Obtain a calibration plate corresponding to the work platform, wherein the calibration plate includes a marking point area and a circular ring mark arranged on the outer circle of the marking point area, the center of the circular ring mark coincides with the center point of the calibration plate, and the marking point area is provided with a plurality of marking points evenly arranged in rows and columns;
获取各待标定相机采集的对应视野范围内的第一图像,所述第一图像包括部分标记点区域和部分圆环标记区域;Acquire a first image within a corresponding field of view captured by each camera to be calibrated, wherein the first image includes a partial marking point area and a partial ring marking area;
根据所述第一图像中部分圆环标记区域的像素坐标确定所述标定板的中心点的像素位置,所述标定板的中心点位于待标定相机的视野范围外;Determining the pixel position of the center point of the calibration plate according to the pixel coordinates of the partial circular ring marked area in the first image, wherein the center point of the calibration plate is outside the field of view of the camera to be calibrated;
基于所述标定板的中心点的像素位置提取所述部分标记点区域中每个标记点的像素坐标,并确定每个所述标记点位于所述标定板中的行列坐标信息;Extracting the pixel coordinates of each marking point in the partial marking point area based on the pixel position of the center point of the calibration plate, and determining the row and column coordinate information of each marking point in the calibration plate;
根据所述部分标记点区域中每个所述标记点的像素坐标以及每个所述标记点位于所述标定板中的行列坐标信息,确定相应的待标定相机的标定参数。According to the pixel coordinates of each of the marking points in the partial marking point area and the row and column coordinate information of each of the marking points in the calibration plate, the calibration parameters of the corresponding camera to be calibrated are determined.
在其中一个实施例中,所述根据所述第一图像中部分圆环标记区域的像素坐标确定所述标定板的中心点的像素位置,包括:提取所述部分圆环标记区域中位于内环上的像素坐标以及位于外环上的像素坐标;对所述内环上的像素坐标以及所述外环上的像素坐标进行拟合,得到拟合后的环心坐标;将所述环心坐标确定为所述标定板的中心点的像素位置。In one embodiment, determining the pixel position of the center point of the calibration plate based on the pixel coordinates of the partial circular ring marked area in the first image includes: extracting the pixel coordinates located on the inner ring and the pixel coordinates located on the outer ring in the partial circular ring marked area; fitting the pixel coordinates on the inner ring and the pixel coordinates on the outer ring to obtain the fitted ring center coordinates; and determining the ring center coordinates as the pixel position of the center point of the calibration plate.
在其中一个实施例中,所述确定每个所述标记点位于所述标定板中的行列坐标信息,包括:根据所述部分标记点区域中每个所述标记点的像素坐标,对每个所述标记点进行行列排序,得到排序结果;根据所述排序结果,获取对应的行间距和列间距;根据每个所述标记点的像素坐标、所述标定板的中心点的像素位置、所述行间距和所述列间距,获取每个所述标记点位于所述标定板中的行列坐标信息。In one embodiment, determining the row and column coordinate information of each marking point located in the calibration plate includes: sorting each marking point in rows and columns according to the pixel coordinates of each marking point in the partial marking point area to obtain a sorting result; obtaining the corresponding row spacing and column spacing according to the sorting result; obtaining the row and column coordinate information of each marking point located in the calibration plate according to the pixel coordinates of each marking point, the pixel position of the center point of the calibration plate, the row spacing and the column spacing.
在其中一个实施例中,所述标记点中包括预先设置的参考标记点;所述根据所述部分标记点区域中每个所述标记点的像素坐标,对每个所述标记点进行行列排序,得到排序结果,包括:识别所述标记点中所述参考标记点的像素坐标;基于所述参考标记点的像素坐标,对每个所述标记点进行旋转;根据旋转后的所述标记点的像素坐标对应的水平方向坐标的大小和竖直方向坐标的大小对所述标记点进行排序,得到排序结果。In one of the embodiments, the marking points include pre-set reference marking points; and according to the pixel coordinates of each marking point in the partial marking point area, each marking point is sorted in rows and columns to obtain a sorting result, including: identifying the pixel coordinates of the reference marking point among the marking points; rotating each marking point based on the pixel coordinates of the reference marking point; and sorting the marking points according to the size of the horizontal coordinates and the size of the vertical coordinates corresponding to the pixel coordinates of the rotated marking points to obtain a sorting result.
在其中一个实施例中,所述标记点中包括预先设置的参考标记点,所述参考标记点具有预设的坐标特征;所述确定每个所述标记点位于所述标定板中的行列坐标信息之后,所述方法还包括:识别所述标记点中所述参考标记点的行列坐标信息;在所述参考标记点的行列坐标信息不满足预设的坐标特征的情况下,调整所述待标定相机的参数;获取调整参数后的待标定相机采集的对应视野范围内的第一图像,并返回执行所述根据所述第一图像中部分圆环标记区域的像素坐标确定所述标定板的中心点的像素位置的步骤,直到所述参考标记点的行列坐标信息满足预设的坐标特征,根据所述部分标记点区域中每个所述标记点的像素坐标以及每个所述标记点位于所述标定板中的行列坐标信息,对相应的待标定相机进行标定。In one embodiment, the marking points include pre-set reference marking points, and the reference marking points have preset coordinate characteristics; after determining the row and column coordinate information of each of the marking points in the calibration plate, the method further includes: identifying the row and column coordinate information of the reference marking points in the marking points; when the row and column coordinate information of the reference marking points does not meet the preset coordinate characteristics, adjusting the parameters of the camera to be calibrated; acquiring the first image within the corresponding field of view captured by the camera to be calibrated after the parameters are adjusted, and returning to execute the step of determining the pixel position of the center point of the calibration plate according to the pixel coordinates of the partial circular marking area in the first image, until the row and column coordinate information of the reference marking points meets the preset coordinate characteristics, and calibrating the corresponding camera to be calibrated according to the pixel coordinates of each of the marking points in the partial marking point area and the row and column coordinate information of each of the marking points in the calibration plate.
在其中一个实施例中,所述确定每个所述标记点位于所述标定板中的行列坐标信息之后,所述方法还包括:根据所述部分标记点区域中每个所述标记点的像素坐标以及每个所述标记点位于所述标定板中的行列坐标信息,确定所述待标定相机的像素坐标到标定板坐标系的仿射变换关系;基于所述仿射变换关系,将对应待标定相机采集的第一图像中部分圆环标记区域中位于外环上的像素坐标进行仿射变换,得到变换后的坐标点集;对所述坐标点集进行拟合,得到拟合后的圆心坐标;获取所述坐标点集中每一个坐标点与所述圆心坐标之间的标准差;在所述标准差大于设定阈值的情况下,调整所述待标定相机的参数;获取调整参数后的待标定相机采集的对应视野范围内的第一图像,并返回执行所述根据所述第一图像中部分圆环标记区域的像素坐标确定所述标定板的中心点的像素位置的步骤,直到所述标准差小于或等于设定阈值,根据所述部分标记点区域中每个所述标记点的像素坐标以及每个所述标记点位于所述标定板中的行列坐标信息,对相应的待标定相机进行标定。In one of the embodiments, after determining the row and column coordinate information of each of the marking points in the calibration plate, the method further includes: determining the affine transformation relationship from the pixel coordinates of the camera to be calibrated to the calibration plate coordinate system according to the pixel coordinates of each of the marking points in the partial marking point area and the row and column coordinate information of each of the marking points in the calibration plate; based on the affine transformation relationship, performing an affine transformation on the pixel coordinates located on the outer ring in the partial circular ring marking area in the first image captured by the camera to be calibrated to obtain a transformed coordinate point set; fitting the coordinate point set to obtain the fitted center coordinates; and obtaining The method comprises the following steps: determining a standard deviation between each coordinate point in the coordinate point set and the coordinates of the center of the circle; adjusting the parameters of the camera to be calibrated when the standard deviation is greater than a set threshold; obtaining a first image within the corresponding field of view acquired by the camera to be calibrated after adjusting the parameters, and returning to execute the step of determining the pixel position of the center point of the calibration plate according to the pixel coordinates of the partial circular ring marked area in the first image until the standard deviation is less than or equal to the set threshold, and calibrating the corresponding camera to be calibrated according to the pixel coordinates of each marked point in the partial marked point area and the row and column coordinate information of each marked point in the calibration plate.
在其中一个实施例中,所述确定相应的待标定相机的标定参数之后,所述方法还包括:在所述作业平台中运动轴位于初始位置处,获取待标定相机采集的对应视野范围内的第二图像,所述初始位置包括所述运动轴相对第一方向的位置和相对第二方向的位置;基于所述待标定相机的标定参数对所述第二图像进行仿射变换,确定所述第二图像中每个标记点位于所述标定板中的行列号和对应的第一坐标;控制所述运动轴相对于所述第一方向运动第一设定距离,获取待标定相机采集的对应视野范围内的第三图像,并确定与所述行列号对应的相同标记点的第二坐标;根据所述相同标记点的第一坐标、第二坐标以及所述第一设定距离,确定所述运动轴相对于所述第一方向运动的第一方向单位运动向量;控制所述运动轴相对于所述第二方向运动第二设定距离,获取待标定相机采集的对应视野范围内的第四图像,并确定与所述行列号对应的相同标记点的第三坐标;根据所述相同标记点的第一坐标、第三坐标以及所述第二设定距离,确定所述运动轴相对于所述第二方向运动的第二方向单位运动向量。In one embodiment, after determining the calibration parameters of the corresponding camera to be calibrated, the method further includes: the motion axis is located at an initial position in the work platform, and a second image in a corresponding field of view captured by the camera to be calibrated is obtained, wherein the initial position includes the position of the motion axis relative to the first direction and the position relative to the second direction; based on the calibration parameters of the camera to be calibrated, an affine transformation is performed on the second image to determine the row and column numbers and the corresponding first coordinates of each mark point in the second image located in the calibration plate; the motion axis is controlled to move a first set distance relative to the first direction, and a third image in a corresponding field of view captured by the camera to be calibrated is obtained, and a second coordinate of the same mark point corresponding to the row and column number is determined; according to the first coordinate, the second coordinate and the first set distance of the same mark point, a first direction unit motion vector of the motion axis relative to the first direction is determined; the motion axis is controlled to move a second set distance relative to the second direction, and a fourth image in a corresponding field of view captured by the camera to be calibrated is obtained, and a third coordinate of the same mark point corresponding to the row and column number is determined; according to the first coordinate, the third coordinate and the second set distance of the same mark point, a second direction unit motion vector of the motion axis relative to the second direction is determined.
在其中一个实施例中,所述标记点中包括预先设置的参考标记点;所述确定相应的待标定相机的标定参数之后,所述方法还包括:控制所述作业平台的运动轴进行旋转,分别获取所述待标定相机采集的旋转前的图像和旋转后的图像;基于所述待标定相机的标定参数对所述旋转前的图像和所述旋转后的图像分别进行仿射变换,获取所述旋转前的图像和所述旋转后的图像中目标参考标记点分别位于所述标定板的坐标信息;对所述目标参考标记点分别位于所述标定板的坐标信息进行拟合,确定所述作业平台的旋转中心的位置。In one of the embodiments, the marking points include pre-set reference marking points; after determining the calibration parameters of the corresponding camera to be calibrated, the method further includes: controlling the motion axis of the work platform to rotate, and respectively obtaining the image before rotation and the image after rotation captured by the camera to be calibrated; performing affine transformation on the image before rotation and the image after rotation based on the calibration parameters of the camera to be calibrated, and obtaining the coordinate information of the target reference marking points in the image before rotation and the image after rotation respectively located on the calibration plate; fitting the coordinate information of the target reference marking points respectively located on the calibration plate, and determining the position of the rotation center of the work platform.
第二方面,本申请还提供了一种相机标定装置,所述装置用于无重叠视野的多台相机的自动标定,所述多台相机相对于作业平台环形布局,所述装置包括:In a second aspect, the present application further provides a camera calibration device, which is used for automatic calibration of multiple cameras with non-overlapping fields of view, wherein the multiple cameras are arranged in a ring relative to a work platform, and the device comprises:
标定板获取模块,用于获取与所述作业平台对应的标定板,所述标定板上包括标记点区域和设置在所述标记点区域外圈的圆环标记,所述圆环标记的环心与所述标定板的中心点重合,所述标记点区域设置有行列均匀排布的多个标记点;A calibration plate acquisition module, used to acquire a calibration plate corresponding to the work platform, wherein the calibration plate includes a marking point area and a circular ring mark arranged on the outer circle of the marking point area, the center of the circular ring mark coincides with the center point of the calibration plate, and the marking point area is provided with a plurality of marking points evenly arranged in rows and columns;
图像获取模块,用于获取各待标定相机采集的对应视野范围内的第一图像,所述第一图像包括部分标记点区域和部分圆环标记区域;An image acquisition module, used to acquire a first image within a corresponding field of view captured by each camera to be calibrated, wherein the first image includes a partial marking point area and a partial ring marking area;
中心点确定模块,用于根据所述第一图像中部分圆环标记区域的像素坐标确定所述标定板的中心点的像素位置,所述标定板的中心点位于待标定相机的视野范围外;A center point determination module, used to determine the pixel position of the center point of the calibration plate according to the pixel coordinates of the partial circular ring marked area in the first image, wherein the center point of the calibration plate is outside the field of view of the camera to be calibrated;
坐标转换模块,用于基于所述标定板的中心点的像素位置提取所述部分标记点区域中每个标记点的像素坐标,并确定每个所述标记点位于所述标定板中的行列坐标信息;A coordinate conversion module, used to extract the pixel coordinates of each marking point in the partial marking point area based on the pixel position of the center point of the calibration plate, and determine the row and column coordinate information of each marking point in the calibration plate;
标定参数确定模块,用于根据所述部分标记点区域中每个所述标记点的像素坐标以及每个所述标记点位于所述标定板中的行列坐标信息,确定相应的待标定相机的标定参数。The calibration parameter determination module is used to determine the calibration parameters of the corresponding camera to be calibrated according to the pixel coordinates of each of the marking points in the partial marking point area and the row and column coordinate information of each of the marking points in the calibration plate.
第三方面,本申请还提供了一种电子设备,包括存储器和处理器,所述存储器存储有计算机程序,所述处理器执行所述计算机程序时实现上述的方法的步骤。In a third aspect, the present application further provides an electronic device, comprising a memory and a processor, wherein the memory stores a computer program, and the processor implements the steps of the above method when executing the computer program.
第四方面,本申请还提供了一种计算机可读存储介质,其上存储有计算机程序,所述计算机程序被处理器执行时实现上述的方法的步骤。In a fourth aspect, the present application further provides a computer-readable storage medium having a computer program stored thereon, wherein the computer program implements the steps of the above method when executed by a processor.
第五方面,本申请还提供了一种计算机程序产品,包括计算机程序,所述计算机程序被处理器执行时实现上述的方法的步骤。In a fifth aspect, the present application also provides a computer program product, including a computer program, which implements the steps of the above method when executed by a processor.
上述相机标定方法、装置、电子设备、计算机可读存储介质和计算机程序产品,通过获取与作业平台对应的标定板,并获取各待标定相机采集的对应视野范围内的第一图像,根据第一图像中部分圆环标记区域的像素坐标确定标定板的中心点的像素位置,基于标定板的中心点的像素位置提取部分标记点区域中每个标记点的像素坐标,并确定每个标记点位于标定板中的行列坐标信息,根据部分标记点区域中每个标记点的像素坐标以及每个标记点位于标定板中的行列坐标信息,确定相应的待标定相机的标定参数。其通过利用标定板中的圆环标记确定标定板中心点在图像拓展区域中的像素位置,并据此确定相机的标定参数,整个流程无需人工干预,不仅能够提高标定效率,且避免了因人工操作所导致的错误。The camera calibration method, device, electronic device, computer-readable storage medium and computer program product described above obtain a calibration plate corresponding to the work platform and obtain a first image within the corresponding field of view captured by each camera to be calibrated, determine the pixel position of the center point of the calibration plate according to the pixel coordinates of the partial circular ring mark area in the first image, extract the pixel coordinates of each mark point in the partial mark point area based on the pixel position of the center point of the calibration plate, and determine the row and column coordinate information of each mark point in the calibration plate, and determine the calibration parameters of the corresponding camera to be calibrated according to the pixel coordinates of each mark point in the partial mark point area and the row and column coordinate information of each mark point in the calibration plate. It determines the pixel position of the center point of the calibration plate in the image expansion area by using the circular ring mark in the calibration plate, and determines the calibration parameters of the camera accordingly. The entire process does not require manual intervention, which not only improves the calibration efficiency, but also avoids errors caused by manual operation.
附图说明BRIEF DESCRIPTION OF THE DRAWINGS
为了更清楚地说明本申请实施例或相关技术中的技术方案,下面将对本申请实施例或相关技术描述中所需要使用的附图作简单地介绍,显而易见地,下面描述中的附图仅仅是本申请的一些实施例,对于本领域普通技术人员来讲,在不付出创造性劳动的前提下,还可以根据这些附图获得其他相关的附图。In order to more clearly illustrate the technical solutions in the embodiments of the present application or related technologies, the drawings required for use in the embodiments of the present application or related technical descriptions will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other related drawings can be obtained based on these drawings without paying creative work.
图1为一个实施例中相机标定方法的应用环境图;FIG1 is a diagram of an application environment of a camera calibration method according to an embodiment;
图2为一个实施例中相机标定方法的流程示意图;FIG2 is a schematic diagram of a flow chart of a camera calibration method in one embodiment;
图3A为一个实施例中标定板的示意图;FIG3A is a schematic diagram of a calibration plate in one embodiment;
图3B为另一个实施例中标定板的示意图;FIG3B is a schematic diagram of a calibration plate in another embodiment;
图4为一个实施例中图像映射示意图;FIG4 is a schematic diagram of image mapping in one embodiment;
图5为一个实施例中确定标记点行列坐标信息步骤的流程示意图;FIG5 is a schematic diagram of a flow chart of a step of determining row and column coordinate information of a marking point in one embodiment;
图6为一个实施例中对标记点排序示意图;FIG6 is a schematic diagram of sorting marking points in one embodiment;
图7为一个实施例中作业平台运动比例标定步骤的流程示意图;FIG7 is a schematic flow chart of a step of calibrating the motion ratio of a working platform in one embodiment;
图8为一个实施例中相机标定装置的结构框图;FIG8 is a structural block diagram of a camera calibration device in one embodiment;
图9为一个实施例中电子设备的内部结构图。FIG. 9 is a diagram showing the internal structure of an electronic device in one embodiment.
具体实施方式DETAILED DESCRIPTION
为了使本申请的目的、技术方案及优点更加清楚明白,以下结合附图及实施例,对本申请进行进一步详细说明。应当理解,此处描述的具体实施例仅仅用以解释本申请,并不用于限定本申请。In order to make the purpose, technical solution and advantages of the present application more clearly understood, the present application is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application.
本申请实施例提供的相机标定方法,可以应用于如图1所示的应用环境中。其中,多台相机相对于作业平台环形布局,图中以作业平台为圆形作业台为例,各相机的成像面(即相机视野)与作业平台的作业面平行,且各相机的视野不重叠。本申请的方法用于对各相机进行自动标定,而无需人工示教。The camera calibration method provided in the embodiment of the present application can be applied to the application environment as shown in FIG1. Among them, multiple cameras are arranged in a ring relative to the work platform. In the figure, the work platform is a circular work platform as an example. The imaging surface (i.e., the camera field of view) of each camera is parallel to the work surface of the work platform, and the field of view of each camera does not overlap. The method of the present application is used to automatically calibrate each camera without manual teaching.
在一个实施例中,如图2所示,提供了一种相机标定方法,该方法包括以下步骤:In one embodiment, as shown in FIG2 , a camera calibration method is provided, the method comprising the following steps:
步骤202,获取与作业平台对应的标定板。Step 202, obtaining a calibration plate corresponding to the work platform.
其中,标定板是一种用于相机标定的工具,它通常包含一系列已知几何图案。标定板用于帮助确定相机的内部参数(焦距、主点坐标等)和外部参数(相机相对于标定板的位置和方向)。在本实施例中,标定板与作业平台的大小相当,形状相同。例如,若作业平台为圆形,标定板则可以是与其对应大小的圆形。Among them, the calibration plate is a tool used for camera calibration, which usually contains a series of known geometric patterns. The calibration plate is used to help determine the internal parameters (focal length, principal point coordinates, etc.) and external parameters (position and orientation of the camera relative to the calibration plate) of the camera. In this embodiment, the calibration plate is of the same size and shape as the work platform. For example, if the work platform is circular, the calibration plate can be a circle of the corresponding size.
具体地,如图3A和图3B所示,标定板上包括标记点区域和设置在标记点区域外圈的圆环标记,圆环标记的环心与标定板的中心点重合,且标记点区域设置有行列均匀排布的多个标记点mark。mark的大小和形状可以基于相机的视野进行设置,例如,mark可以设置为圆形或方形等。在本实施例中以mark为圆形,为适应相机视野其直径为1mm为例,其行列间距可以设置为2mm。其中记标定板中心点的真值坐标为(0,0),按行为X,列为Y方向建立笛卡尔坐标系,每个mark的真值坐标即为该mark中心到标定板中心的距离,当mark的真值坐标具有预设的坐标特征时,可以将mark中心挖去直径为0.5mm的圆,形成空心mark,即形成参考标记点。具体地,坐标特征可以是mark的真值坐标所对应的规律,例如可以在mark的真值坐标为10的倍数时将其确定为参考标记点。此外,在标记点区域的外圈设置有圆环标记,该圆环标记的宽度为2mm,且该圆环标记的环心与标定板的中心点重合。可以理解的是,以上标定板的参数设置是为了更好的理解本申请的方案,其可以基于实际应用场景如作业平台的形状、大小以及相机视野的大小进行调整适配。Specifically, as shown in FIG. 3A and FIG. 3B , the calibration plate includes a marking point area and a circular mark arranged on the outer circle of the marking point area, the center of the circular mark coincides with the center point of the calibration plate, and the marking point area is provided with a plurality of marking points marks arranged evenly in rows and columns. The size and shape of the mark can be set based on the field of view of the camera, for example, the mark can be set to be circular or square, etc. In this embodiment, the mark is circular, and its diameter is 1 mm to adapt to the field of view of the camera, and its row and column spacing can be set to 2 mm. The true value coordinate of the center point of the calibration plate is recorded as (0, 0), and a Cartesian coordinate system is established with the row as the X direction and the column as the Y direction. The true value coordinate of each mark is the distance from the center of the mark to the center of the calibration plate. When the true value coordinate of the mark has a preset coordinate feature, a circle with a diameter of 0.5 mm can be dug out from the center of the mark to form a hollow mark, that is, a reference marking point. Specifically, the coordinate feature can be the law corresponding to the true value coordinate of the mark, for example, when the true value coordinate of the mark is a multiple of 10, it can be determined as a reference marking point. In addition, a circular mark is set on the outer circle of the marking point area, the width of the circular mark is 2mm, and the center of the circular mark coincides with the center point of the calibration plate. It can be understood that the parameter setting of the above calibration plate is for a better understanding of the solution of this application, which can be adjusted and adapted based on actual application scenarios such as the shape and size of the work platform and the size of the camera field of view.
步骤204,获取各待标定相机采集的对应视野范围内的第一图像。Step 204: Acquire a first image within a corresponding field of view captured by each camera to be calibrated.
具体地,在需要对相机进行标定时,首先可以获取各待标定相机采集的对应视野范围内的第一图像。其中,如图4所示,第一图像包括部分标记点区域和部分圆环标记区域。Specifically, when the camera needs to be calibrated, the first image in the corresponding field of view captured by each camera to be calibrated can be obtained. As shown in FIG4 , the first image includes a partial marking point area and a partial circular ring marking area.
步骤206,根据第一图像中部分圆环标记区域的像素坐标确定标定板的中心点的像素位置。Step 206: determine the pixel position of the center point of the calibration plate according to the pixel coordinates of the partial circular ring marked area in the first image.
其中,像素坐标是像素在图像中的位置,其是以图像坐标系确定的坐标。第一图像中部分圆环标记区域的像素坐标,具体可以是第一图像中部分圆环标记区域对应的像素位于该第一图像中的位置。The pixel coordinates are the positions of pixels in the image, which are coordinates determined by the image coordinate system. The pixel coordinates of the partial circular ring marked area in the first image may specifically be the positions of the pixels corresponding to the partial circular ring marked area in the first image in the first image.
在本实施例中,通过采用第一图像中圆环标记区域对应的像素坐标进行拟合,可以计算出整块标定板的中心点在图像拓展区域中的像素位置(Px0 ,Py0)。其中,图像拓展区域就是第一图像画面之外的图像,也就是说标定板的中心点在第一图像画面之外,也即标定板的中心点位于待标定相机的视野范围外。In this embodiment, by fitting the pixel coordinates corresponding to the circular marked area in the first image, the pixel position (Px 0 , Py 0 ) of the center point of the entire calibration plate in the image extension area can be calculated. The image extension area is the image outside the first image, that is, the center point of the calibration plate is outside the first image, that is, the center point of the calibration plate is outside the field of view of the camera to be calibrated.
步骤208,基于标定板的中心点的像素位置提取部分标记点区域中每个标记点的像素坐标,并确定每个标记点位于标定板中的行列坐标信息。Step 208: extract the pixel coordinates of each marking point in the partial marking point area based on the pixel position of the center point of the calibration plate, and determine the row and column coordinate information of each marking point in the calibration plate.
其中,行列坐标信息是以标定板坐标系确定的相关信息,包括对应标记点位于标定板中的行列位置信息以及对应的坐标信息。在本实施例中,基于标定板的中心点的像素位置可以提取第一图像中部分标记点区域中每个标记点的像素坐标,进而可以计算每个标记点位于标定板中的行列坐标信息。The row and column coordinate information is related information determined by the calibration plate coordinate system, including row and column position information of the corresponding marking point in the calibration plate and the corresponding coordinate information. In this embodiment, the pixel coordinates of each marking point in the partial marking point area in the first image can be extracted based on the pixel position of the center point of the calibration plate, and then the row and column coordinate information of each marking point in the calibration plate can be calculated.
步骤210,根据部分标记点区域中每个标记点的像素坐标以及每个标记点位于标定板中的行列坐标信息,确定相应的待标定相机的标定参数。Step 210: determining the calibration parameters of the corresponding camera to be calibrated according to the pixel coordinates of each marker point in the partial marker point area and the row and column coordinate information of each marker point located in the calibration plate.
其中,标定参数包括相机的内部参数(如焦距、主点坐标等)和外部参数(相机相对于标定板的位置和方向)。具体地,根据部分标记点区域中每个标记点的像素坐标以及每个标记点位于标定板中的行列坐标信息,可以确定相应的待标定相机的标定参数。The calibration parameters include the camera's internal parameters (such as focal length, principal point coordinates, etc.) and external parameters (the position and direction of the camera relative to the calibration plate). Specifically, the calibration parameters of the corresponding camera to be calibrated can be determined based on the pixel coordinates of each marker point in the partial marker area and the row and column coordinate information of each marker point in the calibration plate.
可以理解的是,在对某一相机进行标定时,获取的是对应相机采集的视野范围内的第一图像,在需要对多个相机进行标定时,则针对每个相机采集的视野范围内的第一图像分别进行上述处理,以确定每一个相机的标定参数,以完成对每个相机的标定。It can be understood that when calibrating a certain camera, the first image within the field of view captured by the corresponding camera is obtained. When multiple cameras need to be calibrated, the above processing is performed separately on the first image within the field of view captured by each camera to determine the calibration parameters of each camera to complete the calibration of each camera.
上述相机标定方法中,通过获取与作业平台对应的标定板,并获取各待标定相机采集的对应视野范围内的第一图像,根据第一图像中部分圆环标记区域的像素坐标确定标定板的中心点的像素位置,基于标定板的中心点的像素位置提取部分标记点区域中每个标记点的像素坐标,并确定每个标记点位于标定板中的行列坐标信息,根据部分标记点区域中每个标记点的像素坐标以及每个标记点位于标定板中的行列坐标信息,确定相应的待标定相机的标定参数。其通过利用标定板中的圆环标记确定标定板中心点在图像拓展区域中的像素位置,并据此确定相机的标定参数,整个流程无需人工干预,不仅能够提高标定效率,且避免了因人工操作所导致的错误。In the above camera calibration method, by obtaining a calibration plate corresponding to the work platform and obtaining the first image within the corresponding field of view captured by each camera to be calibrated, the pixel position of the center point of the calibration plate is determined according to the pixel coordinates of the partial circular ring mark area in the first image, the pixel coordinates of each mark point in the partial mark point area are extracted based on the pixel position of the center point of the calibration plate, and the row and column coordinate information of each mark point in the calibration plate is determined, and the calibration parameters of the corresponding camera to be calibrated are determined according to the pixel coordinates of each mark point in the partial mark point area and the row and column coordinate information of each mark point in the calibration plate. It determines the pixel position of the center point of the calibration plate in the image expansion area by using the circular ring mark in the calibration plate, and determines the calibration parameters of the camera accordingly. The entire process does not require manual intervention, which not only improves the calibration efficiency, but also avoids errors caused by manual operation.
在一个示例性的实施例中,在步骤206中,根据第一图像中部分圆环标记区域的像素坐标确定标定板的中心点的像素位置,具体可以包括:提取部分圆环标记区域中位于内环上的像素坐标以及位于外环上的像素坐标;对内环上的像素坐标以及外环上的像素坐标进行拟合,得到拟合后的环心坐标;将环心坐标确定为标定板的中心点的像素位置。In an exemplary embodiment, in step 206, the pixel position of the center point of the calibration plate is determined based on the pixel coordinates of the partial circular ring marked area in the first image, which may specifically include: extracting the pixel coordinates on the inner ring and the pixel coordinates on the outer ring in the partial circular ring marked area; fitting the pixel coordinates on the inner ring and the pixel coordinates on the outer ring to obtain the fitted ring center coordinates; and determining the ring center coordinates as the pixel position of the center point of the calibration plate.
具体地,可以通过图像处理技术(如边缘检测),提取第一图像中部分圆环标记区域中位于内环上的像素坐标以及位于外环上的像素坐标,并基于内环上的像素坐标估计对应内圆的圆心,基于外环上的像素坐标估计对应外圆的圆心。其中圆心估计可以基于计算边缘点的质心(即所有点的坐标的平均值)作为圆心的初始估计。由于圆环标记是由两个同心圆组成,它们的圆心应该是相同的。因此,可以通过几何关系来进一步精确圆心的位置。一种方法是使用外圆边缘点和内圆边缘点的切线交点作为圆心。还可以使用最小二乘法来拟合圆心,即对于每个圆,可以建立一个方程组,其中未知数是圆心的坐标,通过最小化所有点到圆的距离的平方和来求解这些方程,最终求解的结果即为拟合后的环心坐标,又由于圆环标记的环心与标定板的中心点重合,因此,可以将拟合后得到的环心坐标确定为标定板的中心点的像素位置。在本实施例中,在成像效果良好的情况下两个圆心的差距一般不会超过10个像素,若不满足指标则需要调整光源均匀度。Specifically, the pixel coordinates located on the inner ring and the pixel coordinates located on the outer ring in the part of the circular ring marked area in the first image can be extracted by image processing technology (such as edge detection), and the center of the corresponding inner circle can be estimated based on the pixel coordinates on the inner ring, and the center of the corresponding outer circle can be estimated based on the pixel coordinates on the outer ring. The center of the circle can be estimated based on the centroid of the edge point (i.e., the average value of the coordinates of all points) as the initial estimate of the center of the circle. Since the circular ring mark is composed of two concentric circles, their centers should be the same. Therefore, the position of the center of the circle can be further refined through geometric relationships. One method is to use the intersection of the tangents of the outer circle edge point and the inner circle edge point as the center of the circle. The least squares method can also be used to fit the center of the circle, that is, for each circle, a set of equations can be established, in which the unknown number is the coordinate of the center of the circle, and these equations are solved by minimizing the sum of the squares of the distances from all points to the circle. The final solution is the coordinate of the center of the ring after fitting. Since the center of the circular ring mark coincides with the center point of the calibration plate, the coordinate of the center of the ring obtained after fitting can be determined as the pixel position of the center point of the calibration plate. In this embodiment, when the imaging effect is good, the difference between the two circle centers generally does not exceed 10 pixels. If the index is not met, the uniformity of the light source needs to be adjusted.
在一个示例性的实施例中,如图5所示,在步骤208中,确定每个标记点位于标定板中的行列坐标信息,具体可以包括:In an exemplary embodiment, as shown in FIG5 , in step 208 , determining the row and column coordinate information of each marking point in the calibration plate may specifically include:
步骤502,根据部分标记点区域中每个标记点的像素坐标,对每个标记点进行行列排序,得到排序结果。Step 502, sorting each marking point in rows and columns according to the pixel coordinates of each marking point in the partial marking point area to obtain a sorting result.
具体地,识别标记点中参考标记点的像素坐标,基于参考标记点的像素坐标,对每个标记点进行旋转;根据旋转后的标记点的像素坐标对应的水平方向坐标的大小和竖直方向坐标的大小对标记点进行排序,得到排序结果。Specifically, the pixel coordinates of the reference marking points among the marking points are identified, and each marking point is rotated based on the pixel coordinates of the reference marking points; the marking points are sorted according to the sizes of the horizontal coordinates and the vertical coordinates corresponding to the pixel coordinates of the rotated marking points to obtain a sorting result.
由于参考标记点为空心mark,因此,可以基于mark坐标处像素的灰度值而确定参考标记点。具体地,可以按灰度值范围的中值分为高于中值和低于中值的亮暗两种,其中亮的为实心mark,暗的为空心mark。从而实现对参考标记点的识别,并提取参考标记点的像素坐标。Since the reference mark point is a hollow mark, the reference mark point can be determined based on the grayscale value of the pixel at the mark coordinate. Specifically, the grayscale value range can be divided into two types: light and dark, which are higher than the median and lower than the median, where the light is a solid mark and the dark is a hollow mark. This allows the reference mark point to be identified and the pixel coordinates of the reference mark point to be extracted.
进而利用参考标记点的像素坐标对所有标记点进行排序。具体地,通过搜索空心mark点互相连线中距离最近的线段(如图6中红线或蓝线),计算该线段倾角与90°的余角,得到标记点排布行与水平线的夹角θ,使用旋转变换将所有mark标记点旋转-θ,变为水平竖直排布。然后取旋转后所有mark标记点的像素X坐标进排序,记录排序后的序号表Index(相等X值不用分前后),选取序号表Index中的任意一个mark点作为行基准点,放入一个新的序号表Indexsub,按Index中的序号挨个检查mark是否同行(mark旋转后坐标Y值和选取的markY值相差小于阈值),将同行mark的序号依次记录进新序号表Indexsub,同时删除序号表Index中对应的序号。重复上一步操作直到序号表Index中所有点被筛选完变为空,即整理完所有同行点。接着取出各个行序号表Indexsub中第一个序号mark的Y坐标,对其进行排序,排序完成即可得到各个行的顺序和列的顺序,即得到排序结果。Then, all the mark points are sorted using the pixel coordinates of the reference mark points. Specifically, by searching for the line segment with the closest distance in the line connecting the hollow mark points (such as the red line or blue line in Figure 6), the complementary angle between the inclination of the line segment and 90° is calculated to obtain the angle θ between the mark point arrangement row and the horizontal line, and the rotation transformation is used to rotate all the mark points -θ to change them into a horizontal and vertical arrangement. Then, the pixel X coordinates of all the mark points after rotation are sorted, and the sorted sequence table Index is recorded (equal X values do not need to be divided into front and back), and any mark point in the sequence table Index is selected as the row reference point, and a new sequence table Indexsub is put into it. According to the sequence number in Index, check whether the mark is in the same row one by one (the difference between the Y value of the mark after rotation and the selected markY value is less than the threshold), and the sequence numbers of the marks in the same row are recorded in the new sequence table Indexsub in sequence, and the corresponding sequence numbers in the sequence table Index are deleted at the same time. Repeat the previous step until all points in the sequence table Index are filtered and become empty, that is, all points in the same row are sorted. Then, the Y coordinate of the first sequence number mark in each row sequence number table Indexsub is taken out and sorted. After the sorting is completed, the order of each row and the order of the column can be obtained, that is, the sorting result can be obtained.
步骤504,根据排序结果,获取对应的行间距和列间距。Step 504: Obtain corresponding row spacing and column spacing according to the sorting result.
其中,行间距和列间距是基于上述排序结果,依据行列号找到相邻行列mark,并计算两个方向上的像素距离得到。例如,可以计算首行(水平方向)首列(竖直方向)mark和下一行同列mark之间的像素距离,从而得到行间距。同理,可以计算首行首列mark和同行邻列mark之间的像素距离,从而得到列间距。The row spacing and column spacing are based on the above sorting results. The adjacent row and column marks are found according to the row and column numbers, and the pixel distances in two directions are calculated. For example, the pixel distance between the mark in the first row (horizontally) and the mark in the same column in the next row can be calculated to obtain the row spacing. Similarly, the pixel distance between the mark in the first row and the mark in the adjacent column in the same row can be calculated to obtain the column spacing.
步骤506,根据每个标记点的像素坐标、标定板的中心点的像素位置、行间距和列间距,获取每个标记点位于标定板中的行列坐标信息。Step 506, obtaining row and column coordinate information of each marking point in the calibration plate according to the pixel coordinates of each marking point, the pixel position of the center point of the calibration plate, the row spacing and the column spacing.
其中,行列坐标信息包括对应标记点位于标定板中的行列位置信息以及对应的坐标信息。具体地,行列位置信息可以基于如下公式计算得到:The row and column coordinate information includes the row and column position information of the corresponding marking point in the calibration plate and the corresponding coordinate information. Specifically, the row and column position information can be calculated based on the following formula:
列位置信息Rx= round(( Px - Px0 )/ Dx)Column position information Rx = round((Px - Px 0 )/Dx)
行位置信息Ry= round(( Py - Py0 )/ Dy)Row position information Ry = round(( Py - Py 0 )/ Dy)
其中,round为取整计算,Px0为标定板的中心点的第一方向(即水平方向或X方向)的像素位置,Py0为标定板的中心点的第二方向(即竖直方向或Y方向)的像素位置,(Px,Py)为对应标记点的像素坐标,Dx为列间距,Dy为行间距。Among them, round is rounding calculation, Px 0 is the pixel position of the first direction (i.e. horizontal direction or X direction) of the center point of the calibration plate, Py 0 is the pixel position of the second direction (i.e. vertical direction or Y direction) of the center point of the calibration plate, (Px, Py) is the pixel coordinate of the corresponding marking point, Dx is the column spacing, and Dy is the row spacing.
由于标定板中mark的行列间距为固定值(如图3B中行列间距设置为2mm),因此,基于标记点位于标定板中的行列位置信息,以及标定板中mark的行列间距,通过计算即可得到对应mark的坐标信息。例如,将列位置信息Rx与行列间距相乘,即可得到对应mark的Y坐标,将行位置信息Ry与行列间距相乘,即可得到对应mark的X坐标。Since the row and column spacing of the mark in the calibration plate is a fixed value (for example, the row and column spacing is set to 2 mm in FIG. 3B ), the coordinate information of the corresponding mark can be obtained by calculation based on the row and column position information of the marking point in the calibration plate and the row and column spacing of the mark in the calibration plate. For example, the Y coordinate of the corresponding mark can be obtained by multiplying the column position information Rx by the row and column spacing, and the X coordinate of the corresponding mark can be obtained by multiplying the row position information Ry by the row and column spacing.
在一个示例性的实施例中,标记点中包括预先设置的参考标记点,参考标记点具有预设的坐标特征;则在步骤208中,确定每个标记点位于标定板中的行列坐标信息之后,上述方法还可以包括:识别标记点中参考标记点的行列坐标信息;在参考标记点的行列坐标信息不满足预设的坐标特征的情况下,调整待标定相机的参数;并获取调整参数后的待标定相机采集的对应视野范围内的第一图像,返回执行根据第一图像中部分圆环标记区域的像素坐标确定标定板的中心点的像素位置的步骤,直到参考标记点的行列坐标信息满足预设的坐标特征,则根据部分标记点区域中每个标记点的像素坐标以及每个标记点位于标定板中的行列坐标信息,对相应的待标定相机进行标定。In an exemplary embodiment, the marking points include pre-set reference marking points, and the reference marking points have preset coordinate features; then in step 208, after determining the row and column coordinate information of each marking point in the calibration plate, the above method may also include: identifying the row and column coordinate information of the reference marking points in the marking points; when the row and column coordinate information of the reference marking points does not meet the preset coordinate features, adjusting the parameters of the camera to be calibrated; and obtaining the first image within the corresponding field of view captured by the camera to be calibrated after the parameters are adjusted, returning to execute the step of determining the pixel position of the center point of the calibration plate according to the pixel coordinates of the partial circular marking area in the first image, until the row and column coordinate information of the reference marking points meets the preset coordinate features, and then calibrating the corresponding camera to be calibrated according to the pixel coordinates of each marking point in the partial marking point area and the row and column coordinate information of each marking point in the calibration plate.
具体地,以参考标记点预设的坐标特征为标记点的真值坐标满足10的倍数为例,则在确定每个标记点位于标定板中的行列坐标信息之后,可以基于预设的坐标特征对标记点位于标定板中的行列坐标信息进行校验。具体地,可以校验参考标记点的行列坐标信息是否满足预设的坐标特征,例如,可以校验参考标记点对应的坐标信息是否为10的倍数,若是10的倍数,则表示对应图像中标记点的行列坐标信息计算正确,因此执行后续步骤确定相机的标定参数即可。Specifically, taking the preset coordinate feature of the reference marker point as the true value coordinate of the marker point satisfying a multiple of 10 as an example, after determining the row and column coordinate information of each marker point in the calibration plate, the row and column coordinate information of the marker point in the calibration plate can be verified based on the preset coordinate feature. Specifically, it can be verified whether the row and column coordinate information of the reference marker point satisfies the preset coordinate feature, for example, it can be verified whether the coordinate information corresponding to the reference marker point is a multiple of 10. If it is a multiple of 10, it means that the row and column coordinate information of the marker point in the corresponding image is calculated correctly, so the subsequent steps can be performed to determine the calibration parameters of the camera.
若出现余数(即不是10的倍数)则表示对应图像中标记点的行列坐标信息计算出错,则提示调整相机垂直度和对焦以保证成像面和作业面的平行度。并获取调整参数后的待标定相机采集的对应视野范围内的第一图像,返回执行根据第一图像中部分圆环标记区域的像素坐标确定标定板的中心点的像素位置的步骤,直到参考标记点的行列坐标信息满足预设的坐标特征,则根据部分标记点区域中每个标记点的像素坐标以及每个标记点位于标定板中的行列坐标信息,确定相应的待标定相机的标定参数。从而实现对相机标定过程中的自动校准,提高了标定的准确性以及相机对焦质量。If a remainder appears (i.e., it is not a multiple of 10), it means that the row and column coordinate information of the marking point in the corresponding image is calculated incorrectly, and the camera verticality and focus are adjusted to ensure the parallelism between the imaging surface and the working surface. The first image in the corresponding field of view captured by the camera to be calibrated after the parameters are adjusted is obtained, and the step of determining the pixel position of the center point of the calibration plate according to the pixel coordinates of the partial circular marking area in the first image is returned to execute until the row and column coordinate information of the reference marking point meets the preset coordinate characteristics, and then the calibration parameters of the corresponding camera to be calibrated are determined according to the pixel coordinates of each marking point in the partial marking point area and the row and column coordinate information of each marking point in the calibration plate. This realizes automatic calibration during the camera calibration process, and improves the accuracy of calibration and the quality of camera focus.
在一个示例性的实施例中,在步骤208中,在确定每个标记点位于标定板中的行列坐标信息之后,上述方法还可以包括:根据部分标记点区域中每个标记点的像素坐标以及每个标记点位于标定板中的行列坐标信息,确定待标定相机的像素坐标到标定板坐标系的仿射变换关系;基于仿射变换关系,将对应待标定相机采集的第一图像中部分圆环标记区域中位于外环上的像素坐标进行仿射变换,得到变换后的坐标点集;对坐标点集进行拟合,得到拟合后的圆心坐标;获取坐标点集中每一个坐标点与圆心坐标之间的标准差;在标准差大于设定阈值的情况下,调整待标定相机的参数;获取调整参数后的待标定相机采集的对应视野范围内的第一图像,并返回执行根据所述第一图像中部分圆环标记区域的像素坐标确定所述标定板的中心点的像素位置的步骤,直到标准差小于或等于设定阈值,根据部分标记点区域中每个标记点的像素坐标以及每个标记点位于标定板中的行列坐标信息,确定相应的待标定相机的标定参数。In an exemplary embodiment, in step 208, after determining the row and column coordinate information of each marker point in the calibration plate, the method may further include: determining an affine transformation relationship between the pixel coordinates of the camera to be calibrated and the calibration plate coordinate system according to the pixel coordinates of each marker point in the partial marker point area and the row and column coordinate information of each marker point in the calibration plate; performing an affine transformation on the pixel coordinates located on the outer ring in the partial ring marker area in the first image captured by the corresponding camera to be calibrated based on the affine transformation relationship to obtain a transformed coordinate point set; fitting the coordinate point set to obtain the fitted center coordinates of the circle; obtaining a standard deviation between each coordinate point in the coordinate point set and the center coordinates of the circle; adjusting the parameters of the camera to be calibrated when the standard deviation is greater than a set threshold; obtaining a first image in the corresponding field of view captured by the camera to be calibrated after the parameters are adjusted, and returning to the step of determining the pixel position of the center point of the calibration plate according to the pixel coordinates of the partial ring marker area in the first image until the standard deviation is less than or equal to the set threshold, and determining the calibration parameters of the corresponding camera to be calibrated according to the pixel coordinates of each marker point in the partial marker point area and the row and column coordinate information of each marker point in the calibration plate.
其中,仿射变换是一种在几何学中非常重要的线性变换,它保持了点、直线和平面之间的相对位置关系不变。仿射变换可以包括平移、旋转、缩放和剪切等操作。在本实施例中,可以基于第一图像中部分标记点区域中每个标记点的像素坐标以及每个标记点位于标定板中的行列坐标信息,而确定待标定相机的像素坐标到标定板坐标系的转换矩阵,从而得到对应的仿射变换关系。Among them, affine transformation is a very important linear transformation in geometry, which keeps the relative position relationship between points, lines and planes unchanged. Affine transformation can include operations such as translation, rotation, scaling and shearing. In this embodiment, based on the pixel coordinates of each marker point in the partial marker point area in the first image and the row and column coordinate information of each marker point in the calibration plate, the transformation matrix from the pixel coordinates of the camera to be calibrated to the calibration plate coordinate system can be determined, thereby obtaining the corresponding affine transformation relationship.
具体地,通过真值标定的仿射变换关系,可以将各个相机视野内的圆环标记区域中位于外环上的像素坐标映射至标定板坐标系,以得到变换后的坐标点集,然后将标定板坐标系下的坐标点集使用RANSAC(Random Sample Consensus,一种迭代方法,用于从一组包含异常值的数据中拟合模型,在拟合圆的情况下,RANSAC算法可以从包含噪声和异常值的边缘点中准确地拟合出一个圆)算法拟合其对应标定板坐标系下的外圆,并得到拟合后的圆心坐标,然后计算其各个点到拟合出来的圆心坐标的标准差,当标准差小于或等于设定阈值时,表示对应图像中标记点的行列坐标信息计算正确,因此执行后续步骤确定相机的标定参数即可。Specifically, through the affine transformation relationship of the true value calibration, the pixel coordinates on the outer ring in the circular ring mark area within the field of view of each camera can be mapped to the calibration plate coordinate system to obtain the transformed coordinate point set, and then the coordinate point set in the calibration plate coordinate system is fitted to the outer circle in the corresponding calibration plate coordinate system using the RANSAC (Random Sample Consensus, an iterative method for fitting a model from a set of data containing outliers. In the case of fitting a circle, the RANSAC algorithm can accurately fit a circle from edge points containing noise and outliers) algorithm, and the fitted center coordinates are obtained. Then, the standard deviation of each point to the fitted center coordinates is calculated. When the standard deviation is less than or equal to the set threshold, it means that the row and column coordinate information of the marked point in the corresponding image is calculated correctly, so the subsequent steps can be performed to determine the calibration parameters of the camera.
而当标准差大于设定阈值时,则表示真值标定结果较差,需要重新调整相机对焦和平面度以提高画面锐度和真值仿射变换的匹配度。并获取调整参数后的待标定相机采集的对应视野范围内的第一图像,返回执行根据所述第一图像中部分圆环标记区域的像素坐标确定所述标定板的中心点的像素位置的步骤,直到标准差小于或等于设定阈值,根据部分标记点区域中每个标记点的像素坐标以及每个标记点位于标定板中的行列坐标信息,确定相应的待标定相机的标定参数。从而实现对相机标定过程中的自动校准,提高了标定的准确性以及相机对焦质量。When the standard deviation is greater than the set threshold, it means that the true value calibration result is poor, and the camera focus and flatness need to be readjusted to improve the image sharpness and the matching degree of the true value affine transformation. The first image in the corresponding field of view captured by the camera to be calibrated after the parameters are adjusted is obtained, and the step of determining the pixel position of the center point of the calibration plate according to the pixel coordinates of the partial circular ring mark area in the first image is returned to execute until the standard deviation is less than or equal to the set threshold, and the calibration parameters of the corresponding camera to be calibrated are determined according to the pixel coordinates of each marking point in the partial marking point area and the row and column coordinate information of each marking point in the calibration plate. Thereby, automatic calibration is realized in the camera calibration process, and the accuracy of calibration and the quality of camera focus are improved.
在一个示例性的实施例中,如图7所示,在步骤210中,确定相应的待标定相机的标定参数之后,上述方法还可以包括:In an exemplary embodiment, as shown in FIG. 7 , in step 210 , after determining the calibration parameters of the corresponding camera to be calibrated, the method may further include:
步骤702,在作业平台中运动轴位于初始位置处,获取待标定相机采集的对应视野范围内的第二图像。Step 702: When the motion axis is at an initial position in the working platform, a second image within a corresponding field of view captured by the camera to be calibrated is acquired.
其中,初始位置包括运动轴相对第一方向的位置和相对第二方向的位置。第一方向与第二方向相互垂直,在本实施例中,以第一方向为水平方向,第二方向为垂直方向进行说明。The initial position includes the position of the movement axis relative to the first direction and the position relative to the second direction. The first direction and the second direction are perpendicular to each other. In this embodiment, the first direction is the horizontal direction and the second direction is the vertical direction.
具体地,控制作业平台的运动轴运动至某一初始位置,获取各相机分别拍摄的对应视野范围内的第二图像。Specifically, the movement axis of the working platform is controlled to move to a certain initial position, and the second images within the corresponding field of view taken by each camera are acquired.
步骤704,基于待标定相机的标定参数对第二图像进行仿射变换,确定第二图像中每个标记点位于标定板中的行列号和对应的第一坐标。Step 704: perform affine transformation on the second image based on the calibration parameters of the camera to be calibrated, and determine the row and column numbers of each marking point in the second image located in the calibration plate and the corresponding first coordinates.
具体地,基于各个相机视野内第二图像中的参考标记点即空心mark,利用外圆环计算空心mark的全局行列号,利用各相机的标定参数将空心mark的像素坐标映射到标定板坐标系,并记录各个空心mark的全局行列号和对应的映射后的第一坐标。Specifically, based on the reference mark point, i.e., the hollow mark, in the second image within the field of view of each camera, the global row and column number of the hollow mark is calculated using the outer ring, the pixel coordinates of the hollow mark are mapped to the calibration plate coordinate system using the calibration parameters of each camera, and the global row and column number of each hollow mark and the corresponding first coordinate after mapping are recorded.
步骤706,控制运动轴相对于第一方向运动第一设定距离,获取待标定相机采集的对应视野范围内的第三图像,并确定与行列号对应的相同标记点的第二坐标。Step 706, control the moving axis to move a first set distance relative to the first direction, obtain a third image within the corresponding field of view captured by the camera to be calibrated, and determine the second coordinates of the same marking point corresponding to the row and column numbers.
具体地,控制作业平台的运动轴相对于第一方向运动第一设定距离,获取各相机再次采集的对应视野范围内的第三图像,利用大圆环计算出上一步记录的全局行列号对应的空心mark的像素坐标(可能在视野外,没有出现大圆环的图像不参与运算),并映射至标定板坐标系,即得到与上一步中全局行列号对应的空心mark即相同参考标记点的第二坐标。Specifically, the motion axis of the working platform is controlled to move a first set distance relative to the first direction, and the third image within the corresponding field of view captured by each camera is obtained again. The large circle is used to calculate the pixel coordinates of the hollow mark corresponding to the global row and column number recorded in the previous step (it may be outside the field of view, and the image without the large circle does not participate in the calculation), and mapped to the calibration plate coordinate system, that is, the second coordinate of the hollow mark corresponding to the global row and column number in the previous step, that is, the same reference mark point, is obtained.
步骤708,根据相同标记点的第一坐标、第二坐标以及第一设定距离,确定运动轴相对于第一方向运动的第一方向单位运动向量。Step 708: Determine a first-direction unit motion vector of the motion axis relative to the first direction according to the first coordinates, the second coordinates, and the first set distance of the same marking point.
具体地,计算每个全局行列号对应的空心mark移动前后坐标点的运动向量,若记为V,则计算所有V向量的平均向量,得到平台运动在标定板坐标系中的精确移动量。其中:Specifically, calculate the motion vector of the coordinate point before and after the hollow mark corresponding to each global row and column number is moved. If it is recorded as V, then calculate the average vector of all V vectors to obtain the precise movement of the platform in the calibration plate coordinate system. .in:
其中,运动向量V是基于某一空心mark移动前后坐标点的差值得到。例如,若移动前图像中mark的第一坐标和行列号Id0对应,将移动后图像中该mark的第二坐标和行列号Id1对应,则遍历移动前的行列号,在移动后的行列号表中寻找对应的mark坐标,得到同名mark移动前后在标定板坐标系的两个点P1,P2,以P1为起点P2为终点,坐标相减得到P1P2向量即为单点的运动向量V。其中,表示共有个空心mark,表示第个空心mark中运动向量的X方向分量,表示第个空心mark中运动向量的Y方向分量。The motion vector V is obtained based on the difference between the coordinates of a hollow mark before and after it moves. For example, if the first coordinate of the mark in the image before the move corresponds to the row and column number Id0, and the second coordinate of the mark in the image after the move corresponds to the row and column number Id1, then the row and column numbers before the move are traversed, and the corresponding mark coordinates are found in the row and column number table after the move, and the two points P1 and P2 of the same mark in the calibration plate coordinate system before and after the move are obtained. With P1 as the starting point and P2 as the end point, the coordinates are subtracted to obtain the P1P2 vector, which is the motion vector V of the single point. Indicates shared A hollow mark, Indicates The X-direction component of the motion vector in the hollow mark, Indicates The Y component of the motion vector in the hollow mark.
进而将除以标定时运动轴的运动长度即运动轴相对于第一方向运动第一设定距离,得到第一方向上即X轴上1个单位长度的运动在标定板坐标系中的向量(Sxx,Sxy),也即得到运动轴相对于第一方向的第一方向单位运动向量。Then Divide by the movement length of the moving axis during calibration, that is, the first set distance that the moving axis moves relative to the first direction, to obtain the vector (S xx , S xy ) of the movement of 1 unit length in the first direction, that is, on the X-axis, in the calibration plate coordinate system, that is, to obtain the first direction unit motion vector of the moving axis relative to the first direction.
步骤710,控制运动轴相对于第二方向运动第二设定距离,获取待标定相机采集的对应视野范围内的第四图像,并确定与行列号对应的相同标记点的第三坐标。Step 710, control the moving axis to move a second set distance relative to the second direction, obtain a fourth image within the corresponding field of view captured by the camera to be calibrated, and determine the third coordinates of the same marking point corresponding to the row and column numbers.
具体地,控制作业平台的运动轴相对于第二方向运动第二设定距离,获取各相机再次采集的对应视野范围内的第四图像,利用大圆环计算出上一步记录的全局行列号对应的空心mark的像素坐标(可能在视野外,没有出现大圆环的图像不参与运算),并映射至标定板坐标系,即得到与上一步中全局行列号对应的空心mark即相同参考标记点的第三坐标。Specifically, the motion axis of the working platform is controlled to move a second set distance relative to the second direction, and the fourth image within the corresponding field of view collected by each camera again is obtained. The large circle is used to calculate the pixel coordinates of the hollow mark corresponding to the global row and column number recorded in the previous step (it may be outside the field of view, and the image without the large circle does not participate in the calculation), and mapped to the calibration plate coordinate system, that is, the third coordinate of the hollow mark corresponding to the global row and column number in the previous step, that is, the same reference mark point, is obtained.
步骤712,根据相同标记点的第一坐标、第三坐标以及第二设定距离,确定运动轴相对于第二方向运动的第二方向单位运动向量。Step 712: Determine a second direction unit motion vector of the motion axis relative to the second direction according to the first coordinate, the third coordinate and the second set distance of the same marking point.
根据相同标记点的第一坐标、第三坐标以及第二设定距离,采用与步骤708相类似的方式计算得到第二方向上即Y轴上1个单位长度的运动在标定板坐标系中的向量(Syx,Syy),也即得到运动轴相对于第二方向的第二方向单位运动向量。According to the first coordinate, the third coordinate and the second set distance of the same marking point, a vector (S yx , S yy ) of the movement of one unit length in the second direction, i.e., on the Y-axis, in the calibration plate coordinate system is calculated in a manner similar to step 708, that is, the second direction unit motion vector of the motion axis relative to the second direction is obtained.
进而可以确定在标定板坐标系中,运动(m,n)长度等效的运动轴距离为(Vx,Vy),其中:Then, it can be determined that in the calibration plate coordinate system, the equivalent motion axis distance of the motion (m, n) length is (V x ,V y ), where:
上述实施例中,在确定各相机的标定参数后,即可将任意相机的任意像素的位置映射至作业平台的固定坐标系即标定板坐标系,即可得到任意一个mark在轴运动定长前后在标定板坐标系中的两个位置,从而标定出轴运动的缩放比例和夹角。而传统方法中需要标定作业人员手动示教一个特定的mark,并控制轴让mark在标定时分别运动至视野的上下左右,而不能超出视野,不仅操作繁琐并且仅有一个mark坐标计算,标定的轴也仅能在一个较小的区间范围运动,从而导致精度不高。而本实施例中,利用与标定参数相同的行列计算方法,自动计算出多个相机视野中出现的各个空心mark在轴运动前后于标定板坐标系中的位置并一一对应,从而更精确的计算出运动轴和标定板坐标系的比例关系和夹角,即使对应的空心mark运动到了视野之外,也可以通过行列像素间距计算出视野之外的空心mark的坐标位置并映射到标定板坐标系,整个标定流程全自动,无需繁琐的人工确认和交互,无需限定标定板的角度,能够实现超视野运动轴的标定,具有良好的鲁棒性。In the above embodiment, after determining the calibration parameters of each camera, the position of any pixel of any camera can be mapped to the fixed coordinate system of the work platform, i.e., the calibration plate coordinate system, and the two positions of any mark in the calibration plate coordinate system before and after the axis moves to a fixed length can be obtained, thereby calibrating the scaling ratio and angle of the axis movement. In the traditional method, the calibration operator is required to manually teach a specific mark and control the axis so that the mark moves to the upper, lower, left, and right of the field of view during calibration, but cannot exceed the field of view. Not only is the operation cumbersome and there is only one mark coordinate calculation, but the calibrated axis can only move in a small range, resulting in low accuracy. In this embodiment, the same row and column calculation method as the calibration parameters is used to automatically calculate the positions of each hollow mark appearing in the field of view of multiple cameras in the calibration plate coordinate system before and after the axis movement and correspond one to one, so as to more accurately calculate the proportional relationship and angle between the motion axis and the calibration plate coordinate system. Even if the corresponding hollow mark moves out of the field of view, the coordinate position of the hollow mark outside the field of view can be calculated through the row and column pixel spacing and mapped to the calibration plate coordinate system. The entire calibration process is fully automatic, without the need for tedious manual confirmation and interaction, and without limiting the angle of the calibration plate. It can realize the calibration of the motion axis beyond the field of view and has good robustness.
在一个示例性的实施例中,在步骤210中,在确定相应的待标定相机的标定参数之后,上述方法还可以包括:控制作业平台的运动轴进行旋转,分别获取待标定相机采集的旋转前的图像和旋转后的图像;基于待标定相机的标定参数对旋转前的图像和旋转后的图像分别进行仿射变换,获取旋转前的图像和旋转后的图像中目标参考标记点分别位于标定板的坐标信息;对目标参考标记点分别位于标定板的坐标信息进行拟合,确定作业平台的旋转中心的位置。In an exemplary embodiment, in step 210, after determining the calibration parameters of the corresponding camera to be calibrated, the method may further include: controlling the motion axis of the work platform to rotate, and respectively acquiring the image before rotation and the image after rotation captured by the camera to be calibrated; performing affine transformation on the image before rotation and the image after rotation based on the calibration parameters of the camera to be calibrated, and acquiring the coordinate information of the target reference mark points in the image before rotation and the image after rotation located on the calibration plate; fitting the coordinate information of the target reference mark points located on the calibration plate, and determining the position of the rotation center of the work platform.
其中,目标参考标记点是具有相同中心距的参考标记点即空心mark。在本实施例中,通过记录多个相同中心距的空心mark在作业平台多次旋转后分别对应的坐标,将相同中心距的空心mark在标定板坐标系的多次落点拟合圆,即可得到作业平台的旋转中心在标定板坐标系的精确位置,从而实现对作业平台的旋转中心的标定。而传统的标定方式只能将同名mark局限在单个相机视野内运动,导致转角的范围非常小,标定的精度误差也很大。而本实施例可以将多个相机绑定在同一个“标定板坐标系”中,实现多相机的融合标定,因此可以达到较高的标定精度。Among them, the target reference mark point is a reference mark point with the same center distance, that is, a hollow mark. In this embodiment, by recording the coordinates corresponding to multiple hollow marks with the same center distance after the work platform rotates multiple times, and fitting circles of multiple landing points of the hollow marks with the same center distance in the calibration plate coordinate system, the precise position of the rotation center of the work platform in the calibration plate coordinate system can be obtained, thereby realizing the calibration of the rotation center of the work platform. However, the traditional calibration method can only limit the movement of the mark with the same name within the field of view of a single camera, resulting in a very small range of the turning angle and a large calibration accuracy error. However, this embodiment can bind multiple cameras to the same "calibration plate coordinate system" to realize multi-camera fusion calibration, so that a higher calibration accuracy can be achieved.
应该理解的是,虽然如上所述的各实施例所涉及的流程图中的各个步骤按照箭头的指示依次显示,但是这些步骤并不是必然按照箭头指示的顺序依次执行。除非本文中有明确的说明,这些步骤的执行并没有严格的顺序限制,这些步骤可以以其它的顺序执行。而且,如上所述的各实施例所涉及的流程图中的至少一部分步骤可以包括多个步骤或者多个阶段,这些步骤或者阶段并不必然是在同一时刻执行完成,而是可以在不同的时刻执行,这些步骤或者阶段的执行顺序也不必然是依次进行,而是可以与其它步骤或者其它步骤中的步骤或者阶段的至少一部分轮流或者交替地执行。It should be understood that, although the various steps in the flowcharts involved in the above-mentioned embodiments are displayed in sequence according to the indication of the arrows, these steps are not necessarily executed in sequence according to the order indicated by the arrows. Unless there is a clear explanation in this article, the execution of these steps does not have a strict order restriction, and these steps can be executed in other orders. Moreover, at least a part of the steps in the flowcharts involved in the above-mentioned embodiments can include multiple steps or multiple stages, and these steps or stages are not necessarily executed at the same time, but can be executed at different times, and the execution order of these steps or stages is not necessarily to be carried out in sequence, but can be executed in turn or alternately with other steps or at least a part of the steps or stages in other steps.
基于同样的发明构思,本申请实施例还提供了一种用于实现上述所涉及的相机标定方法的相机标定装置。该装置所提供的解决问题的实现方案与上述方法中所记载的实现方案相似,故下面所提供的一个或多个相机标定装置实施例中的具体限定可以参见上文中对于相机标定方法的限定,在此不再赘述。Based on the same inventive concept, the embodiment of the present application also provides a camera calibration device for implementing the camera calibration method involved above. The implementation solution provided by the device to solve the problem is similar to the implementation solution recorded in the above method, so the specific limitations in one or more camera calibration device embodiments provided below can refer to the limitations of the camera calibration method above, and will not be repeated here.
在一个示例性的实施例中,如图8所示,提供了一种相机标定装置,所述装置用于无重叠视野的多台相机的自动标定,所述多台相机相对于作业平台环形布局,所述装置包括:标定板获取模块802、图像获取模块804、中心点确定模块806、坐标转换模块808和标定参数确定模块810,其中:In an exemplary embodiment, as shown in FIG8 , a camera calibration device is provided, the device is used for automatic calibration of multiple cameras with non-overlapping fields of view, the multiple cameras are arranged in a ring relative to the working platform, the device comprises: a calibration plate acquisition module 802, an image acquisition module 804, a center point determination module 806, a coordinate conversion module 808 and a calibration parameter determination module 810, wherein:
标定板获取模块802,用于获取与所述作业平台对应的标定板,所述标定板上包括标记点区域和设置在所述标记点区域外圈的圆环标记,所述圆环标记的环心与所述标定板的中心点重合,所述标记点区域设置有行列均匀排布的多个标记点;The calibration plate acquisition module 802 is used to acquire a calibration plate corresponding to the work platform, wherein the calibration plate includes a marking point area and a circular ring mark arranged on the outer circle of the marking point area, the center of the circular ring mark coincides with the center point of the calibration plate, and the marking point area is provided with a plurality of marking points evenly arranged in rows and columns;
图像获取模块804,用于获取各待标定相机采集的对应视野范围内的第一图像,所述第一图像包括部分标记点区域和部分圆环标记区域;An image acquisition module 804 is used to acquire a first image within a corresponding field of view captured by each camera to be calibrated, wherein the first image includes a partial marking point area and a partial ring marking area;
中心点确定模块806,用于根据所述第一图像中部分圆环标记区域的像素坐标确定所述标定板的中心点的像素位置,所述标定板的中心点位于待标定相机的视野范围外;A center point determination module 806 is used to determine the pixel position of the center point of the calibration plate according to the pixel coordinates of the partial circular ring marked area in the first image, and the center point of the calibration plate is outside the field of view of the camera to be calibrated;
坐标转换模块808,用于基于所述标定板的中心点的像素位置提取所述部分标记点区域中每个标记点的像素坐标,并确定每个所述标记点位于所述标定板中的行列坐标信息;A coordinate conversion module 808 is used to extract the pixel coordinates of each marking point in the partial marking point area based on the pixel position of the center point of the calibration plate, and determine the row and column coordinate information of each marking point in the calibration plate;
标定参数确定模块810,用于根据所述部分标记点区域中每个所述标记点的像素坐标以及每个所述标记点位于所述标定板中的行列坐标信息,确定相应的待标定相机的标定参数。The calibration parameter determination module 810 is used to determine the calibration parameters of the corresponding camera to be calibrated according to the pixel coordinates of each of the marking points in the partial marking point area and the row and column coordinate information of each of the marking points in the calibration plate.
在一个示例性的实施例中,中心点确定模块具体用于:提取所述部分圆环标记区域中位于内环上的像素坐标以及位于外环上的像素坐标;对所述内环上的像素坐标以及所述外环上的像素坐标进行拟合,得到拟合后的环心坐标;将所述环心坐标确定为所述标定板的中心点的像素位置。In an exemplary embodiment, the center point determination module is specifically used to: extract the pixel coordinates located on the inner ring and the pixel coordinates located on the outer ring in the partial circular ring marking area; fit the pixel coordinates on the inner ring and the pixel coordinates on the outer ring to obtain the fitted ring center coordinates; and determine the ring center coordinates as the pixel position of the center point of the calibration plate.
在一个示例性的实施例中,坐标转换模块具体用于:根据所述部分标记点区域中每个所述标记点的像素坐标,对每个所述标记点进行行列排序,得到排序结果;根据所述排序结果,获取对应的行间距和列间距;根据每个所述标记点的像素坐标、所述标定板的中心点的像素位置、所述行间距和所述列间距,获取每个所述标记点位于所述标定板中的行列坐标信息。In an exemplary embodiment, the coordinate conversion module is specifically used to: sort each of the marking points in the partial marking point area according to the pixel coordinates of each of the marking points in rows and columns to obtain a sorting result; obtain the corresponding row spacing and column spacing according to the sorting result; obtain the row and column coordinate information of each of the marking points in the calibration plate according to the pixel coordinates of each of the marking points, the pixel position of the center point of the calibration plate, the row spacing and the column spacing.
在一个示例性的实施例中,所述标记点中包括预先设置的参考标记点;坐标转换模块还用于:识别所述标记点中所述参考标记点的像素坐标;基于所述参考标记点的像素坐标,对每个所述标记点进行旋转;根据旋转后的所述标记点的像素坐标对应的水平方向坐标的大小和竖直方向坐标的大小对所述标记点进行排序,得到排序结果。In an exemplary embodiment, the marking points include pre-set reference marking points; the coordinate conversion module is also used to: identify the pixel coordinates of the reference marking points among the marking points; rotate each of the marking points based on the pixel coordinates of the reference marking points; sort the marking points according to the size of the horizontal coordinates and the size of the vertical coordinates corresponding to the pixel coordinates of the rotated marking points to obtain a sorting result.
在一个示例性的实施例中,所述标记点中包括预先设置的参考标记点,所述参考标记点具有预设的坐标特征;所述装置还包括校验模块,用于:识别所述标记点中所述参考标记点的行列坐标信息;在所述参考标记点的行列坐标信息不满足预设的坐标特征的情况下,调整所述待标定相机的参数;获取调整参数后的待标定相机采集的对应视野范围内的第一图像,并返回执行所述根据所述第一图像中部分圆环标记区域的像素坐标确定所述标定板的中心点的像素位置的步骤,直到所述参考标记点的行列坐标信息满足预设的坐标特征,根据所述部分标记点区域中每个所述标记点的像素坐标以及每个所述标记点位于所述标定板中的行列坐标信息,对相应的待标定相机进行标定。In an exemplary embodiment, the marking points include pre-set reference marking points, and the reference marking points have preset coordinate features; the device also includes a verification module, which is used to: identify row and column coordinate information of the reference marking points in the marking points; adjust the parameters of the camera to be calibrated when the row and column coordinate information of the reference marking points does not meet the preset coordinate features; obtain the first image within the corresponding field of view captured by the camera to be calibrated after the parameters are adjusted, and return to execute the step of determining the pixel position of the center point of the calibration plate according to the pixel coordinates of the partial circular marking area in the first image, until the row and column coordinate information of the reference marking points meets the preset coordinate features, and calibrate the corresponding camera to be calibrated according to the pixel coordinates of each of the marking points in the partial marking point area and the row and column coordinate information of each of the marking points located in the calibration plate.
在一个示例性的实施例中,所述校验模块还用于:根据所述部分标记点区域中每个所述标记点的像素坐标以及每个所述标记点位于所述标定板中的行列坐标信息,确定所述待标定相机的像素坐标到标定板坐标系的仿射变换关系;基于所述仿射变换关系,将对应待标定相机采集的第一图像中部分圆环标记区域中位于外环上的像素坐标进行仿射变换,得到变换后的坐标点集;对所述坐标点集进行拟合,得到拟合后的圆心坐标;获取所述坐标点集中每一个坐标点与所述圆心坐标之间的标准差;在所述标准差大于设定阈值的情况下,调整所述待标定相机的参数;获取调整参数后的待标定相机采集的对应视野范围内的第一图像,并返回执行所述根据所述第一图像中部分圆环标记区域的像素坐标确定所述标定板的中心点的像素位置的步骤,直到所述标准差小于或等于设定阈值,根据所述部分标记点区域中每个所述标记点的像素坐标以及每个所述标记点位于所述标定板中的行列坐标信息,对相应的待标定相机进行标定。In an exemplary embodiment, the verification module is further used to: determine the affine transformation relationship between the pixel coordinates of the camera to be calibrated and the calibration plate coordinate system according to the pixel coordinates of each of the marking points in the partial marking point area and the row and column coordinate information of each of the marking points in the calibration plate; based on the affine transformation relationship, perform affine transformation on the pixel coordinates located on the outer ring in the partial circular ring marking area in the first image captured by the corresponding camera to be calibrated to obtain a transformed coordinate point set; fit the coordinate point set to obtain the fitted center coordinates of the circle; obtain the standard deviation between each coordinate point in the coordinate point set and the center coordinates of the circle; if the standard deviation is greater than a set threshold, adjust the parameters of the camera to be calibrated; obtain the first image in the corresponding field of view captured by the camera to be calibrated after the parameters are adjusted, and return to execute the step of determining the pixel position of the center point of the calibration plate according to the pixel coordinates of the partial circular ring marking area in the first image until the standard deviation is less than or equal to the set threshold, and calibrate the corresponding camera to be calibrated according to the pixel coordinates of each of the marking points in the partial marking point area and the row and column coordinate information of each of the marking points in the calibration plate.
在一个示例性的实施例中,所述装置还包括作业平台运动比例标定模块,用于:在所述作业平台中运动轴位于初始位置处,获取待标定相机采集的对应视野范围内的第二图像,所述初始位置包括所述运动轴相对第一方向的位置和相对第二方向的位置;基于所述待标定相机的标定参数对所述第二图像进行仿射变换,确定所述第二图像中每个标记点位于所述标定板中的行列号和对应的第一坐标;控制所述运动轴相对于所述第一方向运动第一设定距离,获取待标定相机采集的对应视野范围内的第三图像,并确定与所述行列号对应的相同标记点的第二坐标;根据所述相同标记点的第一坐标、第二坐标以及所述第一设定距离,确定所述运动轴相对于所述第一方向运动的第一方向单位运动向量;控制所述运动轴相对于所述第二方向运动第二设定距离,获取待标定相机采集的对应视野范围内的第四图像,并确定与所述行列号对应的相同标记点的第三坐标;根据所述相同标记点的第一坐标、第三坐标以及所述第二设定距离,确定所述运动轴相对于所述第二方向运动的第二方向单位运动向量。In an exemplary embodiment, the device further includes a work platform motion ratio calibration module, which is used to: when the motion axis is located at an initial position in the work platform, obtain a second image within a corresponding field of view captured by the camera to be calibrated, wherein the initial position includes the position of the motion axis relative to the first direction and the position relative to the second direction; perform affine transformation on the second image based on the calibration parameters of the camera to be calibrated, and determine the row and column numbers and corresponding first coordinates of each marking point in the second image located in the calibration plate; control the motion axis to move a first set distance relative to the first direction, obtain a third image within a corresponding field of view captured by the camera to be calibrated, and determine the second coordinates of the same marking point corresponding to the row and column numbers; determine a first direction unit motion vector of the motion axis relative to the first direction according to the first coordinates, the second coordinates and the first set distance of the same marking point; control the motion axis to move a second set distance relative to the second direction, obtain a fourth image within the corresponding field of view captured by the camera to be calibrated, and determine the third coordinates of the same marking point corresponding to the row and column numbers; determine a second direction unit motion vector of the motion axis relative to the second direction according to the first coordinates, the third coordinates and the second set distance of the same marking point.
在一个示例性的实施例中,所述装置还包括作业平台旋转中心标定模块,用于:控制所述作业平台的运动轴进行旋转,分别获取所述待标定相机采集的旋转前的图像和旋转后的图像;基于所述待标定相机的标定参数对所述旋转前的图像和所述旋转后的图像分别进行仿射变换,获取所述旋转前的图像和所述旋转后的图像中目标参考标记点分别位于所述标定板的坐标信息;对所述目标参考标记点分别位于所述标定板的坐标信息进行拟合,确定所述作业平台的旋转中心的位置。In an exemplary embodiment, the device also includes a work platform rotation center calibration module, which is used to: control the motion axis of the work platform to rotate, and respectively obtain the image before rotation and the image after rotation captured by the camera to be calibrated; perform affine transformation on the image before rotation and the image after rotation based on the calibration parameters of the camera to be calibrated, and obtain the coordinate information of the target reference mark points in the image before rotation and the image after rotation located on the calibration plate; fit the coordinate information of the target reference mark points located on the calibration plate, and determine the position of the rotation center of the work platform.
上述相机标定装置中的各个模块可全部或部分通过软件、硬件及其组合来实现。上述各模块可以硬件形式内嵌于或独立于电子设备中的处理器中,也可以以软件形式存储于电子设备中的存储器中,以便于处理器调用执行以上各个模块对应的操作。Each module in the above camera calibration device can be implemented in whole or in part by software, hardware, or a combination thereof. Each module can be embedded in or independent of a processor in an electronic device in the form of hardware, or can be stored in a memory in an electronic device in the form of software, so that the processor can call and execute operations corresponding to each module.
在一个示例性的实施例中,提供了一种电子设备,其内部结构图可以如图9所示。该电子设备包括处理器、存储器、输入/输出接口、通信接口、显示单元和输入装置。其中,处理器、存储器和输入/输出接口通过系统总线连接,通信接口、显示单元和输入装置通过输入/输出接口连接到系统总线。其中,该电子设备的处理器用于提供计算和控制能力。该电子设备的存储器包括非易失性存储介质和内存储器。该非易失性存储介质存储有操作系统和计算机程序。该内存储器为非易失性存储介质中的操作系统和计算机程序的运行提供环境。该电子设备的输入/输出接口用于处理器与外部设备之间交换信息。该电子设备的通信接口用于与外部的终端进行有线或无线方式的通信,无线方式可通过WIFI、移动蜂窝网络、近场通信(Near Field Communication,NFC)或其他技术实现。该计算机程序被处理器执行时以实现一种相机标定方法。该电子设备的显示单元用于形成视觉可见的画面,可以是显示屏、投影装置或虚拟现实成像装置。显示屏可以是液晶显示屏或者电子墨水显示屏,该电子设备的输入装置可以是显示屏上覆盖的触摸层,也可以是电子设备外壳上设置的按键、轨迹球或触控板,还可以是外接的键盘、触控板或鼠标等。In an exemplary embodiment, an electronic device is provided, and its internal structure diagram may be shown in FIG9. The electronic device includes a processor, a memory, an input/output interface, a communication interface, a display unit, and an input device. The processor, the memory, and the input/output interface are connected via a system bus, and the communication interface, the display unit, and the input device are connected to the system bus via the input/output interface. The processor of the electronic device is used to provide computing and control capabilities. The memory of the electronic device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system and a computer program. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The input/output interface of the electronic device is used to exchange information between the processor and an external device. The communication interface of the electronic device is used to communicate with an external terminal in a wired or wireless manner, and the wireless manner can be implemented through WIFI, a mobile cellular network, near field communication (NFC) or other technologies. When the computer program is executed by the processor, a camera calibration method is implemented. The display unit of the electronic device is used to form a visually visible picture, which may be a display screen, a projection device, or a virtual reality imaging device. The display screen can be a liquid crystal display screen or an electronic ink display screen, and the input device of the electronic device can be a touch layer covering the display screen, or a button, trackball or touchpad set on the electronic device housing, or an external keyboard, touchpad or mouse.
本领域技术人员可以理解,图9中示出的结构,仅仅是与本申请方案相关的部分结构的框图,并不构成对本申请方案所应用于其上的电子设备的限定,具体的电子设备可以包括比图中所示更多或更少的部件,或者组合某些部件,或者具有不同的部件布置。Those skilled in the art will understand that the structure shown in FIG. 9 is merely a block diagram of a partial structure related to the scheme of the present application, and does not constitute a limitation on the electronic device to which the scheme of the present application is applied. The specific electronic device may include more or fewer components than shown in the figure, or combine certain components, or have a different arrangement of components.
在一个示例性的实施例中,提供了一种电子设备,包括存储器和处理器,存储器中存储有计算机程序,该处理器执行计算机程序时实现上述各方法实施例中的步骤。In an exemplary embodiment, an electronic device is provided, including a memory and a processor, wherein a computer program is stored in the memory, and the processor implements the steps in the above-mentioned method embodiments when executing the computer program.
在一个实施例中,提供了一种计算机可读存储介质,其上存储有计算机程序,计算机程序被处理器执行时实现上述各方法实施例中的步骤。In one embodiment, a computer-readable storage medium is provided, on which a computer program is stored. When the computer program is executed by a processor, the steps in the above-mentioned method embodiments are implemented.
在一个实施例中,提供了一种计算机程序产品,包括计算机程序,该计算机程序被处理器执行时实现上述各方法实施例中的步骤。In one embodiment, a computer program product is provided, including a computer program, which implements the steps in the above method embodiments when executed by a processor.
本领域普通技术人员可以理解实现上述实施例方法中的全部或部分流程,是可以通过计算机程序来指令相关的硬件来完成,所述的计算机程序可存储于一非易失性计算机可读取存储介质中,该计算机程序在执行时,可包括如上述各方法的实施例的流程。其中,本申请提供的各实施例中所使用的对存储器、数据库或其它介质的任何引用,均可包括非易失性存储器和易失性存储器中的至少一种。非易失性存储器可包括只读存储器(Read-Only Memory,ROM)、磁带、软盘、闪存、光存储器、高密度嵌入式非易失性存储器、阻变存储器(Resistive Random Access Memory,ReRAM)、磁变存储器(MagnetoresistiveRandomAccess Memory,MRAM)、铁电存储器(Ferroelectric Random Access Memory,FRAM)、相变存储器(Phase Change Memory,PCM)、石墨烯存储器等。易失性存储器可包括随机存取存储器(Random Access Memory,RAM)或外部高速缓冲存储器等。作为说明而非局限,RAM可以是多种形式,比如静态随机存取存储器(Static Random Access Memory,SRAM)或动态随机存取存储器(Dynamic Random Access Memory,DRAM)等。本申请提供的各实施例中所涉及的数据库可包括关系型数据库和非关系型数据库中至少一种。非关系型数据库可包括基于区块链的分布式数据库等,不限于此。本申请提供的各实施例中所涉及的处理器可为通用处理器、中央处理器、图形处理器、数字信号处理器、可编程逻辑器、基于量子计算的数据处理逻辑器、人工智能(Artificial Intelligence,AI)处理器等,不限于此。A person of ordinary skill in the art can understand that all or part of the processes in the above-mentioned embodiment method can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to the memory, database or other medium used in the embodiments provided in the present application can include at least one of non-volatile memory and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetic random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory can include random access memory (RAM) or external cache memory, etc. As an illustration and not limitation, RAM can be in various forms, such as static random access memory (SRAM) or dynamic random access memory (DRAM). The database involved in each embodiment provided in this application may include at least one of a relational database and a non-relational database. Non-relational databases may include distributed databases based on blockchains, etc., but are not limited to this. The processor involved in each embodiment provided in this application may be a general-purpose processor, a central processing unit, a graphics processor, a digital signal processor, a programmable logic device, a data processing logic device based on quantum computing, an artificial intelligence (AI) processor, etc., but are not limited to this.
以上实施例的各技术特征可以进行任意的组合,为使描述简洁,未对上述实施例中的各个技术特征所有可能的组合都进行描述,然而,只要这些技术特征的组合不存在矛盾,都应当认为是本申请记载的范围。The technical features of the above embodiments may be combined arbitrarily. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this application.
以上所述实施例仅表达了本申请的几种实施方式,其描述较为具体和详细,但并不能因此而理解为对本申请专利范围的限制。应当指出的是,对于本领域的普通技术人员来说,在不脱离本申请构思的前提下,还可以做出若干变形和改进,这些都属于本申请的保护范围。因此,本申请的保护范围应以所附权利要求为准。The above-described embodiments only express several implementation methods of the present application, and the descriptions thereof are relatively specific and detailed, but they cannot be understood as limiting the scope of the present application. It should be pointed out that, for a person of ordinary skill in the art, several variations and improvements can be made without departing from the concept of the present application, and these all belong to the protection scope of the present application. Therefore, the protection scope of the present application shall be subject to the attached claims.
Claims (10)
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202411140630.9A CN118657841B (en) | 2024-08-20 | 2024-08-20 | Camera calibration method, device and electronic equipment |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202411140630.9A CN118657841B (en) | 2024-08-20 | 2024-08-20 | Camera calibration method, device and electronic equipment |
Publications (2)
Publication Number | Publication Date |
---|---|
CN118657841A CN118657841A (en) | 2024-09-17 |
CN118657841B true CN118657841B (en) | 2024-10-25 |
Family
ID=92704128
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202411140630.9A Active CN118657841B (en) | 2024-08-20 | 2024-08-20 | Camera calibration method, device and electronic equipment |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN118657841B (en) |
Citations (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN115409898A (en) * | 2022-08-04 | 2022-11-29 | 华中科技大学 | A high-precision camera calibration method and device based on a special annular calibration plate |
CN117152264A (en) * | 2023-08-04 | 2023-12-01 | 西北工业大学 | A large field of view camera calibration method based on multiple annular coding point calibration plates |
-
2024
- 2024-08-20 CN CN202411140630.9A patent/CN118657841B/en active Active
Patent Citations (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN115409898A (en) * | 2022-08-04 | 2022-11-29 | 华中科技大学 | A high-precision camera calibration method and device based on a special annular calibration plate |
CN117152264A (en) * | 2023-08-04 | 2023-12-01 | 西北工业大学 | A large field of view camera calibration method based on multiple annular coding point calibration plates |
Also Published As
Publication number | Publication date |
---|---|
CN118657841A (en) | 2024-09-17 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN110458898B (en) | Camera calibration board, calibration data acquisition method, distortion correction method and device | |
CN102376089B (en) | Target correction method and system | |
CN111872544B (en) | Calibration method and device for laser light-emitting indication point and galvanometer coaxial vision system | |
CN108198230A (en) | A 3D Point Cloud Extraction System of Crop Fruit Based on Scattered Images | |
CN109272574B (en) | Construction method and calibration method of linear array rotary scanning camera imaging model based on projection transformation | |
JP2022528301A (en) | Calibration method, positioning method, equipment, electronic devices and storage media | |
CN112686950B (en) | Pose estimation method, pose estimation device, terminal equipment and computer readable storage medium | |
CN113409382A (en) | Method and device for measuring damaged area of vehicle | |
WO2024011764A1 (en) | Calibration parameter determination method and apparatus, hybrid calibration board, device, and medium | |
WO2018201677A1 (en) | Bundle adjustment-based calibration method and device for telecentric lens-containing three-dimensional imaging system | |
CN109272555B (en) | A method of obtaining and calibrating external parameters of RGB-D camera | |
CN114463438B (en) | A calibration plate, a calibration plate identification method, a calibration plate identification device and a computer readable medium | |
CN118014832B (en) | Image stitching method and related device based on linear feature invariance | |
CN104376572A (en) | Mobile terminal camera calibrating method | |
CN105423975B (en) | The calibration system and method for a kind of large-scale workpiece | |
CN119006609A (en) | Camera calibration method | |
JP2005140547A (en) | 3-dimensional measuring method, 3-dimensional measuring device and computer program | |
CN111915681B (en) | External parameter calibration method, device, storage medium and equipment for multi-group 3D camera group | |
WO2023028939A1 (en) | Information acquisition system, calibration method and apparatus therefor, and computer-readable storage medium | |
CN118657841B (en) | Camera calibration method, device and electronic equipment | |
WO2025001429A1 (en) | 3d imaging system, calibration method and calibration apparatus therefor, and calibration device | |
CN118247355A (en) | Camera external parameter calibration method, device, computer equipment and storage medium | |
CN112819900B (en) | Method for calibrating internal azimuth, relative orientation and distortion coefficient of intelligent stereography | |
CN112634377B (en) | Camera calibration method, terminal and computer readable storage medium of sweeping robot | |
CN115601451B (en) | External parameter data calibration method, device, computer equipment and storage medium |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
GR01 | Patent grant | ||
GR01 | Patent grant |