CN114708164A - Method for correcting image large and small head distortion caused by object inclination in machine vision measurement - Google Patents

Method for correcting image large and small head distortion caused by object inclination in machine vision measurement Download PDF

Info

Publication number
CN114708164A
CN114708164A CN202210366766.6A CN202210366766A CN114708164A CN 114708164 A CN114708164 A CN 114708164A CN 202210366766 A CN202210366766 A CN 202210366766A CN 114708164 A CN114708164 A CN 114708164A
Authority
CN
China
Prior art keywords
image
camera
calibration
point
images
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.)
Granted
Application number
CN202210366766.6A
Other languages
Chinese (zh)
Other versions
CN114708164B (en
Inventor
林珣
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Sichuan Yan Fei Tech Co ltd
Original Assignee
Sichuan Yan Fei Tech Co ltd
Priority date (The priority date 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 date listed.)
Filing date
Publication date
Application filed by Sichuan Yan Fei Tech Co ltd filed Critical Sichuan Yan Fei Tech Co ltd
Priority to CN202210366766.6A priority Critical patent/CN114708164B/en
Publication of CN114708164A publication Critical patent/CN114708164A/en
Application granted granted Critical
Publication of CN114708164B publication Critical patent/CN114708164B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • G06T5/80
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T7/00Image analysis
    • G06T7/80Analysis of captured images to determine intrinsic or extrinsic camera parameters, i.e. camera calibration
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T2207/00Indexing scheme for image analysis or image enhancement
    • G06T2207/10Image acquisition modality
    • G06T2207/10004Still image; Photographic image

Abstract

The invention relates to a machine vision measurement technology, and particularly discloses a method for correcting image large and small head distortion caused by object inclination in machine vision measurement. The method comprises the following steps: step 1, building a work table and manufacturing a calibration plate; step 2, collecting black and white checkerboard calibration images; step 3, screening the checkerboard calibration images; step 4, calculating internal and external parameters of the camera; step 5, collecting the circular dot matrix calibration plate image and calculating the coordinates of the circular dots; step 6, dividing the circular lattice calibration plate into a far camera part and a near camera part; step 7, calculating the inclined axis of the object; step 8, deducing a correction point expression of the projection point of the far and near camera; step 9, calculating the inclination angle of the object; and step 10, correcting the large and small head images. The distortion parameters can be solved quickly and accurately, and then the distortion of the large head and the small head can be corrected, so that the vision measurement precision can be improved.

Description

Method for correcting image large and small head distortion caused by object inclination in machine vision measurement
One, the technical field
The invention relates to a machine vision measurement technology, in particular to a method for correcting distortion of a large head and a small head of an image caused by object inclination in machine vision measurement.
Second, background Art
The machine vision measurement technology opens up a new way for solving the problems of automation, flexibility and on-line measurement. The method is a non-contact measurement method integrating technologies such as optoelectronics, computer graphics, information processing and the like, and has the advantages of flexibility, economy, convenience in computer analysis and processing of measurement results and the like. The disadvantages of visual measurement are also evident: the image shot by the camera is not an ideal image under a perspective model, and an optical distortion error exists between the actual imaging of the object point on the imaging medium of the camera and the ideal image. Thus, radial distortion, tangential distortion and thin prism distortion (camera distortion for short) exist; the study and correction of the image distortion achieve good study and correction effects. In video measurement, the image size and head distortion (short for size and head distortion) caused by the nonparallel (short for object inclination) of a shooting object and a camera also exists, and the distortion is very common.
For various distortions in machine video measurement, generally ignoring the distortion of the big head and the small head, and independently processing the distortion of the camera by using a Zhang Yong calibration algorithm (the algorithm assumes that an object is parallel to the camera and the distortion of the big head and the small head does not exist); or combining the camera distortion and the large and small head distortion to establish a model, and solving four camera distortion parameters and three large and small head distortion parameters by using a Levenberg-Marquardt optimization algorithm. The disadvantages of this method are: (1) neglecting large and small head distortion is a defect itself; (2) the combined processing parameters are more, and the search time and space cost is higher; (3) the Levenberg-Marquardt optimization algorithm has stronger sensitivity to the initial value, and distortion parameters are easy to be locally optimal solutions. These disadvantages greatly weaken the reliability of distortion parameters and the correction effect is not good, thereby seriously affecting the measurement accuracy.
Because of the universality of the visual measurement of the distortion of the large head and the small head and the difficult acquirement of the correction parameters, the method which is convenient to use, high in reliability of the correction parameters and good in correction effect is required to be invented and has very important significance.
Third, the invention
The invention aims to provide a method for correcting the distortion of the big and small heads of an image caused by the inclination of an object in machine vision measurement, which is used for rapidly and accurately solving distortion parameters and then correcting the distortion of the big and small heads, thereby increasing the precision of vision measurement.
The invention is realized by the following technical scheme: the method for correcting the distortion of the big and small heads of an image caused by the inclination of an object in machine vision measurement comprises the following steps: step 1: building a visual measurement working table and a calibration plate, building the measurement working table according to the size of a visual measurement object, and manufacturing a black-white chessboard calibration plate and a circular dot matrix calibration plate after building is completed; step 2: collecting checkerboard calibration images, and collecting calibration images at different positions in the field of view of the camera; and step 3: screening the checkerboard calibration images, screening the checkerboard calibration images in an OpenCV open source calibration program, and supplementing the screened calibration images; and 4, step 4: calculating the internal parameters of the camera, and calculating the internal parameters of the camera by using the screened checkerboard calibration images; and 5: collecting circular dot matrix calibration plate images and calculating coordinates of circular points; step 6: dividing the circular lattice calibration plate into a far camera part and a near camera part, and dividing the circular lattice calibration image according to the distance from the dual projection circular point to the central point; and 7: calculating a tilt axis of the object; and 8: deducing a correction point expression of a projection point of the far and near camera; and step 9: calculating the inclination angle of the object; step 10: and correcting the large and small head images. It should be noted that, for various distortions in the machine video measurement, the camera distortion is generally handled separately by a Zhang Yong calibration algorithm (the algorithm assumes that the object is parallel to the camera and there is no distortion of the big head and the small head); or combining the camera distortion and the large and small head distortion to establish a model, and solving four camera distortion parameters and three large and small head distortion parameters by using a Levenberg-Marquardt optimization algorithm. The disadvantages of this method are: (1) the theoretical basis of the distortion of the large head and the small head is not sufficient by using a Zhang Yong calibration algorithm; (2) the combined processing parameters are more, and the search time and space cost is higher; (3) the Levenberg-Marquardt optimization algorithm has stronger sensitivity to the initial value, and distortion parameters are easy to be locally optimal solutions. These disadvantages greatly weaken the reliability of distortion parameters and the correction effect is not good, thereby seriously affecting the measurement accuracy.
In view of the above problems, the applicant proposes a method for correcting the distortion of the large and small heads of an image caused by the inclination of an object in the machine vision measurement. Solving the correction parameters of the distorted images of the big and small heads is a brand new method, and the internal parameters of the camera and the distorted correction parameters of the big and small heads are solved step by step: and solving the internal parameters of the camera by applying a Zhang Zhen you camera calibration method, and applying the internal parameters to the solving of the distortion correction parameters of the big and small heads. The image is divided into a near camera projection part and a far camera projection part according to the tilt axis of the object, and the boundary is solved using the position coordinates of the dividing point. And establishing a parameter equation of the inclination angle of the object according to the perspective projection principle and the equal distance between the point corrected by the dual projection point and the principal point, wherein the inclination angle of the object is determined by applying the angle when the absolute value of the difference between the distances from the correction points of all the dual projection points to the principal point is the minimum. The time and space complexity of the correction parameter solution is very low, and the correction effect of the distorted image is improved, so that the precision of vision measurement is improved.
Further, step 2 specifically includes: collecting at least 3 images of black and white chessboard calibration plates at different positions on a work table, placing a circular dot matrix calibration plate on the work table, aligning the center point of the circular dot matrix calibration plate to the center of a camera, leveling the dot matrix calibration plate, and collecting circular dot matrix calibration images. The step 3 specifically comprises the following steps: and screening and supplementing images, namely screening the images of the black and white checkerboard calibration board according to a calibration algorithm, wherein the screening condition is that an angle point diagram appears, and if the number of the images meeting the condition is less than 16, the calibration board needs to be supplemented. When the image is supplemented, the light intensity and the inclination direction of the calibration point can be adjusted. It should be noted that the calibration plate is manufactured by: (1) manufacturing a Zhangyingyou camera calibration plate: 9 x 10 square black and white alternated calibration plates with side length of 10 cm; (2) the method comprises the steps of manufacturing a round dot array calibration plate which is 1.5 meters long and 1 meter wide, is engraved with 19 rows and 25 columns of 475 circular dot arrays with the radius of 1 millimeter and the interval between two vertically and horizontally adjacent dots of 5 centimeters, and the specification of the round dot array calibration plate may change according to the distance between a work table and a camera, so that the dot arrays are required to be ensured to be paved in the field of vision of the camera as much as possible.
Further, step 4 specifically includes: inputting the checkerboard calibration image into the open source function by using the open source function calibration camera, and outputting the checkerboard calibration image as the principal point coordinate (u) of the camera0,v0) Focal length f and the actual distances alpha and beta between the pixels on the X and Y axes. It should be noted that the open source function of the zhangyou calibration algorithm in OpenCV is called by using the C + + language in VS2013 to calibrate the camera. Inputting the image of the black and white chessboard grid calibration plate into an open source function, and calculating the principal point coordinate (u) of the camera0,v0) Focal length f and the actual distances alpha and beta between the pixels on the X and Y axes.
Further, step 7 specifically includes: determining demarcation points of two far and near camera projection points of each line according to different types of points of each line, and determining the demarcation points according to the demarcation pointsThe midpoint is a sample point, and the sample point is fitted by a least square method to obtain the slope of the inclined axis of the camera on the imaging medium plane
Figure BDA0003586184910000031
Wherein (u)i,vi) Representing the coordinates of the middle points of two demarcation points per line, n represents the number of lines of the circular lattice calibration plate, the over-principal point (u)0,v0) The equation for the tilt axis of (c) is: v-ku + v0-ku0. The distances from the two dual points to the central point are unequal, the point with the large distance is a far camera projection point, and the point with the large distance is a near camera projection point. All the far camera projection points and the near camera projection points constitute a far camera part and a near camera part, respectively, and their boundary lines are the inclined axes of the object. And determining the boundary point of the two far and near camera projection points of each line according to the different types of the points in each line, taking the center point as a sample point, and fitting the sample point by using a least square method to obtain the slope k of the inclined axis of the object on the XY plane.
Further, step 9 specifically includes: first derivative function equation for solving expression
Figure BDA0003586184910000032
The value of theta can be obtained; due to the fact thatNThe individual derivative functions cannot be simply summed and are difficult to directly solve; and searching the root of the derivative function equation by using a dichotomy method when the given iteration number or the absolute value of the difference of the derivative values of two adjacent times is smaller than a given threshold value so as to obtain the inclination angle of the object. For tilt angles, the object tilt axis divides the image into two parts, a near camera projection and a far camera projection; according to the perspective projection principle, a near camera projection point in dual projection points is corrected to an imaging medium, then a far camera projection point is also corrected to the imaging medium, and the distances between the two points and a principal point are equal theoretically. In practice not all correction points fulfill this condition. In order to obtain the inclination angle, the inclination angle of the object is determined by the angle at which the absolute value of the differences between the correction points of all the dual projection points and the principal point is minimized. After the iteration times are given, solving a derivative function equation by a dichotomy to obtain the object inclination angle theta.
Further onStep 10 specifically includes: using the coordinates (u) of the principal point of the camera's intrinsic parameters0,v0) The focal length f, the actual distances alpha and beta between the pixels on the X axis and the Y axis, the inclined axis k of the object in the XY plane, the inclined angle theta of the object in the Z axis direction and other parameters, and reversely solving the correction point of each pixel point in the large and small head images; in finding the object tilt axis l: after v is ku + b and the inclination angle theta, dividing the distorted image into near camera projection parts by using the inclination axisπ1Sum-distance camera projection part pi2(ii) a Taking a distorted image point A0(u0,v0) Obtaining the distance r from the ideal point A (u, v) to the center of the image; if A is0(u0,v0)∈π1Then, then
Figure BDA0003586184910000041
If A is0(u0,v0)∈π2Then, then
Figure BDA0003586184910000042
If A is0(u0,v0)∈l,r=r0Rotating the image clockwise around the image center by atan (k) angle so that the tilt axis coincides with U; by
Figure BDA0003586184910000043
And relational expression
Figure BDA0003586184910000044
Finding the coordinates of the ideal point as
Figure BDA0003586184910000045
If A is0(u0,v0) E.g., l, then u is u0V is 0; wherein
Figure BDA0003586184910000046
The ideal point is rotated counterclockwise atan (k) around the center of the image to obtain the ideal image.
Compared with the prior art, the invention has the following advantages and beneficial effects:
1. the method mainly corrects the big-end and small-end images in the video measurement, has fewer and definite calculation parameters and has smaller time and space complexity; and when the shooting environment is not changed, the inclination correction parameters do not need to be repeatedly calculated. The time cost for correcting the image is reduced by 95 percent;
2. the method is based on the industrial machine vision measurement, calibrates the internal and external parameters of the camera and the tilt parameters of the object, searches the edge and corner points of the object by a Canny operator, and calculates the actual size of the object. After the inclination correction, the length difference between the upper side and the lower side of the rectangle is changed from the original 11.88 pixels into 6.1333 corrected pixels, and the image size head phenomenon is obviously corrected;
3. taking correction of the dot matrix calibration plate image as an example, the absolute value of the distance difference is statistically analyzed, the average value of the absolute values of the distance differences from the dual projection points to the center of the dot matrix is 1.79761 pixels, and the variance is 2.02377; the corrected average value is 0.31558 pixels, the variance is 0.0693318, the corrected average value is 17.6 percent of the difference value before correction, the variance is very small, the distance difference value after correction is further explained to be kept less than 0.35 pixel, the distortion parameter can be rapidly and accurately solved, and then the distortion of the large head and the small head is corrected, so that the vision measurement precision is increased;
4. the distortion degree of the distorted image before the object tilt correction is 2.5638 pixels, and the distortion degree of the ideal image is 0.3754 pixels.
Description of the drawings
The accompanying drawings, which are included to provide a further understanding of the embodiments of the invention and are incorporated in and constitute a part of this application, illustrate embodiment(s) of the invention and together with the description serve to explain the principles of the invention. In the drawings:
FIG. 1 is a flow chart of the system of the present invention.
Fifth, detailed description of the invention
In order to make the objects, technical solutions and advantages of the present invention more apparent, the present invention is further described in detail below with reference to examples and accompanying drawings, and the exemplary embodiments and descriptions thereof are only used for explaining the present invention and are not meant to limit the present invention. It should be noted that the present invention is in practical development and use.
Example (b):
as shown in FIG. 1, the method for correcting the image capitalization and capitalization distortion caused by the object inclination in the machine vision measurement comprises the following steps: step 1: building a visual measurement working table and manufacturing a calibration plate, building the measurement working table according to the size of a visual measurement object, and manufacturing a black-white chessboard calibration plate and a circular dot matrix calibration plate after building is completed; step 2: collecting checkerboard calibration images, and collecting calibration images at different positions in the field of view of the camera; and step 3: screening the checkerboard calibration images, screening the checkerboard calibration images in an OpenCV open source calibration program, and supplementing the screened calibration images; and 4, step 4: calculating the internal parameters of the camera, and calculating the internal parameters of the camera by using the screened checkerboard calibration images; and 5: collecting circular dot matrix calibration plate images and calculating coordinates of circular points; step 6: dividing the circular lattice calibration plate into a far camera part and a near camera part, and dividing the circular lattice calibration image according to the distance from the dual projection circular point to the central point; and 7: calculating a tilt axis of the object; and 8: deducing a correction point expression of a projection point of the far and near camera; and step 9: calculating the inclination angle of the object; step 10: and correcting the large and small head images. The step 2 specifically comprises the following steps: collecting at least 3 images of black and white chessboard calibration plates at different positions on a work table, placing a circular dot matrix calibration plate on the work table, aligning the center point of the circular dot matrix calibration plate to the center of a camera, leveling the dot matrix calibration plate, and collecting circular dot matrix calibration images. The step 3 specifically comprises the following steps: and screening and supplementing images, namely screening the images of the black and white checkerboard calibration board according to a calibration algorithm, wherein the screening condition is that an angle point diagram appears, and if the number of the images meeting the condition is less than 16, the calibration board needs to be supplemented. When the image is supplemented, the light intensity and the inclination direction of the calibration point can be adjusted. The step 4 specifically comprises the following steps: inputting the checkerboard calibration image into the open source function by using the open source function calibration camera, and outputting the checkerboard calibration image as the principal point coordinate (u) of the camera0,v0) Focal length f and the actual distances alpha and beta between the pixels on the X and Y axes. The step 7 specifically comprises the following steps: determining boundary points of two far and near camera projection points in each line according to different types of points in each line, fitting the sample points by using the midpoints of the boundary points as sample points by using a least square method to obtain the camera imageSlope of tilt axis in image medium plane
Figure BDA0003586184910000051
Wherein (u)i,vi) Representing the coordinates of the middle points of two demarcation points per line, n represents the number of lines of the circular lattice calibration plate, the over-principal point (u)0,v0) The equation for the tilt axis of (c) is: v-ku + v0-ku0. Step 8, specifically comprising: using the coordinates (u) of the principal point of the camera's intrinsic parameters0,v0) The focal length f, the actual distances alpha and beta between pixels on the X axis and the Y axis, the inclined axis k of the object in the XY plane, the inclined angle theta of the object in the Z axis direction and other parameters; setting dual projection point B on distorted image2(v1,u1) And D2(v2,u2) Distances to the center of the distorted image are r1And r2,β1And beta2The angle, beta, formed by the two projection lines and the image plane1=∠OB2D2,β2=∠OD2B2,η1And η2Are respectively r1And r2On the ideal image; angle, η, formed by orthographic projection and distorted image1=∠B3O2B2,η2=∠D3O2D2(ii) a Let | O2B3|=rl1,|O2D3L-rl 2, r being derived from the principle of perspective projection and the geometric relationship of trianglesl1And rl2The following relationship is satisfied:
Figure BDA0003586184910000061
a point array image having N pairs of even proxels; assuming that the inclination angle of the object is θ, θ is calculated so as to satisfy:
Figure BDA0003586184910000062
wherein r isli1And rli2Respectively representing the distance of the ideal dual proxel from the center of the image,
Figure BDA0003586184910000063
the step 9 specifically comprises: to findFirst derivative function equation of solution expression
Figure BDA0003586184910000064
The value of theta can be obtained; because N derivative functions can not be simply summed, the direct solution is difficult; and searching the root of the derivative function equation by using a dichotomy method when the given iteration number or the absolute value of the difference of the derivative values of two adjacent times is smaller than a given threshold value so as to obtain the inclination angle of the object. The step 10 specifically comprises: using the coordinates (u) of the principal point of the camera's intrinsic parameters0,v0) The focal length f, the actual distances alpha and beta between the pixels on the X axis and the Y axis, the inclined axis k of the object in the XY plane, the inclined angle theta of the object in the Z axis direction and other parameters, and reversely solving the correction point of each pixel point in the large and small head images; in finding the object tilt axis l: after v is ku + b and the inclination angle theta, the distortion image is divided into a near camera projection part pi by the inclination axis1Sum-distance camera projection part pi2(ii) a Taking a distorted image point A0(u0,v0) Obtaining the distance r from the ideal point A (u, v) to the center of the image; if A is0(u0,v0)∈π1Then, then
Figure BDA0003586184910000065
If A is0(u0,v0)∈π2Then, then
Figure BDA0003586184910000066
If A is0(u0,v0)∈l,r=r0. Rotating the image clockwise by an angle a tan (k) around the center of the image such that the tilt axis coincides with U; by
Figure BDA0003586184910000067
And relational expression
Figure BDA0003586184910000068
Finding the coordinates of the ideal point as
Figure BDA0003586184910000069
Figure BDA00035861849100000610
If A is0(u0,v0) E.g., l, then u is u0V is 0; wherein
Figure BDA00035861849100000611
Figure BDA00035861849100000612
The ideal point is rotated counterclockwise atan (k) around the center of the image to obtain the ideal image.
It should be noted that, for various distortions in the machine video measurement, the distortion of the large and small heads is generally ignored, and the distortion of the camera is separately processed by using a Zhang Yongyou calibration algorithm (the algorithm assumes that the object is parallel to the camera, and the distortion of the large and small heads does not exist); or combining the camera distortion and the large and small head distortion to establish a model, and solving four camera distortion parameters and three large and small head distortion parameters by using a Levenberg-Marquardt optimization algorithm. The disadvantages of this method are: (1) neglecting large and small head distortion is a defect itself; (2) the combined processing parameters are more, and the search time and space cost is higher; (3) the Levenberg-Marquardt optimization algorithm has stronger sensitivity to the initial value, and distortion parameters are easy to be locally optimal solutions. These disadvantages greatly weaken the reliability of distortion parameters and the correction effect is not good, thereby seriously affecting the measurement accuracy. In view of the above problems, the applicant proposes a method for correcting the distortion of the large and small heads of an image caused by the inclination of an object in the machine vision measurement. Solving the correction parameters of the distorted images of the big and small heads is a brand new method, and the internal parameters of the camera and the distorted correction parameters of the big and small heads are solved step by step: and solving the internal parameters of the camera by applying a Zhang-Yong camera calibration method, and applying the internal parameters to the solving of the correction parameters of the distortion of the large head and the small head. The image is divided into a near camera projection part and a far camera projection part according to the tilt axis of the object, and the boundary is solved using the position coordinates of the dividing point. And establishing a parameter equation of the inclination angle of the object according to the perspective projection principle and the equal distance between the point corrected by the dual projection point and the principal point, wherein the inclination angle of the object is determined by applying the angle when the absolute value of the difference between the distances from the correction points of all the dual projection points to the principal point is the minimum. The time and space complexity of the correction parameter solution is very low, and the correction effect of the distorted image is improved, so that the precision of vision measurement is improved.
It should be further noted that the manufactured calibration plate is: (1) manufacturing a Zhangyingyou camera calibration plate: 9 x 10 square black and white alternated calibration plates with side length of 10 cm; (2) the method is characterized in that a round dot array calibration plate which is 1.5 meters long and 1 meter wide and is engraved with 19 rows and 25 columns, 475 circular dots with the radius of 1 millimeter and 5 centimeters between two adjacent vertical and horizontal dots is manufactured, the specification of the round dot array calibration plate possibly changes according to the distance between a work table and a camera, and the dot array is required to be ensured to be paved in the field of view of the camera as much as possible. And calling an open source function calibration camera of a Zhang friend calibration algorithm in OpenCV by using a C + + language in VS 2013. Inputting the image of the black and white training friend calibration plate into the open source function, and outputting the principal point coordinate (u) of the camera by calculation0,v0) Focal length f and the actual distances alpha and beta between the pixels on the X and Y axes. According to the position relation of the points in the point array, dual projection points are determined, and the distance between the dual projection points and the central point of the point array is calculated. The distances from the two dual points to the central point are unequal, points with large distances are far camera projection points, and points with large distances from the central point are near camera projection points. All the far camera projection points and the near camera projection points constitute a far camera part and a near camera part, respectively, and their boundary lines are the inclined axes of the object. And determining the boundary point of the two far and near camera projection points of each line according to the different types of the points in each line, taking the center point as a sample point, and fitting the sample point by using a least square method to obtain the slope k of the inclined axis of the object on the XY plane. It should also be noted that, for the tilt angle, the object tilt axis divides the image into two parts, a near camera projection and a far camera projection; according to the perspective projection principle, a near camera projection point in dual projection points is corrected to an imaging medium, then a far camera projection point is also corrected to the imaging medium, and the distances between the two points and a main point are equal theoretically. In practice not all correction points fulfill this condition. In order to obtain the tilt angle, the tilt angle of the object is determined by the angle at which the absolute value of the difference in distances from the correction points to the principal point of all the dual projection points is minimized. After the given iteration number, solving the derivative function equation by using a dichotomy to obtainTo the object tilt angle theta.
The method comprises the following steps: and (5) building a measuring work table. According to the size of an object to be measured visually, a measuring work table needs to be built, and the work table is as flat as possible; a cross bar for placing the camera is erected on the workbench. In order to reduce measurement errors, when the work table and the camera are fixed, the work table is kept horizontal as much as possible, and a camera lens is parallel to the work table. And (5) manufacturing a calibration plate. (1) Manufacturing a Zhangyingyou camera calibration plate: 9 x 10 square black and white alternated calibration plates with side length of 10 cm; (2) a circular dot array calibration plate (the specification of which may vary according to the distance between the stage and the camera) is manufactured, wherein the circular dot array calibration plate is 1.5 meters long and 1 meter wide, 19 rows and 25 columns are engraved, 475 circular dots with the radius of 1 millimeter are arranged, and the distance between adjacent dots is 5 centimeters. And collecting a calibration image. (1) Collecting at least 9 black and white calibration plate images at different positions on a workbench according to the requirements of a Zhangyingyou calibration method; (2) and placing the circular dot matrix calibration plate on a workbench, aligning the center point of the dot matrix calibration plate to the center of the camera, and collecting the image of the calibration plate. And screening the calibration image. And screening the images of the black and white calibration plate by using a Zhangyingyou calibration algorithm. In the camera calibration, a calibration chart in which an angle point diagram can appear is an image satisfying the condition. And supplementing the calibration image. In order to ensure the accuracy of camera calibration, less than 9 images meeting the condition need to be complemented by 9 images, generally no more than 16 images, and the images must come from different positions in the camera view; when a calibration image is shot, the light intensity and the inclination direction of the calibration plate can be adjusted to ensure that the image can pass through screening during calibration. The internal parameters of the camera are calculated. Calling an open source function of a Zhang Zhengyou calibration algorithm in OpenCV by using C + + language in VS2013, inputting Zhang Zhengyou calibration plate images with black and white intervals into the function, and outputting a principal point coordinate (u) of the camera through calculation0,v0) Focal length f and the actual distances alpha and beta between the pixels on the X and Y axes. The coordinates of the circular points are calculated. Binarizing the circular lattice calibration plate image, and assigning 1 to the pixel value of a black point or assigning 0 to other pixel values; clustering points with the pixel value of 1 in the image by using a moving window clustering algorithm, and clustering into classes according to the number of the points on the dot matrix calibration plate; the arithmetic mean of the coordinates of each point in the class is then used as the coordinates of the circular index point. Is divided intoThe image is cut into a far and near camera part. Determining the dual points (two points which are symmetrical by the central point) on the lattice board and the dual projection points (the points of the dual points on the lattice image), and calculating the distance between the dual projection points and the central point. The distances from the dual projection points to the central point are unequal, points with large distances are far camera projection points, and points with large distances from the central point are near camera projection points. All the far camera projection points and the near camera projection points constitute a far camera part and a near camera part, respectively, and their boundary lines are the inclined axes of the object. The axis of tilt of the object in the XY plane is calculated. And determining boundary points of the projection points of the far and near cameras according to different types of the projection points of each line, taking the middle point of the two boundary points as a sample point, and fitting the sample point by using a least square method to obtain the slope k of the object tilt axis on the XY plane. And calculating correction points of the projection points of the far and near cameras. After the far camera proxel and the near camera proxel are determined, they are both corrected to the imaging medium according to the perspective projection principle. The tilt angle of the object in the Z-axis is calculated. Theoretically, the two correction points are equidistant from the principal point. In fact, not all correction points satisfy this condition because the image has other distortions. In order to find the tilt angle, the angle at which the sum of the absolute values of the differences in distances from the correction points to the principal point (a function of the tilt angle θ of the object) of all the dual projection points is minimized is the tilt angle of the object. After the iteration times are given, solving a derivative function equation by a dichotomy to obtain the object inclination angle theta. And correcting the images of the large and small heads. Using the coordinates (u) of the principal point of the camera's intrinsic parameters0,v0) The focal length f, the actual distances alpha and beta between the pixels on the X axis and the Y axis, the inclined axis k of the object in the XY plane, the inclined angle theta of the object in the Z axis direction and other parameters, and each pixel point in the large and small head images is reversely solved to obtain a correction point, so that a corrected image of the large and small head images is obtained.
The above-mentioned embodiments, objects, technical solutions and advantages of the present invention are further described in detail, it should be understood that the above-mentioned embodiments are only examples of the present invention, and are not intended to limit the scope of the present invention, and any modifications, equivalent substitutions, improvements and the like made within the spirit and principle of the present invention should be included in the scope of the present invention.

