Calibration method, device, computer equipment, and storage medium for visual system
The image acquisition device imaged the light spot formed by the light source on the curved surface calibration block. Combined with the position relationship between the light spot and the curved surface calibration block, the target position of the light source is determined and calibrated, which solves the problem of position deviation of light source calibration in the traditional method and improves the calibration accuracy.
Patent Information
- Application Number
- CN202210003298.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-01-04
- Publication Date
- 2025-06-06
- Estimated Expiration
- 2042-01-04
AI Technical Summary
The light source calibration method of traditional vision systems has posture deviations, resulting in inaccurate calibration of light source.
The image acquisition device imaged the light spot formed by the light source on the curved surface calibration block, determine the positional relationship between the light spot and the curved surface calibration block according to the light spot image, obtain the positional relationship between the light source and the curved surface calibration block, combine the two to determine the target position of the light source, and perform calibration.
This method can accurately calibrate the position of the light source, avoid posture deviations caused by inconsistent angle between the outer shell of the light source device and the lamp bead, and improve the accuracy of the calibration of the visual system.
Smart Images

Figure CN114359371B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of visual inspection technology, and in particular to a calibration method, device, computer equipment, storage medium and computer program product for a visual system. Background Art
[0002] Visual inspection refers to photographing an object through an image acquisition device (e.g., a camera, etc.), transmitting the captured object image to an image processing system for processing, extracting the features of the object image, and then determining the operation to be performed on the object based on the features of the object image. For a visual inspection system, high-quality object images help improve the accuracy of visual inspection, and the quality of the object image is closely related to the light source in the shooting environment. Therefore, the light source in the visual system needs to be calibrated.
[0003] In the traditional method, a level can be placed on the housing of the light source device, and the position of the current light source can be determined by the position of the bubble in the level, so as to calibrate the position of the light source in the visual system. However, since the angle of the light source device housing may be inconsistent with the angle of the lamp beads in the light source device, it is easy to cause deviations in the determined light source position, which leads to deviations in the calibration of the light source in the visual system. Summary of the invention
[0004] Based on this, it is necessary to provide a calibration method, device, computer equipment, storage medium and computer program product for a visual system with high accuracy in order to solve the above technical problems.
[0005] In a first aspect, the present application provides a method for calibrating a visual system. The visual system includes an image acquisition device and a light source; the method includes:
[0006] Imaging the light spot formed by the light source on the curved surface calibration block by the image acquisition device to obtain a light spot image;
[0007] Determine a first positional relationship between the light spot and the curved surface calibration block according to the light spot image;
[0008] Acquire a second positional relationship between the light source and the curved surface calibration block;
[0009] According to the first position relationship and the second position relationship, a target position and posture of the light source is determined, and the light source is calibrated according to the target position and posture.
[0010] In one of the embodiments, the first positional relationship includes a first distance between the light spot and the bottom of the curved surface calibration block;
[0011] The light spot image includes a light spot and a contour curve corresponding to the curved surface calibration block;
[0012] The determining a first positional relationship between the light spot and the curved surface calibration block according to the light spot image comprises:
[0013] Determine a first size between the light spot and the center of the curved surface calibration block, and a second size between the contour curve and the center of the curved surface calibration block according to the light spot image;
[0014] The first distance between the light spot and the bottom of the curved surface calibration block is determined according to the first size and the second size.
[0015] In one of the embodiments, the second positional relationship includes a second distance between the light source and the center of the curved surface calibration block, and a third distance between the light source and the bottom of the curved surface calibration block;
[0016] The step of determining a target position of the light source according to the first position relationship and the second position relationship includes:
[0017] determining a first difference between the first distance and the third distance, and a second difference between the second distance and the first size;
[0018] A target position of the light source is determined according to the first difference and the second difference.
[0019] In one embodiment, a plurality of calibration marks are provided on the curved surface calibration block; before imaging the light spot formed by the light source on the curved surface calibration block by the image acquisition device, the method further includes:
[0020] Imaging the curved surface calibration block by the image acquisition device to obtain a marked image;
[0021] The image acquisition device is calibrated according to the position information of the calibration mark in the marked image.
[0022] In one embodiment, the calibration mark includes a plurality of calibration marks arranged at the corners of the curved surface calibration block, and the image acquisition device is calibrated according to the positional relationship of the calibration marks in the marked image, including:
[0023] Determining position information of each of the calibration marks on the marked image;
[0024] Determining the distance between two adjacent calibration marks according to the position information of the calibration marks;
[0025] Calibrate the position of the image acquisition device according to the distance until the distance meets a preset condition;
[0026] Alternatively, the calibration mark comprises a center mark provided at the center position of the curved surface calibration block;
[0027] The step of calibrating the image acquisition device according to the position information of the calibration mark in the marked image comprises:
[0028] The image acquisition device is calibrated according to the position information of the center mark in the mark image, so that the position information of the center mark in the mark image acquired after calibration coincides with the center of the mark image acquired after calibration.
[0029] In one embodiment, imaging the light spot formed by the light source on the curved surface calibration block by the image acquisition device to obtain the light spot image includes:
[0030] Imaging the light spot formed by the light source on the curved surface calibration block through the image acquisition device to obtain an original light spot image;
[0031] Obtaining the grayscale value of each pixel on the original light spot image;
[0032] Pixels whose grayscale values are less than a grayscale threshold are deleted from the original light spot image to obtain the light spot image.
[0033] In one of the embodiments, the curved surface calibration block adopts a hemispherical structure, and the reflectivity of the curved surface calibration block satisfies the mirror reflectivity.
[0034] In a second aspect, the present application also provides a calibration device for a visual system. The visual system includes an image acquisition device and a light source; the device includes:
[0035] A light spot imaging module, used to image the light spot formed by the light source on the curved surface calibration block through the image acquisition device to obtain a light spot image;
[0036] A first relationship determination module, used to determine a first position relationship between the light spot and the curved surface calibration block according to the light spot image;
[0037] A second relationship acquisition module, used to acquire a second position relationship between the light source and the curved surface calibration block;
[0038] A light source calibration module is used to determine a target position and posture of the light source according to the first position relationship and the second position relationship, and calibrate the light source according to the target position and posture.
[0039] In a third aspect, the present application further provides a computer device, wherein the computer device comprises a memory and a processor, wherein the memory stores a computer program, and when the processor executes the computer program, the visual system calibration method described in any one of the embodiments of the first aspect is implemented.
[0040] In a fourth aspect, the present application further provides a computer-readable storage medium having a computer program stored thereon, and when the computer program is executed by a processor, the visual system calibration method described in any one of the embodiments of the first aspect is implemented.
[0041] The above-mentioned visual system calibration method, device, computer equipment and computer-readable storage medium use an image acquisition device to image the light spot formed by the light source on the curved surface calibration block, and determine the first position relationship between the light spot and the curved surface calibration block based on the obtained light spot image; obtain the second position relationship between the light source and the curved surface calibration block; determine the target posture of the light source based on the first position relationship and the second position relationship, and calibrate the light source based on the target posture; there is no need to acquire the posture of the light source device housing, and the actual angle of illumination of the lamp beads in the light source device can be directly determined based on the position relationship between the curved surface calibration block and the light source and the light spot, and the posture of the light source is calibrated to avoid posture deviation caused by inconsistent angles between the light source device housing and the lamp beads, thereby improving the accuracy of calibration of the visual system. BRIEF DESCRIPTION OF THE DRAWINGS
[0042] Figure 1 is a schematic flow chart of a calibration method for a visual system in one embodiment;
[0043] Figure 2 is a schematic flow chart of a calibration step of an image acquisition device in one embodiment;
[0044] Figure 2a It is a structural schematic diagram of a curved surface calibration block in one embodiment;
[0045] Figure 2b is a schematic plan view of a curved surface calibration block in one embodiment;
[0046] Figure 3a is a schematic flow chart of a calibration step of an image acquisition device in one embodiment;
[0047] Figure 3b is a schematic diagram of marking an image in one embodiment;
[0048] Figure 4 A schematic diagram of a process of obtaining a spot image in one embodiment;
[0049] Figure 5 is a flow chart of a calibration method of a visual system in another embodiment;
[0050] Figure 5a A schematic diagram of the positional relationship between the curved surface calibration block, the light source, and the image acquisition device in one embodiment;
[0051] Figure 5b A schematic diagram of the positional relationship between the curved surface calibration block, the annular light source, and the image acquisition device in one embodiment;
[0052] Figure 5c A schematic diagram of a light spot formed by a low-angle annular light source in one embodiment;
[0053] Figure 5d A schematic diagram of a light spot formed by a high-angle annular light source in one embodiment;
[0054] Figure 5e A schematic diagram of a light source target posture determination step in one embodiment;
[0055] Figure 6 is a structural block diagram of a calibration device for a visual system in one embodiment;
[0056] Figure 7 FIG. 4 is a diagram showing the internal structure of a computer device in one embodiment. DETAILED DESCRIPTION
[0057] 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.
[0058] In one embodiment, Figure 1 As shown, a calibration method for a visual system is provided. This embodiment uses the method applied to a terminal as an example. It can be understood that the method can also be applied to a system including a terminal and a server, and is implemented through the interaction between the terminal and the server. Among them, the terminal can be but is not limited to various personal computers, laptops, smart phones, tablet computers, Internet of Things devices and portable wearable devices. The Internet of Things devices can be smart TVs, smart car-mounted devices, etc. Portable wearable devices can be smart watches, smart bracelets, head-mounted devices, etc. The server can be implemented as an independent server or a server cluster consisting of multiple servers.
[0059] In this embodiment, the visual system includes an image acquisition device and a light source; the method includes the following steps:
[0060] Step S102, imaging the light spot formed by the light source on the curved surface calibration block through an image acquisition device to obtain a light spot image.
[0061] The image acquisition device of the visual system can be, but is not limited to, any one of a camera, a video camera, a camera, and a scanner. In one embodiment, the image acquisition device is placed opposite to the curved surface calibration block, for example, the image acquisition device is placed directly above the curved surface calibration block.
[0062] The light source of the visual system can be, but is not limited to, any one of line laser, linear light source, annular light source, and point light source. The light source device is arranged at a preset height above the stage.
[0063] The curved surface calibration block is placed on a stage where the light source angle needs to be calibrated. The curved surface calibration block is a calibration block with a curved surface structure, such as a calibration block with a hemispherical structure. The curved surface calibration block is used to reflect the incident light emitted from the light source to form a light spot. The smoothness of the curved surface structure is similar to the smoothness of a mirror, and the imaging effect of the curved surface structure is similar to the imaging effect of a mirror. In one example, an annular light source forms a circular light spot on the curved surface calibration block, a linear light source forms an arc light spot, and a point light source forms a point light spot, wherein both the arc light spot and the point light spot can be fitted into an approximately circular light spot, and preferably the least squares method is used to fit the light spot into a curve. In addition, the point light spot formed by the point light source on the curved surface calibration block can also be directly used to calculate the distance from the point light spot to the hemisphere center of the curved surface calibration block.
[0064] Specifically, the image acquisition device images the light spot formed by the light source on the curved surface calibration block in response to the imaging request to obtain a light spot image. The imaging request can be manually triggered by the user as needed, for example, the user manually clicks the corresponding imaging button on the image acquisition device to trigger the imaging request; the imaging request can also be automatically triggered by the image acquisition device, for example, the image acquisition device images the object in the field of view every preset time period.
[0065] Step S104: determining a first positional relationship between the light spot and the curved surface calibration block according to the light spot image.
[0066] Among them, the first position relationship may be but is not limited to one or more of the vertical distance between the light spot and the bottom of the curved calibration block, the horizontal distance between the light spot and the center of the curved calibration block, the distance between the light spot and the edge of the curved calibration block, etc.
[0067] Specifically, the terminal receives the spot image transmitted by the image acquisition device, traverses the grayscale value of each pixel on the spot image, and determines the spot curve corresponding to the spot on the spot image and the contour curve corresponding to the surface calibration block according to the grayscale value of the pixel. The coordinates of the spot pixel on the spot curve and the coordinates of the contour pixel on the contour curve are obtained. According to the coordinates of the spot pixel and the coordinates of the contour pixel, the first positional relationship between the spot and the surface calibration block is determined.
[0068] Step S106, obtaining a second positional relationship between the light source and the curved surface calibration block.
[0069] The second positional relationship may include but is not limited to at least one of the vertical distance between the light source and the curved surface calibration block, the horizontal distance between the light source and the curved surface calibration block, the distance between the light source and the edge of the curved surface calibration block, and the like.
[0070] Specifically, the second position relationship may be data pre-stored in a database, and the terminal may search the database for the second position relationship between the light source and the curved surface calibration block based on the identification of the light source; or it may be data currently input by the user, and the terminal may receive the vertical distance and horizontal distance between the light source and the curved surface calibration block input by the user through an input device to generate the second position relationship between the light source and the curved surface calibration block.
[0071] Step S108, determining a target posture of the light source according to the first position relationship and the second position relationship, and calibrating the light source according to the target posture.
[0072] The pose can be used to represent the position and / or angle of the object. The target pose can be used to represent the current pose of the object.
[0073] Specifically, the terminal performs calculation processing on the distance in the horizontal direction in the first position relationship and the distance in the horizontal direction in the second position relationship to determine the target horizontal distance between the light source and the light spot. The terminal performs calculation processing on the distance in the vertical direction in the first position relationship and the distance in the vertical direction in the second position relationship to determine the target vertical distance between the light source and the light spot. According to the target horizontal distance and the target vertical distance between the light source and the light spot, the current posture of the light source is determined. When the current posture of the light source does not meet the preset posture condition, the posture of the light source is calibrated, and the calibrated light source is used as the light source in the visual system; when the current posture of the light source meets the preset posture condition, the light source is directly used as the light source in the visual system. Further, the visual system uses the light source to illuminate the object that needs to be imaged by the image acquisition device.
[0074] In one example, when the light source is a ring light source, the target horizontal distance between the ring light source and the light spot can be obtained. When the target horizontal distance is not zero, the horizontal position of the ring light source is adjusted according to the target horizontal distance between the ring light source and the light spot, so that the ring light source and the image acquisition device are on the same axis. The vertical distance between the adjusted ring light source and the curved surface calibration block is obtained. The vertical position of the ring light source is vertically lifted and lowered according to the vertical distance to obtain a calibrated ring light source.
[0075] In one example, when the light source is a line light source or a point light source, the irradiation angle of the light source can be determined according to the target horizontal distance and the target vertical distance between the light source and the light spot. The angle of the light source is calibrated until the calibrated light source meets the preset angle condition.
[0076] In the above-mentioned calibration method of the visual system, an image is captured of a light spot formed by the light source on the curved surface calibration block through an image acquisition device, and a first positional relationship between the light spot and the curved surface calibration block is determined based on the obtained light spot image; a second positional relationship between the light source and the curved surface calibration block is obtained; a target posture of the light source is determined based on the first positional relationship and the second positional relationship, and the light source is calibrated based on the target posture; the actual angle of illumination of the lamp beads in the light source device can be determined directly based on the positional relationship between the curved surface calibration block, the light source and the light spot without capturing the posture of the light source device housing, and the posture of the light source can be calibrated to avoid posture deviation caused by the inconsistent angle between the light source device housing and the lamp beads, thereby improving the accuracy of calibration of the visual system.
[0077] In one embodiment, the first positional relationship includes a first distance between the light spot and the bottom of the curved surface calibration block. The light spot image includes a light spot and a contour curve corresponding to the curved surface calibration block. Step S104, determining the first positional relationship between the light spot and the curved surface calibration block according to the light spot image, includes: determining a first size between the light spot and the center of the curved surface calibration block, and a second size between the contour curve and the center of the curved surface calibration block according to the light spot image; determining a first distance between the light spot and the bottom of the curved surface calibration block according to the first size and the second size.
[0078] The first size may be, but is not limited to, any one of the radius of the spot curve and the width of the spot curve. The second size may be, but is not limited to, any one of the radius of the contour curve and the width of the contour curve.
[0079] The first distance is used to represent the vertical distance between the light spot and the bottom of the curved surface calibration block.
[0080] Specifically, the terminal obtains a spot image, fits the spot on the spot image to form a spot curve, determines the coordinates of each spot pixel on the spot curve, and determines the radius of the spot curve according to the coordinates of multiple spot pixels. The coordinates of the contour pixel on the contour curve are obtained, and the radius of the contour curve is determined according to the coordinates of multiple contour pixels. The radius of the contour curve and the radius of the spot curve are processed by calculation to determine the vertical distance between the spot and the surface calibration block.
[0081] In an example, the first distance may be determined by referring to the following formula:
[0082]
[0083] Wherein, h is the first distance, R is the radius of the profile curve, and r is the radius of the spot curve.
[0084] In one example, when the light source is a point light source, the first distance between the point light source and the surface calibration block can be determined by directly calculating the distance between the point light spot formed by the point light source on the surface calibration block and the center of the surface calibration block and the second size of the contour curve.
[0085] In this embodiment, by determining the distance between the light spot and the bottom of the curved surface calibration block according to the first size of the light spot curve and the second size of the contour curve, the accuracy of the subsequently acquired vertical distance between the light source and the light spot can be improved, thereby improving the accuracy of determining the light source angle.
[0086] In one embodiment, the second positional relationship includes a second distance between the light source and the center of the curved surface calibration block, and a third distance between the light source and the bottom of the curved surface calibration block. Step S108, determining the target posture of the light source according to the first positional relationship and the second positional relationship, and calibrating the light source according to the target posture, including: determining a first difference between the first distance and the third distance, and a second difference between the second distance and the first size. Determine the target posture of the light source according to the first difference and the second difference.
[0087] The second distance is used to characterize the horizontal distance between the light source and the center of the curved surface calibration block. The third distance is used to characterize the vertical distance between the light source and the bottom of the curved surface calibration block. The first difference is used to characterize the vertical distance between the light source and the light spot. The second difference is used to characterize the horizontal distance between the light source and the light spot.
[0088] Specifically, the terminal performs calculation processing on the first distance between the light spot and the curved surface calibration block and the third distance between the light source and the bottom of the curved surface calibration block to determine the first difference between the light source and the light spot. Perform calculation processing on the second distance between the light source and the center of the curved surface calibration block and the first size of the light spot curve to determine the second difference between the light source and the light spot. Perform calculation processing on the first difference between the light source and the light spot and the second difference between the light source and the light spot to determine the angle of the light source.
[0089] In an example, the angle of the light source can be determined by referring to the following formula:
[0090] θ=tan -1 ((Hh) / (Lr))
[0091] Wherein, θ is the angle of the light source, H is the vertical distance between the light source and the bottom of the curved surface calibration block, h is the vertical distance between the light spot and the bottom of the curved surface calibration block, L is the horizontal distance between the light source and the center of the curved surface calibration block, and r is the radius of the light spot curve.
[0092] In this embodiment, by determining the first difference between the first distance and the third distance, the vertical distance between the light source and the light spot is obtained, and by determining the second difference between the second distance and the first size, the horizontal distance between the light source and the light spot is obtained. By determining the angle of the light source according to the first difference and the second difference, the accuracy of the determined light source angle can be improved, thereby improving the calibration accuracy of the visual system.
[0093] In one embodiment, a plurality of calibration marks are provided on the curved surface calibration block. Figure 2 As shown, in step S102, the light spot formed by the light source on the curved surface calibration block is imaged by an image acquisition device to obtain the light spot image, and the following is also included before:
[0094] Step S202: imaging the surface calibration block by an image acquisition device to obtain a marked image.
[0095] Step S204: calibrate the image acquisition device according to the position information of the calibration mark in the marked image.
[0096] Specifically, the terminal images the curved surface calibration block through an image acquisition device to obtain a marked image. The terminal obtains the coordinates of each calibration mark on the marked image, performs calculations on the coordinates of multiple calibration marks, and determines the correlation between the two calibration marks. The image acquisition device is calibrated according to the correlation between the two calibration marks, so that the image acquisition device is in a horizontal position and the curved surface calibration block is located at the center of the field of view of the image acquisition device.
[0097] In an example, the surface calibration block is as follows Figure 2a As shown in FIG. 1 , a calibration block is formed by combining a hemisphere and a flat plate. There is a calibration mark at the center of the hemisphere of the curved surface calibration block, and there are four calibration marks around the flat plate of the curved surface calibration block. The marked image obtained by imaging the curved surface calibration block is as follows: Figure 2b shown.
[0098] In this embodiment, by calibrating the image acquisition device according to the positional relationship of the calibration marks in the mark image, there is no need to add additional calibration equipment to the image acquisition device. The calibration operation of the image acquisition device can be completed only based on the mark image taken by the image acquisition device, which can simplify the calibration operation of the image acquisition device and improve the efficiency of calibrating the image acquisition device.
[0099] In one embodiment, the calibration mark includes a plurality of calibration marks disposed at the corners of the curved calibration block, such as Figure 3a As shown, step S204, calibrating the image acquisition device according to the position information of the calibration mark in the marked image, includes:
[0100] Step S302, determining the position information of each calibration mark on the mark image.
[0101] Step S304: determining the distance between two adjacent calibration marks according to the position information of the calibration marks.
[0102] Step S306, calibrating the position of the image acquisition device according to the distance until the distance meets a preset condition.
[0103] Specifically, the terminal detects and identifies the mark image and determines the coordinates of each calibration mark on the mark image. According to the coordinates of the calibration marks at the four corners of the mark image, the distances between the two adjacent calibration marks at the four corners are obtained. According to the distances between the two calibration marks, the terminal determines whether the image acquisition device is currently in a horizontal position. When the image acquisition device is not in a horizontal position, the position of the image acquisition device is calibrated until the distances between the two adjacent calibration marks are equal.
[0104] In one example, a labeled image such as Figure 3b As shown, at the four corners of the marked image are calibration mark A, calibration mark B, calibration mark C, and calibration mark D. The terminal obtains the coordinates of A, B, C, and D, and determines the distance AB between A and B, the distance BC between B and C, the distance CD between C and D, and the distance DA between D and A. The terminal calibrates the position of the image acquisition device according to the distances between the calibration marks until the distance AB is equal to the distance BC, the distance CD, and the distance DA.
[0105] In the traditional method, a level is placed on the image acquisition device, and the position of the image acquisition device is calibrated according to the parameters of the level. However, the installation control of the image acquisition device is narrow, which easily leads to deviation in the calibration of the image acquisition device.
[0106] In this embodiment, based on the characteristic that the distances between the calibration marks at the four corners of the marked image captured when the image capture device is in a horizontal position are equal, the image capture device is calibrated by the distances between the calibration marks, which can improve the accuracy of the calibration of the image capture device.
[0107] In one embodiment, the calibration mark includes a center mark set at the center position of the curved surface calibration block. Step S204, calibrating the image acquisition device according to the position information of the calibration mark in the marker image, includes: calibrating the image acquisition device according to the position information of the center mark in the marker image, so that in the marker image acquired after calibration, the position information of the center mark coincides with the center of the marker image acquired after calibration.
[0108] Specifically, the terminal detects the marker image and determines the coordinates of the center marker. When the coordinates of the center marker do not coincide with the center of the marker image, the position of the image acquisition device is calibrated until the center of the marker image acquired after calibration coincides with the coordinates of the center marker.
[0109] In this embodiment, the image acquisition device is calibrated by using the position information of the center mark, so that the accuracy of calibrating the image acquisition device can be improved.
[0110] In one embodiment, Figure 4 As shown, step S102, imaging the light spot formed by the light source on the curved surface calibration block through an image acquisition device to obtain a light spot image, includes:
[0111] Step S402: imaging the light spot formed by the light source on the curved surface calibration block through an image acquisition device to obtain an original light spot image.
[0112] Step S404, obtaining the gray value of each pixel on the original light spot image.
[0113] Step S406, deleting pixels whose grayscale values are less than the grayscale threshold from the original spot image to obtain a spot image.
[0114] In this embodiment, the spot image is obtained by deleting pixels whose grayscale values are less than the grayscale threshold on the original spot image, which can reduce the impact of noise on the spot image and reduce the error of the first position relationship, thereby improving the accuracy of the obtained light source angle.
[0115] In one embodiment, the curved surface calibration block adopts a hemispherical structure, and the reflectivity of the curved surface calibration block satisfies the mirror reflectivity.
[0116] In this embodiment, by adopting a curved surface calibration block that satisfies the mirror reflectivity, the clarity of the spot image acquired by the image acquisition device can be improved, thereby improving the accuracy of the obtained light source angle, thereby improving the accuracy of the visual system calibration.
[0117] In one embodiment, Figure 5 As shown, a calibration method for a visual system is provided, comprising:
[0118] Step S502: imaging the surface calibration block by an image acquisition device to obtain a marked image.
[0119] Step S504: calibrate the image acquisition device according to the position information of the calibration mark in the marked image.
[0120] Specifically, the curved surface calibration block is placed on the stage where the light source angle needs to be measured, and the image acquisition device is started. The terminal uses the image acquisition device to image the curved surface calibration block in combination with the ambient light to obtain a marked image. The marked image is detected to determine the coordinates of each calibration mark in the marked image. The coordinates of the calibration marks located at the four corners of the marked image are processed to determine the distance between two adjacent calibration marks. The position of the image acquisition device is adjusted according to the distance between two adjacent calibration marks until the distance between two adjacent calibration marks is equal, thereby obtaining an image acquisition device horizontal to the stage. The curved surface calibration block is imaged by the image acquisition device in a horizontal position to obtain a new marked image. The new marked image is detected to determine the coordinates of the center mark on the new marked image, and the image acquisition device in a horizontal position is calibrated according to the coordinates of the center mark until the coordinates of the center mark in the marked image acquired by the calibrated image acquisition device coincide with the center of the marked image, thereby obtaining a calibrated image acquisition device.
[0121] Step S506, imaging the light spot formed by the light source on the curved surface calibration block through the calibrated image acquisition device to obtain an original light spot image.
[0122] Step S508, deleting pixels whose grayscale values are less than the grayscale threshold from the original spot image to obtain a spot image, and fitting multiple spots on the spot image to obtain a spot curve.
[0123] Specifically, the light source of the angle to be measured is started, and the terminal uses a calibrated image acquisition device to image the light spot formed by the light source on the curved surface calibration block to obtain an original light spot image. In an example, the positional relationship between the image acquisition device, the light source, and the curved surface calibration block is as follows: Figure 5a In another example, when the light source is a ring light source, Figure 5b As shown, the ring light source and the image acquisition device are on the same axis. The terminal traverses each pixel on the original spot image, determines the gray value of each pixel, compares the gray value of the pixel with the preset gray threshold, deletes the pixel with a gray value less than the gray threshold from the original spot image, obtains the spot image, and fits multiple spots on the spot image to obtain the spot curve. In an example, when the light source is a ring light source, and the light source height is consistent, the imaging of the low-angle ring light source on the curved surface calibration block is as follows: Figure 5c As shown in Figure 2, the imaging of a high-angle ring light source on a curved surface calibration block is as follows: Figure 5d shown.
[0124] Step S510, determining a first size corresponding to the spot curve and a second size corresponding to the contour curve according to the spot image, and determining a first distance between the spot and the curved surface calibration block according to the first size and the second size.
[0125] Step S512, obtaining a second distance between the light source and the center of the curved surface calibration block, and a third distance between the light source and the bottom of the curved surface calibration block.
[0126] Step S514: determining a first difference between the first distance and the third distance, and a second difference between the second distance and the first size.
[0127] Step S516, determining a target posture of the light source according to the first difference and the second difference, and calibrating the light source according to the target posture.
[0128] Specifically, Figure 5e The terminal determines the first size r corresponding to the spot curve and the second size R corresponding to the contour curve according to the spot image. The first size and the second size can be processed by operation according to the following formula to determine the first distance h between the spot and the curved surface calibration block.
[0129]
[0130] The definitions of the parameters in the formula may refer to the formula parameter definitions in the above embodiments, and will not be elaborated here.
[0131] The terminal obtains a second distance L between the light source and the center of the curved surface calibration block, and a third distance H between the light source and the bottom of the curved surface calibration block (i.e., the vertical distance between the light source and the stage). The first distance h and the third distance H are processed by operation to determine a first difference between the first distance h and the third distance H. The second distance L and the first size r are processed by operation to determine a second difference between the second distance L and the first size r. According to the first difference and the second difference, the angle θ of the light source can be determined by referring to the following formula:
[0132] θ=tan -1 ((Hh) / (Lr))
[0133] The definitions of the parameters in the formula may refer to the formula parameter definitions in the above embodiments, and will not be elaborated here.
[0134] The terminal compares the angle of the light source with a preset angle threshold. When the angle of the light source does not meet the preset angle condition, the terminal calibrates the angle of the light source and uses the calibrated light source as the light source in the visual system. When the angle of the light source meets the preset angle condition, the terminal directly uses the light source as the light source in the visual system.
[0135] In one example, when there are multiple light sources in the visual system and there is no need to determine the angle of the light source, first start the light source No. 1, and use the image acquisition device to image the light spot formed by the light source No. 2 on the curved surface calibration block to obtain the image of the light source No. 1 corresponding to the light source No. 1. Turn off the light source No. 1, start the light source No. 2, and use the image acquisition device to image the light spot formed by the light source No. 2 on the curved surface calibration block to obtain the image of the light source No. 2 corresponding to the light source No. 2. Using the image of the light source No. 1 as a reference, calibrate the angle of the light source No. 2 until the image of the light source No. 2 matches the image of the light source No. 1, and obtain the calibrated light source No. 2. Calibrate the light sources other than the light source No. 2 according to the above method to obtain the light source calibrated by the visual system. Furthermore, use the light source calibrated by the visual system to illuminate the object.
[0136] In one example, when the light source is a ring light source, a spot image of the ring light source on the curved surface calibration block can be obtained. Multiple spots on the spot image are fitted to obtain a circular ring curve of the spot. Determine whether the center of the circular ring spot coincides with the center of the contour curve, and adjust the horizontal position of the ring light source according to the center of the contour curve until the adjusted ring light source and the curved surface calibration block are on the same axis. According to the distance between the ring light source and the bottom of the curved surface calibration block, the ring light source is vertically raised and lowered until the ring light source after the vertical raising and lowering adjustment meets the preset calibration conditions, and a calibrated ring light source is obtained, and the calibrated ring light source is used as the light source of the visual system.
[0137] In one example, when the light source is a point light source, a spot image of the point light source on the curved surface calibration block can be obtained to determine the distance between the point light spot in the spot image and the center of the curved surface calibration block. The distance and the second dimension of the contour curve are processed to obtain a first distance. The angle of the point light source is determined based on the first distance and the second positional relationship between the point light source and the curved surface calibration block. The angle of the point light source is calibrated to obtain a calibrated point light source, and the calibrated point light source is used as the light source of the visual system.
[0138] In this embodiment, the curved surface calibration block is imaged by an image acquisition device, and the image acquisition device is calibrated according to the calibration mark on the obtained mark image. The light spot formed by the light source on the curved surface calibration block is imaged by the calibrated image acquisition device, and the posture of the light source is determined according to the obtained light spot image and the positional relationship between the light source and the curved surface calibration block. The light source is calibrated, which can avoid posture deviations caused by inconsistent angles between the light source device housing and the lamp beads, thereby improving the accuracy of visual system calibration.
[0139] 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.
[0140] Based on the same inventive concept, the embodiment of the present application also provides a visual system calibration device for implementing the visual system 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 the one or more visual system calibration device embodiments provided below can refer to the limitations of the visual system calibration method above, and will not be repeated here.
[0141] In one embodiment, Figure 6 As shown, a visual system calibration device 600 is provided, the visual system includes an image acquisition device and a light source, and the visual system calibration device 600 includes: a spot imaging module 602, a first relationship determination module 604, a second relationship acquisition module 606 and a light source calibration module 608, wherein:
[0142] The light spot imaging module 602 is used to image the light spot formed by the light source on the curved surface calibration block through an image acquisition device to obtain a light spot image.
[0143] The first relationship determination module 604 is used to determine a first position relationship between the light spot and the curved surface calibration block according to the light spot image.
[0144] The second relationship acquisition module 606 is used to acquire a second position relationship between the light source and the curved surface calibration block.
[0145] The light source calibration module 608 is used to determine the target position and posture of the light source according to the first position relationship and the second position relationship, and calibrate the light source according to the target position and posture.
[0146] In one embodiment, the first positional relationship includes a first distance between the light spot and the bottom of the curved surface calibration block. The light spot image includes a light spot and a contour curve corresponding to the curved surface calibration block. The first relationship determination module 604 includes: a size determination unit, which is used to determine the first size between the light spot and the center of the curved surface calibration block and the second size between the contour curve and the center of the curved surface calibration block according to the light spot image; and a distance determination unit, which is used to determine the first distance between the light spot and the bottom of the curved surface calibration block according to the first size and the second size.
[0147] In one embodiment, the second positional relationship includes a second distance between the light source and the center of the curved surface calibration block, and a third distance between the light source and the bottom of the curved surface calibration block. The light source calibration module 608 includes: a difference determination unit, configured to determine a first difference between the first distance and the third distance, and a second difference between the second distance and the first size; and a posture determination unit, configured to determine a target posture of the light source according to the first difference and the second difference.
[0148] In one embodiment, a plurality of calibration marks are provided on the curved surface calibration block. The visual system calibration device 600 further includes: a mark image generation module, which is used to image the curved surface calibration block through an image acquisition device to obtain a mark image; and an image acquisition device calibration module, which is used to calibrate the image acquisition device according to the position information of the calibration marks in the mark image.
[0149] In one embodiment, the calibration mark includes a plurality of calibration marks arranged at the corners of the curved surface calibration block, and the image acquisition device calibration module includes: a position relationship determination unit, used to determine the position information of each calibration mark on the mark image; a distance determination unit, used to determine the distance between two adjacent calibration marks according to the position information of the calibration mark; and a calibration unit, used to calibrate the position of the image acquisition device according to the distance until the distance meets a preset condition.
[0150] In one embodiment, the calibration mark includes a center mark set at the center position of the curved surface calibration block. The image acquisition device calibration module is also used to: calibrate the image acquisition device according to the position information of the center mark in the marker image, so that the position information of the center mark in the marker image acquired after calibration coincides with the center of the marker image acquired after calibration.
[0151] In one embodiment, the spot imaging module 602 includes: an original spot image acquisition unit, which is used to image the spot formed by the light source on the curved surface calibration block through an image acquisition device to obtain an original spot image; a pixel filtering unit, which is used to obtain the grayscale value of each pixel point on the original spot image; and delete the pixel points whose grayscale value is less than the grayscale threshold from the original spot image to obtain the spot image.
[0152] In one embodiment, the reflectivity of the curved surface calibration block satisfies the mirror reflectivity.
[0153] Each module in the above-mentioned visual system calibration device can be implemented in whole or in part by software, hardware, or a combination thereof. Each of the above-mentioned modules can be embedded in or independent of a processor in a computer device in the form of hardware, or can be stored in a memory in a computer device in the form of software, so that the processor can call and execute the operations corresponding to each of the above modules.
[0154] In one embodiment, a computer device is provided. The computer device may be a terminal, and its internal structure diagram may be as follows: Figure 7 As shown. The computer device includes a processor, a memory, a communication interface, a display screen and an input device connected through a system bus. Among them, the processor of the computer device is used to provide computing and control capabilities. The memory of the computer 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 communication interface of the computer device is used to communicate with an external terminal in a wired or wireless manner, and the wireless manner can be achieved through WIFI, a mobile cellular network, NFC (near field communication) or other technologies. When the computer program is executed by the processor, a calibration method for a visual system is implemented. The display screen of the computer device can be a liquid crystal display screen or an electronic ink display screen, and the input device of the computer device can be a touch layer covered on the display screen, or a button, trackball or touchpad set on the computer device housing, or an external keyboard, touchpad or mouse, etc.
[0155] Those skilled in the art will understand that Figure 7 The structure shown in the figure is only a block diagram of a part of the structure related to the solution of the present application, and does not constitute a limitation on the computer device to which the solution of the present application is applied. The specific computer device may include more or fewer components than those shown in the figure, or combine certain components, or have a different arrangement of components.
[0156] In one embodiment, a computer device is further 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 method embodiments when executing the computer program.
[0157] In one embodiment, a computer-readable storage medium is further 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.
[0158] 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.
[0159] Those skilled in the art can understand that all or part of the processes in the above-mentioned embodiment methods 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 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), magnetoresistive 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, etc., but are not limited to this.
[0160] 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 specification.
[0161] 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
1. A method for calibrating a visual system, It is characterized in that The visual system includes an image acquisition device and a light source; the method includes: Imaging the light spot formed by the light source on the curved surface calibration block by the image acquisition device to obtain a light spot image, wherein the light spot image includes a light spot curve formed by the light spot fitting; Determine a first positional relationship between the light spot and the curved surface calibration block according to the light spot image, wherein the first positional relationship includes a first distance between the light spot and the bottom of the curved surface calibration block; Acquire a second positional relationship between the light source and the curved surface calibration block, wherein the second positional relationship includes a second distance between the light source and the center of the curved surface calibration block, and a third distance between the light source and the bottom of the curved surface calibration block; Determining a target horizontal distance and a target vertical distance between the light source and the light spot according to the distance in the horizontal direction and the distance in the vertical direction between the first position relationship and the second position relationship, comprising: determining a first difference between the first distance and the third distance to obtain the target vertical distance, and determining a second difference between the second distance and the first size of the light spot curve to obtain the target horizontal distance; The target horizontal distance and the target vertical distance are processed by calculation to obtain the angle of the light source as the target posture of the light source, and the light source is calibrated according to the target posture.
2. The method according to claim 1, It is characterized in that The light spot image includes a contour curve corresponding to the curved surface calibration block; The determining a first positional relationship between the light spot and the curved surface calibration block according to the light spot image comprises: Determining the first size and the second size between the contour curve and the center of the curved surface calibration block according to the spot image; The first distance between the light spot and the bottom of the curved surface calibration block is determined according to the first size and the second size.
3. The method according to claim 1, It is characterized in that The curved surface calibration block is provided with a plurality of calibration marks; before the image acquisition device is used to image the light spot formed by the light source on the curved surface calibration block, the method further includes: Imaging the curved surface calibration block by the image acquisition device to obtain a marked image; The image acquisition device is calibrated according to the position information of the calibration mark in the marked image.
4. The method according to claim 3, It is characterized in that The calibration mark includes a plurality of calibration marks arranged at the corners of the curved surface calibration block, and the image acquisition device is calibrated according to the positional relationship of the calibration marks in the marked image, including: Determining position information of each of the calibration marks on the marked image; Determining the distance between two adjacent calibration marks according to the position information of the calibration marks; Calibrate the position of the image acquisition device according to the distance until the distance meets a preset condition; Alternatively, the calibration mark comprises a center mark provided at the center position of the curved surface calibration block; The step of calibrating the image acquisition device according to the position information of the calibration mark in the marked image comprises: The image acquisition device is calibrated according to the position information of the center mark in the mark image, so that the position information of the center mark in the mark image acquired after calibration coincides with the center of the mark image acquired after calibration.
5. The method according to any one of claims 1 to 4, It is characterized in that The imaging of the light spot formed by the light source on the curved surface calibration block by the image acquisition device to obtain the light spot image comprises: Imaging the light spot formed by the light source on the curved surface calibration block through the image acquisition device to obtain an original light spot image; Obtaining the grayscale value of each pixel on the original light spot image; Pixels whose grayscale values are less than a grayscale threshold are deleted from the original light spot image to obtain the light spot image.
6. The method according to any one of claims 1 to 4, It is characterized in that The curved surface calibration block adopts a hemispherical structure, and the reflectivity of the curved surface calibration block meets the mirror reflectivity.
7. A calibration device for a visual system, It is characterized in that The visual system comprises an image acquisition device and a light source; the device comprises: A light spot imaging module, used for imaging the light spot formed by the light source on the curved surface calibration block through the image acquisition device to obtain a light spot image, wherein the light spot image includes a light spot curve formed by the light spot fitting; A first relationship determination module, configured to determine a first positional relationship between the light spot and the curved surface calibration block according to the light spot image, wherein the first positional relationship includes a first distance between the light spot and a bottom of the curved surface calibration block; A second relationship acquisition module, used to acquire a second positional relationship between the light source and the curved surface calibration block, wherein the second positional relationship includes a second distance between the light source and the center of the curved surface calibration block, and a third distance between the light source and the bottom of the curved surface calibration block; a light source calibration module, configured to determine a target horizontal distance and a target vertical distance between the light source and the light spot according to the distance in the horizontal direction and the distance in the vertical direction between the first position relationship and the second position relationship, determine a target posture of the light source according to the target horizontal distance and the target vertical distance, and calibrate the light source according to the target posture; Among them, the light source calibration module is also used to determine the first difference between the first distance and the third distance to obtain the target vertical distance, and determine the second difference between the second distance and the first size of the light spot curve to obtain the target horizontal distance; perform calculation processing on the target horizontal distance and the target vertical distance to obtain the angle of the light source as the target posture of the light source.
8. The device according to claim 7, It is characterized in that The light spot image includes a contour curve corresponding to the curved surface calibration block; The first relationship determination module includes: a size determination unit, configured to determine the first size and a second size between the contour curve and the center of the curved surface calibration block according to the spot image; A distance determination unit is used to determine the first distance between the light spot and the bottom of the curved surface calibration block according to the first size and the second size.
9. A computer device comprising a memory and a processor, wherein the memory stores a computer program. It is characterized in that When the processor executes the computer program, the steps of the method according to any one of claims 1 to 6 are implemented.
10. A computer-readable storage medium having a computer program stored thereon, It is characterized in that When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 6 are implemented.
Citation Information
Patent Citations
Drilling normal vector alignment method based on high-reflection imaging principle
CN111964612A
Sub-aperture scanning flat field calibration data processing method and system and storage medium
CN112288785A