A method and system for de-shaking and edge calibration of automobile longitudinal beam images
Through the combination of bilinear correction and linear regression model, the jitter problem during the image acquisition process of automobile longitudinal beams is solved, the image debounce and edge calibration are achieved, the detection accuracy and efficiency are improved, and it is suitable for image processing of rigid materials.
Patent Information
- Application Number
- CN202111133378.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-09-27
- Publication Date
- 2024-09-27
- Estimated Expiration
- 2041-09-27
AI Technical Summary
During the punching process of automobile longitudinal beams, due to the severe vibration of the digital punching machine, there is obvious jitter in the sampling process of the image acquisition equipment, which affects the detection accuracy. It is difficult to effectively remove jitter and perform edge calibration with the existing technology, resulting in large detection errors. The efficiency and accuracy are not high.
The bilinear correction method is used, and the adaptive threshold OTSU algorithm is used for binary processing to determine the upper and lower boundary points of the vehicle longitudinal beam image, and the linear regression model is used to fit the boundary, calculate the theoretical position, and perform image debounce and edge calibration. Ensure detection accuracy.
It effectively removes image jitter, improves detection accuracy and efficiency, is suitable for image debounce and edge calibration of most rigid materials, reduces the calculation amount of the algorithm, and is suitable for deployment in low-cost industrial control equipment.
Smart Images

