Method and apparatus for image registration and detection, terminal and storage medium

By preprocessing the train image and segmenting the image stretching and compression processing of the matching sub-region, the problems of image offset, stretching and compression during train operation are solved, and more accurate image registration and detection are achieved.

CN114241019BActive Publication Date: 2025-07-18SUZHOU NEW VISION SCI & TECH
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202111392082.5
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-11-23
Publication Date
2025-07-18
Estimated Expiration
2041-11-23

AI Technical Summary

Technical Problem

During the train operation, due to speed changes and camera vibration, the captured train's external surface images may have problems such as offset, stretching and compression, resulting in inaccurate image registration, affecting the accuracy of fault and damage detection.

Method used

By acquiring the train images and standard images to be processed, pre-processing is performed to ensure the same length and width, a two-dimensional coordinate system is established, multiple sub-regions are divided, and the corresponding sub-regions are matched based on the center point of the sub-regions, image stretching and compression processing is performed, and the pre-trained U-Net neural network is used to segment the front, carriage and rear images to achieve image registration.

Benefits of technology

It improves the accuracy of train external surface faults and damage detection, ensures the accuracy of image registration, and can effectively deal with the offset, stretching and compression problems of images during train operation.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114241019B_ABST
    Figure CN114241019B_ABST
Patent Text Reader

Abstract

The present invention discloses a method and apparatus for image registration and detection, a terminal, and a storage medium. The image registration method includes: obtaining a train image to be processed and a standard image, preprocessing the train image to be processed, segmenting the train image to be processed into a plurality of first sub-regions, corresponding second sub-regions in the standard image, and matching the matching sub-regions corresponding to the first sub-regions from the second sub-regions, and performing image stretching and compression processing on the train image to be processed based on the center points of all the first sub-regions and the center points of the corresponding matching sub-regions. This method can register the train image to be processed based on the standard image.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of train detection, and particularly to a method and device for image registration and detection, a terminal, and a storage medium. Background Art

[0002] During the operation of a train, the train may experience failures, damages, etc. Among them, some failures and damages will cause damage to the outer surface of the train (for example, the outer surfaces on both sides of a stationary train, the outer surface of the roof, the outer surface of the bottom of the train, etc.). Similarly, if certain areas of the outer surface of the train are damaged, it can be determined that corresponding failures, damages, etc. have occurred. Therefore, the original image of the outer surface of the train when it is normal can be prepared in advance. Then, cameras can be installed on the railway track. When the train passes by, the on-site images of the outer surface of the train (for example, images of both sides of the moving train, the image of the roof, the image of the bottom of the train, etc.) are taken. Then, these two on-site images are compared with the original image to detect the train (i.e., detect failures, damages, etc. of the train).

[0003] It can be understood that since the train is in motion, the speed of movement and other factors will also change. In addition, when the train is moving, it may cause the camera to vibrate, resulting in the following problems in the captured images: some areas of the image are offset, stretched, compressed, etc. Therefore, it is necessary to process the captured images to register the on-site image and the original image, thereby improving the accuracy of train detection. Summary of the Invention

[0004] In view of this, the main object of the present invention is to provide a method and device for image registration and detection, a terminal, and a storage medium.

