Linear array camera image correction method and device, electronic equipment and storage medium
The position of the detection frame is obtained by using the train component detection model in the online array camera image correction, which solves the problem that stains affect the accuracy of image correction, improves the accuracy of image correction, and ensures the safe operation of the train.
Patent Information
- Application Number
- CN202410787911.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-06-18
- Publication Date
- 2024-11-01
- Estimated Expiration
- Not applicable · inactive patent
AI Technical Summary
Images acquired by linear array cameras during train operation are prone to failure or error in feature extraction due to stains, which reduces the accuracy of image correction.
By inputting the template image and the line array camera image to be corrected into the train component detection model, the detection frame position of the preset train component is obtained, and image correction is performed based on these positions, and the preset train component whose surface area is larger than the preset area is used as the characteristic characterization. Improve the accuracy of the detection frame and the accuracy of image correction.
It effectively improves the accuracy of image correction, reduces feature extraction failure problems caused by stains, ensures the accuracy and reliability of images, and supports safe operation of trains and fault prevention.
Smart Images

Figure CN118887141A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of image processing technology, and in particular to a method, device, electronic equipment and storage medium for correcting a line array camera image. Background Art
[0002] With the rapid development of train technology, linear scan cameras are increasingly used in the field of train safety monitoring. Linear scan cameras can capture high-speed dynamic images during train operation, providing important visual information for train safety operation and fault prevention. However, due to the complex and changeable train operating environment, the images obtained by linear scan cameras often have problems such as distortion, which seriously affects the image quality. Therefore, it is particularly important to calibrate the images of linear scan cameras for trains.
[0003] In related technologies, such as Figure 1 As shown, the SIFT algorithm is used to perform feature detection on the image to be corrected and the template image respectively, to obtain feature points of the image to be corrected and the template image, to match the feature points of the image to be corrected with the feature points of the template image, to obtain at least one matched feature point pair, to delete the erroneous matching points in at least one feature point pair, to calculate the transformation matrix based on multiple sets of accurately matched feature point pairs, to perform coordinate mapping based on the transformation matrix, and to achieve correction of the image to be corrected.
[0004] However, stains are easily generated during the operation of trains. When feature detection is performed on the image to be corrected including stains based on the Scale-Invariant Feature Transform (SIFT) algorithm, the stains may cause feature extraction failure or feature extraction errors, thereby reducing the accuracy of image correction. Summary of the invention
[0005] The present invention provides a method, device, electronic equipment and storage medium for correcting a line array camera image, so as to solve the defect of reducing the accuracy of image correction in the prior art.
[0006] The present invention provides a method for correcting a line array camera image, comprising: Acquire the linear array camera image to be corrected of the train; Inputting the template image and the line array camera image to be calibrated into a train component detection model, obtaining a first detection frame of at least one first preset train component in the template image output by the train component detection model, and a second detection frame of at least one first preset train component in the line array camera image to be calibrated; the first preset train component includes a component having a surface area greater than a preset area; The line array camera image to be corrected is corrected based on the position of each first detection frame and the corresponding position of the second detection frame.
[0007] According to a method for correcting a line array camera image provided by the present invention, the step of obtaining a line array camera image of a train to be corrected comprises: Acquire an initial line array camera image to be calibrated of the train collected during the running of the train, and acquire the real size of the train; the real size includes the height and length of the train; Determining a length-to-height ratio of the train based on the vehicle height and the vehicle length; Based on the aspect ratio, the initial line array camera image to be calibrated is scaled to obtain the line array camera image to be calibrated.
[0008] According to a method for correcting a linear array camera image provided by the present invention, the real size also includes a first size of each of the first preset train components and a second size between two second preset train components in the length direction of the train; The step of scaling the initial line array camera image to be calibrated based on the aspect ratio to obtain the line array camera image to be calibrated includes: Based on the aspect ratio, scaling the initial line array camera image to be calibrated to obtain a scaled line array camera image to be calibrated; The scaled line array camera image to be calibrated is adjusted based on the first size and the second size to obtain the line array camera image to be calibrated.
[0009] According to a method for correcting a line array camera image provided by the present invention, the method of adjusting the scaled line array camera image to be corrected based on the first size and the second size to obtain the line array camera image to be corrected includes: determining a first ratio of a length dimension or a radial dimension in the first size to the vehicle length, and a second ratio of the second dimension to the vehicle length; Determine a third ratio of a height dimension or a radial dimension in the first dimension to the vehicle height; The scaled line array camera image to be calibrated is adjusted based on the first ratio, the second ratio, and the third ratio respectively to obtain the line array camera image to be calibrated.
[0010] According to a method for correcting a line array camera image provided by the present invention, the method further includes: Acquire an initial template image of the train captured when the train is in a stationary state; The initial template image is adjusted based on the actual size of the train to obtain the template image.
[0011] According to a method for correcting a line array camera image provided by the present invention, the method corrects the line array camera image to be corrected based on the position of each first detection frame and the corresponding position of the second detection frame, including: For each of the first detection frames, determining a feature point pair of the first detection frame and the corresponding second detection frame based on a position of the first detection frame and a position of the corresponding second detection frame; Based on each of the feature point pairs, determining a transformation matrix; The line array camera image to be corrected is corrected based on the transformation matrix.
[0012] The present invention also provides a linear array camera image correction device, comprising: A first acquisition unit is used to acquire a linear array camera image of the train to be calibrated; a detection unit, configured to input a template image and the line array camera image to be calibrated into a train component detection model, and obtain a first detection frame of at least one first preset train component in the template image output by the train component detection model, and a second detection frame of at least one first preset train component in the line array camera image to be calibrated; the first preset train component includes a component having a surface area greater than a preset area; A correction unit is used to correct the line array camera image to be corrected based on the position of each first detection frame and the corresponding position of the second detection frame.
[0013] The present invention also provides an electronic device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the program, the method for correcting the image of a linear array camera as described above is implemented.
[0014] The present invention also provides a non-transitory computer-readable storage medium having a computer program stored thereon, and when the computer program is executed by a processor, the method for correcting a line array camera image as described in any one of the above is implemented.
[0015] The present invention also provides a computer program product, comprising a computer program, wherein when the computer program is executed by a processor, the computer program implements any of the above-mentioned methods for correcting a line array camera image.
[0016] The method, device, electronic device and storage medium for correcting a linear array camera image provided by the present invention input a template image and a linear array camera image to be corrected of a train into a train component detection model, obtain a first detection frame of at least one first preset train component in the template image output by the train component detection model, and a second detection frame of at least one first preset train component in the linear array camera image to be corrected, and the first preset train component includes a component with a surface area greater than a preset area, and the linear array camera image to be corrected is corrected based on the position of each first detection frame and the position of the corresponding second detection frame. It can be seen that the present invention uses the position of the detection frame corresponding to the preset train component with a surface area greater than the preset area as a feature representation, and when there is stain on the preset train component, due to the large surface area of the preset train component, the accuracy of the detection of the preset train component detection frame can be improved, and the accuracy of image correction is further improved. BRIEF DESCRIPTION OF THE DRAWINGS
[0017] In order to more clearly illustrate the technical solutions in the present invention or the prior art, the following briefly introduces the drawings required for use in the embodiments or the description of the prior art. Obviously, the drawings described below are some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0018] Figure 1 It is a schematic diagram of image correction of a line array camera in the related art.
[0019] Figure 2 This is one of the flow charts of the method for correcting a line array camera image provided by an embodiment of the present invention.
[0020] Figure 3 This is a second flow chart of the method for correcting a line array camera image provided in an embodiment of the present invention.
[0021] Figure 4 This is the third flow chart of the method for correcting a line array camera image provided by an embodiment of the present invention.
[0022] Figure 5 It is a schematic diagram of the structure of a linear array camera image correction device provided by an embodiment of the present invention.
[0023] Figure 6 It is a schematic diagram of the physical structure of the electronic device provided by the present invention. DETAILED DESCRIPTION
[0024] In order to make the purpose, technical solution and advantages of the present invention clearer, the technical solution of the present invention will be clearly and completely described below in conjunction with the drawings of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0025] For the detection of abnormalities in the appearance of train bodies, the most basic requirement is to obtain high-definition images of the appearance of the body. Currently, linear array cameras are commonly used to collect images of the appearance of trains. The working principle of the linear array camera is: one line of image is obtained each time it is exposed, and the line frequency output by the controller triggers the linear array camera to expose. The linear array camera continuously obtains train images, and then stitches the lines of images together to obtain the image of the object moving relative to the linear array camera. For objects such as trains that are in motion and have a large length, the same number of truncation signals will be given according to the number of train formations. In this way, the amount of data obtained from the linear array camera image is what the current computer can process. At the same time, each image generated can be bound to the train car number, which is also the basic condition for locating train faults manually or by computer. In theory, when the line frequency of the linear array camera matches the speed of the train, a clear, non-deformed image can be obtained. However, in engineering applications, errors in the measurement of the train's speed and the delay in the triggering of the linear array camera will cause the image to be stretched or compressed after stitching. Therefore, the correction of the linear array camera image for the train is particularly important.
[0026] Combine the following Figure 2-Figure 4 The present invention describes a method for correcting a line array camera image. The execution subject of the method for correcting a line array camera image may be an electronic device such as a terminal, a computer or a server, or may be a correction device for a line array camera image arranged in the electronic device. The correction device for a line array camera image may be implemented by software, hardware or a combination of the two.
[0027] Figure 2 FIG. 1 is a flow chart of a method for correcting a line array camera image provided by an embodiment of the present invention. Figure 2 As shown, the method for correcting the image of the line array camera includes the following steps: Step 201: Acquire a line array camera image of a train to be calibrated.
[0028] For example, the line array camera images acquired during the running of the train may be determined as the line array camera images to be corrected of the train.
[0029] Step 202: Input the template image and the line array camera image to be calibrated into a train component detection model to obtain a first detection frame of at least one first preset train component in the template image output by the train component detection model, and a second detection frame of at least one first preset train component in the line array camera image to be calibrated; the first preset train component includes a component having a surface area greater than a preset area.
[0030] The template image may be an undistorted image obtained by photographing the train, and the first preset train component may be a component with a larger surface area such as a wheelset, a window, a bearing cover or a silk-screen area.
[0031] For example, a train component detection model is pre-trained, and when a template image and a linear array camera image to be calibrated are obtained, both the template image and the linear array camera image to be calibrated are input into the train component detection model, and the first preset train components in the template image and the linear array camera image to be calibrated are respectively detected by the train component detection model to obtain a first detection frame of each first preset train component in the template image and a second detection frame of each first preset train component in the linear array camera image to be calibrated.
[0032] It should be noted that, in practical applications, the more the number of first preset train components, the better, so as to ensure that the number of feature extractions meets the image correction and improve the accuracy of image correction. In addition, pre-setting the first preset train components can eliminate the inaccuracy and randomness of detection frame extraction.
[0033] It should be noted that the specific training process of the train component detection model is as follows: obtain a sample linear array camera image, input the sample linear array camera image into the initial train component detection model, obtain the prediction frame of the sample train component in the sample linear array camera image output by the initial train component detection model, construct a loss function based on the prediction frame of the sample train component and the label frame of the sample train component, adjust the model parameters of the initial train component detection model based on the loss function until the convergence condition is reached, and finally obtain the train component detection model. Among them, the specific structure of the initial train component detection model can be a deep neural network (Deep Neural Networks, DNN) or a convolutional neural network (Convolutional Neural Network, CNN), etc., and the present invention does not limit this.
[0034] Step 203: Correct the line array camera image to be corrected based on the position of each first detection frame and the corresponding position of the second detection frame.
[0035] For example, when obtaining the first detection frame of each first preset train component in the template image and the second detection frame of each first preset train component in the line array camera image to be corrected, the four vertex coordinates and the center coordinate of the first detection frame are used as feature representations of the first preset train component in the template image, and the four vertex coordinates and the center coordinates of the second detection frame are used as feature representations of the first preset train component in the line array camera image to be corrected, and the line array camera image to be corrected is corrected based on the four vertex coordinates and the center coordinates of each first detection frame and the four vertex coordinates and the center coordinates of the corresponding second detection frame.
[0036] It should be noted that the main purpose of correcting the train's line array camera image to be corrected into a template image is to eliminate image distortion and ensure the accuracy and reliability of the image. This is crucial for the subsequent analysis, processing and application of the image. Through the corrected line array camera image, various parts of the train, such as the bogie, brake beam, middle part and coupler, can be more accurately identified, thereby helping to promptly discover and deal with possible faults or hidden dangers and ensure the safe operation of the train.
[0037] The method for correcting a linear array camera image provided by the present invention inputs a template image and a linear array camera image to be corrected of a train into a train component detection model, obtains a first detection frame of at least one first preset train component in the template image output by the train component detection model, and a second detection frame of at least one first preset train component in the linear array camera image to be corrected, and the first preset train component includes a component with a surface area greater than a preset area, and the linear array camera image to be corrected is corrected based on the position of each first detection frame and the position of the corresponding second detection frame. It can be seen that the present invention uses the position of the detection frame corresponding to the preset train component with a surface area greater than the preset area as a feature representation, and when there is stain on the preset train component, due to the large surface area of the preset train component, the accuracy of the detection of the preset train component detection frame can be improved, and the accuracy of image correction is further improved.
[0038] In one embodiment, Figure 3 FIG. 2 is a flow chart of a method for correcting a line array camera image provided by an embodiment of the present invention. Figure 3 As shown, the above step 201 obtains the linear array camera image to be calibrated of the train, which can be specifically implemented by the following steps: Step 2011, obtain the initial linear array camera image to be calibrated of the train collected during the operation of the train, and obtain the real size of the train; the real size includes the height and length of the train.
[0039] For example, a train image acquisition system is built using a linear array camera. Linear array cameras are usually set up on both sides of the track. The train appearance image is collected by the linear array camera during the train operation. The train appearance image is used as the linear array camera image. A speed radar is placed at the far end of the track to obtain the instantaneous speed of the train through the speed radar. An industrial computer is placed next to the track to calculate the camera line frequency and intercept the initial linear array camera image to be corrected of the train. The actual size of the train is obtained through the train design data, which includes the height and length of the actual train.
[0040] Step 2012: Determine the length-to-height ratio of the train based on the vehicle height and the vehicle length.
[0041] For example, when the vehicle length and vehicle height of a physical train are obtained, the ratio of the vehicle length to the vehicle height is calculated to obtain the length-to-height ratio of the physical train.
[0042] Step 2013: scaling the initial line array camera image to be calibrated based on the aspect ratio to obtain the line array camera image to be calibrated.
[0043] For example, when the aspect ratio of the actual train is obtained, the initial line array camera image to be calibrated is scaled according to the aspect ratio of the actual train, so that the aspect ratio of the obtained line array camera image to be calibrated is the same as that of the actual train.
[0044] In this embodiment, the initial linear array camera image to be corrected is scaled based on the length-to-height ratio of the train to obtain the linear array camera image to be corrected, thereby achieving a rough adjustment of the initial linear array camera image to be corrected, thereby reducing the degree of deformation of the first preset train component in the initial linear array camera image to be corrected, thereby improving the accuracy of subsequent detection of the detection frame of the first preset train component in the linear array camera image to be corrected, and further improving the accuracy of image correction. That is, this embodiment solves the problem of failure of feature extraction caused by large deformation of the linear array camera image by combining the real image of the train with the real train.
[0045] In one embodiment, the actual size further includes a first size of each of the first preset train components and a second size between two second preset train components in the length direction of the train; Figure 4 FIG. 3 is a flow chart of a method for correcting a line array camera image provided by an embodiment of the present invention. Figure 4 As shown, the above step 2013 scales the initial line array camera image to be calibrated based on the aspect ratio to obtain the line array camera image to be calibrated, which can be specifically achieved through the following steps: Step 20131, scales the initial line array camera image to be calibrated based on the aspect ratio to obtain the scaled line array camera image to be calibrated.
[0046] For example, when the aspect ratio of the actual train is obtained, the initial line array camera image to be calibrated is scaled according to the aspect ratio of the actual train, so that the aspect ratio of the scaled line array camera image to be calibrated is the same as that of the actual train.
[0047] Step 20132: Based on the first size and the second size, adjust the scaled line array camera image to be calibrated to obtain the line array camera image to be calibrated.
[0048] Among them, the second preset train component can be the front axle of the train, the rear axle of the train, the front axle of the bogie and the rear axle of the bogie, etc. The horizontal distance between the center lines of the front axle of the train and the rear axle of the train is the second dimension, also called the full wheelbase; the horizontal distance between the center lines of the front axle of the bogie and the rear axle of the bogie is the second dimension, also called the fixed wheelbase; that is, the second dimension can be at least one of the full wheelbase and the fixed wheelbase.
[0049] For example, taking the example that the first preset train component includes a wheelset and a window, and the second size between two second preset train components includes a full wheelbase and a fixed wheelbase, the first size includes the size of the window and the size of the wheelset, the size of the window includes the window length and the window height, and the size of the wheelset includes the wheel diameter. The aspect ratio of the window can be determined based on the window length and the window height, and the size of the corresponding window in the scaled linear array camera image to be corrected is scaled based on the aspect ratio of the window to obtain a first linear array camera image to be corrected, and then the wheel diameter of the corresponding wheelset in the first linear array camera image to be corrected is scaled based on the wheel diameter to obtain a second linear array camera image to be corrected, and then the full wheelbase in the second linear array camera image to be corrected is scaled based on the full wheelbase to obtain a third linear array camera image to be corrected, and then the fixed wheelbase in the third linear array camera image to be corrected is scaled based on the fixed wheelbase to obtain a linear array camera image to be corrected.
[0050] It should be noted that the present invention does not limit the order of scaling based on the aspect ratio of the vehicle window, the wheel diameter, the full wheelbase and the fixed wheelbase, and the above is only an exemplary description.
[0051] It should be noted that the second size between the two second preset train components may also be the distance between two other components of the train, which is not limited in the present invention.
[0052] In this embodiment, the scaled line array camera image to be corrected obtained after the rough adjustment can be locally fine-adjusted again based on the first size and the second size, thereby further reducing the degree of deformation of the scaled line array camera image to be corrected, improving the accuracy of subsequent detection of the first preset train component detection frame in the line array camera image to be corrected, and further improving the accuracy of image correction.
[0053] In one embodiment, the above-mentioned step 20132 adjusts the scaled line array camera image to be calibrated based on the first size and the second size to obtain the line array camera image to be calibrated, which can be specifically achieved in the following manner: determining a first ratio of a length dimension or a radial dimension in the first size to the vehicle length, and a second ratio of the second size to the vehicle length; determining a third ratio of a height dimension or a radial dimension in the first size to the vehicle height; and adjusting the scaled line array camera image to be calibrated based on the first ratio, the second ratio and the third ratio respectively to obtain the line array camera image to be calibrated.
[0054] For example, taking the example that the first preset train component includes a wheelset and a window, and the second size between two second preset train components includes a full wheelbase and a fixed wheelbase, the first size includes the size of the window and the size of the wheelset, the size of the window includes the window length and the window height, the size of the wheelset includes the wheel diameter, and the wheel diameter is the radial size. A first ratio 1 of the wheel diameter to the vehicle length, a first ratio 2 of the window length to the vehicle length, a second ratio 1 of the full wheelbase to the vehicle length, a second ratio 2 of the fixed wheelbase to the vehicle length, a third ratio 1 of the window height to the vehicle height, and a third ratio 2 of the wheel diameter to the vehicle height are calculated. Based on the first ratio 1, the ratio of the wheel diameter to the vehicle length in the scaled linear array camera image to be corrected is adjusted to obtain the linear array camera image to be corrected 1, and then Based on the first ratio 2, the ratio of the window length to the vehicle length in the linear array camera image 1 to be corrected is adjusted to obtain the linear array camera image 2 to be corrected. Based on the second ratio 1, the ratio of the full wheelbase to the vehicle length in the linear array camera image 2 to be corrected is adjusted to obtain the linear array camera image 3 to be corrected. Based on the second ratio 2, the ratio of the fixed wheelbase to the vehicle length in the linear array camera image 2 to be corrected is adjusted to obtain the linear array camera image 4 to be corrected. Based on the third ratio 1, the ratio of the window height to the vehicle height in the linear array camera image 4 to be corrected is adjusted to obtain the linear array camera image 5 to be corrected. Based on the third ratio 2, the ratio of the wheel diameter to the vehicle height in the linear array camera image 5 to be corrected is adjusted to finally obtain the linear array camera image to be corrected.
[0055] It should be noted that the present invention does not limit the order of adjusting the image based on the first ratio 1, the first ratio 2, the second ratio 1, the second ratio 2, the third ratio 1 and the third ratio 2, and the above is only an exemplary description.
[0056] In this embodiment, a first ratio of the length dimension or radial dimension in the first dimension to the vehicle length, and a second ratio of the second dimension to the vehicle length are determined, and a third ratio of the height dimension or radial dimension in the first dimension to the vehicle height is determined, and the scaled line array camera image to be corrected is adjusted based on the first ratio, the second ratio, and the third ratio, respectively, to further reduce the degree of deformation of the line array camera image to be corrected, so that the image correction is more accurate.
[0057] In one embodiment, before step 202, the method for correcting the linear array camera image further includes the following steps: acquiring an initial template image of the train captured when the train is in a stationary state; and adjusting the initial template image based on the actual size of the train to obtain the template image.
[0058] For example, when the train is stationary, a linear array camera can be used to capture an appearance image of the train, and the captured appearance image of the train is used as an initial template image. Considering that there is a certain gap between the overall size of the train and the sizes of various train components in the directly captured initial template image and the sizes of various train components of the actual train, the initial template image needs to be adjusted based on the actual size of the train so that the sizes of various components in the obtained template image are the same as the sizes of corresponding components of the actual train.
[0059] In this embodiment, when the initial template image is collected, the initial template image is adjusted based on the actual size of the train, so that the size of each component in the obtained template image is the same as the size of the corresponding component of the actual train, thereby improving the accuracy of the template image.
[0060] In one embodiment, the above step 203 corrects the line array camera image to be corrected based on the position of each first detection frame and the corresponding position of the second detection frame, which can be specifically implemented by the following steps: For each of the first detection frames, based on the position of the first detection frame and the corresponding position of the second detection frame, determine a feature point pair of the first detection frame and the corresponding second detection frame; based on each of the feature point pairs, determine a transformation matrix; based on the transformation matrix, correct the line array camera image to be corrected.
[0061] For example, when obtaining the first detection frame of each first preset train component in the template image and the second detection frame of each first preset train component in the line array camera image to be corrected, the four vertex coordinates and the center coordinates of the first detection frame are used as feature representations of the first preset train component in the template image, and the four vertex coordinates and the center coordinates of the second detection frame are used as feature representations of the first preset train component in the line array camera image to be corrected. For each first detection frame, the four vertex coordinates and the center coordinates of the first detection frame are used as first feature points, and for each second detection frame, the four vertex coordinates and the center coordinates of the second detection frame are used as second feature points. A correspondence between feature points is established through a feature descriptor matching algorithm. Since feature point matching may produce some erroneous matching pairs, it is necessary to filter out these erroneous matching points through a random sample consensus algorithm (RANSAC) and the like to retain the correct feature point pairs. Then, the correct feature point pairs after screening are used to calculate the transformation matrix through mathematical methods such as least squares method or singular value decomposition (SVD). The transformation matrix can be a homography Homographies matrix, which describes the transformation relationship from the linear array camera image to be corrected to the template image. The calculated Homographies matrix is used to transform each pixel point in the linear array camera image to be corrected, and the corresponding position of the linear array camera image to be corrected in the template image coordinate system is obtained. The blank area in the transformed image is filled by the interpolation method, and finally the corrected linear array camera image is obtained. Among them, the feature descriptor matching algorithm includes the Fast Library for Approximate Nearest Neighbors (FLANN) or the Brute-force matcher (BFMatcher).
[0062] In this embodiment, based on the position of the first detection frame and the position of the corresponding second detection frame, feature point pairs of the first detection frame and the corresponding second detection frame are determined, and a transformation matrix is determined based on each feature point pair; the line array camera image to be corrected is corrected based on the transformation matrix, so that the corrected line array camera image is close to the template image, thereby improving the accuracy of image correction.
[0063] The following is a description of the correction device for line array camera images provided by the present invention. The correction device for line array camera images described below and the correction method for line array camera images described above can be referred to each other.
[0064] Figure 5 is a schematic diagram of the structure of a linear array camera image correction device provided by an embodiment of the present invention, such as Figure 5As shown, the linear array camera image correction device 500 includes a first acquisition unit 501, a detection unit 502 and a correction unit 503; wherein: A first acquisition unit 501 is used to acquire a linear array camera image of a train to be calibrated; The detection unit 502 is used to input the template image and the line array camera image to be calibrated into a train component detection model to obtain a first detection frame of at least one first preset train component in the template image output by the train component detection model, and a second detection frame of at least one first preset train component in the line array camera image to be calibrated; the first preset train component includes a component having a surface area greater than a preset area; The correction unit 503 is configured to correct the line array camera image to be corrected based on the position of each of the first detection frames and the corresponding position of the second detection frame.
[0065] The linear array camera image correction device provided by the present invention inputs the template image and the linear array camera image to be corrected of the train into the train component detection model, obtains a first detection frame of at least one first preset train component in the template image output by the train component detection model, and a second detection frame of at least one first preset train component in the linear array camera image to be corrected, and the first preset train component includes a component with a surface area greater than a preset area, and the linear array camera image to be corrected is corrected based on the position of each first detection frame and the position of the corresponding second detection frame. It can be seen that the present invention uses the position of the detection frame corresponding to the preset train component with a surface area greater than the preset area as a feature representation, and when there is stain on the preset train component, due to the large surface area of the preset train component, the accuracy of the detection of the preset train component detection frame can be improved, and the accuracy of image correction is further improved.
[0066] Based on any of the foregoing embodiments, the first acquiring unit 501 is specifically configured to: Acquire an initial line array camera image to be calibrated of the train collected during the running of the train, and acquire the real size of the train; the real size includes the height and length of the train; Determining a length-to-height ratio of the train based on the vehicle height and the vehicle length; Based on the aspect ratio, the initial line array camera image to be calibrated is scaled to obtain the line array camera image to be calibrated.
[0067] Based on any of the above embodiments, the real size also includes a first size of each of the first preset train components and a second size between two second preset train components in the length direction of the train; the first acquisition unit 501 is further specifically used to: scale the initial line array camera image to be calibrated based on the aspect ratio to obtain a scaled line array camera image to be calibrated; The scaled line array camera image to be calibrated is adjusted based on the first size and the second size to obtain the line array camera image to be calibrated.
[0068] Based on any of the foregoing embodiments, the first acquiring unit 501 is further specifically configured to: determining a first ratio of a length dimension or a radial dimension of the first dimension to the vehicle length, and a second ratio of the second dimension to the vehicle length; Determine a third ratio of a height dimension or a radial dimension in the first dimension to the vehicle height; The scaled line array camera image to be calibrated is adjusted based on the first ratio, the second ratio, and the third ratio respectively to obtain the line array camera image to be calibrated.
[0069] Based on any of the above embodiments, the linear array camera image correction device 500 further includes: A second acquisition unit, used for acquiring an initial template image of the train collected when the train is in a stationary state; An adjustment unit is used to adjust the initial template image based on the actual size of the train to obtain the template image.
[0070] Based on any of the above embodiments, the correction unit 503 is specifically used for: For each of the first detection frames, determining a feature point pair of the first detection frame and the corresponding second detection frame based on a position of the first detection frame and a position of the corresponding second detection frame; Based on each of the feature point pairs, determining a transformation matrix; The line array camera image to be corrected is corrected based on the transformation matrix.
[0071] Figure 6 is a schematic diagram of the physical structure of an electronic device provided by an embodiment of the present invention, such as Figure 6 As shown, the electronic device may include: a processor 610, a communications interface 620, a memory 630 and a communication bus 640, wherein the processor 610, the communications interface 620 and the memory 630 communicate with each other via the communication bus 640. The processor 610 may call the logic instructions in the memory 630 to execute the method for correcting the linear array camera image, the method comprising: obtaining the linear array camera image to be corrected of the train; Inputting the template image and the line array camera image to be calibrated into a train component detection model, obtaining a first detection frame of at least one first preset train component in the template image output by the train component detection model, and a second detection frame of at least one first preset train component in the line array camera image to be calibrated; the first preset train component includes a component having a surface area greater than a preset area; The line array camera image to be corrected is corrected based on the position of each first detection frame and the corresponding position of the second detection frame.
[0072] In addition, the logic instructions in the above-mentioned memory 630 can be implemented in the form of a software functional unit and can be stored in a computer-readable storage medium when it is sold or used as an independent product. Based on such an understanding, the technical solution of the present invention, in essence, or the part that contributes to the prior art or the part of the technical solution, can be embodied in the form of a software product, and the computer software product is stored in a storage medium, including a number of instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present invention. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), disk or optical disk and other media that can store program codes.
[0073] On the other hand, the present invention further provides a computer program product, the computer program product includes a computer program, the computer program can be stored in a non-transitory computer-readable storage medium, when the computer program is executed by a processor, the computer can execute the linear array camera image correction method provided by the above methods, the method includes: obtaining a linear array camera image to be corrected of a train; Inputting the template image and the line array camera image to be calibrated into a train component detection model, obtaining a first detection frame of at least one first preset train component in the template image output by the train component detection model, and a second detection frame of at least one first preset train component in the line array camera image to be calibrated; the first preset train component includes a component having a surface area greater than a preset area; The line array camera image to be corrected is corrected based on the position of each first detection frame and the corresponding position of the second detection frame.
[0074] In another aspect, the present invention further provides a non-transitory computer-readable storage medium having a computer program stored thereon, and when the computer program is executed by a processor, the method for correcting the linear array camera image provided by the above methods is implemented, and the method comprises: obtaining a linear array camera image to be corrected of a train; Inputting the template image and the line array camera image to be calibrated into a train component detection model, obtaining a first detection frame of at least one first preset train component in the template image output by the train component detection model, and a second detection frame of at least one first preset train component in the line array camera image to be calibrated; the first preset train component includes a component having a surface area greater than a preset area; The line array camera image to be corrected is corrected based on the position of each first detection frame and the corresponding position of the second detection frame.
[0075] The device embodiments described above are merely illustrative, wherein the units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place, or they may be distributed on multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the scheme of this embodiment. Ordinary technicians in this field can understand and implement it without paying creative labor.
[0076] Through the description of the above implementation methods, those skilled in the art can clearly understand that each implementation method can be implemented by means of software plus a necessary general hardware platform, and of course, it can also be implemented by hardware. Based on this understanding, the above technical solution is essentially or the part that contributes to the prior art can be embodied in the form of a software product, and the computer software product can be stored in a computer-readable storage medium, such as ROM / RAM, a disk, an optical disk, etc., including a number of instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to execute the methods described in each embodiment or some parts of the embodiments.
[0077] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit it. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present invention.
Claims
1. A method for correcting a line array camera image, characterized in that: include: Acquire the linear array camera image to be corrected of the train; Inputting the template image and the line array camera image to be calibrated into a train component detection model, obtaining a first detection frame of at least one first preset train component in the template image output by the train component detection model, and a second detection frame of at least one first preset train component in the line array camera image to be calibrated; The first predetermined train component includes a component having a surface area greater than a predetermined area; The line array camera image to be corrected is corrected based on the position of each first detection frame and the corresponding position of the second detection frame.
2. The method for correcting a line array camera image according to claim 1, characterized in that: The step of obtaining the line array camera image to be corrected of the train comprises: Acquire an initial line array camera image to be calibrated of the train collected during the running of the train, and acquire the real size of the train; the real size includes the height and length of the train; Determining a length-to-height ratio of the train based on the vehicle height and the vehicle length; Based on the aspect ratio, the initial line array camera image to be calibrated is scaled to obtain the line array camera image to be calibrated.
3. The method for correcting a line array camera image according to claim 2, characterized in that: The actual size also includes a first size of each of the first preset train components and a second size between two second preset train components in the length direction of the train; The step of scaling the initial line array camera image to be calibrated based on the aspect ratio to obtain the line array camera image to be calibrated includes: Based on the aspect ratio, scaling the initial line array camera image to be calibrated to obtain a scaled line array camera image to be calibrated; The scaled line array camera image to be calibrated is adjusted based on the first size and the second size to obtain the line array camera image to be calibrated.
4. The method for correcting a line array camera image according to claim 3, characterized in that: The step of adjusting the scaled line array camera image to be calibrated based on the first size and the second size to obtain the line array camera image to be calibrated includes: determining a first ratio of a length dimension or a radial dimension of the first dimension to the vehicle length, and a second ratio of the second dimension to the vehicle length; Determine a third ratio of a height dimension or a radial dimension in the first dimension to the vehicle height; The scaled line array camera image to be calibrated is adjusted based on the first ratio, the second ratio, and the third ratio respectively to obtain the line array camera image to be calibrated.
5. The method for correcting a line array camera image according to claim 1, characterized in that: The method further comprises: Acquire an initial template image of the train captured when the train is in a stationary state; The initial template image is adjusted based on the actual size of the train to obtain the template image.
6. The method for correcting a line array camera image according to any one of claims 1 to 5, characterized in that: The correcting the line array camera image to be corrected based on the position of each of the first detection frames and the corresponding position of the second detection frame comprises: For each of the first detection frames, determining a feature point pair of the first detection frame and the corresponding second detection frame based on a position of the first detection frame and a position of the corresponding second detection frame; Based on each of the feature point pairs, determining a transformation matrix; The line array camera image to be corrected is corrected based on the transformation matrix.
7. A linear array camera image correction device, characterized in that: include: A first acquisition unit is used to acquire a linear array camera image of the train to be calibrated; a detection unit, configured to input a template image and the line array camera image to be calibrated into a train component detection model, and obtain a first detection frame of at least one first preset train component in the template image output by the train component detection model, and a second detection frame of at least one first preset train component in the line array camera image to be calibrated; The first predetermined train component includes a component having a surface area greater than a predetermined area; A correction unit is used to correct the line array camera image to be corrected based on the position of each first detection frame and the corresponding position of the second detection frame.
8. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the program, the method for correcting the line array camera image according to any one of claims 1 to 6 is implemented.
9. A non-transitory computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the method for correcting a line array camera image according to any one of claims 1 to 6 is implemented.
10. A computer program product, comprising a computer program, characterized in that When the computer program is executed by a processor, the method for correcting a line array camera image according to any one of claims 1 to 6 is implemented.
Citation Information
Patent Citations
Target detection method and device for image distortion correction of linear array camera of rail train
CN112801110A
Urban rail vehicle linear array camera image correction method and system and storage medium
CN113780309A
Train linear array image distortion correction method and electronic equipment
CN113808049A
Wheel tread splicing method based on multiple linear array cameras
CN114708179A
Vehicle-mounted top view image generation method and device and computer readable storage medium
CN117522745A
