Corner point detection method, device, computer equipment and storage medium
By reducing the detection area to the calibration plate area during the camera calibration process, and using corner point collection and attitude information for corner point detection, the problem of waste of computing resources in the existing technology is solved, and the calibration efficiency and production line productivity are improved.
Patent Information
- Application Number
- CN202110684113.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-06-21
- Publication Date
- 2024-08-23
- Estimated Expiration
- 2041-06-21
AI Technical Summary
During the camera calibration process, the existing technology consumes too much computing resources through global detection, resulting in low efficiency. Especially when detecting corner points in the video stream, the entire image frame needs to be detected, including the non-calibration plate area, resulting in computational Waste of resources.
By determining the corner point set, narrow the detection area to the calibration plate area, only detect corner points in this area, use the corner point set and attitude information to determine the calibration plate area, and perform corner point detection based on this area, reducing the consumption of computing resources.
It effectively reduces the consumption of computing resources, improves the efficiency of corner detection, is suitable for batch calibration operations, and improves the production capacity of the calibration production line.
Smart Images

Figure CN113569843B
Abstract
Description
Technical Field
[0001] The present application relates to the technical field of camera calibration, and in particular to a corner point detection method, device, computer equipment and storage medium. Background Art
[0002] In the camera production process, the camera imaging sensor is definitely not perfect, so the picture seen through the camera is different from what the human eye sees, that is, the image is distorted. In addition, the camera is installed in a position that makes the plane where the lens is located and the imaged plane not horizontal, but at an angle, so the position of the object seen by the camera does not match the actual position of the object. Therefore, it is necessary to calibrate the camera before using it, especially before using it in machine vision applications and image measurement scenarios.
[0003] In the process of camera calibration, a camera is often used to shoot a calibration plate with a specific corner point pattern, and the image coordinates of each corner point are extracted from each frame of the captured image, and the image coordinates of these corner points are matched with the three-dimensional spatial coordinates of the corresponding corner points on the calibration plate, thereby providing a data basis for the subsequent calibration process. Usually, camera calibration only requires taking a dozen photos for calibration, but when calibrating the camera-gyroscope, a video is generally recorded for video calibration. At this time, it is necessary to detect the corner points of the calibration plate in each frame of the video stream. In the related art, the corner point coordinates are mainly obtained by global detection, that is, by performing global detection on each image frame in the video stream. Since the calibration plate may only occupy a part of the image, and the entire image is detected, the corner point-free area of the non-calibration plate in the image will be detected at the same time, which will consume too many computing resources. Summary of the invention
[0004] Based on this, it is necessary to provide a corner point detection method, device, computer equipment and storage medium that can save computing resources in order to solve the above technical problems.
[0005] A corner point detection method, the method comprising:
[0006] Based on the corner point set, determine the calibration plate area in the target image frame to be detected and use it as the detection area. The corner point set is determined based on the corner points in the calibration plate. The target image frame is an image frame in a video stream. The video stream is obtained by shooting the calibration plate with a shooting device in motion.
[0007] Based on the detection area, the corner points in the target image frame are detected.
[0008] In one embodiment, determining a calibration plate area in a target image frame to be detected based on a set of corner points includes:
[0009] If the corner point set satisfies the first preset condition, obtaining position information of each corner point in the corner point set in the target image frame;
[0010] Based on the position information of each corner point in the corner point set in the target image frame, the calibration plate area is determined.
[0011] In one embodiment, the corner point set is determined after tracking the corner points detected in the previous image frame based on the corner points that can be tracked when tracking to the target image frame; the previous image frame is the image frame before the target image frame in the video stream.
[0012] In one embodiment, obtaining position information of each corner point in the corner point set in the target image frame includes:
[0013] Acquire posture information, where the posture information is used to indicate the positional relationship of the shooting device relative to the calibration plate when shooting the target image frame;
[0014] According to the posture information and the image coordinate system established based on the target image frame, the position information of each corner point in the corner point set in the target image frame is obtained.
[0015] In one embodiment, the corner point set is determined by the corner points corresponding to the vertices that can determine the contour of the calibration plate, and / or the posture information is determined based on the coordinate system conversion between the coordinate system of the calibration plate and the coordinate system of the capturing device when capturing the target image frame.
[0016] In one of the embodiments, the first preset condition includes that the total number of corner points in the corner point set is greater than a preset threshold.
[0017] In one of the embodiments, the calibration plate area satisfies a second preset condition, which includes that each corner point in the corner point set is located in the calibration plate area or that the corner point features of each corner point in the corner point set can be retained in the calibration plate area.
[0018] A corner point detection device, comprising:
[0019] A determination module is used to determine the calibration plate area in the target image frame to be detected based on the corner point set, and use it as the detection area. The corner point set is determined based on the corner points in the calibration plate. The target image frame is an image frame in a video stream. The video stream is obtained by shooting the calibration plate by a shooting device in a moving state.
[0020] The detection module is used to detect corner points in the target image frame based on the detection area.
[0021] A computer device includes a memory and a processor, wherein the memory stores a computer program, and the processor implements the following steps when executing the computer program: based on a corner point set, a calibration plate area in a target image frame to be detected is determined and used as a detection area, wherein the corner point set is determined based on the corner points in the calibration plate, and the target image frame is an image frame in a video stream, and the video stream is obtained by shooting the calibration plate by a shooting device in a moving state; based on the detection area, the corner points in the target image frame are detected.
[0022] A computer-readable storage medium stores a computer program, which implements the following steps when executed by a processor: based on a corner point set, a calibration plate area in a target image frame to be detected is determined and used as a detection area, the corner point set is determined based on the corner points in the calibration plate, the target image frame is an image frame in a video stream, and the video stream is obtained by shooting the calibration plate with a shooting device in motion; based on the detection area, the corner points in the target image frame are detected.
[0023] The above-mentioned corner point detection method, device, computer equipment and storage medium determine the calibration plate area in the target image frame to be detected based on the corner point set, and use it as the detection area. Based on the detection area, the corner points in the target image frame are detected. Since the entire area of the image frame is not detected during corner point detection, that is, it is not a global corner point detection, but only the calibration plate area in the entire area is detected, the detection range is reduced, and the consumed computing resources can be reduced. At the same time, since the detection range is reduced, the overall detection workload is also reduced accordingly, which can also improve the detection efficiency, and is also conducive to batch calibration operations and to improving the capacity of the calibration production line. BRIEF DESCRIPTION OF THE DRAWINGS
[0024] Figure 1 A schematic diagram of a camera calibration scene in one embodiment;
[0025] Figure 2 1 is a flow chart of a corner point detection method in one embodiment;
[0026] Figure 3 A schematic diagram of image frames captured by a camera in different postures in one embodiment;
[0027] Figure 4 is a schematic flow chart of a corner point detection method in another embodiment;
[0028] Figure 5 is a schematic diagram of calibrating a system coordinate system in one embodiment;
[0029] Figure 6 A schematic diagram of calibrating a system coordinate system in another embodiment;
[0030] Figure 7 1 is a flow chart of a corner point detection method in one embodiment;
[0031] Figure 8 is a schematic flow chart of a corner point detection method in another embodiment;
[0032] Fig. 9 is a structural block diagram of a corner point detection device in one embodiment;
[0033] Fig.10 FIG. 4 is a diagram showing the internal structure of a computer device in one embodiment. DETAILED DESCRIPTION
[0034] 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.
[0035] It is understood that the terms "first", "second", etc. used in this application can be used in this article to describe various professional terms, but unless otherwise specified, these professional terms are not limited by these terms. These terms are only used to distinguish one professional term from another professional term. For example, without departing from the scope of this application, the third preset threshold and the fourth preset threshold can be the same or different.
[0036] In the camera production process, the camera imaging sensor is definitely not perfect, so the picture seen through the camera is different from what the human eye sees, that is, the image is distorted. In addition, the camera is installed in a position that makes the plane where the lens is located and the imaged plane not horizontal, but at an angle, so the position of the object seen by the camera does not match the actual position of the object. Therefore, it is necessary to calibrate the camera before using it, especially before using it in machine vision applications and image measurement scenarios.
[0037] In the process of camera calibration, a camera is often used to shoot a calibration plate with a specific corner point pattern, and the image coordinates of each corner point are extracted from each frame of the captured image, and the image coordinates of these corner points are matched with the three-dimensional spatial coordinates of the corresponding corner points on the calibration plate, thereby providing a data basis for the subsequent calibration process. From the above process, it can be seen that it is necessary to obtain the corner point coordinates of the calibration plate in each frame of the image. In the related art, the corner point coordinates are mainly obtained by global detection, that is, by detecting the entire image. Since the calibration plate may only occupy a part of the image, detecting the entire image will also detect the corner point-free area of the non-calibration plate in the image, which will consume too many computing resources.
[0038] In view of the problems existing in the above-mentioned related technologies, an embodiment of the present invention provides a corner point detection method, which can be applied to a device with a shooting function, and the device can be a camera, a smart phone, a personal computer with a camera, a laptop, a tablet computer, and a portable wearable device, etc. It should be noted that the number of "multiple" and the like mentioned in each embodiment of the present application refers to the number of "at least two", for example, "multiple" means "at least two".
[0039] Before describing the specific implementation of the present application, the main application scenarios of the present application are described first. The corner point detection method in the present application is mainly used to calibrate the shooting equipment. Specifically, Figure 1 As shown, the calibration plate is placed in front of the camera, that is, the shooting device, and the robotic arm is used to place the camera. The camera takes images and transmits the images to the server through the data transmission channel between the two. The server performs calibration processing, and then the server transmits the calibration results to the camera, so that the camera adjusts itself according to the calibration results.
[0040] In combination with the contents of the above embodiments, in one embodiment, see Figure 2 , provides a corner point detection method. Taking the method applied to a server and the execution subject being the server as an example for explanation, it can be understood that the method can also be applied to a shooting device and the corresponding execution subject is the shooting device, or according to actual needs and feasibility, the method can be applied to both the shooting device and the server, that is, the execution subject of some steps in the method can be the shooting device, and the execution subject of other steps can be the server, and the embodiment of the present invention does not specifically limit this. For example, Figure 2 In the corresponding method flow, step 201 may be performed by the photographing device, and then the photographing device sends the data corresponding to the calibration plate area to the server, and then the server performs step 202. In combination with the content of the above embodiment, in one embodiment, the method includes the following steps:
[0041] 201. Based on the corner point set, determine a calibration plate area in a target image frame to be detected and use it as a detection area, the corner point set is determined based on the corner points in the calibration plate, the target image frame is an image frame in a video stream, and the video stream is obtained by shooting the calibration plate by a shooting device in a moving state;
[0042] 202. Based on the detection area, corner points in the target image frame are detected.
[0043] In the above step 201, after the camera captures the calibration plate, a video stream can be obtained, and the calibration plate will exist in each image frame of the video stream. The corner points in the calibration plate will be captured in each image frame, so that the corner points captured in each image frame can constitute a corner point set, that is, the corner point set is composed of the corner points in the image frame, and the corner points in the image frame include the corner points in the corresponding calibration plate. When determining the calibration plate area in the target image frame to be detected based on the corner point set, since the corner point set is composed of the corner points in the target image frame, the corner points in the corner point set can be connected, so that the calibration plate area can be selected based on the connection box, and the embodiment of the present invention does not specifically limit this.
[0044] like Figure 3 As shown, Figure 3 The left half is the image frame taken by the camera facing the calibration plate. Figure 3 The right half of the figure is the image frame taken by the camera after the camera changes its posture relative to the calibration plate. Figure 3 The dashed box in the middle right half is a representation when the calibration plate area is demarcated by a box. Figure 3 Whether in the middle left half or the right half, it can be clearly seen that the image frame not only captures the calibration plate, but also the environment around the calibration plate, and these parts will also be detected for corner points in related technologies.
[0045] It can be seen from the execution process of step 201 and step 202 that the above execution process can be applied to corner point detection based on video stream. Specifically, a video is composed of frames of images, and corner point detection needs to be performed on each frame. For a certain image frame, before performing corner point detection on the image frame, if a detection area smaller than the image frame can be determined in the image frame, and corner points are detected only in the detection area, computing resources can be reduced.
[0046] In the actual implementation process, if it is based on video corner detection, combined with Figure 1 The actual calibration process can be that the camera is installed on the robotic arm to record the calibration plate. During the recording process, the robotic arm makes different gestures, and the recorded video is transmitted to the server to detect the corner points of the calibration plate using the following algorithm, so as to perform batch calibration production. If the actual calibration workload is large, such as a long video, the video stream that needs to detect the corner points can be divided into n segments, and the same operation is performed on the n segments, and then the corner points detected in each video are organized in time sequence for subsequent calibration work. Among them, the division into n segments can be divided into multiple threads in the server for corner point detection, such as n threads performing corner point detection in parallel.
[0047] The method provided by the embodiment of the present invention determines the calibration plate area in the target image frame to be detected based on the corner point set, and uses it as the detection area. Based on the detection area, the corner points in the target image frame are detected. Since the entire area of the image frame is not detected during corner point detection, that is, it is not a global corner point detection, but only the calibration plate area in the entire area is detected, the detection range is reduced, and the consumed computing resources can be reduced. At the same time, since the detection range is reduced, the workload of the overall detection is also reduced accordingly, which can also improve the detection efficiency, and is also conducive to batch calibration operations and to improving the capacity of the calibration production line.
[0048] In combination with the contents of the above embodiments, in one embodiment, see Figure 4 The embodiment of the present invention further provides a corner point detection method, comprising the following steps:
[0049] 401. If the corner point set satisfies a first preset condition, obtain position information of each corner point in the corner point set in the target image frame;
[0050] 402. Based on the position information of each corner point in the corner point set in the target image frame, determine the calibration plate area and use it as the detection area;
[0051] 403. Based on the detection area, corner points in the target image frame are detected.
[0052] In the above step 401, the first preset condition is set for the corner point set because the embodiment of the present invention needs to determine the calibration plate area based on the corner point set, and there are situations where the calibration plate area cannot be determined or the determined calibration plate area is not accurate enough because the corner point set does not meet certain conditions. Therefore, for these situations, it is necessary to pre-set the first preset condition for the corner point set in advance, so that the calibration plate area can be determined in step 402 only on the premise that the first preset condition is met.
[0053] For example, if the corner point set contains only those corner points concentrated in a certain area of the calibration plate, such as the corner point set contains only the corner points squeezed in the middle area of the calibration plate, then it is obvious that based on such a corner point set, the entire calibration plate area cannot be accurately determined. Therefore, the first preset condition can be that the number of corner points in the corner point set with a spacing greater than a certain threshold value reaches a certain number. The reason why the first preset condition can be set in this way is mainly due to the following two considerations: first, the existence of corner points with a spacing greater than a certain threshold value can indicate that the corner points in the corner point set are not all concentrated in a certain area of the calibration plate; second, the number of corner points with a spacing greater than a certain threshold value can ensure that the corner points with a spacing greater than a certain threshold value are not individual cases, but are widely distributed in the corner point set. In summary, based on these two considerations, it is possible to ensure that the accurate calibration plate area is determined. Of course, in the actual implementation process, the first preset condition can also be set for the corner point set from different consideration angles, and the embodiment of the present invention does not make specific limitations on this.
[0054] In step 401, the position information may be the coordinates of the corner point in the target image frame. For example, a coordinate system may be established at the lower left corner of the image frame. Since the corner point is represented by pixels in the image frame, that is, it is composed of pixels, the pixel coordinates may be determined, and thus the coordinates of the corner point may also be determined. It should be noted that the corner point usually includes multiple pixels in the image frame, and thus the position information of a corner point may actually be represented by the coordinates of multiple pixels included in the image frame corresponding to the corner point.
[0055] It should be noted that, in addition to the above step 401, if the corner point set does not meet the first preset condition, it means that the corner point set is not suitable for determining the calibration plate area. In such a case, global corner point detection can be performed on the target image frame to be detected.
[0056] The method provided by the embodiment of the present invention determines whether the corner point set satisfies the first preset condition, and only determines the calibration plate area based on the corner point set when the corner point set satisfies the first preset condition. Since the first preset condition can filter out the situation where the calibration plate area cannot be determined or is not determined accurately based on the corner point set, the success rate of subsequent corner point detection can be improved.
[0057] It should be understood that although Figure 1 and Figure 4 The steps in the flowchart are shown in sequence as indicated by the arrows, but these steps are not necessarily executed in the order indicated by the arrows. Unless otherwise specified in this document, there is no strict order restriction for the execution of these steps, and these steps can be executed in other orders. Moreover, Figure 1 and Figure 4At least part of the steps may include multiple steps or multiple stages. These steps or stages are not necessarily performed at the same time, but can be performed at different times. The execution order of these steps or stages is not necessarily sequential, but can be performed in turn or alternately with other steps or at least part of the steps or stages in other steps.
[0058] In combination with the contents of the above embodiments, in one embodiment, the corner point set is determined after tracking the corner points detected in the previous image frame, based on the corner points that can be tracked when tracking to the target image frame; the previous image frame is the image frame before the target image frame in the video stream.
[0059] Among them, when tracking the detected corner points, a target tracking-related algorithm can be used. The target tracking-related algorithm can be a correlation filtering algorithm, a scale adaptive algorithm, and an optical flow tracking algorithm. For ease of understanding, the optical flow tracking algorithm is now used as an example for explanation: optical flow is the instantaneous speed of the pixel movement of a spatial moving object on the observation imaging plane. Optical flow tracking is a method of using the change of pixels in the time domain in an image sequence and the correlation between adjacent frames to find the corresponding relationship between the previous frame and the current frame, thereby calculating the motion information of the object between adjacent frames. Combined with the above explanation, optical flow tracking requires that the distance between the two frames is relatively close, so that the preceding image frame in the embodiment of the present invention is the preceding image frame of the target image frame. After determining the position information of each corner point in the corner point set in the preceding image frame, based on optical flow tracking, the position information of each corner point in the corner point set in the target image frame can be obtained.
[0060] After obtaining the position information of each corner point in the corner point set in the target image frame, that is, the positions of these corner points in the corner point set in the target image frame are determined, based on which the calibration plate area can be determined. Accordingly, the embodiment of the present invention does not specifically limit the method of determining the calibration plate area based on the position information of each corner point in the corner point set in the target image frame, including but not limited to: determining a frame that can surround each corner point in the corner point set in the target image frame based on the position information of each corner point in the corner point set in the target image frame; determining the calibration plate area based on the frame.
[0061] It should be noted that, since the calibration plate is generally rectangular, the border in the above process can be rectangular. Of course, in the actual implementation process, the border can also be other shapes, such as an irregular border, as long as it can surround each corner point in the corner point set and is smaller than the size of the image frame itself. Taking the border as a rectangle as an example, the border can further be the minimum border that can surround each corner point in the corner point set, thereby reducing the area that needs to be detected for subsequent corner point detection, thereby reducing the consumed computing resources and improving the detection efficiency. It should be noted that in the actual implementation process, regardless of whether the border is the above-mentioned minimum border, in order to ensure that it can surround each corner point in the corner point set, the border can be expanded according to certain principles, such as uniformly expanding the distance of two pixels outward, and the embodiment of the present invention does not make specific limitations on this.
[0062] The method provided by the embodiment of the present invention can determine the position information of each corner point in the corner point set in the target image frame based on the tracking algorithm, and based on the position information of each corner point in the corner point set in the target image frame, it can determine the calibration plate area, that is, the detection area, and detect the corner points in the target image frame based on the detection area. Since the subsequent corner point detection is not performed on the entire area of the image frame, that is, it is not a global corner point detection, but only the calibration plate area in the entire area is detected, the detection range is narrowed, and the consumed computing resources can be reduced. At the same time, since the detection range is narrowed, the workload of the overall detection is also reduced accordingly, which can also improve the detection efficiency, and is also conducive to batch calibration operations and to improving the capacity of the calibration production line.
[0063] The above process is mainly based on tracking to achieve corner detection. The main idea is to track the corner points detected in the previous image frame, so as to predict the position information of these corner points in the target image frame, and then delineate an area smaller than the size of the image frame itself based on the position information of these corner points, so that subsequent corner detection is only performed in this area.
[0064] And from above Figure 1 It can be seen that the calibration process requires the robot arm to drive the camera to move and the camera to shoot, so as to calibrate based on the video stream obtained by shooting. In addition, Figure 1 The coordinate system of the robot base is o w And the coordinate system o where the calibration plate is located b The robot arm will drive the camera to move, that is, the camera moves with the robot arm. For specific movement methods, please refer to Figure 5 and Figure 6 ,Depend on Figure 5 and Figure 6 It can be seen that the coordinate system o where the robot is located h The coordinate system o of the camera cis relatively unchanged, but o c and h These two coordinate systems are relative to o w and b All of them have changed. Figure 5 The image captured by the camera in the state shown by the corresponding robotic arm can be referred to Figure 3 The left half of the . Figure 6 The image captured by the camera in the state shown by the corresponding robotic arm can be referred to Figure 3 The right half of .
[0065] Since the robot arm is controlled by the system, its movement is known. From the above embodiments, it can be seen that the coordinate system o of the robot arm base is w And the coordinate system o where the calibration plate is located b is unchanged, and the coordinate system o of the robot arm h The coordinate system o of the camera c is relatively unchanged. Therefore, we only need to know o w With o b The relative transformation T w_b , o h With o c The relative transformation T h_c And then learn o w With o h The relative transformation T w_h , you can determine o c With o b The relative transformation T c_b It should be noted that the above relative transformations all refer to relative transformations between coordinate systems. When determining the time at which the target image frame is captured, c With o b The relative transformation T c_b , based on T c_b , calculate the position information of each corner point in the corner point set in the target image frame.
[0066] Combined with the above description, it can be known that the shooting device is constantly moving when shooting the video stream, so for each image frame in the video stream, the posture of the shooting device relative to the calibration plate is different each time the image frame is shot, that is, the video stream is shot when the shooting device is in a state of continuous motion. Based on the above principles and combined with the contents of the above embodiments, in one embodiment, the embodiment of the present invention does not specifically limit the method of obtaining the position information of each corner point in the corner point set in the target image frame, including but not limited to: obtaining posture information, the posture information is used to indicate the position relationship of the shooting device relative to the calibration plate when shooting the target image frame; according to the posture information and the image coordinate system established based on the target image frame, obtaining the position information of each corner point in the corner point set in the target image frame.
[0067] Combined with the above mentioned Figure 5 and Figure 6 The positional relationship between the shooting device and the calibration plate when shooting the target image frame, that is, the posture information, can be the relative transformation between the coordinate systems mentioned above, which can be specifically represented by the transformation matrix between the coordinate systems, that is, the relative transformation T mentioned above. w_b , T h_c , T w_h and T c_b All of them can be transformation matrices, and the embodiment of the present invention does not make any specific limitation to this.
[0068] The transformation relationship between the transformation matrices can be referred to the following formula (1) and formula (2):
[0069]
[0070]
[0071] In the above formulas (1) and (2), T w_b and T h_c is fixed, while T w_h and T c_b will change. Figure 5 and Figure 6 The robot arm will move and move with the camera. The interval between each photo is very short. For example, a video may be taken for 24 frames per second. In this way, the T w_h and T c_b It is continuous frame by frame.
[0072] In the above formula, The superscript 1 in the image may refer to the time when the first frame was taken. w With o h The transformation matrix between The superscript 2 in the image may refer to the time when the second frame is taken.w With o h The transformation matrix between them. It should be noted that and The value of is different because when the second frame is shot, the robot arm has moved and its own coordinate system has changed relative to the coordinate system of the robot arm base.
[0073] Similarly, The superscript 1 in the image may refer to the time when the first frame was taken. c With o b The transformation matrix between The superscript 2 in the image may refer to the time when the second frame is taken. c With o b The transformation matrix between them. It should be noted that and The value of is also different. This is because when shooting to the second frame, the camera has moved with the movement of the robotic arm, and its own coordinate system has changed relative to the coordinate system of the calibration plate.
[0074] It should be noted that due to T w_b and T h_c is fixed, so we can first solve T w_b and T h_c Specifically, for the same corner points in the calibration plate, T can be solved based on the coordinates of these corner points in the coordinate system of the previous image frame, the coordinates of these corner points in the coordinate system of the target image frame, and the coordinates of these corner points in the coordinate system of the calibration plate. w_b and T h_c For the target image frame to be detected, if you need to obtain the coordinates of the corner points in the punctuation board in the target image frame, you can combine T w_b and T h_c The coordinates of the corner points in the calibration plate in the target image frame specifically refer to the coordinates of the corner points in the image coordinate system established based on the target image frame, and the image coordinate system is established with the upper left corner vertex of the target image frame as the origin.
[0075] It should be noted that, unlike the optical flow tracing method to solve the corner point in the target image frame, assuming that the previous image frame is the first frame and the target image frame to be detected is the kth frame, when solving T w_b and T h_c, k needs to be as large as possible to make the interval between the previous image frame and the target image frame as large as possible. This is because the shooting interval between two adjacent frames is too short. If k is not 2 and is small, even if there are several frames, the interval between the previous image frame and the target image frame is still very short. This results in the robot arm not moving much, and its movement is basically undetectable. Correspondingly, the transformation matrix determined in the first frame will not change from the transformation matrix determined in the kth frame. At this time, the position of the corner point in the kth frame, that is, the target image frame, may be the same as that in the previous image frame, so it is impossible to accurately solve T w_b and T h_c In summary, the shooting time interval between the previous image frame and the target image frame needs to be as large as possible to ensure that the movement of the robot arm can be detected.
[0076] From the above process, it can be seen that if the position information of the corner point in the target image frame needs to be obtained, the T when the target image frame is shot can be obtained. c_b The T c_b It can be used as posture information. c_b When obtaining the position information of each corner point in the corner point set in the target image frame based on the image coordinate system established by the target image frame, the following two formulas can be specifically referred to:
[0077]
[0078]
[0079] In the above formulas (3) and (4), s is the scaling factor, p is the position information of the corner point in the target image frame, that is, the coordinates, K and are the camera internal parameters, When the kth frame is taken, c With o b The transformation matrix between them, P is the coordinate system o where the corner point is located on the calibration plate b The coordinates in is when the kth frame is taken. w With o h The transformation matrix between them. Among them, the kth frame is the target image frame.
[0080] The method provided by the embodiment of the present invention obtains the position information of each corner point in the corner point set in the target image frame according to the posture information and the image coordinate system established based on the target image frame. Based on the position information of each corner point in the corner point set in the target image frame, the calibration plate area, that is, the detection area, can be determined, and the corner points in the target image frame can be detected based on the detection area. Since the entire area of the image frame is not detected during the subsequent corner point detection, that is, it is not a global corner point detection, but only the calibration plate area in the entire area is detected, the detection range is reduced, and the consumed computing resources can be reduced. At the same time, since the detection range is reduced, the workload of the overall detection is also reduced accordingly, which can also improve the detection efficiency, and is also conducive to batch calibration operations and to improving the capacity of the calibration production line.
[0081] It can be seen from the contents of the above embodiments that the embodiments of the present invention mainly determine the calibration plate area based on the positions of the corner points in the calibration plate in the image frame. In addition to the above method of determining the calibration plate area by determining the minimum border that can surround these corner points, if these corner points themselves have certain characteristics, the plate area can also be calibrated. Based on this principle, combined with the contents of the above embodiments, in one embodiment, the corner point set is determined by the corner points corresponding to the vertices that can determine the contour of the calibration plate, and / or the posture information is determined based on the coordinate system conversion between the coordinate system where the calibration plate is located and the coordinate system where the shooting device is located when shooting the target image frame.
[0082] Among them, these corner point sets can be the four vertices of the calibration plate, or because the calibration plate is a rectangle, the corner point set can also be the two vertices of the calibration plate at the opposite corners, and the embodiment of the present invention does not specifically limit this. The above four vertices or the two vertices of the opposite corners can determine the outline of the calibration plate. In addition, the posture information can be determined based on the coordinate system conversion between the coordinate system where the calibration plate is located and the coordinate system where the shooting device is located when shooting the target image frame, which can be specifically the conversion matrix in the above embodiment, and the embodiment of the present invention does not specifically limit this.
[0083] The method provided by the embodiment of the present invention can determine the calibration plate area based on the corner points corresponding to the vertices that can determine the contour of the calibration plate. When performing corner point detection later, instead of detecting the entire area of the image frame, that is, not global corner point detection, only the calibration plate area in the entire area is detected, thereby reducing the detection range and further reducing the consumed computing resources. At the same time, since the detection range is reduced, the workload of the overall detection is also reduced accordingly, thereby improving the detection efficiency, facilitating batch calibration operations, and improving the capacity of the calibration production line.
[0084] In combination with the content of the above embodiment, in one embodiment, the first preset condition includes that the total number of corner points in the corner point set is greater than a preset threshold. Since the total number of corner points in the corner point set is greater than a certain threshold, it is ensured that there are enough corner points in the corner point set. In this way, the bounding box surrounding these corner points can restore the outline of the calibration plate itself as much as possible.
[0085] The method provided by the embodiment of the present invention determines whether the corner point set satisfies the first preset condition, and only determines the calibration plate area based on the corner point set when the corner point set satisfies the first preset condition. Since the first preset condition can filter out the situation where the calibration plate area cannot be determined or is not determined accurately based on the corner point set, the success rate of subsequent corner point detection can be improved.
[0086] In combination with the contents of the above embodiments, in one embodiment, the calibration plate area satisfies a second preset condition, and the second preset condition includes that each corner point in the corner point set is located in the calibration plate area or the corner point features of each corner point in the corner point set can be retained in the calibration plate area.
[0087] In combination with the content of the above embodiment, it can be pointed out that only when the corner points in the corner point set are all within the calibration plate area, can it be guaranteed that these corner points can be detected when the corner point detection is performed in the calibration plate area later. Furthermore, if the determined calibration plate area can retain the corner point features of the corner points, it is more guaranteed that these corner points can be detected when the corner point detection is performed in the calibration plate area later. Among them, the corner point is located in the calibration plate area, which can mean that n pixels of the corner point are located in the calibration plate area, or the pixel at the center of the corner point is located in the calibration plate area, which is not specifically limited in the embodiment of the present invention.
[0088] The method provided by the embodiment of the present invention can limit the calibration plate area to meet the second preset condition, so that when corner point detection is subsequently performed in the calibration plate area, all corner points can be detected, thereby ensuring that the subsequent calibration process can proceed smoothly.
[0089] For ease of understanding, the two corner point detection methods provided in the embodiments of the present invention are now specifically explained in combination with the contents of the above embodiments. Among them, the first method is mainly based on optical flow tracking to determine the position of the corner points in the image frame in the video stream, determine the detection area based on the position of the corner points, and then perform corner point detection based on the detection area. The second method is mainly based on the movement of the robotic arm to determine the position of the corner points in the image frame in the video stream, determine the detection area based on the position of the corner points, and then perform corner point detection based on the detection area. The processing process of the above first method can be referred to Figure 7 .
[0090] exist Figure 7In the example, the video stream can be divided into n segments, and each segment can be processed by a thread of the server. For the sake of explanation, one of the threads is taken as an example: the first frame image in the video stream can be globally detected to detect the corner points in the first frame image. The corner points detected in the first frame image are optically tracked. After tracking to the second frame image, it is determined whether the number of corner points that can be tracked is greater than a preset threshold. If it is greater than the preset threshold, the best bounding box can be determined based on the tracked corner points, that is, a suitable area is selected, and local corner point detection is performed in the best bounding box in the second frame image. After the corner point detection of the second frame image is performed, the corner points detected in the second frame image can be tracked again, and the above process is repeated until the corner point detection of the last frame image is completed. After completing the corner point detection of the image frames in the video stream, the detected corner points can be organized according to the time sequence of the image frames in the video stream, thereby completing the external parameter calibration.
[0091] The processing process of the second method mentioned above can be referred to Figure 8 .exist Figure 8 In the example above, we can first calculate T w_b and T h_c , the specific calculation method can refer to the above process. Afterwards, the video stream can also be divided into n segments, each of which can be processed by a thread of the server. For the sake of convenience, take one of the threads as an example: for a certain frame of the video stream, based on T w_b and T h_c , get the T corresponding to the moment of the frame image c_b . After getting T c_b After that, according to T c_b The positions of the corner points at the four corners of the calibration plate in the frame image can be obtained by the coordinates of the corner points at the four corners of the calibration plate in the calibration plate coordinate system. According to the positions of the corner points at the four corners of the calibration plate in the frame image, the detection area can be determined in the frame image, and corner point detection can be performed in the detection area.
[0092] If the number of corner points detected in the detection area is less than the preset threshold, it means that T w_b and T h_c The previous calculation may not be accurate enough, so it can be solved again. If the number of corner points detected in the detection area is not less than the preset threshold, the image frames in the video stream can continue to be detected in the above manner until the corner point detection of the last frame is completed. After completing the corner point detection of the image frames in the video stream, the detected corner points can be organized according to the time sequence of the image frames in the video stream, thereby completing the external parameter calibration.
[0093] It should be noted that the technical solutions described above can be implemented as independent embodiments in the actual implementation process, or they can be combined with each other and implemented as combined embodiments. In addition, when describing the contents of the above embodiments of the present invention, different embodiments are described in a corresponding order based on the idea of convenient description, such as the order of data flow, instead of limiting the execution order between different embodiments. Accordingly, in the actual implementation process, if it is necessary to implement multiple embodiments provided by the present invention, it is not necessary to follow the execution order provided when describing the embodiments of the present invention, but the execution order between different embodiments can be arranged according to the needs.
[0094] In combination with the contents of the above embodiments, in one embodiment, Fig. 9 As shown, a corner point detection device is provided, including: a determination module 901 and a detection module 902, wherein:
[0095] The determination module 901 is used to determine the calibration plate area in the target image frame to be detected based on the corner point set, and use it as the detection area. The corner point set is determined based on the corner points in the calibration plate. The target image frame is an image frame in a video stream. The video stream is obtained by shooting the calibration plate by a shooting device in a moving state.
[0096] The detection module 902 is used to detect corner points in the target image frame based on the detection area.
[0097] In one embodiment, the determination module 901 includes:
[0098] An acquiring unit, configured to acquire position information of each corner point in the corner point set in the target image frame when the corner point set satisfies a first preset condition;
[0099] The determination unit is used to determine the calibration plate area based on the position information of each corner point in the corner point set in the target image frame.
[0100] In one embodiment, the corner point set is determined after tracking the corner points detected in the previous image frame based on the corner points that can be tracked when tracking to the target image frame; the previous image frame is the image frame before the target image frame in the video stream.
[0101] In one embodiment, an acquisition unit is used to acquire posture information, where the posture information is used to represent the positional relationship of the shooting device relative to the calibration plate when shooting the target image frame; based on the posture information and an image coordinate system established based on the target image frame, the position information of each corner point in the corner point set in the target image frame is acquired.
[0102] In one embodiment, the corner point set is determined by the corner points corresponding to the vertices that can determine the contour of the calibration plate, and / or the posture information is determined based on the coordinate system conversion between the coordinate system of the calibration plate and the coordinate system of the capturing device when capturing the target image frame.
[0103] In one embodiment, the first preset condition includes that the total number of corner points in the corner point set is greater than a preset threshold.
[0104] In one embodiment, the calibration plate area satisfies a second preset condition, which includes that each corner point in the corner point set is located in the calibration plate area or that the corner point features of each corner point in the corner point set can be retained in the calibration plate area.
[0105] For the specific definition of the corner detection device, please refer to the definition of the corner detection method above, which will not be repeated here. Each module in the above corner detection device can be implemented in whole or in part by software, hardware and their combination. The above modules can be embedded in or independent of the processor in the computer device in the form of hardware, or can be stored in the memory of the computer device in the form of software, so that the processor can call and execute the operations corresponding to the above modules.
[0106] In one embodiment, a computer device is provided. The computer device may be a server, and its internal structure diagram may be as follows: Fig.10 As shown. The computer device includes a processor, a memory and a network interface 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, a computer program and a database. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The database of the computer device is used to store data related to corner points. The network interface of the computer device is used to communicate with an external terminal through a network connection. When the computer program is executed by the processor, a corner point detection method is implemented.
[0107] Those skilled in the art will understand that Fig.10 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.
[0108] In one embodiment, a computer device is provided, including a memory and a processor, wherein a computer program is stored in the memory, and when the processor executes the computer program, the following steps are implemented:
[0109] Based on the corner point set, determine the calibration plate area in the target image frame to be detected and use it as the detection area. The corner point set is determined based on the corner points in the calibration plate. The target image frame is an image frame in a video stream. The video stream is obtained by shooting the calibration plate with a shooting device in motion.
[0110] Based on the detection area, the corner points in the target image frame are detected.
[0111] In one embodiment, when the processor executes the computer program, the processor further implements the following steps:
[0112] If the corner point set satisfies the first preset condition, obtaining position information of each corner point in the corner point set in the target image frame;
[0113] Based on the position information of each corner point in the corner point set in the target image frame, the calibration plate area is determined.
[0114] In one embodiment, when the processor executes a computer program, the corner point set is determined after tracking the corner points detected in the previous image frame, based on the corner points that can be tracked when tracking to the target image frame; the previous image frame is the image frame before the target image frame in the video stream.
[0115] In one embodiment, when the processor executes the computer program, the processor also implements the following steps:
[0116] Acquire posture information, where the posture information is used to indicate the positional relationship of the shooting device relative to the calibration plate when shooting the target image frame;
[0117] According to the posture information and the image coordinate system established based on the target image frame, the position information of each corner point in the corner point set in the target image frame is obtained.
[0118] In one embodiment, when the processor executes a computer program, the corner point set is determined by the corner points corresponding to the vertices that can determine the contour of the calibration plate, and / or the posture information is determined based on the coordinate system conversion between the coordinate system of the calibration plate and the coordinate system of the shooting device when shooting the target image frame.
[0119] In one embodiment, when the processor executes the computer program, the first preset condition includes that the total number of corner points in the corner point set is greater than a preset threshold.
[0120] In one embodiment, when the processor executes the computer program, the calibration plate area satisfies a second preset condition, and the second preset condition includes that each corner point in the corner point set is located in the calibration plate area or the corner point features of each corner point in the corner point set can be retained in the calibration plate area.
[0121] In one embodiment, a computer readable storage medium is provided, on which a computer program is stored, and when the computer program is executed by a processor, the following steps are implemented:
[0122] Based on the corner point set, determine the calibration plate area in the target image frame to be detected and use it as the detection area. The corner point set is determined based on the corner points in the calibration plate. The target image frame is an image frame in a video stream. The video stream is obtained by shooting the calibration plate with a shooting device in motion.
[0123] Based on the detection area, the corner points in the target image frame are detected.
[0124] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented: if the corner point set satisfies a first preset condition, obtaining the position information of each corner point in the corner point set in the target image frame; based on the position information of each corner point in the corner point set in the target image frame, determining the calibration plate area.
[0125] In one embodiment, when the computer program is executed by a processor, the corner point set is determined after tracking the corner points detected in the previous image frame, based on the corner points that can be tracked when tracking to the target image frame; the previous image frame is the image frame before the target image frame in the video stream.
[0126] In one embodiment, when the computer program is executed by the processor, the computer program also implements the following steps: obtaining posture information, where the posture information is used to represent the positional relationship of the shooting device relative to the calibration plate when shooting the target image frame; and obtaining the position information of each corner point in the corner point set in the target image frame according to the posture information and the image coordinate system established based on the target image frame.
[0127] In one embodiment, when the computer program is executed by a processor, the corner point set is determined by the corner points corresponding to the vertices that can determine the contour of the calibration plate, and / or the posture information is determined based on the coordinate system conversion between the coordinate system of the calibration plate and the coordinate system of the shooting device when shooting the target image frame.
[0128] In one embodiment, when the computer program is executed by a processor, the first preset condition includes that the total number of corner points in the corner point set is greater than a preset threshold.
[0129] In one embodiment, when the computer program is executed by the processor, the calibration plate area satisfies a second preset condition, and the second preset condition includes that each corner point in the corner point set is located in the calibration plate area or the corner point features of each corner point in the corner point set can be retained in the calibration plate area.
[0130] Those of ordinary skill 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 memory, storage, database or other media used in the embodiments provided in this 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 or optical memory, etc. Volatile memory can include random access memory (RAM) or external cache memory. 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).
[0131] 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.
[0132] The above-mentioned 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 invention patent. 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 patent of the present application shall be subject to the attached claims.
Claims
1. A corner point detection method, It is characterized in that The method comprises: If the corner point set satisfies a first preset condition, obtaining position information of each corner point in the corner point set in a target image frame, the corner point set is determined based on the corner points in the calibration plate, the target image frame is an image frame in a video stream, the video stream is obtained by photographing the calibration plate by a photographing device in a moving state, and the first preset condition includes that the total number of corner points in the corner point set is greater than a preset threshold; Based on the position information of each corner point in the corner point set in the target image frame, determine the calibration plate area in the target image frame to be detected and use it as the detection area; Based on the detection area, corner points in the target image frame are detected.
2. The method according to claim 1, It is characterized in that The corner point set is determined after tracking the corner points detected in the previous image frame based on the corner points that can be tracked when tracking to the target image frame; The preceding image frame is an image frame preceding the target image frame in the video stream.
3. The method according to claim 1, It is characterized in that The obtaining the position information of each corner point in the corner point set in the target image frame includes: Acquire posture information, where the posture information is used to indicate the positional relationship of the shooting device relative to the calibration plate when shooting the target image frame; According to the posture information and an image coordinate system established based on the target image frame, position information of each corner point in the corner point set in the target image frame is obtained.
4. The method according to claim 3, It is characterized in that The step of obtaining position information of each corner point in the corner point set in the target image frame according to the posture information and an image coordinate system established based on the target image frame includes: Among them, s is the scaling factor, p is the position information of the corner point in the target image frame, K and are the camera internal parameters, When the kth frame is taken, c With o b The transformation matrix between them, P is the coordinate system o where the corner point is located on the calibration plate b The coordinates in is when the kth frame is taken. w With o h The transformation matrix between them; where the kth frame is the target image frame.
5. The method according to claim 3, It is characterized in that The corner point set is determined by the corner points corresponding to the vertices that can determine the contour of the calibration plate, and / or the posture information is determined based on the coordinate system conversion between the coordinate system of the calibration plate and the coordinate system of the shooting device when shooting the target image frame.
6. The method according to claim 1, It is characterized in that The step of determining a calibration plate area in the target image frame to be detected based on the position information of each corner point in the corner point set in the target image frame comprises: Based on the position information of each corner point in the corner point set in the target image frame, determining a frame that can surround each corner point in the corner point set in the target image frame; Based on the border, a calibration plate area is determined.
7. The method according to any one of claims 1 to 6, It is characterized in that The calibration plate area satisfies a second preset condition, where the second preset condition includes that each corner point in the corner point set is located in the calibration plate area or that the corner point features of each corner point in the corner point set can be retained in the calibration plate area.
8. A corner point detection device, It is characterized in that The device comprises: A determination module, used to determine a calibration plate area in a target image frame to be detected based on a set of corner points, and use the calibration plate area as a detection area, wherein the set of corner points is determined based on the corner points in the calibration plate, and the target image frame is an image frame in a video stream, and the video stream is obtained by shooting the calibration plate by a shooting device in a moving state; A detection module, used for detecting corner points in the target image frame based on the detection area; The determining module comprises: an acquiring unit, configured to acquire position information of each corner point in the corner point set in the target image frame when the corner point set satisfies a first preset condition, wherein the first preset condition includes that a total number of corner points in the corner point set is greater than a preset threshold; The determination unit is used to determine the calibration plate area based on the position information of each corner point in the corner point set in the target image frame.
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 7 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 7 are implemented.