Claims (9)

1. The method for correcting the distortion of the big and small heads of an image caused by the inclination of an object in machine vision measurement is characterized in that: the method comprises the following steps:
step 1: building a visual measurement working table and manufacturing a calibration plate, building the measurement working table according to the size of a visual measurement object, and manufacturing a black-white chessboard calibration plate and a circular dot matrix calibration plate after building is completed;
step 2: collecting checkerboard calibration images, and collecting calibration images at different positions in the field of view of the camera;
and step 3: screening the checkerboard calibration images, screening the checkerboard calibration images in an OpenCV open source calibration program, and supplementing the screened calibration images;
and 4, step 4: calculating internal parameters of the camera, and calculating the internal parameters of the camera by using the screened checkerboard calibration images;
and 5: collecting circular dot matrix calibration plate images and calculating coordinates of circular points;
step 6: dividing the circular lattice calibration plate into a far camera part and a near camera part, and dividing the circular lattice calibration image according to the distance from the dual projection circular point to the central point;
and 7: calculating a tilt axis of the object;
and 8: deducing a correction point expression of a projection point of the far and near camera;
and step 9: calculating the inclination angle of the object;
step 10: and correcting the large and small head images.
2. The method for correcting the distortion of the large and small image heads caused by the inclination of the object in the machine vision measurement as claimed in claim 1, wherein: the step 2 specifically comprises the following steps: collecting at least 3 images of black and white chessboard calibration plates at different positions on a work table, placing a circular dot matrix calibration plate on the work table, aligning the center point of the circular dot matrix calibration plate to the center of a camera, leveling the dot matrix calibration plate, and collecting circular dot matrix calibration images.
3. The method for correcting image size and head distortion caused by object tilt in machine vision measurement as claimed in claim 1, wherein: the step 3 specifically comprises the following steps: and screening and supplementing images, namely screening the images of the black and white checkerboard calibration board according to a calibration algorithm, wherein the screening condition is that an angle point diagram appears, and if the number of the images meeting the condition is less than 16, the calibration board needs to be supplemented.
4. The method for correcting the distortion of the large and small image heads caused by the inclination of the object in the machine vision measurement as claimed in claim 3, wherein: when the image is supplemented, the light intensity and the inclination direction of the calibration point can be adjusted.
5. The method for correcting the distortion of the large and small image heads caused by the inclination of the object in the machine vision measurement as claimed in claim 1, wherein: the step 4 specifically comprises the following steps: inputting the checkerboard calibration image into the open source function by using the open source function calibration camera, and outputting the checkerboard calibration image as the principal point coordinate (u) of the camera0,v0) Focal length f and the actual distances alpha and beta between the pixels on the X and Y axes.
6. The method for correcting the distortion of the large and small image heads caused by the inclination of the object in the machine vision measurement as claimed in claim 1, wherein: the step 7 specifically comprises the following steps: determining boundary points of projection points of two near-far cameras in each line according to different types of points in each line, fitting the sample points by using the midpoints of the boundary points as sample points by using a least square method to obtain the slope of the inclined axis of the camera on the imaging medium plane
Figure FDA0003586184900000021
Wherein (u)i,vi) Representing the coordinates of the middle points of two demarcation points per line, n represents the number of lines of the circular lattice calibration plate, the over-principal point (u)0,v0) The equation for the tilt axis of (c) is: v-ku + v0-ku0
7. The method for correcting the distortion of the large and small image heads caused by the inclination of the object in the machine vision measurement as claimed in claim 1, wherein: step 8, in particularThe method comprises the following steps: using the coordinates (u) of the principal point of the camera's intrinsic parameters0,v0) The focal length f, the actual distances alpha and beta between pixels on the X axis and the Y axis, the inclined axis k of the object in the XY plane, the inclined angle theta of the object in the Z axis direction and other parameters; setting dual projection point B on distorted image2(v1,u1) And D2(v2,u2) Distances to the center of the distorted image are r1And r2,β1And beta2The angle, beta, formed by the two projection lines and the image plane1=∠OB2D2,β2=∠OD2B2,η1And η2Are respectively r1And r2On the ideal image; angle, η, formed by orthographic projection and distorted image1=∠B3O2B2,η2=∠D3O2D2(ii) a Let | O2B3|=rl1,|O2D3|=rl2R is obtained by perspective projection principle and triangle geometry relationl1And rl2The following relationship is satisfied:
Figure FDA0003586184900000022
a point array image having N pairs of even proxels; assuming that the inclination angle of the object is θ, θ is calculated so as to satisfy:
Figure FDA0003586184900000023
wherein r isli1And rli2Respectively representing the distance of the ideal dual proxel from the center of the image,
Figure FDA0003586184900000024
8. the method for correcting the distortion of the large and small image heads caused by the inclination of the object in the machine vision measurement as claimed in claim 1, wherein: the step 9 specifically comprises: first derivative function equation for solving expression
Figure FDA0003586184900000025
The value of theta can be obtained; because N derivative functions can not be simply summed, the direct solution is difficult; and searching the root of the derivative function equation by using a dichotomy method when the given iteration number or the absolute value of the difference of the derivative values of two adjacent times is smaller than a given threshold value so as to obtain the inclination angle of the object.
9. The method for correcting the distortion of the large and small image heads caused by the inclination of the object in the machine vision measurement as claimed in claim 1, wherein: the step 10 specifically comprises: using the coordinates (u) of the principal point of the camera's intrinsic parameters0,v0) The focal length f, the actual distances alpha and beta between the pixels on the X axis and the Y axis, the inclined axis k of the object in the XY plane, the inclined angle theta of the object in the Z axis direction and other parameters, and reversely solving the correction point of each pixel point in the large and small head images; in finding the object tilt axis l: after v is ku + b and the inclination angle theta, the distortion image is divided into a near camera projection part pi by the inclination axis1Sum-distance camera projection part pi2(ii) a Taking a distorted image point A0(u0,v0) Obtaining the distance r from the ideal point A (u, v) to the center of the image; if A is0(u0,v0)∈π1Then, then
Figure FDA0003586184900000031
If A is0(u0,v0)∈π2Then, then
Figure FDA0003586184900000032
If A is0(u0,v0)∈l,r=r0Rotating the image clockwise around the image center by atan (k) angle so that the tilt axis coincides with U; by
Figure FDA0003586184900000033
And relational expression
Figure FDA0003586184900000034
Finding the coordinates of the ideal point as
Figure FDA0003586184900000035
Figure FDA0003586184900000036
If A is0(u0,v0) E, l, then u is u0V is 0; wherein
Figure FDA0003586184900000037
Figure FDA0003586184900000038
The ideal point is rotated counterclockwise atan (k) around the center of the image to obtain the ideal image.
CN202210366766.6A 2022-04-08 2022-04-08 Method for correcting image large and small head distortion caused by object inclination in machine vision measurement Active CN114708164B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202210366766.6A CN114708164B (en) 2022-04-08 2022-04-08 Method for correcting image large and small head distortion caused by object inclination in machine vision measurement

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202210366766.6A CN114708164B (en) 2022-04-08 2022-04-08 Method for correcting image large and small head distortion caused by object inclination in machine vision measurement