[0005] To achieve one of the above-mentioned invention purposes, an embodiment of the present invention provides a method for image registration of a train, including the following steps: obtaining a train image P' to be processed and a standard image P", both the train image P' to be processed and the standard image P" are side images, roof images or bottom images of the same car body in the same vehicle type, and the car body is the head, tail or carriage; preprocessing the train image P' to be processed so that the train image P' to be processed and the standard image P" have the same length and width; creating a two-dimensional coordinate system (X, Y), in the two-dimensional coordinate system, the coordinates of the upper left corner of the train image P' to be processed and the standard image P" are (0, 0), the left-right direction is the width direction, the up-down direction is the length direction, and in the left-to-right direction, the X value gradually increases, and in the up-to-down direction, the Y value gradually increases; in the train image P' to be processed and the standard image P", the extension direction of the car body is the same, and the extension direction is the direction from the head to the tail; dividing the train image P' to be processed into N successively connected first sub-regions SP1', SP2',..., SP N ', for each first sub-region SP i ', there is a corresponding second sub-region SP i " in the standard image P", and for any pixel (X i , Y i ) in the first sub-region SP i ', there are pixels (X i , AY i ), (X i , BY i ), (LX i , Y i ) and (RX i , Y i ) in the second sub-region SP i ", where AY i ≤Y i ≤BY i , LX i ≤X i ≤RX i , i = 1, 2,..., N; for each first sub-region SP i ', a corresponding matching sub-region is matched from the corresponding second sub-region SP i ", where the center point of the first sub-region SP i ' is (CX i ', CY i '), and the center point of the matching sub-region is (CX i ", CY i "); based on the center points (CX i ') of all the first sub-regions SP i', CY i ) and the center points (CX i ') of the matching sub-regions corresponding to each first sub-region SP i ”, CY i ) of the train image P' to be processed are subjected to image stretching and compression processing.

[0006] As an improvement of the embodiment of the present invention, the preprocessing of the train image P' to be processed specifically includes: obtaining the position information of the axles corresponding to the car body, and performing correction processing on the train image P' to be processed based on the position information of the axles and the standard image P".

[0007] As an improvement of the embodiment of the present invention, the splitting of the train image P' to be processed into N successively connected first sub-regions SP1', SP2',..., SP N ' specifically includes: splitting the train image P' to be processed into N successively connected first sub-regions SP1', SP2',..., SP N ' The upper side of the first sub-region SP i ' is parallel to the upper side of the train image P' to be processed, and the lower side of the first sub-region SP i ' is parallel to the lower side of the train image P' to be processed. The left side of the first sub-region SP i ' is parallel to the left side of the train image P' to be processed and is located inside the left side. The right side of the first sub-region SP i ' is parallel to the right side of the train image P' to be processed and is located inside the left side;

[0008] For the first sub-region SP i ', there is a corresponding second sub-region SP i ” in the standard image P" specifically includes: for the first sub-region SP i ', there is a corresponding second sub-region SP i ” in the standard image P". Among them, the upper side of the second sub-region SP i ” is parallel to the upper side of the standard image P", and the Y value corresponding to the upper side of the second sub-region SP i ” ≤ the Y value corresponding to the upper side of the first sub-region SP i '; the lower side of the second sub-region SP i ” is parallel to the lower side of the standard image P", and the Y value corresponding to the lower side of the second sub-region SP i ” ≥ the Y value corresponding to the lower side of the first sub-region SP i '; the left side of the second sub-region SP i ” is the left side of the standard image P", and the second sub-region SPi The right side of the " is the right side of the standard image P".

[0009] As an improvement of an embodiment of the present invention, for each first sub-region SP i ', a corresponding matching sub-region is matched from the corresponding second sub-region SP i ", wherein the center point of the first sub-region SP i ' is (CX i ', CY i '), and the center point of the matching sub-region is (CX i ", CY i ) specifically includes: for any first sub-region SP i ' and the corresponding second sub-region SP i ", the following processing is performed: all Sum intermediate images are obtained from the second sub-region SP i ", the length of the intermediate image is equal to the length of the first sub-region SP i ', the width is equal to the width of the first sub-region SP i ', the similarity value between the first sub-region SP i ' and each intermediate image is obtained, the target intermediate image corresponding to the maximum similarity is selected, the center point of the first sub-region SP i ' is (CX i ', CY i '), and the center point of the matching sub-region is (CX i ", CY i ) = the center point of the target intermediate image.

[0010] As an improvement of an embodiment of the present invention, obtaining the similarity value between the first sub-region SP i " and each intermediate image specifically includes: for each intermediate image, the following processing is performed: the coordinates of the pixel at the upper left corner of the first sub-region SP i ' are (tsx i , tsy i ), the coordinates of the pixel at the lower right corner are (tex i , tey i ), the coordinates of the pixel at the upper left corner of the intermediate image are (ssx, ssy), and the coordinates of the pixel at the lower right corner are (sex, sey);

[0011] As an improvement of an embodiment of the present invention, performing image stretching and compression processing on the train image P' to be processed based on the center points of all the first sub-regions SP i ' and the center points of the corresponding matching sub-regions specifically includes: when any two different first sub-regions SPi ' and the first sub-region SP j ', the center point of the first sub-region SP i ' is (CX i ', CY i '), the center point of the corresponding matching sub-region is (CX i ”, CY i ”), the center point of the first sub-region SP j ' is (CX j ', CY j '), the center point of the corresponding matching sub-region (CX' j ', CY j ”), satisfying CX i '< CX j ' and CX i ” > CX' j ', delete the center point (CX i ', CY i ') of the first sub-region SP i ', the center point (CX i ”, CY i ”) of the corresponding matching sub-region, and the center point of the first sub-region SP j ' is (CX j ', CY j '), the center point (CX' j ', CY j ”) of the corresponding matching sub-region; then, based on the center points of the remaining first sub-regions and the center points of the corresponding matching sub-regions, perform image stretching and compression processing on the train image P' to be processed.

[0012] As an improvement of the embodiment of the present invention, the image stretching and compression processing of the train image P' to be processed based on the center points (CX i ', CY i ') of all the first sub-regions SP i ' and the center points (CX i ”, CY i ”) of the corresponding matching sub-regions of each first sub-region SP i ' specifically includes: stretching the first sub-region SP i'Sort in ascending order according to the Y - coordinate values to obtain the queue Q. Select the unprocessed first sub - region SP' from the queue Q in the order from the head to the tail of the queue, and perform the following processing on each of them: Perform rigid registration on the first sub - region SP' and the matching sub - region used as a reference to obtain the first deformation information. Use the first deformation information as the initial deformation information, and perform the first non - rigid registration on the first sub - region SP' and the matching sub - region to obtain the second deformation information. Use the second deformation information as the initial deformation information, and perform the second non - rigid registration on the first sub - region SP' and the matching sub - region to obtain the third deformation information. Superimpose the third deformation information on the first sub - region SP' or the matching sub - region to generate a registered image, and replace the first sub - region SP i ' with the registered image; after all the first sub - regions SP' have been processed, replace the train image P' to be processed with the image obtained by splicing all the first sub - regions SP'.

[0013] An embodiment of the present invention also provides an apparatus for image registration of a train, including the following modules:

[0014] An image acquisition module, configured to acquire a train image P' to be processed and a standard image P", where both the train image P' to be processed and the standard image P" are side images, roof images, or bottom images of the same car body in the same vehicle type, and the car body is the head, tail, or carriage;

[0015] A pre - processing module, configured to pre - process the train image P' to be processed so that both the train image P' to be processed and the standard image P" have the same length and width; create a two - dimensional coordinate system (X, Y). In the two - dimensional coordinate system, the coordinates of the upper - left corner of the train image P' to be processed and the standard image P" are (0, 0), the left - right direction is the width direction, the up - down direction is the length direction, and the X value gradually increases in the left - to - right direction, and the Y value gradually increases in the up - to - down direction; in the train image P' to be processed and the standard image P", the extension direction of the car body is the same, and the extension direction is the direction from the head to the tail of the car body;

[0016] An image segmentation module, configured to segment the train image P' to be processed into N successively connected first sub - regions SP1', SP2',..., SP N ', for each first sub - region SP i ', there is a corresponding second sub - region SP i ” in the standard image P", and for any pixel (X i in the first sub - region SP i , Y i ), there is a pixel (X i in the second sub - region SP i , AYi ), (X i , BY i ), (LX i , Y i ), and (RX i , Y i ), where AY i ≤ Y i ≤ BY i , LX i ≤ X i ≤ RX i , i = 1, 2,..., N;

[0017] An image matching module for, for each first sub-region SP i ', matching a corresponding matching sub-region from the corresponding second sub-region SP i ", where the center point of the first sub-region SP i ' is (CX i ', CY i '), and the center point of the matching sub-region is (CX i ", CY i ");

[0018] A processing module for, based on the center points (CX i ', CY i ') of all the first sub-regions SP i ' and the center points (CX i ', CY i ") of the corresponding matching sub-regions of each first sub-region SP i ", performing image stretching and compression processing on the train image P' to be processed.

[0019] An embodiment of the present invention also provides a terminal, the terminal includes a memory and a processor, the memory stores a computer program that can run on the processor, and when the processor executes the program, it implements the steps in the above image registration method.

[0020] An embodiment of the present invention also provides a computer-readable storage medium, on which a computer program is stored, and when the computer program is executed by a processor, it implements the steps in the above image registration method.

[0021] An embodiment of the present invention also provides a detection method for a train, including the following steps:

[0022] Obtain the original full-body image of the train when it is normal, and take the full-body image of the train to be processed, where both the original full-body image and the full-body image to be processed are side images, roof images, or bottom images of the whole train of the train;

[0023] Segment a first front - end image, the first car images car1 of Num adjacent cars, 1 , car2 1 ,..., car Num 1 and a first rear - end image from the to - be - processed full - vehicle image, and segment a second front - end image, the second car images car1 of Num adjacent cars 2 , car2 2 ,..., car Num 2 and a second rear - end image from the original full - vehicle image, where Num is a natural number, car j 1 is closer to the front - end than car k 1 , car j 2 is closer to the front - end than car k 2 , 1 ≤ j < k ≤ Num;

[0024] Process the first front - end image and the second front - end image based on the above - mentioned image registration method, where the train image P' is the first front - end image and the standard image P" is the second front - end image; process car h 1 and car h 2 based on the above - mentioned image registration method, where the train image P' is car h 1 , and the standard image P" is car h 2 , h = 1, 2,..., Num; process the first rear - end image and the second rear - end image based on the above - mentioned image registration method, where the train image P' is the first rear - end image and the standard image P" is the second rear - end image;

[0025] Detect the train based on the first front - end image, the N first car images car1 1 , car2 1 ,..., car Num 1 , the first rear - end image and the original full - vehicle image.

[0026] As an improvement of an embodiment of the present invention, the step of segmenting a first front - end image, the first car images car1 of Num adjacent cars 1 , car2 1 ,..., car Num 1The first front vehicle image and the first rear vehicle image specifically include: performing cumulative histogram processing on the to-be-processed full vehicle image, and then, segmenting out the first front vehicle image, the first car images of Num adjacent carriages car1 1 , car2 1 ,..., car Num 1 and the first rear vehicle image from the to-be-processed full vehicle image; the process of segmenting out the second front vehicle image, the second car images of Num adjacent carriages car1 2 , car2 2 ,..., car Num 2 and the second rear vehicle image from the original full vehicle image specifically includes: performing cumulative histogram processing on the original full vehicle image, and then, segmenting out the second front vehicle image, the second car images of Num adjacent carriages car1 2 , car2 2 ,..., car Num 2 and the second rear vehicle image.

[0027] As an improvement of the embodiment of the present invention, the process of segmenting out the first front vehicle image, the first car images of Num adjacent carriages car1 1 , car2 1 ,..., car Num 1 and the first rear vehicle image from the to-be-processed full vehicle image specifically includes: based on the pre-trained U-Net neural network, segmenting out the first front vehicle image, the first rear vehicle image and Num + 1 vehicle body connection images from the to-be-processed full vehicle image, and then, using the Num + 1 vehicle body connection images to segment out the first car images of Num adjacent carriages car1 1 , car2 1 ,..., car Num 1 ;

[0028] The process of segmenting out the second front vehicle image, the second car images of Num adjacent carriages car1 2 , car2 2 ,..., car Num 2 and the second rear vehicle image from the original full vehicle image specifically includes: based on the U-Net neural network, segmenting out the second front vehicle image, the second rear vehicle image and Num + 1 vehicle body connection images from the original full vehicle image, and then, using the Num + 1 vehicle body connection images to segment out the second car images of Num adjacent carriages car1 2, car2 2 , ..., car Num 2 ;

[0029] During the training process of the U-Net neural network, the Adam optimization method is selected; in the U-Net neural network, the loss function is cross-entropy.

[0030] As an improvement of the embodiment of the present invention, segmenting the first front image, the first rear image and Num + 1 body connection images from the to-be-processed full vehicle image based on the pre-trained U-Net neural network specifically includes: segmenting the first front image, the first rear image and multiple body connection images from the to-be-processed full vehicle image based on the pre-trained U-Net neural network, where the number of the body connection images ≥ Num + 1; arranging the multiple body connection images in descending order of area, and selecting the first Num + 1 body connection images ranked in the front;

[0031] Segmenting the second front image, the second rear image and Num + 1 body connection images from the original full vehicle image based on the U-Net neural network specifically includes: segmenting the second front image, the second rear image and multiple body connection images from the original full vehicle image based on the U-Net neural network, where the number of the body connection images ≥ Num + 1; arranging the multiple body connection images in descending order of area, and selecting the first Num + 1 body connection images ranked in the front.

[0032] The embodiment of the present invention also provides a detection device for a train, including the following modules:

[0033] Full vehicle image acquisition module, configured to acquire the original full vehicle image when the train is normal, and photograph the to-be-processed full vehicle image of the train, where both the original full vehicle image and the to-be-processed full vehicle image are side images, roof images or bottom images of the whole train;

[0034] Image cutting module, configured to segment the first front image, the first car body images car1 of Num adjacent carriages 1 , car2 1 , ..., car Num 1 and the first rear image from the to-be-processed full vehicle image, and segment the second front image, the second car body images car1 of Num adjacent carriages 2 , car2 2 , ..., car Num 2 and the second rear image from the original full vehicle image, where Num is a natural number, carj 1 Compared with car k 1 Close to the front of the car j 2 Compared with car k 2 Close to the front of the car, 1 ≤ j < k ≤ Num;

[0035] A processing module for processing the first front image and the second front image based on the above image registration method, where the train image P' is the first front image and the standard image P" is the second front image; processing car based on the above image registration method h 1 And car h 2 For processing, where the train image P' is car h 1 And the standard image P" is car h 2 , h = 1, 2,..., Num; processing the first rear image and the second rear image based on the above image registration method, where the train image P' is the first rear image and the standard image P" is the second rear image;

[0036] A detection module for detecting the train based on the first front image, N first carriage images car1 1 , car2 1 ,..., car Num 1 And the first rear image and the original full - train image.

[0037] An embodiment of the present invention also provides a terminal, the terminal includes a memory and a processor, the memory stores a computer program that can run on the processor, and when the processor executes the program, it implements the steps in the above detection method.

[0038] An embodiment of the present invention also provides a computer - readable storage medium, on which a computer program is stored, and when the computer program is executed by a processor, it implements the steps in the above detection method.

[0039] Compared with the prior art, the technical effect of the present invention is as follows: The embodiments of the present invention disclose a method and apparatus for image registration and detection, a terminal, and a storage medium. The image registration method includes: obtaining a to-be-processed train image and a standard image, preprocessing the to-be-processed train image, segmenting the to-be-processed train image into multiple first sub-regions, corresponding second sub-regions in the standard image, and matching the matching sub-regions corresponding to the first sub-regions from the second sub-regions, and performing image stretching and compression processing on the to-be-processed train image based on the center points of all the first sub-regions and the center points of the corresponding matching sub-regions; this method can register the to-be-processed train image based on the standard image. Description of the Drawings

[0040] Figure 1 It is a schematic flow chart of the method for image registration provided by the embodiment of the present invention;

[0041] Figure 2 、 Figure 3 、 Figure 4 、 Figure 5 and Figure 6 It is a schematic principle diagram of the method for image registration provided by the embodiment of the present invention;

[0042] Figure 7 It is a structural diagram of the U-Net provided by the embodiment of the present invention. Detailed Embodiments

[0043] The present invention will be described in detail below in conjunction with the embodiments shown in the drawings. However, this embodiment does not limit the present invention, and any structural, method, or functional transformation made by those of ordinary skill in the art based on this embodiment is included in the protection scope of the present invention.

[0044] The following description and the accompanying drawings fully illustrate specific embodiments herein, enabling those skilled in the art to practice them. Parts and features of some embodiments may be included in or substituted for parts and features of other embodiments. The scope of the embodiments herein includes the entire scope of the claims and all available equivalents of the claims. In this document, the terms "first", "second", etc. are only used to distinguish one element from another, without requiring or implying any actual relationship or order between these elements. In fact, the first element can also be called the second element, and vice versa. Moreover, the term "comprising", "including" or any other variant thereof is intended to cover non-exclusive inclusion, such that a structure, device or equipment comprising a series of elements not only includes those elements but also other elements not expressly listed, or also includes elements inherent to such structure, device or equipment. Without further limitation, an element defined by the statement "comprising one..." does not exclude the presence of another identical element in the structure, device or equipment comprising the said element. The various embodiments herein are described in a progressive manner, with each embodiment highlighting the differences from other embodiments. The same or similar parts among the various embodiments can be referred to each other.

[0045] The terms "longitudinal", "lateral", "upper", "lower", "front", "rear", "left", "right", "vertical", "horizontal", "top", "bottom", "inner", "outer", etc. in this document indicate the orientation or positional relationship based on the orientation or positional relationship shown in the drawings, and are only for the convenience of describing this document and simplifying the description, rather than indicating or implying that the device or element referred to must have a specific orientation, be constructed and operated in a specific orientation, and thus should not be construed as a limitation on the present utility model. In the description of this document, unless otherwise specified and defined, the terms "installed", "connected", "coupled" should be understood in a broad sense. For example, it can be a mechanical connection or an electrical connection, or it can be the communication inside two elements. It can be directly connected or indirectly connected through an intermediate medium. For those of ordinary skill in the art, the specific meanings of the above terms can be understood according to specific circumstances.

[0046] Embodiment 1 of the present invention provides a method for image registration for a train, as Figure 1 shown, which includes the following steps:

[0047] Step 101: Obtain the train image P' to be processed and the standard image P". Both the train image P' to be processed and the standard image P" are side images, roof images, or bottom images of the same car body in the same train model. The car body is the locomotive head, the locomotive tail, or a carriage. Here, it can be understood that a train is usually composed of a locomotive head, a locomotive tail, and multiple carriages. The train image P' to be processed and the standard image P" can both be side images of the locomotive head, or both be roof images of the locomotive head, or both be bottom images of the locomotive head. Also, the train image P' to be processed and the standard image P" can both be side images of the locomotive tail, or both be roof images of the locomotive tail, or both be bottom images of the locomotive tail. Also, the train image P' to be processed and the standard image P" can both be side images of the same carriage, or both be roof images of the same carriage, or both be bottom images of the same carriage.

[0048] The train image P' to be processed is taken by a camera during the train's movement. It can be understood that there may be problems such as offset, stretching, or compression in some areas of the train image P' to be processed, while the rest of the areas may not have such problems. The standard image P" is a standard image of the train and does not have such problems.

[0049] The purpose of this image registration method is to register the train image P' to be processed with the standard image P".

[0050] Here, in practice, cameras can be installed on both sides, directly above, or in the middle of the two tracks of the railway, so as to capture side images, roof images, and bottom images of the train. Optionally, the type of the camera is CCD (Charge Coupled Device).

[0051] Step 102: Preprocess the train image P' to be processed so that both the train image P' to be processed and the standard image P" have the same length and width. Create a two-dimensional coordinate system (X, Y). In this two-dimensional coordinate system, the upper left corner coordinates of the train image P' to be processed and the standard image P" are (0, 0). The left-right direction is the width direction, and the up-down direction is the length direction. And in the left-to-right direction, the X value gradually increases, and in the up-to-down direction, the Y value gradually increases. In the train image P' to be processed and the standard image P", the extension direction of the car body is the same, and the extension direction is from the locomotive head towards the locomotive tail. Here, for the convenience of processing, it is necessary to first preprocess the train image P' to be processed and the standard image P", for example, stretch or compress the train image P' to be processed so that the length values and width values of the train image P' to be processed and the standard image P" are equal, and then create a Figure 2For the convenience of processing, the train image P' to be processed may need to be rotated, etc., so that the vehicle body is overlapped in the two images; in addition, in the two images, it is necessary to ensure that the direction from the front of the vehicle to the rear of the vehicle is consistent. For example, in the standard image P", the extension direction is the vector (A, B), then, in the train image P' to be processed, the extension direction is also the vector (A, B).

[0052] Here, the vehicle body has two ends, wherein the first end faces the front of the vehicle and the second end faces the rear of the vehicle, and the direction from the first end to the second end is the extending direction.

[0053] Step 103: Segment the train image P' to be processed into N first sub-regions SP1', SP2', ..., SP N ', for each first sub-region SP i ', in the standard image P" there is a corresponding second sub-area SP i ", and for the first sub-area SP i Any pixel (X i , Y i ), in the second sub-area SP i There are pixels (X i , AY i ), (X i , BY i ), (LX i , Y i ) and (RX i , Y i ), where AY i ≤Y i ≤BY i , LX i ≤X i ≤RX i , i = 1, 2, ..., N; here, for the first sub-region SP i Any pixel (X i , Y i ), in the second sub-area SP i " corresponds to pixels (X i , Y i ), and in the second sub-area SP i ”, pixel (X i , Y i ) has other pixels above, below, left and right, namely, the second sub-area SP i "Including" the first sub-area SP i '.

[0054] Step 104: For each first sub-region SP i ', a corresponding matching sub-region is matched from the corresponding second sub-region SP i ”. Among them, the center point of the first sub-region SP i ' is (CX i , CY i ), and the center point of the matching sub-region is (CX i , CY i );

[0055] Step 105: Based on the center points (CX i , CY i ) of all the first sub-regions SP i ' and the center points (CX i , CY i ) of the corresponding matching sub-regions of each first sub-region SP i ”, the to-be-processed train image P' is subjected to image stretching and compression processing.

[0056] Here, in this image registration method, the to-be-processed train image P' is segmented into several first sub-regions, and each first sub-region corresponds to a second sub-region in the standard image P". Then, a matching sub-region that matches the first sub-region is found from the second sub-region. It can be understood that if there are problems such as offset, stretching, and compression in the to-be-processed train image P', then CX i ' ≠ CX i ” or CY i ' ≠ CY i ”. Therefore, it is necessary to perform image stretching and compression processing on the first sub-region SP i ' so that CX i ' = CX i ”, CY i ' = CY i ”.

[0057] In this embodiment, as Figure 4 shown, the preprocessing of the to-be-processed train image P' specifically includes: obtaining the position information of the axles corresponding to the vehicle body, and based on the position information of the axles and the standard image P", performing correction processing on the to-be-processed train image P'. Here, when the to-be-processed train image P' is a train body image or a side image, the position of the axles can be located, and then based on the position of the axles, correction processing (i.e., preliminary correction) is performed on the to-be-processed train image P'; if it is the roof position, the characteristics of the roof area corresponding to the axles (this roof area is directly above the axles) can be obtained in advance, and then, based on this characteristic, correction processing (i.e., preliminary correction) is performed on the to-be-processed train image P'.

[0058] In this embodiment, as Figure 4 shown, the splitting of the to-be-processed train image P' into N successively connected first sub-regions SP1', SP2',..., SP N ' specifically includes: splitting the to-be-processed train image P' into N successively connected first sub-regions SP1', SP2',..., SP N ' The upper side of the first sub-region SP i ' is parallel to the upper side of the to-be-processed train image P', and the lower side of the first sub-region SP i ' is parallel to the lower side of the to-be-processed train image P'. The left side of the first sub-region SP i ' is parallel to the left side of the to-be-processed train image P' and is located inside the left side. The right side of the first sub-region SP i ' is parallel to the right side of the to-be-processed train image P' and is located inside the left side;

[0059] For the first sub-region SP i ', there is a corresponding second sub-region SP i ” in the standard image P". Specifically includes: for the first sub-region SP i ', there is a corresponding second sub-region SP i ” in the standard image P". Among them, the upper side of the second sub-region SP i ” is parallel to the upper side of the standard image P", and the Y value corresponding to the upper side of the second sub-region SP i ” ≤ the Y value corresponding to the upper side of the first sub-region SP i '; the lower side of the second sub-region SP i ” is parallel to the lower side of the standard image P", and the Y value corresponding to the lower side of the second sub-region SP i ” ≥ the Y value corresponding to the lower side of the first sub-region SP i '; the left side of the second sub-region SP i ” is the left side of the standard image P", and the right side of the second sub-region SP i ” is the right side of the standard image P".

[0060] Here, it can be understood that both the first sub-region SP i ' and the second sub-region SP i ” are square regions; and in practice, for the parts of the to-be-processed train image P' near the left and right sides, it is possible that the photographed part is not the vehicle body. Therefore, the left side of the first sub-region SP i ' is located inside the left side, and the left side of the first sub-region SP iThe right side of 'is located inside the left side, so that these square areas can be effectively avoided.

[0061] Here, it is assumed that the length of the train image P' to be processed and the standard image P" is H, and the width is W. The first sub-region SP i The coordinates of the pixel at the upper left corner of'is (tsx i , tsy i ), and the coordinates of the pixel at the lower right corner are (tex i , tey i ). The coordinates of the pixel at the upper left corner of the corresponding second sub-region SP i ” are (ssx i , ssy i ), and the coordinates of the pixel at the lower right corner are (sex i , sey i ). The specific formula is as follows:

[0062]

[0063] In this embodiment, for each first sub-region SP i ', a corresponding matching sub-region is matched from the corresponding second sub-region SP i ”. Among them, the center point of the first sub-region SP i ' is (CX i ', CY i '), and the center point of the matching sub-region is (CX i ”, CY i ”). Specifically, for any first sub-region SP i ' and the corresponding second sub-region SP i ” are all processed as follows: All Sum intermediate images are obtained from the second sub-region SP i ”. The length of the intermediate image is equal to the length of the first sub-region SP i ', and the width is equal to the width of the first sub-region SP i '. The similarity values between the first sub-region SP i ' and each intermediate image are obtained, and the target intermediate image corresponding to the maximum similarity is selected. The center point of the first sub-region SP i ' is (CX i ', CY i '), and the center point of the matching sub-region is (CX i ”, CY i ”) = the center point of the target intermediate image. Here, the one with the highest similarity is selected from the second sub-region SP i ” as the matching sub-region.

[0064] In this embodiment, the obtaining of the first sub-region SP i " and the similarity values of each intermediate image specifically include:

[0065] For each intermediate image, the following processing is performed: The first sub-region SP i ' The coordinates of the pixel at the upper left corner are (tsx i , tsy i ), and the coordinates of the pixel at the lower right corner are (tex i , tey i ). The coordinates of the pixel at the upper left corner of the intermediate image are (ssx, ssy), and the coordinates of the pixel at the lower right corner are (sex, sey);

[0066]

[0067] In this embodiment, the image stretching and compression processing of the train image P' to be processed based on the center points of all the first sub-regions SP i ' and the center points of the corresponding matching sub-regions specifically includes:

[0068] When any two different first sub-regions SP i ' and the first sub-region SP j ', the center point of the first sub-region SP i ' is (CX i , CY i '), and the center point of the corresponding matching sub-region is (CX i ”, CY i ”). The center point of the first sub-region SP j ' is (CX j , CY j '), and the center point of the corresponding matching sub-region (CX″ j , CY j ”). When CX i '<CX j ' and CX i ”>CX″ j , delete the center point (CX i ', CY i ) of the first sub-region SP i ' and the center point (CX i ”, CY i ) of the corresponding matching sub-region, and the center point of the first sub-region SP j ' is (CX j , CY j ) and the center point of the corresponding matching sub-region (CX″ j , CY j"); After that, based on the center points of the remaining first sub-regions and the center points of the corresponding matching sub-regions, perform image stretching and compression processing on the train image P' to be processed.

[0069] In this embodiment, the based on all the first sub-regions SP i 's center points (CX i ', CY i ') and the center points (CX i ”, CY i ”) of the corresponding matching sub-regions for each first sub-region SP i ', performing image stretching and compression processing on the train image P' to be processed specifically includes: sorting the first sub-regions SP i ' in ascending order of the Y coordinate value to obtain a queue Q, and in the order from the head to the tail of the queue, successively select the unprocessed first sub-regions SP' from the queue Q and perform the following processing on all of them: perform rigid body registration on the first sub-region SP' and the matching sub-region used as a reference to obtain the first deformation information, use the first deformation information as the initial deformation information, perform the first non-rigid body registration on the first sub-region SP' and the matching sub-region to obtain the second deformation information, use the second deformation information as the initial deformation information, perform the second non-rigid body registration on the first sub-region SP' and the matching sub-region to obtain the third deformation information, superimpose the third deformation information on the first sub-region SP' or the matching sub-region to generate a registered image, and replace the first sub-region SP i ' with the registered image; after all the first sub-regions SP' have been processed, replace the train image P' to be processed with the image stitched by all the first sub-regions SP'. Here, when stretching the image, the linear interpolation method can be used to fill the newly added area.

[0070] According to the matching center point pairs, calculate the coordinate mapping relationship between the first sub-region SP' and the matching sub-region by piecewise linear interpolation to generate Xmap and Ymap. Let the width and height of the first sub-region SP' be W and H respectively. Then Xmap is a matrix of size W*2, and Ymap is a matrix of size H*2. The first column of Xmap is the natural number sequence from 1 to W and the abscissa xi of the first sub-region SP', and the second column is the interpolated xi'. Ymap is similar to Xmap. According to this mapping relationship, the first sub-region SP' can be transformed into a corrected image aligned with the standard image, and according to the mapping relationship, the template frame of the standard image P” can be mapped to the image P' to be processed (such as Figure 6 's template area A), as shown in Figure 6 .

[0071] Embodiment 2 of the present invention provides an apparatus for image registration of trains, including the following modules:

[0072] An image acquisition module for acquiring a train image P' to be processed and a standard image P", where both the train image P' to be processed and the standard image P" are side images, roof images or bottom images of the same car body in the same vehicle type, and the car body is the head, tail or carriage;

[0073] A preprocessing module for preprocessing the train image P' to be processed so that both the train image P' to be processed and the standard image P" have the same length and width; creating a two-dimensional coordinate system (X, Y), in which the coordinates of the upper left corner of the train image P' to be processed and the standard image P" are (0,0), the left-right direction is the width direction, the up-down direction is the length direction, and in the direction from left to right, the X value gradually increases, and in the direction from top to bottom, the Y value gradually increases; in the train image P' to be processed and the standard image P", the extension direction of the car body is the same, and the extension direction is the direction from the head towards the tail;

[0074] An image segmentation module for segmenting the train image P' to be processed into N successively connected first sub-regions SP1', SP2',..., SP N ', for each first sub-region SP i ', there is a corresponding second sub-region SP i " in the standard image P", and for any pixel (X i , Y i ) in the first sub-region SP i , there are pixels (X i , AY i ), (X i , BY i ), (LX i , Y i ) and (RX i , Y i ) in the second sub-region SP i ", where AY i ≤ Y i ≤ BY i , LX i ≤ X i ≤ RX i , i = 1, 2,..., N;

[0075] An image matching module for, for each first sub-region SP i ', matching a corresponding matching sub-region from the corresponding second sub-region SP i ", where the center point of the first sub-region SP i ' is (CX i ', CY i '), and the center point of the matching sub-region is (CXi ”, CY i ”);

[0076] A processing module, configured to perform image stretching and compression processing on the train image P' to be processed based on the center points (CX i ', CY i ') of all the first sub-regions SP i ' and the center points (CX i ", CY i ") of the corresponding matching sub-regions of each first sub-region SP i ".

[0077] Embodiment 3 of the present invention provides a terminal, which includes a memory and a processor. The memory stores a computer program that can run on the processor, and when the processor executes the program, it implements the steps in the image registration method in Embodiment 1.

[0078] Embodiment 4 of the present invention provides a computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, it implements the steps in the image registration method in Embodiment 1.

[0079] Embodiment 5 of the present invention provides a detection method for a train, including the following steps:

[0080] Step 401: Obtain the original full-body image of the train when it is normal, and capture the full-body image of the train to be processed. Both the original full-body image and the full-body image to be processed are the side image, roof image, or bottom image of the whole train of the train; here, the original full-body image is the full-body image of the train captured when the train is normal, that is, the full-body image of the train captured when there is no failure or damage; the full-body image to be processed is the full-body image of the train captured by a camera during the running of the train, and the train may have failures, damages, etc.; it can be understood that the "whole train" of the train includes the train head, multiple carriages, and the train tail. In addition, the original full-body image and the full-body image to be processed can both be the side image of the whole train, can both be the roof image, can also be the bottom image at the same time, or can also include the side image, roof image, and bottom image of the whole train of the train at the same time.

[0081] Step 402: Segment a first train head image, the first carriage images car1 1 , car2 1 ,..., car Num 1 of Num adjacent carriages, and a first train tail image from the full-body image to be processed, and segment a second train head image, the second carriage images car1 2 , car22 ,..., car Num 2 and the second rear - end image, where Num is a natural number, car j 1 is closer to the head of the vehicle than car k 1 and is closer to the head of the vehicle, car j 2 is closer to the head of the vehicle than car k 2 and is closer to the head of the vehicle, 1 ≤ j < k ≤ Num; Here, since the original full - vehicle image and the original full - vehicle image are both for the same train, the number of carriages is the same (i.e., Num). It can be understood that if the first head - end image, car1 1 , car2 1 ,..., car Num 1 and the first rear - end image are spliced together in sequence, it is the full - vehicle image to be processed; if the second head - end image, car1 2 , car2 2 ,..., car Num 2 and the second rear - end image are spliced together in sequence, it is the original full - vehicle image.

[0082] Step 403: Process the first head - end image and the second head - end image based on the image registration method in any one of the first embodiments, where the train image P' is the first head - end image and the standard image P" is the second head - end image; Process car h 1 and car h 2 based on the image registration method in the first embodiments, where the train image P' is car h 1 , and the standard image P" is car h 2 , h = 1, 2,..., Num; Process the first rear - end image and the second rear - end image based on the image registration method in the first embodiments, where the train image P' is the first rear - end image and the standard image P" is the second rear - end image;

[0083] Step 404: Detect the train based on the first head - end image, N first - carriage images car1 1 , car2 1 ,..., car Num 1 , the first rear - end image and the original full - vehicle image.

[0084] Here, it can be understood that the original full-vehicle image and the full-vehicle image to be processed may have different sizes, and there may be problems such as offset, stretching, or compression in some areas of the full-vehicle image to be processed; both the original full-vehicle image and the full-vehicle image to be processed contain the entire train, and it may be necessary to rotate one of the images by a certain angle so that the trains in these two images can coincide; during the train's travel, it may be necessary to turn, so that two adjacent carriages are not on the same straight line, that is, the entire train is in a curved shape, etc. In the detection method of this embodiment, the train will be divided into a locomotive, multiple carriages, and a tail car, and then the locomotive images in the original full-vehicle image and the full-vehicle image to be processed will be registered, the corresponding carriage images will be registered, and the tail car images will be registered, so as to facilitate the detection of the train using the original full-vehicle image and the full-vehicle image to be processed.

[0085] In this embodiment, the step of segmenting the first locomotive image, the first carriage images car1 of Num adjacent carriages 1 , car2 1 ,..., car Num 1 and the first tail car image from the full-vehicle image to be processed specifically includes: performing cumulative histogram processing on the full-vehicle image to be processed After that, the first locomotive image, the first carriage images car1 of Num adjacent carriages 1 , car2 1 ,..., car Num 1 and the first tail car image are segmented from the full-vehicle image to be processed;

[0086] The step of segmenting the second locomotive image, the second carriage images car1 of Num adjacent carriages 2 , car2 2 ,..., car Num 2 and the second tail car image from the original full-vehicle image specifically includes: performing cumulative histogram processing on the original full-vehicle image, and after that, the second locomotive image, the second carriage images car1 of Num adjacent carriages 2 , car2 2 ,..., car Num 2 and the second tail car image are segmented from the original full-vehicle image.

[0087] Here, performing cumulative histogram processing on the full-vehicle image to be processed and the original full-vehicle image first, it can be understood that this can greatly improve the contrast of the images.

[0088] The formula corresponding to this cumulative histogram is:

[0089]

[0090] Among them, x can be the gray value of the pixels in the whole vehicle image to be processed. Each x is replaced with x' obtained by processing through the above formula, so that the cumulative histogram processing of the whole vehicle image to be processed is performed. Similarly, x can be the gray value of the pixels in the original whole vehicle image. Each x is replaced with x' obtained by processing through the above formula, so that the cumulative histogram processing of the original whole vehicle image is performed.

[0091] Here, in the original whole vehicle image and the whole vehicle image to be processed, the ratio of the sum of the number of pixels with gray value ≤ Xlow to the total number is percent_low, and the ratio of the sum of the number of pixels with gray value ≤ Xhigh to the total number is percent_high.

[0092] In this embodiment, as Figure 7 shown, the process of segmenting the first front vehicle image, the first car body images car1 1 , car2 1 ,..., car Num 1 and the first rear vehicle image from the whole vehicle image to be processed specifically includes: based on the pre-trained U-Net neural network, segmenting the first front vehicle image, the first rear vehicle image and Num + 1 vehicle body connection images from the whole vehicle image to be processed. Then, using the Num + 1 vehicle body connection images, segment the first car body images car1 1 , car2 1 ,..., car Num 1 ;

[0093] The process of segmenting the second front vehicle image, the second car body images car1 2 , car2 2 ,..., car Num 2 and the second rear vehicle image from the original whole vehicle image specifically includes: based on the U-Net neural network, segmenting the second front vehicle image, the second rear vehicle image and Num + 1 vehicle body connection images from the original whole vehicle image. Then, using the Num + 1 vehicle body connection images, segment the second car body images car1 2 , car2 2 ,..., car Num 2 ;

[0094] During the training process of the U-Net neural network, the Adam optimization method is selected; in the U-Net neural network, the loss function is cross-entropy. Here, a train usually includes a locomotive head, a locomotive tail, and a plurality of carriages connected in series between the locomotive head and the locomotive tail. Connection devices are usually provided between the locomotive head and the carriages, between the carriages, and between the carriages and the locomotive tail. This connection device is the body connection; usually, an air conditioner is often installed on the roof, and the roof is usually composed of multiple components spliced together. These features can be regarded as the prominent features of the roof.

[0095] Here, as Figure 5 shows the structure diagram of the U-Net neural network. The input size of the U-Net neural network can be 768 pixels * 128 pixels.

[0096] Here, when training the U-Net, a train image P1 of the train can be taken (the train image P1 is a side image, a roof image or a bottom image of the train, and includes all the carriages, the locomotive head and the locomotive tail of the train), and then the cumulative histogram processing is performed on the train image P1 to obtain the train image P2. After that, the locomotive head image area, the locomotive tail image area, the body connection area, the prominent features of the roof, etc. are manually marked on the train image P2. Then, noise addition processing (the added noise includes: salt and pepper noise, Gaussian noise, etc.), scale transformation processing, and gray-scale transformation processing, etc. need to be performed on the train image P2. Then, based on multiple train images P2, the U-Net neural network is trained. When training, the Adam optimization method is selected, the loss function is cross-entropy, and the model with the highest Dice coefficient in the test set is selected as the best segmentation model, specifically as follows:

[0097] In this embodiment, the specific process of segmenting the first locomotive head image, the first locomotive tail image, and Num + 1 body connection images from the to-be-processed full-body image based on the pre-trained U-Net neural network includes: based on the pre-trained U-Net neural network, segmenting the first locomotive head image, the first locomotive tail image, and a plurality of body connection images from the to-be-processed full-body image, where the number of the body connection images ≥ Num + 1; arranging the plurality of body connection images in descending order according to the area, and selecting the first Num + 1 body connection images arranged in the front;

[0098] Segmenting the second front - end image, the second rear - end image, and Num + 1 body connection images from the original full - vehicle image based on the U - Net neural network specifically includes: Based on the U - Net neural network, segmenting the second front - end image, the second rear - end image, and multiple body connection images from the original full - vehicle image, where the number of body connection images ≥ Num + 1; arranging the multiple body connection images in descending order of area, and selecting the first Num + 1 body connection images ranked in the front.

[0099] In practice, the inventor found that the U - Net neural network may make mistakes and misjudge some areas on the outer surface of certain trains as body connection parts. However, the areas of these regions are usually relatively small. Therefore, select the Num + 1 body connection images with the largest areas.

[0100] Here, in practice, the full - vehicle image to be processed and the original full - vehicle image may be relatively large and not convenient for computer processing. The full - vehicle image to be processed and the original full - vehicle image can be first segmented into Num1 * Num2 small pictures, where Num1 and Num2 are both natural numbers. Then, input them into the U - Net neural network, and the U - Net neural network can splice the complete image. It can be understood that during training, the training images also need to be processed in the same way.

[0101] Here, in practice, a program needs to be written to implement this detection method. The OpenMP technology can be used. Among them, OpenMP is proposed by the OpenMP Architecture Review Board and is a set of guiding compilation processing schemes for multi - processor programming in shared - memory parallel systems.

[0102] Embodiment 6 of the present invention provides a detection device for trains, including the following modules:

[0103] Full - vehicle image acquisition module, used to acquire the original full - vehicle image when the train is normal and photograph the full - vehicle image to be processed of the train. Both the original full - vehicle image and the full - vehicle image to be processed are the side image, roof image, or bottom image of the whole train.

[0104] Image cutting module, used to segment the first front - end image, the first car images car1 of Num adjacent carriages 1 , car2 1 ,..., car Num 1 and the first rear - end image from the full - vehicle image to be processed, and segment the second front - end image, the second car images car1 of Num adjacent carriages 2 , car2 2,..., car Num 2 and the second rear - end image, where Num is a natural number, car j 1 is closer to the head of the vehicle than car k 1 is closer to the head of the vehicle, car j 2 is closer to the head of the vehicle than car k 2 is closer to the head of the vehicle, 1 ≤ j < k ≤ Num;

[0105] A processing module, configured to process the first head - end image and the second head - end image based on the image registration method in Embodiment 1, where the train image P' is the first head - end image and the standard image P" is the second head - end image; based on the image registration method in Embodiment 1, process car h 1 and car h 2 where the train image P' is car h 1 , and the standard image P" is car h 2 , h = 1, 2,..., Num; based on the image registration method in Embodiment 1, process the first rear - end image and the second rear - end image, where the train image P' is the first rear - end image and the standard image P" is the second rear - end image;

[0106] A detection module, configured to detect the train based on the first head - end image, N first carriage images car1 1 , car2 1 ,..., car Num 1 , the first rear - end image and the original full - vehicle image.

[0107] Embodiment 7 of the present invention provides a terminal, the terminal includes a memory and a processor, the memory stores a computer program that can run on the processor, and when the processor executes the program, it implements the steps in the detection method in Embodiment 6.

[0108] Embodiment 8 of the present invention provides a computer - readable storage medium, on which a computer program is stored, and when the computer program is executed by a processor, it implements the steps in the detection method in Embodiment 6.

[0109] It should be understood that although this specification is described in terms of embodiments, not every embodiment contains only one independent technical solution. This narrative style of the specification is only for clarity. Those skilled in the art should regard the specification as a whole, and the technical solutions in each embodiment can also be appropriately combined to form other embodiments that can be understood by those skilled in the art.

[0110] The series of detailed descriptions listed above are only specific descriptions of the feasible embodiments of the present invention, and they are not intended to limit the protection scope of the present invention. Any equivalent embodiments or modifications made without departing from the technical spirit of the present invention should be included within the protection scope of the present invention.

Claims

1. A method for image registration of a train, characterized in that, Including the following steps: Obtain a train image P' to be processed and a standard image P", where both the train image P' to be processed and the standard image P" are side images, roof images or bottom images of the same car body in the same vehicle type, and the car body is the head, tail or carriage; Preprocess the train image P' to be processed so that both the train image P' to be processed and the standard image P" have the same length and width; establish a two-dimensional coordinate system (X, Y), in which the coordinates of the upper left corner of the train image P' to be processed and the standard image P" are (0, 0), the left-right direction is the width direction, the up-down direction is the length direction, and in the left-to-right direction, the X value gradually increases, and in the up-to-down direction, the Y value gradually increases; in the train image P' to be processed and the standard image P", the extending direction of the car body is the same, and the extending direction is the direction from the head towards the tail; Divide the to-be-processed train image P' into N successively connected first sub-regions SP1', SP2',..., SP N 'N The upper side of the first sub-region SP i ' is parallel to the upper side of the to-be-processed train image P', and the lower side of the first sub-region SP i ' is parallel to the lower side of the to-be-processed train image P'. The left side of the first sub-region SP i ' is parallel to the left side of the to-be-processed train image P' and is located inside the left side. The right side of the first sub-region SP i ' is parallel to the right side of the to-be-processed train image P' and is located inside the left side. For the first sub-region SP i ', there corresponds a second sub-region SP i ” in the standard image P". Among them, the upper side of the second sub-region SP i ” is parallel to the upper side of the standard image P", and the Y value corresponding to the upper side of the second sub-region SP i ” ≤ the Y value corresponding to the upper side of the first sub-region SP i '; the lower side of the second sub-region SP i ” is parallel to the lower side of the standard image P", and the Y value corresponding to the lower side of the second sub-region SP i ” ≥ the Y value corresponding to the lower side of the first sub-region SP i '; the left side of the second sub-region SP i ” is the left side of the standard image P", and the right side of the second sub-region SP i ” is the right side of the standard image P". And for any pixel (X i ', Y i ) in the first sub-region SP i , there exist pixels (X i , AY i ), (X i , BY i ), (LX i , Y i ) and (RX i , Y i ) in the second sub-region SP i ”, where AY i ≤ Y i ≤ BY i , LX i ≤ X i ≤ RX i , i = 1, 2,..., N; For any first sub-region SP i ' and the corresponding second sub-region SP i ”, the following processing is performed for each: Obtain all Sum intermediate images from the second sub-region SP i ”. The length of the intermediate images is equal to the length of the first sub-region SP i ', and the width is equal to the width of the first sub-region SP i '. Obtain the similarity values between the first sub-region SP i ' and each intermediate image, and select the target intermediate image corresponding to the maximum similarity. The center point of the first sub-region SP i ' is (CX i ', CY i '), and the center point of the matching sub-region is (CX i ”, CY i ) = the center point of the target intermediate image; Based on the center points (CX i ', CY i ') of all the first sub-regions SP i ' and the center points (CX i ", CY i ") of the corresponding matching sub-regions of each first sub-region SP i ", the image stretching and compression processing is performed on the train image P' to be processed.

2. The method for image registration according to claim 1, characterized in that, The preprocessing of the train image P' to be processed specifically includes: Obtain the position information of the axle corresponding to the car body, and perform calibration processing on the train image P' to be processed based on the position information of the axle and the standard image P".

3. The method for image registration according to claim 1, wherein The obtaining of the first sub-region SP i The similarity values between " and each intermediate image specifically include: For each intermediate image, the following processing is performed: the first sub-region SP i The coordinates of the pixel at the upper left corner are (tsx i , tsy i ), and the coordinates of the pixel at the lower right corner are (tex i , tey i ). The coordinates of the pixel at the upper left corner of the intermediate image are (ssx, ssy), and the coordinates of the pixel at the lower right corner are (sex, sey); The first sub-region SP i ' and the similarity value of the intermediate image = 4. The method for image registration according to claim 3, wherein Based on the center points of all the first sub-regions SP i and the center points of the corresponding matching sub-regions, the specific image stretching and compression processing of the train image P' to be processed includes: When any two different first sub-regions SP i ' and the first sub-region SP j ', the center point of the first sub-region SP i ' is (CX i ', CY i '), the center point of the corresponding matching sub-region is (CX i ”, CY i ”), the center point of the first sub-region SP j ' is (CX j ', CY j '), the center point of the corresponding matching sub-region (CX' j ', CY j ”), when CX i '<CX j ' and CX i ”>CX' j ', delete the center point (CX i ', CY i ') of the first sub-region SP i ', the center point (CX i ”, CY i ”) of the corresponding matching sub-region, and the center point of the first sub-region SP j ' is (CX j ', CY j '), the center point (CX' j ', CY j ”) of the corresponding matching sub-region; then, based on the center points of the remaining first sub-regions and the center points of the corresponding matching sub-regions, perform image stretching and compression processing on the train image P' to be processed.

5. The method for image registration according to claim 4, characterized in that Based on the center points (CX i ', CY i ') of all the first sub-regions SP i ' and the center points (CX i ”, CY i ”) of the corresponding matching sub-regions of each first sub-region SP i ', the image stretching and compression processing of the train image P' to be processed specifically includes: sorting the first sub-regions SP i ' in ascending order of the Y coordinate value to obtain a queue Q, and in the order from the head to the tail of the queue, successively selecting the unprocessed first sub-regions SP' from the queue Q and performing the following processing on each of them: performing rigid registration on the first sub-region SP' and the matching sub-region used as a reference to obtain first deformation information, using the first deformation information as the initial deformation information, performing first non-rigid registration on the first sub-region SP' and the matching sub-region to obtain second deformation information, using the second deformation information as the initial deformation information, performing second non-rigid registration on the first sub-region SP' and the matching sub-region to obtain third deformation information, superimposing the third deformation information on the first sub-region SP' or the matching sub-region to generate a registered image, and replacing the first sub-region SP i ' with the registered image; after all the first sub-regions SP' have been processed, replacing the train image P' to be processed with the image obtained by splicing all the first sub-regions SP'.

6. An apparatus for image registration of a train, characterized in that, Including the following modules: An image acquisition module for obtaining a train image P' to be processed and a standard image P", where both the train image P' to be processed and the standard image P" are side images, roof images or bottom images of the same car body in the same vehicle type, and the car body is the head, tail or carriage; A preprocessing module for preprocessing the train image P' to be processed so that both the train image P' to be processed and the standard image P" have the same length and width; establish a two-dimensional coordinate system (X, Y), in which the coordinates of the upper left corner of the train image P' to be processed and the standard image P" are (0, 0), the left-right direction is the width direction, the up-down direction is the length direction, and in the left-to-right direction, the X value gradually increases, and in the up-to-down direction, the Y value gradually increases; in the train image P' to be processed and the standard image P", the extending direction of the car body is the same, and the extending direction is the direction from the head towards the tail; An image segmentation module for segmenting the to-be-processed train image P' into N successively connected first sub-regions SP1', SP2',..., SP N 'N first sub-regions SP i ' whose upper side is parallel to the upper side of the to-be-processed train image P', and the lower side of the first sub-region SP i ' is parallel to the lower side of the to-be-processed train image P'. The left side of the first sub-region SP i ' is parallel to the left side of the to-be-processed train image P' and is located inside the left side. The right side of the first sub-region SP i ' is parallel to the right side of the to-be-processed train image P' and is located inside the left side. For the first sub-region SP i ', there is a corresponding second sub-region SP i ” in the standard image P". Among them, the upper side of the second sub-region SP i ” is parallel to the upper side of the standard image P", and the Y value corresponding to the upper side of the second sub-region SP i ” ≤ the Y value corresponding to the upper side of the first sub-region SP i '; the lower side of the second sub-region SP i ” is parallel to the lower side of the standard image P", and the Y value corresponding to the lower side of the second sub-region SP i ” ≥ the Y value corresponding to the lower side of the first sub-region SP i '; the left side of the second sub-region SP i ” is the left side of the standard image P", and the right side of the second sub-region SP i ” is the right side of the standard image P". And for any pixel (X i ', Y i ) in the first sub-region SP i , there are pixels (X i , AY i ), (X i , BY i ), (LX i , Y i ) and (RX i , Y i ) in the second sub-region SP i ”, where AY i ≤ Y i ≤ BY i , LX i ≤ X i ≤ RX i , i = 1, 2,..., N; An image matching module, for any first sub-region SP i ' and the corresponding second sub-region SP i ” all perform the following processing: Obtain all Sum intermediate images from the second sub-region SP i ”. The length of the intermediate image is equal to the length of the first sub-region SP i ', and the width is equal to the width of the first sub-region SP i '. Obtain the similarity values between the first sub-region SP i ' and each intermediate image, and select the target intermediate image corresponding to the maximum similarity. The center point of the first sub-region SP i ' is (CX i ', CY i '), and the center point of the matching sub-region is (CX i ”, CY i ”) = the center point of the target intermediate image; A processing module for performing image stretching and compression processing on a train image P' to be processed based on the center points (CX i ', CY i ') of all the first sub-regions SP and the center points (CX i ', CY i ') of the matching sub-regions corresponding to each first sub-region SP. i ' of the center point (CX i ', CY i ) and the center point (CX i ", CY i ") of the matching sub-region corresponding to each first sub-region SP i ) to perform image stretching and compression processing on the train image P' to be processed.