Figure CN114119384B
Abstract
Description
Technical Field
[0001] The present invention belongs to the technical field of computer vision, and in particular relates to a method, system, device and storage medium for rapid de-jittering and edge calibration of an automobile longitudinal beam image. Background Art
[0002] With the gradual promotion of the application of computer vision technology in industrial production, the accuracy of machine recognition has gradually increased and has been gradually used for identification in the process of workpiece processing and quality inspection. In the production of vehicle longitudinal beams, holes are punched at specific positions to reduce the overall weight of the vehicle, enhance the impact resistance of the vehicle body, and facilitate the subsequent installation of workpieces. However, during the production process, the punching machine will be affected by environmental factors and may cause missed punching, multiple punching, or excessive punching deviation, which will seriously affect the safety of the vehicle and the subsequent installation process. If a visual solution is used to identify and detect the punching position of the punched automobile longitudinal beam, the large vibration of the punching machine will also have a great impact on the sampling quality of the image, that is, there will be obvious image jitter marks and edge amplitude phenomena in the sampled image, which further affects the detection accuracy of the subsequent punching position.
[0003] Therefore, the current inspection of automobile longitudinal beam punching mainly relies on manual quality inspection, that is, the production line relies on specific molds or masks to manually inspect the longitudinal beam after punching. This method is not efficient and accurate. Batch sampling and quality inspection methods that rely on visual judgment cannot guarantee accuracy and consume a lot of manpower costs.
[0004] In the inspection process of other production fields, some algorithms in computer vision are used to identify, match and detect specific positions in the image. However, there is currently no such general method in the quality inspection process of automobile longitudinal beams that can be directly applied to the punching position identification and size detection on the line. The main reasons are as follows:
[0005] 1. Affected by the production environment, most automobile longitudinal beam punching operations have great vibrations, which greatly affects the stability of image sampling and the clarity of the image. The detection error range of the punching position and size of most automobile longitudinal beams needs to be controlled within 50mm. If it is an online detection mode, that is, a camera placed at a fixed point behind the digital punching machine is used to sample and detect the automobile longitudinal beam currently being processed. The advantage of this mode is that it ensures that the detection link will not affect the production rhythm. However, the risk is that the vibration amplitude of the punching operation is very large, which often causes the amplitude of the end of the 10m long longitudinal beam to exceed 2cm, which far exceeds the detection error range and has a serious impact on the sampling accuracy. At the same time, it will also cause the sampled longitudinal beam image boundary to shake significantly, further affecting the detection accuracy.
[0006] 2. Most detection and recognition methods have very high requirements for image quality, and require customized image preprocessing processes to provide highly stable test samples for later detection algorithms. For example, in the detection process in other production fields, Hough transform and other detection methods are used for contour recognition. Although such traditional methods are highly efficient, they are often highly sensitive to image quality and prefabricated parameters, and are extremely sensitive to noise points in the image. Although existing deep learning and other methods have proven the accuracy of their algorithms in a large number of experiments, the computational complexity of such algorithms is too large, and the algorithms are difficult to deploy in low-cost industrial control equipment in actual production. Summary of the invention
[0007] In order to solve the problem of severe shaking caused by a digital punching machine during the image acquisition process of a car longitudinal beam, the present invention provides a method, system, device and storage medium for de-shaking and edge calibration of the image of the car longitudinal beam, which can quickly de-shake and perform edge calibration on the collected image of the car longitudinal beam based on a bilinear correction method.
[0008] The present invention is implemented by the following technical solutions:
[0009] A method for de-jittering and edge calibration of a vehicle longitudinal beam image, comprising:
[0010] Acquire an image of a longitudinal beam of a vehicle sampled by a line scan camera;
[0011] The image of the automobile longitudinal beam is binarized by using an adaptive threshold OTSU algorithm to determine all upper and lower boundary points in the image of the automobile longitudinal beam;
[0012] Obtain an upper boundary point training set and a lower boundary point training set according to the upper and lower boundary points, and respectively fit the upper and lower boundaries of the automobile longitudinal beam through a linear regression model;
[0013] Calculating theoretical positions of the upper and lower boundaries of the automobile longitudinal beam according to the fitted upper and lower boundaries of the automobile longitudinal beam to obtain predicted theoretical positions of the upper and lower boundaries of the automobile longitudinal beam;
[0014] Based on the predicted theoretical positions of the upper and lower boundaries of the automobile longitudinal beam, the width of the steel beam in each frame of the image is calculated, and the average value is taken to obtain the average width of the automobile longitudinal beam;
[0015] The steel beam width of the current image frame is transformed into the average width and mapped to the theoretical position to obtain a target image after de-jittering and edge calibration.
[0016] Furthermore, the high-frequency sampling method of the automobile longitudinal beam image includes:
[0017] The horizontal displacement of the longitudinal beam of the automobile is identified by the encoder, and the pulse signal of the translation of the longitudinal beam of the automobile is captured;
[0018] The captured pulse signal is used to trigger the line scan camera to sample the steel beam of the automobile longitudinal beam.
[0019] Furthermore, the method of binarizing the image of the automobile longitudinal beam using an adaptive threshold OTSU algorithm comprises:
[0020] Acquire a vehicle longitudinal beam image to be processed, and circle a region of interest (ROI) from the vehicle longitudinal beam image;
[0021] OTSU is used to perform binary evaluation on the ROI area to obtain the threshold t;
[0022] Applying the obtained threshold value t to the grayscale image of the automobile longitudinal beam image to complete the binarization of the automobile longitudinal beam image and obtain a binary image;
[0023] Among them, in the grayscale image of the automobile longitudinal beam image, pixel points with pixel values greater than the threshold t are regarded as foreground and set to white, and pixel points with pixel values less than the threshold t are regarded as background and set to black, so as to achieve foreground and background separation.
[0024] Furthermore, before the image of the automobile longitudinal beam is binarized using the adaptive threshold OTSU algorithm, the method further includes:
[0025] Grayscale the acquired automobile longitudinal beam image to obtain a grayscale image;
[0026] Gaussian smoothing is performed on the grayscale image of the complete automobile longitudinal beam image to remove noise interference.
[0027] Furthermore, the method for determining all upper and lower boundary points in the automobile longitudinal beam image includes:
[0028] According to the binary image after the smoothing process, the i-th column of image data in the binary image is determined, i={1, ..., w}, where w represents the total number of columns of the image;
[0029] Extract the y-axis coordinate of the initial foreground point and the y-axis coordinate of the end foreground point Get all the upper and lower boundary points of the car longitudinal beam in the picture.
[0030] Further, obtaining the upper boundary point training set and the lower boundary point training set according to the upper and lower boundary points also includes: removing samples of the upper and lower boundary points that deviate too much from the mean point where the corresponding boundary is located, wherein the mean point of the initial foreground point coordinates is The mean point of the end foreground point coordinates is Then, the upper boundary point training set D is obtained according to the upper and lower boundary points. 1 and the lower boundary point training set D 2 .
[0031] Further, the method of fitting the upper and lower boundaries of the automobile longitudinal beam respectively through the linear regression model includes:
[0032] Fitting the upper boundary of the car longitudinal beam:
[0033] Fitting the lower boundary of the car longitudinal beam:
[0034] Among them, x (i) =i, indicating the x-axis coordinate of the i-th column image required for training linear regression.
[0035] Furthermore, according to the fitted upper and lower boundaries of the automobile longitudinal beam, the theoretical positions of the upper and lower boundaries of the automobile longitudinal beam are calculated to obtain the predicted theoretical positions of the upper and lower boundaries of the automobile longitudinal beam, including:
[0036] Through the coordinate position training set D 1 And coordinate position training set D 2 Train two linear regression models to predict the theoretical y-axis coordinate positions of the upper and lower boundaries of the longitudinal beam of the vehicle. and
[0037] Furthermore, based on the coordinate position training set D 1 And coordinate position training set D 2 Train the linear model parameters separately;
[0038] Based on the trained model parameters, the theoretical position of the longitudinal beam boundary is predicted.
[0039] The training line model parameters are obtained by using the theoretical solution of linear regression, and the formula is as follows:
[0040] The upper boundary of the automobile longitudinal beam is:
[0041] Among them, the Contains the slope of the line coef start and the intercept of the line on the y-axis start ,Right now:
[0042]
[0043] The lower boundary of the automobile longitudinal beam is:
[0044] Among them, the Contains the slope of the line coef end and the intercept of the line on the y-axis end ,Right now:
[0045]
[0046] Furthermore, based on the upper boundary of the longitudinal beam of the vehicle and the lower boundary of the vehicle longitudinal beam Calculate the theoretical position of the upper and lower boundaries of the longitudinal beam and The calculation formula is as follows:
[0047]
[0048]
[0049] Furthermore, the average width of the automobile longitudinal beam is:
[0050] For each column in the vehicle longitudinal beam diagram, determine the longitudinal beam width of the current column as:
[0051] The steel beam width of the current image frame is transformed into the average width l avg Previously, the image data between the upper and lower boundary points in the current column in the original automobile longitudinal beam image was extracted. When the width l (i) and the average width l avg If it does not match, the steel beam width l of the current image frame is adjusted by linear interpolation. (i) Transformed into the average width l avg .
[0052] The present invention also includes a vehicle longitudinal beam image de-jittering and edge calibration system, which uses the above-mentioned image de-jittering and edge calibration method to quickly de-jitter the collected vehicle longitudinal beam image and perform edge calibration; the image de-jittering and edge calibration system includes an image acquisition module, a boundary point determination module, a boundary fitting module, a theoretical position prediction module and a jitter frame position mapping module.
[0053] The image acquisition module is used to acquire the image of the automobile longitudinal beam sampled by the line scanning camera; the boundary point determination module is used to perform binarization processing on the image of the automobile longitudinal beam using the adaptive threshold OTSU algorithm to determine all upper and lower boundary points in the image of the automobile longitudinal beam; the boundary fitting module is used to obtain an upper boundary point training set and a lower boundary point training set according to the upper and lower boundary points, and respectively fit the upper and lower boundaries of the automobile longitudinal beam through a linear regression model; the theoretical position prediction module is used to calculate the theoretical positions of the upper and lower boundaries of the automobile longitudinal beam according to the fitted upper and lower boundaries of the automobile longitudinal beam, and obtain the predicted theoretical positions of the upper and lower boundaries of the automobile longitudinal beam; and the jitter frame position mapping module is used to calculate the steel beam width in each frame of the image based on the predicted theoretical positions of the upper and lower boundaries of the automobile longitudinal beam, and take the average value to obtain the average width of the automobile longitudinal beam, transform the steel beam width of the current image frame into the average width, and map it to the theoretical position to obtain the target image after de-jittering and edge calibration.
[0054] The present invention also includes a computer device, including a memory and a processor, wherein the memory stores a computer program, and the processor implements the steps of the image de-shaking and edge calibration method when loading and executing the computer program.
[0055] The present invention also includes a storage medium storing a computer program, wherein the computer program implements the steps of the image de-shaking and edge calibration method when loaded and executed by a processor.
[0056] The technical solution provided by the present invention has the following beneficial effects:
[0057] The image de-jittering and edge calibration method, system, device and storage medium provided by the present invention adopt a linear regression model to accurately predict the theoretical position of the boundary of the automobile longitudinal beam in view of the characteristic that the longitudinal beam is a rigid material, thereby effectively realizing de-jittering and edge calibration; the present invention has certain versatility and is suitable for image de-jittering and edge calibration of most rigid materials. When determining the edge position of the automobile longitudinal beam, a local estimation threshold is adopted, and then applied to the global strategy, which accelerates the operation rhythm of the algorithm; the present invention also proposes a corresponding image and data denoising algorithm to ensure the robustness of the result. BRIEF DESCRIPTION OF THE DRAWINGS
[0058] The accompanying drawings are used to provide a further understanding of the present invention and constitute a part of the specification. Together with the embodiments of the present invention, they are used to explain the present invention and do not constitute a limitation of the present invention. In the accompanying drawings:
[0059] Figure 1 The present invention is a flowchart of a method for de-jittering and edge calibration of a vehicle longitudinal beam image according to an embodiment of the present invention.
[0060] Figure 2The hardware layout diagram of high-frequency sampling in a method for de-jittering and edge calibration of an automobile longitudinal beam image according to an embodiment of the present invention.
[0061] Figure 3 The present invention is a sampling hardware logic interaction diagram in a method for de-jittering and edge calibration of a longitudinal beam image of an automobile according to an embodiment of the present invention.
[0062] Figure 4 The present invention is a flowchart of binarization processing in a method for de-jittering and edge calibration of an automobile longitudinal beam image according to an embodiment of the present invention.
[0063] Figure 5 This is a test image captured by a line scan camera triggered by an encoder in a method for de-jittering and edge calibration of an automobile longitudinal beam image in an embodiment of the present invention.
[0064] Figure 6 This is an output diagram of the result of bilinear correction in a method for de-jittering and edge calibration of an automobile longitudinal beam image according to an embodiment of the present invention.
[0065] Figure 7 This is a result output diagram of a single-side calibration in a method for de-jittering and edge calibration of an automobile longitudinal beam image according to an embodiment of the present invention.
[0066] Figure 8 The system block diagram of a vehicle longitudinal beam image de-jittering and edge calibration system in an embodiment of the present invention. DETAILED DESCRIPTION
[0067] In order to make the purpose, technical solution and advantages of the present invention more clearly understood, the present invention 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 invention and are not used to limit the present invention.
[0068] The present invention provides a method for de-jittering and edge calibration of an automobile longitudinal beam image. Considering the influence of severe jitter caused by a digital punching machine on the sampling process of an image acquisition device, and based on the fact that most automobile longitudinal beams are rigid materials and have a constant width, a high-frequency sampling method is used to acquire an image of the automobile longitudinal beam, thereby ensuring the effectiveness and completeness of the sampling of the automobile longitudinal beam. The collected automobile longitudinal beam image is quickly de-jittered and edge-calibrated using a bilinear correction method. The following description of at least one exemplary embodiment is actually only illustrative and is in no way intended to limit the disclosure of the present invention and its application or use.
[0069] Specifically, the embodiments of the present application are further described below in conjunction with the accompanying drawings.
[0070] like Figure 1As shown, an embodiment of the present invention provides a method for de-jittering and edge calibration of a longitudinal beam image of an automobile, which is used for quickly de-jittering and edge calibration of a longitudinal beam image of an automobile; the method comprises the following steps:
[0071] S1: Get the image of the car longitudinal beam sampled by the line scan camera.
[0072] In this embodiment, the high-frequency sampling method of the automobile longitudinal beam image includes:
[0073] The horizontal displacement of the longitudinal beam of the automobile is identified by the encoder, and the pulse signal of the translation of the longitudinal beam of the automobile is captured;
[0074] The captured pulse signal is used to trigger the line scan camera to sample the steel beam of the automobile longitudinal beam.
[0075] For details, see Figure 2 As shown, the high-frequency sampling method of the automobile longitudinal beam image is implemented based on the following high-frequency sampling device of the automobile longitudinal beam image, and the high-frequency sampling device of the automobile longitudinal beam image includes a first photoelectric sensor 4, a PLC controller 5, a relay 6, an encoder cylinder 7, a first encoder 8, an industrial RGB line scan camera 9, an industrial computer 10, a light source controller 14, a strip light source 15 and an alarm light 16. Figure 3 As shown, the workflow of high-frequency sampling is as follows:
[0076] When the longitudinal beam 1 to be tested is processed by the digital punching machine 2, it is carried by the displacement fixture 3 into the area to be tested, and at this time, the first photoelectric sensor 4 is triggered to transmit an activation signal to the PLC controller 5;
[0077] The PLC controller 5 receives the activation signal transmitted by the first photoelectric sensor 4, controls the encoder cylinder 7 to move forward, and drives the first encoder 8 to move from the preparation position to the sampling position; at the same time, the PLC controller 5 controls the relay 6 to trigger the first encoder 8 to start sampling;
[0078] The PLC controller 5 receives the activation signal transmitted by the first photoelectric sensor 4, and triggers the light source controller 14 to turn on the bar light source 15;
[0079] When the displacement fixture 3 continues to drive the longitudinal beam 1 to be tested forward, the first encoder 8 captures the translation pulse signal of the longitudinal beam 1 to be tested. This pulse signal triggers the industrial RGB line scan camera 9 to perform sampling;
[0080] The industrial RGB line scan camera 9 transmits the samples to the industrial computer 10 for subsequent software algorithm analysis;
[0081] When the displacement fixture 3 continues to drive the longitudinal beam 1 to be tested to move forward, the longitudinal beam 1 to be tested triggers the second photoelectric sensor 11 to transmit an activation signal to the PLC controller 5;
[0082] The PLC controller 5 receives the activation signal transmitted by the second photoelectric sensor 11, controls the encoder cylinder 12 to move forward, and drives the second encoder 13 to move from the preparation position to the sampling position; at the same time, the PLC controller 5 controls the relay 6 to trigger the second encoder 13 to start sampling;
[0083] The PLC controller 5 controls the encoder cylinder 7 to withdraw to the ready position, so that the first encoder 8 is separated from the steel beam 1 to be measured;
[0084] When the displacement fixture 3 continues to drive the longitudinal beam 1 to be tested forward, the second encoder 13 will capture the translation pulse signal of the longitudinal beam 1 to be tested. This pulse signal will continue to trigger the industrial RGB line scan camera 9 to sample;
[0085] The industrial RGB line scan camera 9 transmits the samples to the industrial computer 10 for subsequent software algorithm analysis;
[0086] When the photoelectric sensor 11 captures the signal that the longitudinal beam 1 to be tested has left, the signal is transmitted to the PLC controller 5. At this time, the PLC controller 5 controls the encoder cylinder 12 to withdraw to the ready position, so that the second encoder 13 is separated from the steel beam 1 to be tested;
[0087] The PLC controller 5 controls the light source controller 14 to turn off the bar light source 15;
[0088] The industrial computer 10 receives the complete image signal of the longitudinal beam of the automobile, triggers the built-in image synthesis and visual detection algorithm, and outputs the size detection, punching position and size detection information of the longitudinal beam of the automobile to the user interface. If the algorithm detects an abnormality (abnormal hole position, abnormal steel beam size) beyond the safety range, the industrial computer 10 will sound an alarm and activate the alarm light 16 to flash continuously.
[0089] In this embodiment, a high-speed RGB line scan camera is used in conjunction with multiple sensors to collect images of the vehicle longitudinal beam. This design avoids insufficient sampling time caused by an overly fast longitudinal beam production process, which further causes insufficient image exposure and unclear images.
[0090] S2: Binarization is performed on the image of the automobile longitudinal beam using an adaptive threshold OTSU algorithm to determine all upper and lower boundary points in the image of the automobile longitudinal beam.
[0091] In this embodiment, before the automobile longitudinal beam image is binarized using the adaptive threshold OTSU algorithm, the acquired automobile longitudinal beam image is grayed to obtain a grayscale image, and the complete grayscale image of the automobile longitudinal beam image is Gaussian smoothed to remove noise interference.
[0092] Among them, for Gaussian smoothing, 5x5 Gaussian smoothing is used to process the complete automobile longitudinal beam image. The formula for Gaussian smoothing is as follows:
[0093]
[0094] In the above formula, (x, y) represents the x and y values of all pixels within the blur radius. In the experiment, σ=0.8 is the standard deviation of the normal distribution, and e represents a natural constant.
[0095] In this embodiment, see Figure 4 As shown, the method for binarizing the image of the automobile longitudinal beam using the adaptive threshold OTSU algorithm includes:
[0096] S21, obtaining a to-be-processed automobile longitudinal beam image, and defining a region of interest (ROI) from the automobile longitudinal beam image.
[0097] In this embodiment, the OTSU adaptive threshold algorithm is used to perform a binary evaluation on the ROI area, wherein the region of interest (ROI) for confirming the effective OTSU threshold is selected in accordance with the conventional sampling conditions of the automobile longitudinal beam, avoiding conditions such as obstructions and overexposure of the light source. At the same time, the range of the region should not be too large to affect the algorithm speed, nor too small to affect the accuracy of the evaluation. For example, for a picture of a longitudinal beam of an automobile with a length and width of 100000x4096, the range of the middle 10000 to 20000 columns can be used as the calculation area of the OTSU threshold.
[0098] S22, using OTSU to perform binary evaluation on the ROI area to obtain a threshold t.
[0099] S23, applying the obtained threshold value t to the grayscale image of the automobile longitudinal beam image, completing the binarization of the automobile longitudinal beam image, and obtaining a binary image.
[0100] In this embodiment, after the OTSU adaptive threshold algorithm obtains the threshold t for the region of interest (ROI), this threshold is applied to the entire automobile longitudinal beam image, that is, in the grayscale image of the automobile longitudinal beam image, the pixel points with pixel values greater than the threshold t are regarded as the foreground, and the pixel value is set to 255 white, and the pixel points with pixel values less than the threshold t are regarded as the background, and the pixel value is set to 0 black, so as to achieve foreground and background separation.
[0101] S3: obtaining an upper boundary point training set and a lower boundary point training set according to the upper and lower boundary points, and fitting the upper and lower boundaries of the automobile longitudinal beam respectively through a linear regression model.
[0102] In this embodiment, the method for determining all upper and lower boundary points in the automobile longitudinal beam image includes:
[0103] According to the binary image after the smoothing process, the i-th column of image data in the binary image is determined, i={1, ..., w}, where w represents the total number of columns of the image;
[0104] Extract the y-axis coordinate of the initial foreground point and the y-axis coordinate of the end foreground point Get all the upper and lower boundary points of the car longitudinal beam in the picture.
[0105] Among them, the y-axis coordinate of the initial foreground point and the y-axis coordinate of the end foreground point To find the y-axis coordinate of the first foreground point and the y-axis coordinate of the last foreground point Thus, all upper and lower boundary points of the vehicle longitudinal beam in the image are determined.
[0106] S4: Calculate theoretical positions of the upper and lower boundaries of the automobile longitudinal beam according to the fitted upper and lower boundaries of the automobile longitudinal beam to obtain predicted theoretical positions of the upper and lower boundaries of the automobile longitudinal beam.
[0107] In this embodiment, in order to ensure that the trained linear regression can fit a more accurate automobile longitudinal beam boundary line, when integrating the training samples of the linear regression, it also includes removing the samples of the upper and lower boundary points that deviate too much from the mean point where the corresponding boundary is located. Among them, the mean point of the initial foreground point coordinates is The mean point of the end foreground point coordinates is Then, the upper boundary point training set D is obtained according to the upper and lower boundary points. 1 and the lower boundary point training set D 2 .
[0108] Among them, remove the upper and lower boundary points that deviate too much from the mean point of their corresponding boundaries ( and ) samples. For example, if the error exceeds dis = 50 pixels, we finally get D 1 and D 2 The two training sets are used to train two linear regression models to fit the upper and lower boundaries of the automobile longitudinal beam respectively.
[0109] In this embodiment, the method of fitting the upper and lower boundaries of the automobile longitudinal beam respectively by a linear regression model includes:
[0110] Fitting the upper boundary of the car longitudinal beam:
[0111] Fitting the lower boundary of the car longitudinal beam:
[0112] Among them, x (i) =i, indicating the x-axis coordinate of the i-th column image required for training linear regression.
[0113] S5: Based on the predicted theoretical positions of the upper and lower boundaries of the automobile longitudinal beam, the width of the steel beam in each frame of the image is calculated, and the average value is taken to obtain the average width of the automobile longitudinal beam.
[0114] In this embodiment, according to the fitting of the upper and lower boundaries of the automobile longitudinal beam, the method for calculating the theoretical positions of the upper and lower boundaries of the automobile longitudinal beam and obtaining the predicted theoretical positions of the upper and lower boundaries of the automobile longitudinal beam includes:
[0115] Through the coordinate position training set D 1 And coordinate position training set D 2 Train two linear regression models to predict the theoretical y-axis coordinate positions of the upper and lower boundaries of the longitudinal beam of the vehicle. and
[0116] In an embodiment of the present invention, based on the coordinate position training set D 1 And coordinate position training set D 2 The straight line model parameters are trained respectively; based on the trained model parameters, the theoretical position of the longitudinal beam boundary is predicted.
[0117] Specifically, the training line model parameters are parameter values obtained by using the theoretical solution of linear regression, and the formula is as follows:
[0118] The upper boundary of the automobile longitudinal beam is:
[0119] Among them, the Contains the slope of the line coef start and the intercept of the line on the y-axis start ,Right now:
[0120]
[0121] The lower boundary of the automobile longitudinal beam is:
[0122] Among them, the Contains the slope of the line coef end and the intercept of the line on the y-axis end ,Right now:
[0123]
[0124] In this embodiment, based on the obtained upper boundary of the automobile longitudinal beam and the lower boundary of the vehicle longitudinal beam Calculate the theoretical position of the upper and lower boundaries of the longitudinal beam and The calculation formula is as follows:
[0125]
[0126]
[0127] S6: transforming the steel beam width of the current image frame into the average width, and mapping it to the theoretical position, to obtain a target image after de-jittering and edge calibration.
[0128] In this embodiment, for each frame in the automobile longitudinal beam image, the width of the steel beam in the current column is determined based on the binary image obtained in step S23, and the image data between the upper and lower boundary points in the current column in the original automobile longitudinal beam image is extracted. When the steel beam width does not match the average width, it is transformed to the average width.
[0129] Specifically, the average width of the automobile longitudinal beam is:
[0130] For each column in the vehicle longitudinal beam diagram, determine the longitudinal beam width of the current column as: The steel beam width of the current image frame is transformed into the average width l avg Previously, the image data between the upper and lower boundary points in the current column in the original automobile longitudinal beam image was extracted. When the width l (i) and the average width l avg When the symbol is broken, the steel beam width l of the current image frame is converted to (i) Transformed into the average width l avg .
[0131] Finally, the transformed data is mapped to the theoretical position obtained by the linear regression algorithm, that is, and between.
[0132] The method of the present invention uses a fixed-point encoder and a line scan camera to perform high-frequency sampling to ensure the effectiveness and completeness of the sampling of the automobile longitudinal beam; for the sampled automobile longitudinal beam image, the OTSU adaptive threshold algorithm is used to quickly determine the upper and lower boundaries of the automobile longitudinal beam in the image; for all the coordinate points on the upper and lower boundaries of the longitudinal beam extracted above, the upper and lower boundary lines are fitted respectively by linear regression; using the characteristic that the longitudinal beam is a rigid material, the position of the jitter frame (the width is different from the width of most frames) is confirmed, and the upper and lower ends are aligned with the boundary line fitted by the linear regression, thereby realizing boundary calibration and de-jittering.
[0133] In one embodiment of the present invention, a unilateral calibration method can also be used for boundary calibration and de-jittering, which is the same as the above-mentioned bilinear correction-based method for quickly de-jittering the collected automobile longitudinal beam image and performing edge calibration, that is, using OTSU to confirm the upper boundary and then align the upper boundary.
[0134] To compare the results of the present invention and this alternative, please refer to Figure 5-Figure 7 As shown, Figure 5 This is a test example of the encoder triggering the line scan camera to collect data. Figure 6 The result output of the processing method of quickly de-jittering the collected automobile longitudinal beam image and performing edge calibration based on the bilinear correction method of the present invention; Figure 7 This is a result output diagram of boundary calibration and de-jittering based on the unilateral calibration method of the present invention. Both methods of the present invention can achieve boundary calibration and de-jittering.
[0135] In one embodiment of the present invention, see Figure 8 As shown, the present invention also discloses a vehicle longitudinal beam image de-jittering and edge calibration system, which uses the above-mentioned image de-jittering and edge calibration method to quickly de-jitter the collected vehicle longitudinal beam image and perform edge calibration; the image de-jittering and edge calibration system includes an image acquisition module 100, a boundary point determination module 200, a boundary fitting module 300, a theoretical position prediction module 400 and a jitter frame position mapping module 500.
[0136] The image acquisition module 100 is used to acquire the image of the automobile longitudinal beam sampled by the line scanning camera.
[0137] The boundary point determination module 200 is used to perform binarization processing on the automobile longitudinal beam image by using an adaptive threshold OTSU algorithm to determine all upper and lower boundary points in the automobile longitudinal beam image.
[0138] The boundary fitting module 300 is used to obtain an upper boundary point training set and a lower boundary point training set according to the upper and lower boundary points, and respectively fit the upper and lower boundaries of the automobile longitudinal beam through a linear regression model.
[0139] The theoretical position prediction module 400 is used to calculate the theoretical positions of the upper and lower boundaries of the automobile longitudinal beam according to the fitted upper and lower boundaries of the automobile longitudinal beam, and obtain the predicted theoretical positions of the upper and lower boundaries of the automobile longitudinal beam.
[0140] The jitter frame position mapping module 500 is used to calculate the steel beam width in each frame image based on the predicted theoretical positions of the upper and lower boundaries of the automobile longitudinal beam, and take the average value to obtain the average width of the automobile longitudinal beam, transform the steel beam width of the current image frame into the average width, and map it to the theoretical position to obtain the target image after de-jittering and edge calibration.
[0141] In one embodiment of the present invention, a computer device is provided, including a memory and a processor. The memory stores a computer program, and the processor implements the steps in the above method embodiments when executing the computer program.
[0142] In one embodiment of the present invention, a 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 method embodiments are implemented.
[0143] A person skilled in the art can understand that all or part of the processes in the above-mentioned embodiments can be implemented 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.
[0144] In summary, the technical solution provided by the present invention targets the characteristic that the longitudinal beam is a rigid material, and adopts a linear regression model to accurately predict the theoretical position of the boundary of the automobile longitudinal beam, thereby effectively realizing de-jittering and edge calibration; the present invention has certain versatility and is suitable for image de-jittering and edge calibration of most rigid materials. When determining the edge position of the automobile longitudinal beam, a local estimation threshold is adopted, and then applied to the global strategy, which accelerates the operation rhythm of the algorithm; the present invention also proposes a corresponding image and data denoising algorithm to ensure the robustness of the result.
[0145] The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. Any modifications, equivalent substitutions and improvements made within the spirit and principles of the present invention should be included in the protection scope of the present invention.
Claims
1. A method for de-shaking and edge calibration of a longitudinal beam image of an automobile, comprising: Acquire an image of a longitudinal beam of a vehicle sampled by a line scan camera; The image of the automobile longitudinal beam is binarized by using an adaptive threshold OTSU algorithm to determine all upper and lower boundary points in the image of the automobile longitudinal beam; Obtain an upper boundary point training set and a lower boundary point training set according to the upper and lower boundary points, and respectively fit the upper and lower boundaries of the automobile longitudinal beam through a linear regression model; Calculating theoretical positions of the upper and lower boundaries of the automobile longitudinal beam according to the fitted upper and lower boundaries of the automobile longitudinal beam to obtain predicted theoretical positions of the upper and lower boundaries of the automobile longitudinal beam; Based on the predicted theoretical positions of the upper and lower boundaries of the automobile longitudinal beam, the width of the steel beam in each frame of the image is calculated, and the average value is taken to obtain the average width of the automobile longitudinal beam; The steel beam width of the current image frame is transformed into the average width and mapped to the theoretical position to obtain a target image after de-jittering and edge calibration.
2. The method for de-jittering and edge calibration of a longitudinal beam of an automobile as claimed in claim 1, characterized in that: The method for binarizing the image of the automobile longitudinal beam using an adaptive threshold OTSU algorithm comprises: Grayscale the acquired automobile longitudinal beam image to obtain a grayscale image; Performing Gaussian smoothing on the grayscale image of the complete automobile longitudinal beam image to remove noise interference; Acquire a grayscale image of a smoothed automobile longitudinal beam image, and circle a region of interest (ROI) from the automobile longitudinal beam image; OTSU is used to perform binary evaluation on the ROI area to obtain the threshold t; Applying the obtained threshold value t to the grayscale image of the automobile longitudinal beam image to complete the binarization of the automobile longitudinal beam image and obtain a binary image; Among them, in the grayscale image of the automobile longitudinal beam image, pixel points with pixel values greater than the threshold t are regarded as foreground and set to white, and pixel points with pixel values less than the threshold t are regarded as background and set to black, so as to achieve foreground and background separation.
3. The method for de-jittering and edge calibration of a longitudinal beam of an automobile as claimed in claim 2, characterized in that: The method for determining all upper and lower boundary points in the automobile longitudinal beam image comprises: According to the binary image after the smoothing process, the i-th column of image data in the binary image is determined, i={1, ..., w}, where w represents the total number of columns of the image; Extract the y-axis coordinate of the initial foreground point and the y-axis coordinate of the end foreground point Get all the upper and lower boundary points of the car longitudinal beam in the picture.
4. The method for de-jittering and edge calibration of a longitudinal beam of an automobile as claimed in claim 3, characterized in that: The method of obtaining the upper boundary point training set and the lower boundary point training set according to the upper and lower boundary points also includes: removing samples of the upper and lower boundary points that deviate too much from the mean point where the corresponding boundary is located, wherein the mean point of the initial foreground point coordinates is The mean point of the end foreground point coordinates is Then, the upper boundary point training set D1 and the lower boundary point training set D2 are obtained according to the upper and lower boundary points, namely: Fitting the upper boundary of the car longitudinal beam: Fitting the lower boundary of the car longitudinal beam: Among them, x (i) =i, indicating the x-axis coordinate of the i-th column image required for training linear regression.
5. The method for de-jittering and edge calibration of a longitudinal beam of an automobile as claimed in claim 4, characterized in that: The method of calculating the theoretical positions of the upper and lower boundaries of the automobile longitudinal beam according to the fitted upper and lower boundaries of the automobile longitudinal beam to obtain the predicted theoretical positions of the upper and lower boundaries of the automobile longitudinal beam comprises: Two linear regression models are trained respectively by using the coordinate position training set D1 and the coordinate position training set D2 to predict the theoretical y-axis coordinate positions of the upper and lower boundaries of the longitudinal beam of the automobile. and Among them, the straight line model parameters are trained based on the coordinate position training set D1 and the coordinate position training set D2 respectively; Based on the trained model parameters, the theoretical position of the longitudinal beam boundary is predicted; The training line model parameters are obtained by using the theoretical solution of linear regression, and the formula is as follows: The upper boundary of the automobile longitudinal beam is: Among them, the Contains the slope of the line coef start and the intercept of the line on the y-axis start ,Right now: The lower boundary of the automobile longitudinal beam is: Among them, the Contains the slope of the line coef end and the intercept of the line on the y-axis end ,Right now: Among them, based on the upper boundary of the automobile longitudinal beam and the lower boundary of the vehicle longitudinal beam Calculate the theoretical position of the upper and lower boundaries of the longitudinal beam and The calculation formula is as follows:
6. The method for de-jittering and edge calibration of a longitudinal beam of an automobile as claimed in claim 5, characterized in that: The average width of the automobile longitudinal beam is: For each column in the vehicle longitudinal beam diagram, determine the longitudinal beam width of the current column as: The steel beam width of the current image frame is transformed into the average width l avg Previously, the image data between the upper and lower boundary points in the current column in the original automobile longitudinal beam image was extracted. When the width l (i) and the average width l avg If it does not match, the steel beam width l of the current image frame is adjusted by linear interpolation. (i) Transformed into the average width l avg .
7. A vehicle longitudinal beam image de-jittering and edge calibration system, characterized in that: The image de-shaking and edge calibration system uses the image de-shaking and edge calibration method described in any one of claims 1 to 6 to quickly de-shake the collected automobile longitudinal beam image and perform edge calibration; The image de-shaking and edge calibration system comprises: An image acquisition module, used to obtain the image of the longitudinal beam of the vehicle sampled by the line scan camera; A boundary point determination module, used for performing binarization processing on the automobile longitudinal beam image by using an adaptive threshold OTSU algorithm to determine all upper and lower boundary points in the automobile longitudinal beam image; A boundary fitting module, used for obtaining an upper boundary point training set and a lower boundary point training set according to the upper and lower boundary points, and fitting the upper and lower boundaries of the automobile longitudinal beam respectively through a linear regression model; A theoretical position prediction module, used to calculate the theoretical positions of the upper and lower boundaries of the automobile longitudinal beam according to the fitted upper and lower boundaries of the automobile longitudinal beam, and obtain the predicted theoretical positions of the upper and lower boundaries of the automobile longitudinal beam; and The jitter frame position mapping module is used to calculate the steel beam width in each frame image based on the predicted theoretical positions of the upper and lower boundaries of the automobile longitudinal beam, and take the average value to obtain the average width of the automobile longitudinal beam, transform the steel beam width of the current image frame into the average width, and map it to the theoretical position to obtain the target image after de-jittering and edge calibration.
8. A computer device comprising a memory and a processor, wherein the memory stores a computer program, wherein: When the processor loads and executes the computer program, the steps of the method according to any one of claims 1 to 6 are implemented.
9. A storage medium storing a computer program, characterized in that: When the computer program is loaded and executed by a processor, the steps of the method according to any one of claims 1 to 6 are implemented.
