Method and system for constructing plane model of train carriage
Through three-dimensional matching of multiple sets of image sets and camera parameter calculation, the efficiency and accuracy problems of train car length measurement are solved, and a high-precision train car plane model is generated, suitable for railway transportation management and safety monitoring.
Patent Information
- Application Number
- CN202510456793.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-04-12
- Publication Date
- 2025-07-11
AI Technical Summary
The prior art is inefficient in obtaining the length of train cars, is susceptible to human factors, and is difficult to achieve accurate proportional modeling, especially when generating train simulation plan based on length proportions, the degree of automation and measurement accuracy are insufficient.
By obtaining multiple sets of image sets of trains entering the station, the target images containing the left and right edges of the carriage are filtered out for stereo matching, the parallax value is calculated, and combined with camera parameters and carriage edge position information, appropriate calculation formulas are selected to calculate the carriage length, and a train plane image with carriage texture is generated.
It realizes accurate calculation of train car length and high-precision construction of floor plans, improves the degree of automation of measurement and data accuracy, and meets the needs of modern railway systems for data accuracy and proportional modeling.
Smart Images

Figure CN120298532A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the technical field of plane model generation, and particularly to a method and system for constructing a plane model of a train carriage. Background Art
[0002] The construction of a plane model of a train carriage is of great significance in the fields of railway transportation management, dispatching optimization, and safety monitoring. With the improvement of railway transportation efficiency and the increasing demand for intelligence, the industry's need for efficiently and accurately obtaining the geometric information of train carriages is becoming increasingly urgent. Although traditional technical means such as manual measurement or simple image processing technology can meet basic needs, they can no longer meet the requirements of modern railway systems for data accuracy and automation. Especially when it is necessary to generate a train simulation floor plan based on length ratios, the existing technologies are particularly insufficient.
[0003] Currently, the following several methods are mainly used in the industry to obtain the length of a train carriage: One is to directly measure the actual size of the carriage with manual measuring tools. Although it is simple and intuitive, it is inefficient and easily affected by human factors; the second is to use a single camera to take a side image of the carriage and estimate the length in combination with known camera parameters, but the perspective limitation is large and it is difficult to capture the complete contour; the third is to calculate the length of the carriage after obtaining three-dimensional point cloud data based on lidar scanning. Although the accuracy is high, the equipment cost is high and the operation is complex. These methods all rely on single or limited technical means and fail to effectively integrate multiple groups of image data to achieve more accurate length measurement and proportional modeling.
[0004] The above methods have obvious limitations in practical applications. Especially when it is necessary to quickly and accurately obtain the specific length of each carriage and generate a train simulation floor plan with accurate proportions based on this, the existing technologies are insufficient in terms of automation degree, measurement accuracy, and proportional modeling ability. Therefore, there is an urgent need for a technical solution that can efficiently process multiple groups of image data, accurately calculate the carriage length, and at the same time generate a train simulation floor plan with accurate proportions to make up for the defects of the existing technologies. Summary of the Invention
[0005] The purpose of this application is to overcome the above technical problems and provide a method and system for constructing a plane model of a train carriage, which can efficiently process multiple groups of image data, accurately calculate the carriage length, and at the same time generate a train simulation floor plan with accurate proportions.
[0006] First aspect, an embodiment of the present application discloses a method for constructing a plane model of a train carriage, adopting the following solution: A method for constructing a plane model of a train carriage, characterized by comprising: obtaining image information of a train entering a station, the image information including multiple sets of image sets for each carriage, each set of image sets including multiple images and corresponding image shooting times, and the multiple images being taken by different cameras respectively; screening out two target images containing the left and right edges of the carriage from each set of image sets, and performing stereo matching on the two target images to calculate a disparity value, the disparity value being a pixel difference; based on the disparity value, camera focal length, camera baseline distance, distance from the camera perpendicular to the carriage, and positions of the carriage entry / exit edges in the two target images, selecting a target formula for calculating the carriage length, and calculating the length of each carriage; associating the multiple sets of image sets with each carriage and the length of each carriage, and inputting them into a simulation model for simulation processing to output a train plane image with carriage texture.
[0007] By adopting the above technical solution, it is possible to accurately calculate the length of the train carriage and generate a train plane image with carriage texture. The specific effects are as follows: By obtaining multiple sets of image sets and screening out target images containing the left and right edges of the carriage for stereo matching to calculate the disparity value, the accuracy of carriage edge detection is improved, thereby providing a reliable data basis for subsequent carriage length calculation. Selecting a suitable calculation formula based on the disparity value, camera parameters, and carriage edge positions ensures the accuracy of carriage length calculation and meets the requirements for measuring carriage lengths in different scenarios. Associating the image information with the calculated carriage length and inputting it into the simulation model to generate a plane image with carriage texture realizes the visualization of the train carriage model, facilitating further analysis and application.
[0008] Optionally, the determining the calculation formula for the carriage length based on the disparity value, camera focal length, camera baseline distance, distance from the camera perpendicular to the carriage, and positions of the carriage entry / exit edges in the two target images, and calculating the length of each carriage includes: based on the disparity value, the camera focal length, the camera baseline distance, and the distance from the camera perpendicular to the carriage, obtaining the distances from two target cameras perpendicular to the carriage points to the two edges of the carriage, where the cameras close to the two ends of the carriage are taken as the two target cameras; based on the distances from the two target cameras perpendicular to the carriage points to the two edges of the carriage and the positions of the carriage entry / exit edges relative to the two target cameras, determining the calculation formula for the carriage length to calculate the length of each carriage.
[0009] By adopting the above technical solution, the accurate calculation of the length of the train carbody can be achieved. The specific effects are as follows: By obtaining the distances from the points where two target cameras are perpendicular to the carbody to the two edges of the carbody based on the parallax value, the camera focal length, the camera baseline distance, and the distance from the camera perpendicular to the carbody, the accuracy of distance measurement is improved, providing reliable basic data for the subsequent calculation of the carbody length. By combining the distances from the points where two target cameras are perpendicular to the carbody to the two edges of the carbody and the positions of the entrance / exit edges of the carbody relative to the two target cameras, a suitable calculation formula is selected to calculate the carbody length, ensuring the adaptability and accuracy of the carbody length calculation in different scenarios.
[0010] Optionally, the obtaining of the distances from the points where two target cameras are perpendicular to the carbody to the two edges of the carbody based on the parallax value, the camera focal length, the camera baseline distance, and the distance from the camera perpendicular to the carbody includes: calculating the depth value through a first calculation formula based on the parallax value, the camera focal length, and the camera baseline distance; calculating and obtaining the distances from the points where two target cameras are perpendicular to the carbody to the two edges of the carbody through a second calculation formula based on the depth value and the distance from the camera perpendicular to the carbody.
[0011] By adopting the above technical solution, the depth value can be calculated based on the parallax value, the camera focal length, and the camera baseline distance, and the distances from the points where two target cameras are perpendicular to the carbody to the two edges of the carbody can be further calculated in combination with the distance from the camera perpendicular to the carbody. This solution realizes the accurate measurement of the distances of the carbody edges, provides reliable data support for the accurate calculation of the subsequent carbody length, and improves the accuracy and reliability of constructing the plane model of the train carbody.
[0012] Optionally, based on the distances from the two target cameras perpendicular to the carriage point to the two edges of the carriage, and the positions of the carriage entry / exit edges relative to the two target cameras, select a target formula for calculating the carriage length and calculate the length of each carriage, including: among the two target cameras, take the camera that first captures the entry edge of the target carriage as the first target camera, and take the camera that captures the exit edge of the target carriage as the second target camera, where the target carriage is any carriage in the train; when the entry edge of the target carriage is on the right side of the first target camera and the exit edge of the target carriage is on the left side of the camera, select the first target formula to calculate the length of each carriage; when the entry edge of the target carriage is on the right side of the first target camera and the exit edge of the target carriage is on the right side of the camera, select the second target formula to calculate the length of each carriage; when the entry edge of the target carriage is on the left side of the first target camera and the exit edge of the target carriage is on the left side of the camera, select the third target formula to calculate the length of each carriage; when the entry edge of the target carriage is on the left side of the first target camera and the exit edge of the target carriage is on the right side of the camera, select the fourth target formula to calculate the length of each carriage.
[0013] By adopting the above technical solution, it is possible to accurately select a formula suitable for calculating the carriage length according to the positional relationship of the carriage edges captured by different cameras. The specific effects are as follows: by defining the first target camera and the second target camera, the shooting positions of the carriage entry and exit edges are clarified, improving the accuracy of the carriage length calculation. Specific formulas are selected for different positional relationships (right - left, right - right, left - left, left - right) respectively, covering all possible combinations of carriage edge positions, ensuring the comprehensiveness and adaptability of the calculation method. This solution effectively avoids calculation errors caused by the camera position or the carriage movement direction, improving the accuracy and reliability of the carriage length measurement.
[0014] Optionally, the first target formula is: L = a + b + c; the second target formula is: L = a - b + c; the third target formula is: L = -a + b + c; the fourth target formula is: L = -a - b + c; where L is the carriage length; a is the distance from the point where the first target camera is perpendicular to the carriage to the adjacent carriage edge; b is the distance from the point where the second target camera is perpendicular to the carriage to the adjacent carriage edge; c is the installation distance between the first target camera and the second target camera.
[0015] By adopting the above technical solution, it is possible to accurately select the corresponding calculation formula according to different situations of the carriage edge positions, so as to accurately calculate the length of each carriage. The specific effects are as follows: By clarifying the specific expression forms of the first target formula, the second target formula, the third target formula, and the fourth target formula, it provides a quantitative basis for calculating the carriage length in different scenarios and improves the accuracy of the calculation results. The parameters L, a, b, and c in the formula respectively represent the carriage length, the distance from the camera to the carriage edge, and the installation distance between the cameras. These parameters are all derived from actual measurements or calculations, ensuring the reliability of the basic data for formula calculation. For different carriage edge positions (such as different combinations of the entry edge and the exit edge on the left or right side of the camera), a specific target formula is selected for calculation, effectively solving the problem of calculating the carriage length in complex scenarios and enhancing the adaptability and precision of the overall system.
[0016] Optionally, the first calculation formula is: Where Z is the depth value; f is the camera focal length, B is the camera baseline distance, and d is the parallax value.
[0017] By adopting the above technical solution, it is possible to accurately calculate the depth value based on the parallax value, the camera focal length, and the camera baseline distance, thereby providing key parameters for determining the spatial relationship between the camera and the carriage subsequently. This solution improves the accuracy of calculating the carriage length and ensures the accuracy of the finally generated train plane image.
[0018] Optionally, the second calculation formula is: Where A is the distance from the point where the camera is perpendicular to the carriage to the adjacent carriage edge; H is the vertical distance from the camera to the carriage.
[0019] By adopting the above technical solution, it is possible to accurately calculate the distance from the point where the camera is perpendicular to the carriage to the adjacent carriage edge based on the depth value and the vertical distance from the camera to the carriage. This technical means improves the accuracy of calculating the carriage length and ensures the precision of texture mapping when constructing the train carriage plane model subsequently, thereby enhancing the realism and reliability of the overall model.
[0020] Optionally, before screening out two target images containing the left and right edges of the carriage from each group of image sets and performing stereo matching on the two target images to calculate the parallax value, it further includes: detecting whether the shooting time difference of the multiple images in each group of image sets exceeds a preset time. If so, the target group of image sets exceeding the preset time is removed from the multiple groups of image sets.
[0021] By adopting the above technical solution, during the process of constructing the plane model of the train carriage, it is possible to effectively eliminate the image sets with too large shooting time differences, thereby avoiding the influence of image inconsistency caused by time differences on subsequent processing. The specific effects are as follows: improving the quality of the selected target images and ensuring the accuracy of stereo matching. Reducing the errors caused by too large time differences and enhancing the reliability of the disparity value calculation. Optimizing the data input and improving the texture accuracy and authenticity of the train plane images generated by the simulation processing.
[0022] Optionally, based on the disparity value, camera focal length, camera baseline distance, distance between the camera and the carriage vertically, and the positions of the carriage entry / exit edges in the two target images, selecting a target formula for calculating the carriage length and calculating the length of each carriage further includes: calculating multiple length values corresponding to each carriage based on the multiple groups of image sets, and calculating the average value of the multiple length values as the carriage length of each carriage.
[0023] By adopting the above technical solution, it is possible to calculate multiple length values of each carriage based on multiple groups of image sets and obtain a more accurate carriage length through average value calculation. This method effectively reduces the errors that may be caused by single calculation, improves the accuracy and reliability of the carriage length measurement, and thus provides data support for constructing a more realistic plane model of the train carriage.
[0024] In a second aspect, an embodiment of the present application discloses a system for constructing a plane model of a train carriage, adopting the following solution: A system for constructing a plane model of a train carriage includes: an acquisition module for acquiring image information of a train entering the station, where the image information includes multiple groups of image sets for each carriage, and each group of image sets includes multiple images and corresponding image shooting times, and the multiple images are respectively taken by different cameras; a screening and calculation module for screening out two target images containing the left and right edges of the carriage from each group of image sets and performing stereo matching on the two target images to calculate the disparity value, where the disparity value is the pixel difference; a selection module for selecting a target formula for calculating the carriage length based on the disparity value, camera focal length, camera baseline distance, distance between the camera and the carriage vertically, and the positions of the carriage entry / exit edges in the two target images, and calculating the length of each carriage; an input module for associating the multiple groups of image sets with each carriage and the length of each carriage and inputting them into a simulation model for simulation processing to output a train plane image with carriage texture.
[0025] By adopting the above technical solutions, the system can collect multiple sets of image sets when the train enters the station through the acquisition module, ensuring the integrity and diversity of image information; the screening and calculation module screens out target images containing the left and right edges of the carriage from the image sets and performs stereo matching to calculate the disparity value, improving the accuracy of carriage edge recognition; the selection module selects appropriate calculation formulas based on the disparity value, camera parameters, and carriage edge position information to accurately calculate the length of each carriage, thereby improving the accuracy of carriage length measurement; the input module associates the image information with the carriage length and inputs it into the simulation model for processing, and finally outputs a train plane image with carriage texture, realizing the high-precision construction of the train carriage plane model.
[0026] In a third aspect, an embodiment of the present application discloses an electronic device, adopting the following solution: An electronic device includes: a memory and a processor. The memory is used to store a computer program; the processor is used to implement the steps of the method as described in any one of the above when executing the computer program.
[0027] In a fourth aspect, an embodiment of the present application discloses a computer-readable storage medium, adopting the following solution: A computer-readable storage medium has a computer program stored thereon. When the computer program is executed by a processor, it implements the steps of the method as described in any one of the above.
[0028] In summary, the present application includes at least one of the following beneficial technical effects: 1. By calculating the disparity value through multiple sets of image sets and stereo matching technology, and combining camera parameters and carriage edge position information, the length of each carriage can be calculated efficiently and accurately, significantly improving the measurement accuracy and meeting the requirements of modern railway systems for data accuracy; 2. Based on the disparity value, camera focal length, camera baseline distance, and the distance between the camera and the carriage perpendicular to it, multi-step calculation formulas are used to determine the carriage length, effectively overcoming the limitations of single technical means and realizing a higher degree of automation in length measurement; 3. Associating multiple sets of image sets with the calculated carriage length and inputting them into the simulation model to generate a train plane image with carriage texture can meet the requirements of accurate proportional modeling and provide strong support for railway transportation management, dispatching optimization, and safety monitoring. BRIEF DESCRIPTION OF THE DRAWINGS
[0029] Figure 1 is a schematic flowchart of a method for constructing a train carriage plane model disclosed in an embodiment of the present application; Figure 2 is Figure 1 a specific flowchart of step S30 in a method for constructing a train carriage plane model disclosed in Figure 3 In Figure 2 the specific process schematic diagram of step S31 in a method for constructing a plane model of a train carriage disclosed in Figure 4 the schematic diagram of dividing the structure of the carriage floor plan based on shooting in an embodiment of the present application; Figure 5 the schematic diagram of the positions of Z, H, and a in a method for constructing a plane model of a train carriage disclosed in an embodiment of the present application; Figure 6 the schematic diagram of the state of the carriage relative to the camera when selecting the first target formula to calculate the length of each carriage in a method for constructing a plane model of a train carriage disclosed in an embodiment of the present application; Figure 7 the schematic diagram of the state of the carriage relative to the camera when selecting the second target formula to calculate the length of each carriage in a method for constructing a plane model of a train carriage disclosed in an embodiment of the present application; Figure 8 the schematic diagram of the state of the carriage relative to the camera when selecting the third target formula to calculate the length of each carriage in a method for constructing a plane model of a train carriage disclosed in an embodiment of the present application; Figure 9 the schematic diagram of the state of the carriage relative to the camera when selecting the fourth target formula to calculate the length of each carriage in a method for constructing a plane model of a train carriage disclosed in an embodiment of the present application; Figure 10 the process schematic diagram of a system for constructing a plane model of a train carriage disclosed in another embodiment of the present application; Figure 11 the structural schematic diagram of an electronic device disclosed in still another embodiment of the present application. Detailed implementation manners
[0030] The present application will be further described in detail below with reference to the accompanying drawings.
[0031] The embodiments of the present application will be described in more detail below with reference to the drawings. Although the embodiments of the present application are shown in the drawings, it should be understood that the present application can be implemented in various forms and should not be limited by the embodiments set forth herein. On the contrary, these embodiments are provided to make the present application more thorough and complete, and to fully convey the scope of the present application to those skilled in the art.
[0032] The terms used in this application are for the purpose of describing specific embodiments only and are not intended to limit this application. The singular forms "a" and "the" used in this application and the appended claims are also intended to include the plural forms unless the context clearly indicates otherwise. It should also be understood that the term "and / or" as used herein refers to and encompasses any and all possible combinations of one or more of the associated listed items.
[0033] It should be understood that although the terms "first", "second", etc. may be used in this application to describe various information, such information should not be limited to these terms. These terms are only used to distinguish the same type of information from each other. For example, without departing from the scope of this application, the first information may also be referred to as the second information, and similarly, the second information may also be referred to as the first information. Thus, the features defined with "first" and "second" may explicitly or implicitly include one or more of such features. In the description of this application, "a plurality" means two or more unless otherwise specifically defined.
[0034] The technical solutions of the embodiments of this application will be described in detail below with reference to the accompanying drawings.
[0035]
First Embodiment
[0036] It should be noted that before the execution of the method steps, 1 set of magnetic steel is deployed on the railway track of the railway station, located at the position before entering the station. At this time, the train speed is relatively slow, which is convenient for subsequent image acquisition. A binocular camera is deployed outside the railway track where the magnetic steel is located, and a second binocular camera is deployed at the railway track position about one standard short carriage distance behind the magnetic steel, and a third binocular camera is deployed at the railway track position about one standard short carriage distance behind here. The three binocular cameras are in the same optical fiber network, and a synchronization protocol is added to the communication of the cameras in the background system to ensure that the cameras reach a microsecond-level delay when executing the same instruction.
[0037] Specifically, when the train enters the station, the first set of wheels of the train enters the magnet steel area. After the system obtains the magnet steel change signal, it starts three binocular cameras to take high-speed continuous shots. Each shot forms a set of images, which includes: the images of the first, second, and third cameras and the specific time (detailed to milliseconds) when the images are actually taken. Due to the existence of a synchronization protocol, the time difference is about 0.01 milliseconds. If the maximum exceeds 10 milliseconds, problems will occur, and the corresponding set of images will be discarded, that is, it is detected whether the shooting time difference of multiple images in each set of images exceeds the preset time. If so, the target set of images that exceeds the preset time will be excluded from multiple sets of images.
[0038] For example: Image set 1 (Picture 1 - 15:10:47:888; Picture 2 - 15:10:47:888; Picture 2 - 15:10:47:887) with an error of 1 millisecond, is available; Image set 2 (Picture 1 - 15:11:43:858; Picture 2 - 15:11:43:888; Picture 3 - 15:11:43:887) with an error of 30 milliseconds, is not available, and this set of images is discarded; When the number of available image sets reaches the preset array, for example, after 10 sets, the shooting stops, and these are used as multiple sets of images in step S10 for data processing.
[0039] S20. Select two target images containing the left and right edges of the carriage from each set of images, and perform stereo matching on the two target images to calculate the disparity value; Among them, in this step, the images in each set of images are recognized to select two target images containing the left and right edges of the carriage. As Figure 4 shown, select the left and right two images that respectively shoot parts A and C, and perform stereo matching on these two images to calculate the disparity value, that is, the pixel difference.
[0040] Specifically, align the left and right images to the same horizontal line so that the corresponding points are only on the same row (the midpoint of the carriage edge is selected here, and any relatively stable pixel point can also be used). Increase or decrease the abscissa of the pixel points in the left image, find the area with the closest gray value (for example, a pixel area of several by several) in the right image, and then calculate the pixel value of the increase or decrease of the abscissa, which is the disparity value.
[0041] For example: Assume that the left and right images have been aligned and corrected, and select the gray value segment of a certain row (y = 100): Left image row (y = 100): [50, 52, 55, 50, 48, 50, 53,...] (starting from x = 100); Right image row (y = 100): [48, 50, 53, 50, 52, 55, 50,...] (starting from x = 50); The grayscale value of the left image point (100, 100) (100, 100) is 50, and the surrounding window is [50, 52, 55]; Slide the window in the right image and calculate the SAD (Sum of Absolute Differences): When x = 50 in the right image, the window is [48, 50, 53], and SAD = |50 - 48| + |52 - 50| + |55 - 53| = 6; When x = 51 in the right image, the window is [50, 53, 50], and SAD = |50 - 50| + |52 - 53| + |55 - 50| = 6; When x = 52 in the right image, the window is [53, 50, 52], and SAD = 10; ... Best match: x = 50 or x = 51 (SAD is the smallest); Therefore, the disparity d = 100 - 50 = 50 pixels (or d = 49 pixels).
[0042] It should be noted here that for the stereo matching of two target images to calculate the disparity value, the algorithm can refer to the existing related technologies, which are not limited here; S30. Based on the disparity value, camera focal length, camera baseline distance, the distance from the camera to the carriage vertically, and the positions of the carriage entry / exit edges in the two target images, select the target formula for calculating the carriage length and calculate the length of each carriage; Among them, the disparity value is calculated and obtained through the above step S20. The camera focal length and camera baseline distance can be obtained by calibrating the camera, and the distance from the camera to the carriage vertically can be determined during installation and can be used as the known data of the camera here. For the positions of the carriage entry or exit edges in the two target images, reference can be made to Figures 3 to 7 the positions of the carriage captured by the camera in the image of
[0043] Specifically, referring to Figure 2 , step S30 includes: S31. Based on the disparity value, camera focal length, camera baseline distance, and the distance from the camera to the carriage vertically, obtain the distances from the two target cameras perpendicular to the carriage points to the two edges of the carriage; Among them, the cameras close to both ends of the carriage are used as the two target cameras. Referring to Figure 3 , the distances from the two target cameras perpendicular to the carriage points to the two edges of the carriage are a and b.
[0044] Specifically, referring to Figure 3 This step S31 includes: S311. Calculate the depth value based on the disparity value, camera focal length, and camera baseline distance using the first calculation formula; Among them, the first calculation formula is Z is the depth value; f is the camera focal length, B is the camera baseline distance, and d is the disparity value. See Figure 5 , and the position of Z can be referred to.
[0045] S312. Based on the depth value and the distance between the camera and the carriage perpendicular to the carriage, calculate and obtain the distances from the points where the two target cameras are perpendicular to the carriage to the two edges of the carriage using the second calculation formula.
[0046] Among them, the second calculation formula is A(a / b) is the distance from the point where the camera is perpendicular to the carriage to the adjacent edge of the carriage, and H is the vertical distance from the camera to the carriage. See Figure 5 .
[0047] S32. Based on the distances from the points where the two target cameras are perpendicular to the carriage to the two edges of the carriage and the positions of the entry / exit edges of the carriage relative to the two target cameras, determine the calculation formula for the carriage length to calculate the length of each carriage.
[0048] Among them, among the two target cameras, the camera that first captures the entry edge of the target carriage is regarded as the first target camera, and the camera that captures the exit edge of the target carriage is regarded as the second target camera. The target carriage is any carriage in the train.
[0049] Specifically, see Figure 6 , when the entry edge of the target carriage is on the right side of the first target camera and the exit edge of the target carriage is on the left side of the camera, select the first target formula to calculate the length of each carriage; Among them, the first target formula is L = a + b + c, where a is the distance from the point where the first target camera is perpendicular to the carriage to the adjacent edge of the carriage; b is the distance from the point where the second target camera is perpendicular to the carriage to the adjacent edge of the carriage; c is the installation distance between the first target camera and the second target camera.
[0050] See Figure 7 , when the entry edge of the target carriage is on the right side of the first target camera and the exit edge of the target carriage is on the right side of the camera, select the second target formula to calculate the length of each carriage; Among them, the second target formula is L = a - b + c, and a, b, and c are as explained above.
[0051] See Figure 8 , when the entry edge of the target carriage is on the left side of the first target camera and the exit edge of the target carriage is on the left side of the camera, select the third target formula to calculate the length of each carriage; Among them, the third target formula is L = a - b + c, where a, b, and c refer to the corresponding explanations above.
[0052] See Figure 9 , when the entry edge of the target carriage is on the left side of the first target camera and the exit edge of the target carriage is on the right side of the camera, the fourth target formula is selected to calculate the length of each carriage.
[0053] Among them, the fourth target formula is L = a - b + c, where a, b, and c refer to the corresponding explanations above.
[0054] In this way, by selecting specific target formulas for calculation according to different carriage edge positions (such as different combinations of the entry edge and the exit edge on the left or right side of the camera), the problem of calculating the carriage length in complex scenarios can be effectively solved, and then the accuracy of calculating the carriage length can be improved.
[0055] Furthermore, it is worth mentioning that based on the execution of the above steps S10 to S30, multiple length values corresponding to each carriage will be obtained by calculating based on multiple sets of image sets. In this embodiment, the multiple length values are averaged to obtain the carriage length of each carriage. This can effectively reduce the error caused by single calculation, improve the accuracy and reliability of carriage length measurement, and thus provide data support for the execution of step S40, that is, constructing a more realistic train carriage plane model.
[0056] S40. Associate multiple sets of image sets with each carriage and the length of each carriage, and input them into the simulation model for simulation processing to output a train plane image with carriage texture; Among them, this step S40 realizes the visualization of the train carriage model, which is convenient for further analysis and application. The simulation model is used to complement the reliable carriage type, wheel type and number, and the complete carriage image texture, etc. based on the input information, and scale down the length proportionally. Of course, see Figure 4 , the function of this step S40 can also be simply understood as complementing image B based on the captured images A and C, and correspondingly simulating and supplementing the carriage surface texture, wheels, etc. The simulation model can be understood as a pre-trained model. In this step S40, multiple sets of image sets are associated with each carriage and the length of each carriage, and input together - as input data, and output a train plane image with carriage texture - as output data, which can be used as a piece of training data for this simulation model again. The specific training process is not limited here.
[0057] In summary, a method for constructing a plane model of a train carriage disclosed in the first embodiment of the present invention can calculate the disparity value through multiple sets of image sets and stereo matching technology, and combine the camera parameters and the carriage edge position information to efficiently and accurately calculate the length of each carriage, significantly improving the measurement accuracy and meeting the requirements of modern railway systems for data accuracy; based on the disparity value, camera focal length, camera baseline distance, and the distance between the camera and the carriage perpendicular to the carriage, use a multi-step calculation formula to determine the carriage length, effectively overcoming the limitations of a single technical means and achieving a higher degree of automation in length measurement; associate multiple sets of image sets with the calculated carriage length and input them into a simulation model to generate a train plane image with carriage texture, which can meet the requirements of accurate proportional modeling and provide strong support for railway transportation management, dispatching optimization, and safety monitoring.
[0058]
Second Embodiment
[0059] Among them, the acquisition module 210 is used to acquire image information of a train entering the station. The image information includes multiple sets of image sets for each carriage. Each set of image sets includes multiple images and the corresponding image shooting time, and the multiple images are taken by different cameras respectively; the screening and calculation module 220 screens out two target images containing the left and right edges of the carriage from each set of image sets, and performs stereo matching on the two target images to calculate the disparity value, and the disparity value is the pixel difference; the selection module 230 is used to select a target formula for calculating the carriage length based on the disparity value, camera focal length, camera baseline distance, the distance between the camera and the carriage perpendicular to the carriage, and the position of the carriage entry / exit edge in the two target images, and calculate the length of each carriage; the input module 240 is used to associate the multiple sets of image sets with each carriage and the length of each carriage, and input them into a simulation model for simulation processing to output a train plane image with carriage texture.
[0060] It should be noted that the method for constructing a plane model of a train carriage implemented by the system for constructing a plane model of a train carriage disclosed in the second embodiment of the present application is as described in the first embodiment, so it will not be elaborated in detail here. Optionally, each module in this embodiment and the above other operations or functions are respectively used to implement the method in the foregoing embodiment.
[0061]
Third Embodiment
[0062] The technical effect of the electronic device provided in this embodiment in actual application is the same as that of the method for constructing a plane model of a train carriage in the first embodiment.
[0063]
Fourth Embodiment
[0064] In addition, it can be understood that the foregoing embodiments are only exemplary descriptions of the present invention. On the premise that there is no conflict in technical features, no contradiction in structure, and no violation of the invention purpose of the present invention, the technical solutions of the various embodiments can be arbitrarily combined and used in combination.
[0065] In several embodiments provided by the present invention, it should be understood that the disclosed methods, systems, and devices can be implemented in other ways. For example, the modules included in the system described above are only illustrative. The division of modules is only a logical function division. In actual implementation, there may be other division methods. For example, multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the displayed or discussed mutual coupling, direct coupling, or communication connection can be through some interfaces, and the indirect coupling or communication connection of devices or units can be in electrical, mechanical, or other forms.
[0066] The units described as separate components may or may not be physically separated. The components displayed as units may or may not be physical units, that is, they can be located in one place, or they can be distributed to multiple network units. Some or all of the units can be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0067] In addition, in each embodiment of the present invention, each functional unit / module can be integrated into one processing unit / module, or each unit / module can exist physically alone, or two or more units / modules can be integrated into one unit / module. The above-mentioned integrated unit / module can be implemented in the form of hardware, or in the form of hardware plus software functional unit / module.
[0068] The above-mentioned integrated unit / module implemented in the form of software functional unit / module can be stored in a computer-readable storage medium. The above-mentioned software functional unit is stored in a storage medium and includes several instructions for causing one or more processors of a computer device (which can be a personal computer, a server, or a network device, etc.) to execute some steps of the methods described in various embodiments of the present application. The foregoing storage medium includes: various media such as USB flash drives, mobile hard disks, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical discs that can store program codes.
[0069] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention and are not intended to limit them; although the present invention has been described in detail with reference to the foregoing embodiments, those of ordinary skill in the art should understand that they can still modify the technical solutions described in the foregoing embodiments, or perform equivalent replacements for some of the technical features; and these modifications or replacements do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the various embodiments of the present invention.
Claims
1. A method for constructing a plane model of a train carriage, characterized in that, Including: Obtain image information of a train approaching a station. The image information includes multiple sets of image collections for each carriage. Each set of image collections includes multiple images and corresponding image capture times, and the multiple images are captured by different cameras respectively; Screen out two target images containing the left and right edges of the carriage from each set of image collections, and perform stereo matching on the two target images to calculate the disparity value, where the disparity value is the pixel difference; Based on the disparity value, camera focal length, camera baseline distance, distance from the camera perpendicular to the carriage, and the positions of the carriage entrance / exit edges in the two target images, select a target formula for calculating the carriage length and calculate the length of each carriage; Associate the multiple sets of image collections with each carriage and the length of each carriage, and input them into a simulation model for simulation processing to output a planar image of the train with carriage textures.
2. The method according to claim 1, wherein The step of determining the calculation formula for the carriage length based on the disparity value, camera focal length, camera baseline distance, distance from the camera perpendicular to the carriage, and the positions of the carriage entrance / exit edges in the two target images, and calculating the length of each carriage includes: Based on the disparity value, the camera focal length, the camera baseline distance, and the distance from the camera perpendicular to the carriage, obtain the distances from the points where two target cameras are perpendicular to the carriage to the two edges of the carriage, where the cameras close to both ends of the carriage are used as the two target cameras; Based on the distances from the points where the two target cameras are perpendicular to the carriage to the two edges of the carriage and the positions of the carriage entrance / exit edges relative to the two target cameras, determine the calculation formula for the carriage length to calculate the length of each carriage.
3. The method according to claim 2, wherein The step of obtaining the distances from the points where two target cameras are perpendicular to the carriage to the two edges of the carriage based on the disparity value, camera focal length, camera baseline distance, and distance from the camera perpendicular to the carriage includes: calculating the depth value through a first calculation formula based on the disparity value, the camera focal length, and the camera baseline distance; Based on the depth value and the distance from the camera perpendicular to the carriage, calculate through a second calculation formula to obtain the distances from the points where the two target cameras are perpendicular to the carriage to the two edges of the carriage.
4. The method according to claim 2, wherein The step of selecting a target formula for calculating the carriage length based on the distances from the points where the two target cameras are perpendicular to the carriage to the two edges of the carriage and the positions of the carriage entrance / exit edges relative to the two target cameras, and calculating the length of each carriage includes: Among the two target cameras, take the camera that first captures the entrance edge of the target carriage as the first target camera, and take the camera that captures the exit edge of the target carriage as the second target camera, where the target carriage is any carriage in the train; when the entrance edge of the target carriage is on the right side of the first target camera and the exit edge of the target carriage is on the left side of the camera, select the first target formula to calculate the length of each carriage; When the entrance edge of the target carriage is on the right side of the first target camera and the exit edge of the target carriage is on the right side of the camera, select the second target formula to calculate the length of each carriage; When the approaching edge of the target carriage is on the left side of the first target camera and the departing edge of the target carriage is on the left side of the camera, the third target formula is selected to calculate the length of each carriage; When the approaching edge of the target carriage is on the left side of the first target camera and the departing edge of the target carriage is on the right side of the camera, the fourth target formula is selected to calculate the length of each carriage.
5. The method according to claim 4, wherein The first target formula is: L = a + b + c; The second target formula is: L = a - b + c; The third target formula is: L = -a + b + c; The fourth target formula is: L = -a - b + c; wherein, L is the length of the carriage; a is the distance from the point where the first target camera is perpendicular to the carriage to the adjacent carriage edge; b is the distance from the point where the second target camera is perpendicular to the carriage to the adjacent carriage edge; c is the installation distance between the first target camera and the second target camera.
6. The method according to claim 3, wherein The first calculation formula is: wherein, Z is the depth value; f is the camera focal length, B is the camera baseline distance, and d is the parallax value.
7. The method according to claim 6, characterized in that, The second calculation formula is: wherein, A is the distance from the point where the camera is perpendicular to the carriage to the adjacent carriage edge; H is the vertical distance from the camera to the carriage.
8. The method according to claim 1, wherein Before screening out two target images containing the left and right edges of the carriage from each set of image sets and performing stereo matching on the two target images to calculate the parallax value, it further includes: Detecting whether the shooting time difference of the multiple images in each set of image sets exceeds a preset time. If so, the target set of image sets exceeding the preset time is removed from the multiple sets of image sets.
9. The method according to claim 1, wherein The step of selecting a target formula for calculating the carriage length based on the parallax value, camera focal length, camera baseline distance, distance from the camera perpendicular to the carriage, and the position of the carriage approaching / departing edge in the two target images, and calculating the length of each carriage, further includes: Calculating multiple length values corresponding to each carriage based on the multiple sets of image sets, and calculating the average value of the multiple length values as the carriage length of each carriage.
10. A system for constructing a planar model of a train carriage, characterized in that, It includes: An acquisition module, configured to acquire image information of a train approaching a station. The image information includes multiple sets of image sets for each carriage. Each set of image sets includes multiple images and corresponding image shooting times, and the multiple images are respectively taken by different cameras; A screening and calculation module, which screens out two target images containing the left and right edges of the carriage from each set of image sets, and performs stereo matching on the two target images to calculate the parallax value. The parallax value is the pixel difference; A selection module, configured to select a target formula for calculating the carriage length based on the parallax value, camera focal length, camera baseline distance, distance from the camera perpendicular to the carriage, and the position of the carriage approaching / departing edge in the two target images, and calculate the length of each carriage; An input module, configured to associate the multiple sets of image sets with each carriage and the length of each carriage, and input them into a simulation model for simulation processing to output a train plane image with carriage texture.