7. A terminal, the terminal comprising a memory and a processor, the memory storing a computer program that can run on the processor, characterized in that, When the processor executes the program, it implements the steps in the method for image registration according to any one of claims 1-5.

8. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by the processor, it implements the steps in the method for image registration according to any one of claims 1-5.

9. A detection method for a train, characterized in that, Including the following steps: Obtain the original full train image when the train is normal, and take the full train image to be processed of the train. Both the original full train image and the full train image to be processed are side images, roof images or bottom images of the whole train; Segment a first front - end image, first car images car1 of Num adjacent carriages, 1 , car2 1 ,..., car Num 1 and a first rear - end image from the full - vehicle image to be processed, and segment a second front - end image, second car images car1 of Num adjacent carriages, 2 , car2 2 ,..., car Num 2 and a second rear - end image from the original full - vehicle image, where Num is a natural number, and car j 1 is closer to the front - end than car k 1 , and car j 2 is closer to the front - end than car k 2 , 1 ≤ j < k ≤ Num; Process the first front-end image and the second front-end image by the image registration method according to any one of claims 1-5, wherein the train image P' is the first front-end image, and the standard image P" is the second front-end image; process car h 1 and car h 2 by the image registration method according to any one of claims 1-5, wherein the train image P' is car h 1 , and the standard image P" is car h 2 , h = 1, 2,..., Num; process the first rear-end image and the second rear-end image by the image registration method according to any one of claims 1-5, wherein the train image P' is the first rear-end image, and the standard image P" is the second rear-end image; Based on the first locomotive image, N first car images car1 1 , car2 1 ,..., car Num 1 , the first caboose image, and the original full train image, detect the train.