Publications (2)

Publication Number Publication Date
CN114708164A true CN114708164A (en) 2022-07-05
CN114708164B CN114708164B (en) 2022-10-28

Family

ID=82173308

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202210366766.6A Active CN114708164B (en) 2022-04-08 2022-04-08 Method for correcting image large and small head distortion caused by object inclination in machine vision measurement

Country Status (1)

Country Link
CN (1) CN114708164B (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115306165A (en) * 2022-08-25 2022-11-08 中国建筑第二工程局有限公司 Assembly type prefabricated part mounting system
CN116735167A (en) * 2023-08-16 2023-09-12 深圳市灿锐科技有限公司 Lens multiplying power and distortion detection method

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2014010100A (en) * 2012-07-02 2014-01-20 Ricoh Co Ltd Image processing device and image processing method and imaging device
CN108876749A (en) * 2018-07-02 2018-11-23 南京汇川工业视觉技术开发有限公司 A kind of lens distortion calibration method of robust
CN110458898A (en) * 2019-08-15 2019-11-15 北京迈格威科技有限公司 Camera calibration plate, nominal data acquisition method, distortion correction method and device
CN112767497A (en) * 2021-01-25 2021-05-07 深慧视(深圳)科技有限公司 High-robustness calibration device based on circular calibration plate and positioning method

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2014010100A (en) * 2012-07-02 2014-01-20 Ricoh Co Ltd Image processing device and image processing method and imaging device
CN108876749A (en) * 2018-07-02 2018-11-23 南京汇川工业视觉技术开发有限公司 A kind of lens distortion calibration method of robust
CN110458898A (en) * 2019-08-15 2019-11-15 北京迈格威科技有限公司 Camera calibration plate, nominal data acquisition method, distortion correction method and device
CN112767497A (en) * 2021-01-25 2021-05-07 深慧视(深圳)科技有限公司 High-robustness calibration device based on circular calibration plate and positioning method

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115306165A (en) * 2022-08-25 2022-11-08 中国建筑第二工程局有限公司 Assembly type prefabricated part mounting system
CN116735167A (en) * 2023-08-16 2023-09-12 深圳市灿锐科技有限公司 Lens multiplying power and distortion detection method
CN116735167B (en) * 2023-08-16 2023-10-13 深圳市灿锐科技有限公司 Lens multiplying power and distortion detection method

Also Published As

Publication number Publication date
CN114708164B (en) 2022-10-28

Similar Documents

Publication Publication Date Title
CN112669393B (en) Laser radar and camera combined calibration method
CN114708164B (en) Method for correcting image large and small head distortion caused by object inclination in machine vision measurement
CN114331924B (en) Large workpiece multi-camera vision measurement method
CN110285827B (en) Distance-constrained photogrammetry high-precision target positioning method
CN111369630A (en) Method for calibrating multi-line laser radar and camera
CN110146038B (en) Distributed monocular camera laser measuring device and method for assembly corner of cylindrical part
CN106780388B (en) Optical distortion correction method for linear array camera
CN109029299B (en) Dual-camera measuring device and method for butt joint corner of cabin pin hole
JP2008014940A (en) Camera calibration method for camera measurement of planar subject and measuring device applying same
CN102376089A (en) Target correction method and system
CN112802123B (en) Binocular linear array camera static calibration method based on stripe virtual target
CN107339935B (en) Target space intersection measuring method for full-view scanning measuring system
CN110966935B (en) Deflection measurement system integrated geometric calibration method based on mark points
CN101509759B (en) Self-demarcating system and method for vision detecting system
CN112037284A (en) Checkerboard grid center point detection method, camera distortion calibration method and system
CN113610929B (en) Combined calibration method of camera and multi-line laser
CN108322736B (en) Calibration plate and calibration method for calibrating rotation angles of multiple linear array cameras around visual axis
CN115289997B (en) Binocular camera three-dimensional contour scanner and application method thereof
CN103575742A (en) One-touch optical measuring instrument
CN113592962B (en) Batch silicon wafer identification recognition method based on machine vision
CN114998417A (en) Method for measuring size of thin-wall stamping part hole group based on secondary curve invariant
CN111968182A (en) Calibration method for binocular camera nonlinear model parameters
JPH11132735A (en) Ic lead floating inspection device and inspection method
TWI810950B (en) Correction method for 2d vision measurement with large fov
CN116797669B (en) Multi-camera array calibration method based on multi-face tool

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