10. The detection method according to claim 9, characterized in that Segmenting the first front vehicle image, the first car images car1 of Num adjacent carriages, car2, ..., car, and the first rear vehicle image from the to-be-processed full vehicle image specifically includes: performing cumulative histogram processing on the to-be-processed full vehicle image, and then segmenting the first front vehicle image, the first car images car1 of Num adjacent carriages, car2, ..., car, and the first rear vehicle image from the to-be-processed full vehicle image; 1 , car2 1 , ..., car Num 1 and the first rear vehicle image specifically includes: performing cumulative histogram processing on the to-be-processed full vehicle image, and then segmenting the first front vehicle image, the first car images car1 of Num adjacent carriages, car2, ..., car, 1 , car2 1 , ..., car Num 1 and the first rear vehicle image; Segmenting the second front vehicle image, the second vehicle images car1 of Num adjacent carriages, 2 , car2 2 ,..., car Num 2 and the second rear vehicle image from the original full vehicle image specifically includes: performing cumulative histogram processing on the original full vehicle image, and then segmenting the second front vehicle image, the second vehicle images car1 of Num adjacent carriages 2 , car2 2 ,..., car Num 2 and the second rear vehicle image from the original full vehicle image.

11. The detection method according to claim 9, characterized in that Segmenting the first front - end image, the first car images car1 of Num adjacent cars, 1 , car2 1 ,..., car Num 1 and the first rear - end image from the to - be - processed full - vehicle image specifically includes: Based on the pre - trained U - Net neural network, segmenting the first front - end image, the first rear - end image and Num + 1 body connection images from the to - be - processed full - vehicle image, and then using the Num + 1 body connection images to segment the first car images car1 of Num adjacent cars 1 , car2 1 ,..., car Num 1 ; Segmenting the second front vehicle image, the second vehicle images of Num adjacent carriages car1 from the original full vehicle image 2 , car2 2 ,..., car Num 2 And the second rear vehicle image specifically includes: Based on the U-Net neural network, segmenting the second front vehicle image, the second rear vehicle image and Num + 1 body connection images from the original full vehicle image, and then using the Num + 1 body connection images to segment the second vehicle images of Num adjacent carriages car1 2 , car2 2 ,..., car Num 2 ; During the training process of the U-Net neural network, the Adam optimization method is selected; in the U-Net neural network, the loss function is cross-entropy.

12. The detection method according to claim 11, characterized in that Segmenting a first front image, a first rear image, and Num + 1 body connection images from the to-be-processed full vehicle image based on the pre-trained U-Net neural network specifically includes: segmenting a first front image, a first rear image, and multiple body connection images from the to-be-processed full vehicle image based on the pre-trained U-Net neural network, where the number of body connection images ≥ Num + 1; arranging the multiple body connection images in descending order of area, and selecting the first Num + 1 body connection images in the ranking; Segmenting a second front image, a second rear image, and Num + 1 body connection images from the original full vehicle image based on the U-Net neural network specifically includes: segmenting a second front image, a second rear image, and multiple body connection images from the original full vehicle image based on the U-Net neural network, where the number of body connection images ≥ Num + 1; arranging the multiple body connection images in descending order of area, and selecting the first Num + 1 body connection images in the ranking.

13. A detection device for a train, characterized in that, It includes the following modules: A full vehicle image acquisition module, configured to acquire the original full vehicle image when the train is normal, and capture the to-be-processed full vehicle image of the train, where both the original full vehicle image and the to-be-processed full vehicle image are side images, roof images, or bottom images of the entire train; An image cutting module, configured to segment a first front - end image, first car images car1 of Num adjacent cars, 1 , car2 1 ,..., car Num 1 and a first rear - end image from the to - be - processed full - vehicle image, and segment a second front - end image, second car images car1 of Num adjacent cars, 2 , car2 2 ,..., car Num 2 and a second rear - end image from the original full - vehicle image, where Num is a natural number, car j 1 is closer to the front - end than car k 1 , car j 2 is closer to the front - end than car k 2 , 1 ≤ j < k ≤ Num; A processing module is configured to process a first front train image and a second front train image based on the image registration method according to any one of claims 1-5, where the train image P' is the first front train image and the standard image P" is the second front train image; process car based on the image registration method according to any one of claims 1-5 h 1 and car h 2 where the train image P' is car h 1 and the standard image P" is car h 2 , h = 1, 2,..., Num; process a first rear train image and a second rear train image based on the image registration method according to any one of claims 1-5, where the train image P' is the first rear train image and the standard image P" is the second rear train image; Detection module, configured to detect the train based on the first locomotive image, N first carriage images car1 1 , car2 1 ,..., car Num 1 , the first caboose image, and the original full train image 14. A terminal, the terminal includes a memory and a processor, the memory stores a computer program that can run on the processor, characterized in that, When the processor executes the program, it implements the steps in the detection method according to any one of claims 9 - 12.

15. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by the processor, it implements the steps in the detection method according to any one of claims 9 - 12.

Citation Information

Patent Citations

  • Improved train image accurate registration method and system based on SURF features

    CN111354026A