Train multi-band video adaptive switching method, device, equipment, medium and product
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-05-09
- Publication Date
- 2026-08-11
AI Technical Summary
[0003]但是,上述视频切换方式多以环境光强或简单全图清晰度为判断依据,具有以下缺陷:一是无法区分列车高速运动导致的画面拖影与真实图像模糊,易引发误切换;二是临界光照下易出现视频数据频繁跳变,干扰司机观察与系统算法稳定性;三是人工切换响应滞后无法适应列车高速进出隧道时的瞬间致盲
Smart Images

Figure CN122554597A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of image processing technology, and in particular to a method, apparatus, device, medium and product for adaptive switching of multi-band video on trains. Background Technology
[0002] In the field of rail transit safety, train obstacle detection systems rely on front-end video imaging for all-weather monitoring. Therefore, the quality of front-end video imaging is crucial to the reliability and engineering application value of the train obstacle detection system. Due to the influence of the train operating environment, a single imaging mode cannot meet the requirements for clear imaging. Therefore, existing technologies mostly adopt a dual-camera configuration of visible light and infrared, switching between videos based on ambient brightness or manual methods to ensure the quality of front-end video imaging.
[0003] However, the aforementioned video switching methods mostly rely on ambient light intensity or simple overall image clarity as the basis for judgment, which has the following drawbacks: First, they cannot distinguish between image blur caused by high-speed train movement and true image blur, easily leading to erroneous switching; second, under critical lighting conditions, video data is prone to frequent jumps, interfering with driver observation and system algorithm stability; third, the lag in manual switching response cannot adapt to the instantaneous blindness caused by trains entering and exiting tunnels at high speed. Therefore, existing video switching methods are difficult to adapt to the complex train operating environment, and there is an urgent need to provide an effective train multi-band video adaptive switching method that adapts to the train operating environment. Summary of the Invention
[0004] In view of the above-mentioned defects or deficiencies in the related technologies, the purpose of this application is to provide a train multi-band video adaptive switching method, device, equipment, medium and product, which can effectively adapt to the complex train driving environment, provide high-quality video imaging data for the train obstacle detection system, and ensure the stability of the train obstacle detection system.
[0005] To achieve the above objectives, this application provides the following solution: In a first aspect, this application provides a train multi-band video adaptive switching method, comprising: acquiring dual-source video data of the track area ahead of the train synchronously acquired by a first imaging unit and a second imaging unit; extracting the ROI region of each frame of the dual-source video data to obtain dual-source multi-frame target images; calculating the sharpness of the dual-source multi-frame target images using an image edge gradient evaluation algorithm to obtain sharpness scores for the dual-source multi-frame target images; determining whether the sharpness scores of the dual-source multi-frame target images trigger switching when the current output video source is determined, using an asymmetric hysteresis comparison strategy to determine whether the sharpness scores of the dual-source multi-frame target images trigger switching, and obtaining a switching judgment result; and performing a switching operation according to the switching judgment result to output single-source video data to the train obstacle detection system.
[0006] Optionally, the dual-source video data includes visible light video output by the first imaging unit and infrared video output by the second imaging unit. The step of extracting the ROI region of each frame of the dual-source video data to obtain dual-source multi-frame target images includes: performing grayscale processing on the image frames of the visible light video and the infrared video respectively to obtain grayscale visible light video frames and grayscale infrared video frames; extracting the ROI regions of the grayscale visible light video frames and the grayscale infrared video frames respectively along the central track extension direction of the image, and removing the blurred interference areas caused by the high-speed movement of the train at the roadside edge to obtain multi-frame target visible light images and multi-frame target infrared images.
[0007] Optionally, the step of using an image edge gradient evaluation algorithm to calculate the sharpness of the dual-source multi-frame target images to obtain a sharpness score for the dual-source multi-frame target images includes: using the Sobel operator to calculate the gradient values in the horizontal and / or vertical directions of the multi-frame target visible light images and multi-frame target infrared images respectively, to obtain the gradient value of each frame of visible light images and the gradient value of each frame of infrared images; filtering the gradient values of each frame of visible light images and the gradient values of each frame of infrared images respectively, to obtain the effective gradient values of each frame of visible light images and the effective gradient values of each frame of infrared images; summing all the effective gradient values of each frame of visible light images to obtain a single-frame original sharpness score for visible light; performing a moving average on the original sharpness scores of K consecutive frames of visible light images to obtain a visible light sharpness score; summing all the effective gradient values of each frame of infrared images to obtain a single-frame original sharpness score for infrared images; and performing a moving average on the original sharpness scores of K consecutive frames of infrared images to obtain an infrared sharpness score.
[0008] Optionally, when the current output video source is determined, the step of using an asymmetric hysteresis comparison strategy to determine whether the sharpness score of the dual-source multi-frame target image triggers switching, and obtaining a switching determination result, includes: if the current output video source is visible light, and the visible light sharpness score is lower than a first preset sharpness threshold and the infrared sharpness score is greater than a set multiple of the visible light sharpness score, triggering a first result for switching output; if the current output video source is visible light or infrared, and both the visible light sharpness score and the infrared sharpness score are lower than a second preset sharpness threshold, not triggering a second result for switching output; wherein the second preset sharpness threshold is lower than the first preset sharpness threshold; if the current output video source is infrared, and the visible light sharpness score is greater than a set multiple of the infrared sharpness score, triggering a third result for switching output, wherein the set multiple is 1.1 to 2.0 times.
[0009] Optionally, the step of performing the switching operation based on the switching judgment result and outputting single-source video data to the train obstacle detection system includes: if the switching judgment result is the first result, switching the currently output visible light video to infrared video data; if the switching judgment result is the second result, maintaining the current output video source and issuing a visual loss alarm; if the switching judgment result is the third result, switching the currently output infrared video to visible light video.
[0010] Optionally, the method further includes: when judging the visible light video and infrared video frame by frame, if a switch is triggered, the counter is incremented by one; if no switch is triggered, the counter is reset to zero; when the counter accumulates to a preset number of frames, a switch is performed.
[0011] Secondly, this application provides a train multi-band video adaptive switching device, comprising: The acquisition module is used to acquire dual-source video data of the track area in front of the train, which are synchronously collected by the first imaging unit and the second imaging unit. The extraction module is used to extract the ROI region of each frame of the dual-source video data to obtain dual-source multi-frame target images; The calculation module is used to calculate the sharpness of the dual-source multi-frame target images using an image edge gradient evaluation algorithm, and obtain the sharpness score of the dual-source multi-frame target images. The judgment module is used to determine whether the sharpness score of the dual-source multi-frame target image triggers switching when the current output video source is determined, using an asymmetric hysteresis comparison strategy, and obtains the switching judgment result. The switching module is used to perform a switching operation based on the switching judgment result and output single-source video data to the train obstacle detection system.
[0012] Thirdly, this application provides a computer device, including: a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the computer program to implement the steps of the train multi-band video adaptive switching method described in any one of the above.
[0013] Fourthly, this application provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the steps of the train multi-band video adaptive switching method described above.
[0014] Fifthly, this application provides a computer program product, including a computer program that, when executed by a processor, implements the steps of the train multi-band video adaptive switching method described above.
[0015] According to the specific embodiments provided in this application, the following technical effects are disclosed: This application provides a method, apparatus, device, medium, and product for adaptive switching of multi-band video for trains. By extracting the ROI region of each frame in the dual-source video data, it can eliminate the blurred interference area caused by the high-speed movement of the train at the roadside edge, reduce misjudgments caused by normal motion blur, and provide reliable image data for subsequent sharpness calculation, making the sharpness evaluation more accurate and in line with the needs of obstacle detection. By using an image edge gradient evaluation algorithm to calculate the sharpness of the dual-source multi-frame target images, it can objectively quantify the true sharpness of the images, is not affected by ambient light intensity, and can adapt to complex working conditions such as strong light, fog, night, and tunnels, ensuring the accuracy of subsequent switching judgments. By using an asymmetric hysteresis comparison strategy to determine whether the sharpness score of the dual-source multi-frame target images triggers switching, it can realize the control logic of visible light priority, strict tangential infrared, and relaxed switch back to visible light, significantly reducing frequent switching and ensuring stable output. Attached Figure Description
[0016] To more clearly illustrate the technical solutions in the embodiments of this application or the prior art, the drawings used in the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0017] Figure 1 This is an application environment diagram of a train multi-band video adaptive switching method according to an embodiment of this application; Figure 2 A flowchart illustrating a train multi-band video adaptive switching method provided in an embodiment of this application; Figure 3 This is a schematic diagram of ROI region extraction provided in an embodiment of this application; Figure 4 A schematic diagram of the functional modules of a train multi-band video adaptive switching device provided in an embodiment of this application; Figure 5 This is a schematic diagram of the structure of a computer device provided in an embodiment of this application. Detailed Implementation
[0018] The technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, and not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.
[0019] To make the above-mentioned objectives, features and advantages of this application more apparent and understandable, the application will be further described in detail below with reference to the accompanying drawings and specific embodiments.
[0020] The train multi-band video adaptive switching method provided in this application can be applied to, for example... Figure 1 In the application environment shown, the first imaging unit 101 and the second imaging unit 102 communicate with the server 103 via a network. A data storage system can store the data that the server 103 needs to process. The data storage system can be set up separately, integrated into the server 103, or placed in the cloud or on another server. The first imaging unit 101 and the second imaging unit 102 can send synchronously acquired dual-source video data to the server 103. After receiving the dual-source video data, the server 103 extracts the ROI region of each frame in the dual-source video data to obtain dual-source multi-frame target images. An image edge gradient evaluation algorithm is used to calculate the sharpness of the dual-source multi-frame target images to obtain sharpness scores. Given the current output video source, an asymmetric hysteresis comparison strategy is used to determine whether the sharpness score of the dual-source multi-frame target images triggers switching, obtaining a switching judgment result. Based on the switching judgment result, a switching operation is executed, and single-source video data is output to the train obstacle detection system.
[0021] The first imaging unit 101 is a visible light imaging unit, the second imaging unit 102 is an infrared imaging unit, and the server 103 can be implemented by an independent server or a server cluster composed of multiple servers, or it can be a cloud server.
[0022] In one exemplary embodiment, such as Figure 2 As shown, a train multi-band video adaptive switching method is provided. This method is executed by a computer device. In this embodiment, the method is applied to... Figure 1 Taking server 103 as an example, the explanation includes the following steps S201 to S205. Wherein: Step S201: Acquire dual-source video data of the track area in front of the train, which are synchronously acquired by the first imaging unit and the second imaging unit.
[0023] In the example embodiment, the dual-source video data includes visible light video output by the first imaging unit and infrared video output by the second imaging unit. After acquiring the dual-source video data, the visible light video and infrared video need to be time-stamped to ensure that the imaging scene is consistent at the same time.
[0024] It should be noted that the first imaging unit of this application is a visible light imaging unit, specifically a long-focal-length visible light camera with a working wavelength of 400nm–760nm, used to acquire color visible light video images of the track area in front of the train, providing color and texture detail information. The second imaging unit is an infrared imaging unit, specifically a long-focal-length infrared camera / thermal imaging camera with a working wavelength of near-infrared or long-wave infrared, used to acquire infrared video images of the track area in front of the train, with fog penetration, smoke penetration, and night vision capabilities, and performs time stamp synchronization and frame alignment processing on the dual-source video data to ensure that the imaging time of the two-channel images is consistent.
[0025] Step S202: Extract the ROI region of each frame image in the dual-source video data to obtain dual-source multi-frame target images.
[0026] In the example embodiment, due to the high-speed movement of the train, the edges (both sides of the roadbed) of the visible light video and infrared video image frames experience physical motion blur caused by high-speed receding, which lowers the overall sharpness score. Therefore, it is necessary to extract the Region of Interest (ROI) for each frame. The ROI in this application is a fixed central rectangular or trapezoidal region in the visible light video and / or infrared video, or a region dynamically shifted left and right according to the train's turning curvature signal, always covering the track area in front of the train. For example, the ROI extracted along the direction extending from the central track is as follows: Figure 3 The area shown.
[0027] Optionally, step S202 may include: performing grayscale processing on the image frames of the visible light video and the infrared video respectively to obtain grayscale visible light video frames and grayscale infrared video frames; extracting the ROI regions of the visible light video frames and grayscale infrared video frames along the central track extension direction of the image respectively, and removing the blurred interference regions caused by the high-speed movement of the train at the roadside edge to obtain multiple frames of target visible light images and multiple frames of target infrared images.
[0028] By extracting the ROI region of each frame in the dual-source video data, the blurred interference area caused by the high-speed movement of the train at the roadside edge can be eliminated, which can reduce misjudgment caused by normal motion blur and provide reliable image data for subsequent sharpness calculation, making the sharpness evaluation more accurate and more in line with the needs of obstacle detection.
[0029] Step 203: The image edge gradient evaluation algorithm is used to calculate the sharpness of the dual-source multi-frame target images to obtain the sharpness score of the dual-source multi-frame target images.
[0030] In the example implementation, an image edge gradient evaluation algorithm is used to calculate the sharpness of multiple frames of target images in both visible light and infrared video, enabling objective and accurate quantification of the true sharpness of the images. This method does not rely on ambient light intensity, but evaluates imaging quality solely based on the sharpness of the image's own edge texture, effectively eliminating external interference such as sudden changes in light, backlighting, and haze.
[0031] By comprehensively calculating multiple frames of images, single-frame noise and transient interference can be filtered out, making the clarity score of the obtained dual-source multi-frame target images stable, reliable, and representative. This provides accurate data for subsequent adaptive switching of video sources, ensures that the switching judgment is not affected by accidental factors, and improves the overall stability and detection reliability of the train obstacle detection system.
[0032] Step 204: Given the current output video source, use an asymmetric hysteresis comparison strategy to determine whether the sharpness score of the dual-source multi-frame target image triggers switching, and obtain the switching judgment result.
[0033] In the example embodiment, the asymmetric hysteresis comparison strategy refers to a control strategy that employs differentiated and asymmetric switching conditions for different output states during the video source switching judgment process, and combines this with a hysteresis judgment based on the sharpness gain amplitude. Here, the sharpness gain amplitude is the percentage by which the sharpness score of the video source to be switched is higher than the sharpness score of the currently output video source.
[0034] The core of the asymmetric hysteresis comparison strategy is as follows: the conditions for switching from visible light to infrared are more stringent, requiring insufficient clarity in visible light and a significant clarity advantage in infrared; the conditions for switching from infrared to visible light are more lenient, requiring only a significant clarity advantage in visible light to trigger the switch. Simultaneously, the new video source must reach a higher clarity threshold than the current output video source before switching can occur, avoiding frequent switching due to minor fluctuations in scores.
[0035] The asymmetric hysteresis comparison strategy enables infrared imaging as a supplement when visible light imaging quality is insufficient. Simultaneously, by setting the sharpness gain amplitude to form a hysteresis interval, false triggers caused by illumination fluctuations and fractional jitter can be effectively filtered out, preventing the current output video source from repeatedly jumping in a critical state and ensuring continuous and stable output images. In other words, the asymmetric hysteresis comparison strategy achieves visible light priority, asymmetric switching conditions, and anti-jitter adaptive control, reducing the number of invalid switching attempts, improving system response reliability, and ensuring the train obstacle detection system always operates in the optimal imaging state.
[0036] Step 205: Perform a switching operation based on the switching judgment result and output single-source video data to the train obstacle detection system.
[0037] In the example embodiment, if the switching judgment result is the first result, the currently output visible light video is switched to infrared video data; if the switching judgment result is the second result, the current output video source is maintained and a visual loss alarm is issued; if the switching judgment result is the third result, the currently output infrared video is switched to visible light video.
[0038] Based on the switching judgment result, a video source switching operation is performed to stably output a single optimal video data to the train obstacle detection system. This avoids the processing pressure and image clutter caused by simultaneous output of dual-source data, ensuring that the backend system receives only a clear and reliable image. This output method is directly compatible with existing on-board detection systems and can be adapted without modifying the backend algorithm. The switching process is smooth and uninterrupted, with no image flicker, effectively ensuring the continuity and stability of train operation safety monitoring.
[0039] By implementing steps S201 to S205, the ROI region of each frame in the dual-source video data can be extracted, eliminating the blurred interference area caused by the high-speed movement of the train at the roadside edge. This reduces misjudgments caused by normal motion blur and provides reliable image data for subsequent sharpness calculation, making the sharpness evaluation more accurate and better suited to obstacle detection needs. The sharpness calculation of the dual-source multi-frame target images is performed separately using the image edge gradient evaluation algorithm, which can objectively quantify the true sharpness of the image. It is not affected by ambient light intensity and can adapt to complex working conditions such as strong light, fog, night, and tunnels, ensuring the accuracy of subsequent switching judgments. The asymmetric hysteresis comparison strategy determines whether the sharpness score of the dual-source multi-frame target images triggers switching. This enables the control logic of visible light priority, strict tangential infrared, and relaxed switchback to visible light, significantly reducing frequent switching and ensuring stable output.
[0040] Furthermore, this application processes the dual-source videos acquired by the visible light imaging unit and the infrared imaging unit separately. By extracting the ROI region of the track area in front of the train, the interference of motion blur at the roadside edges on the sharpness evaluation is effectively eliminated. An image edge gradient evaluation algorithm is used to calculate the sharpness of the dual-source multi-frame target images separately, objectively quantifying the true imaging quality of the two videos, filtering out single-frame noise and instantaneous fluctuation interference, and obtaining stable and reliable sharpness scores, providing an accurate data basis for video source switching. Given the current output video source, an asymmetric hysteresis comparison strategy is used to determine the switching of the dual-source sharpness scores, realizing a control logic that prioritizes visible light and uses asymmetric switching conditions. This avoids frequent video source jumps due to small score fluctuations or critical illumination states, ensuring stable and continuous image output. Finally, based on the switching judgment result, a switching operation is executed, outputting the optimal single-source video data to the train obstacle detection system. The switching process is smooth and uninterrupted, with high compatibility with existing onboard detection systems, significantly improving the reliability of all-weather obstacle detection and the stability of system operation.
[0041] In another exemplary embodiment of this application, in order to accurately identify the true imaging quality of the track area in front of the train, effectively eliminate the influence of motion blur, image noise, and instantaneous light fluctuations caused by high-speed train operation on the sharpness evaluation results, and avoid misjudgment of sharpness due to local image interference; at the same time, in order to obtain a stable, accurate, and consistent sharpness score, provide a reliable basis for video source switching judgment, and ensure that the system can still output the best imaging image under complex working conditions, significantly improving the all-weather adaptability and working stability of the train obstacle detection system, the above step S203 may include the following steps S2031 to S2036, specifically: Step S2031: The Sobel operator is used to calculate the gradient values in the horizontal and / or vertical directions of multiple frames of target visible light images and multiple frames of target infrared images respectively, so as to obtain the gradient value of each frame of visible light image and the gradient value of each frame of infrared image. Step S2032: Filter the gradient values of each frame of visible light image and each frame of infrared image to obtain the effective gradient values of each frame of visible light image and each frame of infrared image. Step S2033: Sum the effective gradient values of all visible light images in each frame to obtain the original visible light sharpness score; Step S2034: Perform a moving average on the raw visible light sharpness scores of K consecutive frames to obtain the visible light sharpness score; Step S2035: Sum the effective gradient values of all infrared images in each frame to obtain the original infrared sharpness score; Step S2036: Perform a moving average on the raw infrared sharpness scores of K consecutive frames to obtain the infrared sharpness score.
[0042] Understandably, the Tenengrad gradient function is chosen as the image edge gradient evaluation algorithm. Taking a target visible light image as an example, the specific steps are as follows: First, set the prerequisites: all visible light images of the target in multiple frames are single-channel grayscale images, and the pixel matrix is set as follows. ,in, M The height is the number of pixels. N This represents the width in pixels. The horizontal / vertical gradient is calculated using the Sobel operator (3×3). The Sobel-X (horizontal) operator is preset to... G x The Sobel-Y (vertical) operator is preset to... G y If, then: , Set gradient threshold T g(e.g., 5~15), below the gradient threshold T g The gradient value is considered noise and is not included in the calculation.
[0043] Then, convolution operations are performed pixel by pixel, that is, convolution operations are performed on the pixel matrix of the target visible light image. Each pixel except the edges x, y (2≤) x ≤ M- 1,2≤ y ≤ N- 1) respectively with G x , G y Perform convolution to obtain the horizontal gradient values of each frame of the visible light image. Vertical gradient value ,in: (Convolution operation) (Convolution operation) Next, the pixel gradient magnitude is calculated, that is, for each pixel... , Calculate the gradient magnitude The edge sharpness of the pixel is reflected by the following formula (1): (1) Next, noise filtering and effective gradient selection are performed. That is, the gradient magnitude and gradient threshold are compared. T g The comparison only retains the effective gradient values, and the calculation formula is as follows (2): (2) Next, the original sharpness score of visible light for each frame is calculated, which involves summing the effective gradient values of all visible light images in each frame to obtain the original sharpness score of visible light for each frame. S raw The calculation formula is as follows (3): (3) Finally, to eliminate the interference of single-frame noise on the score, a moving average is used to filter the original visible light sharpness score, that is, to filter the original visible light sharpness score of K consecutive frames (e.g., 3-5 frames). S raw Calculate a moving average to obtain the final sharpness score for each band, i.e., the visible light sharpness score. S vis The calculation formula is as follows (4): Similarly, the infrared sharpness score can be calculated. Sir .
[0044] By using multi-frame moving average, single-frame noise and score fluctuations caused by instantaneous environmental disturbances can be effectively filtered out, making the sharpness evaluation results continuous and stable. This avoids frequent fluctuations in sharpness values near the switching threshold, eliminates frequent erroneous switching of video sources from the data source level, and ensures stable and consistent output video.
[0045] In another exemplary embodiment of this application, in order to set differentiated judgment conditions and sharpness gain range (set multiple) through an asymmetric hysteresis comparison strategy, under the premise of determining the current output video source, frequent video source jumps caused by small fluctuations in sharpness score or changes in critical state are avoided, ensuring stable and continuous output image. Simultaneously, to ensure that switching is triggered only when the quality of the current output video source significantly decreases and another video source has a clear sharpness advantage, thus always providing the optimal video source for the train obstacle detection system and improving driver observation comfort and the operational stability of the backend detection algorithm, the above step S204 may include: If the current output video source is visible light, and the visible light clarity score is lower than the first preset clarity threshold while the infrared clarity score is greater than a set multiple of the visible light clarity score, the first output result is triggered. If the current output video source is either visible light or infrared, and both the visible light clarity score and the infrared clarity score are lower than the second preset clarity threshold, the second output result is not triggered. If the current output video source is infrared, and the visible light clarity score is greater than a set multiple of the infrared clarity score, the third output result is triggered.
[0046] In an example embodiment, the first result of this application indicates switching visible light video to infrared video, the second result indicates maintaining the current output video source, and the third result indicates switching infrared video to visible light video. The second preset sharpness threshold is lower than the first preset sharpness threshold; for example, the first preset sharpness threshold is set as a basic sharpness threshold. T base The first is the visible light sharpness threshold at which the human eye / AI algorithm can effectively identify obstacles; the second preset sharpness threshold is the lowest threshold at which the image is completely unrecognizable. T min The multiplier is set to 1.1 to 2.0.
[0047] In conjunction with the embodiments, for example, scenario A: the current output video source is visible light, and infrared is the backup video source; that is: like S vis ≥ T base If so, maintain visible light output; even if infrared is slightly better, do not cut it, prioritizing the color image that the human eye is accustomed to. S vis andS ir All are below the minimum threshold T min If so, the current output video source remains visible light, and a visual loss alarm is sent. S vis < T base and S ir > S vis × If this is triggered, the current output video source will be switched from visible light to infrared.
[0048] It should be noted that the core purpose of the asymmetric hysteresis comparison strategy set in this application is to prioritize the preservation of visible light and only cut off infrared light when necessary, i.e., conditional... S vis < T base Only when the visible light sharpness score is lower than T base Only after this condition is met will the switching judgment be initiated, avoiding meaningless switching when visible light is clear but infrared light is slightly better, thus conforming to the human eye's visual habits regarding colored visible light. Conditions S vis > S ir × In the railway scenario, A value of 1.1 is preferred, meaning that the improvement in infrared sharpness score relative to visible light sharpness score is ≥10%. This eliminates invalid handovers caused by minor score differences; in other words, it completely avoids frequent handovers caused by score fluctuations in critical states. In railway scenarios, 1.1 is preferred to balance handover sensitivity and anti-shake performance. In other embodiments, For calibrable parameters, such as 1.05 / 1.15. Conditions S vis and S ir All are below the minimum threshold T min At this point, switching to any source is meaningless. Maintaining the current output video source is to ensure the stability of the output source, avoid video interruption during the switching process, and send an alarm to inform the driver / dispatch center that the visual detection has failed and initiate manual observation.
[0049] Scenario B: The current output video source is infrared, and visible light is the backup video source; that is: like S vis > S ir × If the infrared output is detected, a switch will be triggered, changing the previous output video source from infrared to visible light. In other words, the switch will prioritize reverting to infrared output as long as the visible light becomes clear. Otherwise, infrared output will remain active.
[0050] It should be noted that, compared to the conditions for cutting infrared light from visible light, the conditions for cutting visible light from infrared light lack the pre-threshold judgment. S vis ≥ T base The core underlying logic stems from the visible light priority principle in railway scenarios, coupled with the backup attribute of infrared. This setup is based on the following: First, the core advantages of visible light are irreplaceable: visible light provides color texture information, and the human eye's recognition efficiency for color images is far higher than that for monochrome / thermal imaging images from infrared. Furthermore, the backend AI algorithm has higher accuracy in identifying obstacle categories using visible light, such as distinguishing between falling rocks, people, and vehicles. Therefore, as soon as visible light recovers to a state significantly superior to infrared, it is immediately switched back without waiting for it to reach that state. T base Firstly, it maximizes the informational advantages of visible light. Secondly, it leverages infrared as a backup for positioning: infrared is only used as a supplement when visible light fails, such as in backlight, fog, or at night. Its core value is maintaining visibility, not replacing it. Therefore, the conditions for switching from infrared to visible light are more relaxed, with no pre-threshold restrictions, allowing for immediate switching back as soon as visible light is restored. Furthermore, if switching from infrared to visible light also increases... S ir × The prerequisite is that visible light may be superior to infrared but not yet reach the level of infrared. T base However, maintaining infrared output contradicts the original design principle of prioritizing visible light. At the same time, this asymmetric judgment logic can further reduce the number of critical state switching and improve system stability.
[0051] In another exemplary embodiment of this application, the method further includes: when judging the visible light video and infrared video frame by frame, if a switching is triggered, the counter is incremented by one; if no switching is triggered, the counter is cleared to zero; when the counter accumulates to a preset number of frames, a switching is performed.
[0052] As can be understood from the above embodiments, this example embodiment is applicable to situations where the visible light sharpness score and infrared sharpness score are not filtered using a moving average method. That is, when the effective gradient values of all visible light images in each frame are summed to obtain the original visible light sharpness score of a single frame, and the effective gradient values of all infrared images in each frame are summed to obtain the original infrared sharpness score of a single frame, the switching operation is performed when the preset frame number N of the counter is greater than 5, based on the original visible light sharpness score or the original infrared sharpness score satisfying the trigger switching.
[0053] It should be noted that the counter is used to prevent momentary jitter. The core logic of the counter is not that the sharpness score meets the condition + N>5, but rather that the switching is executed after the sharpness score condition is met for N consecutive frames, where N is the preset frame number of the counter, such as 5 frames. The specific execution logic can be understood as follows: For example, the condition for switching the current output video source from infrared to visible light is: S raw > S ira × ,in S ira This represents the raw sharpness score of a single infrared frame. If a visible light image frame meets the switching conditions, the counter increments by 1; if a visible light image frame does not meet the conditions, the counter is reset to zero and starts counting again. Automatic switching or manual switching by the operator is only performed when the counter value reaches 5 frames, meaning 5 consecutive visible light images meet the switching conditions. If the counter has not reached K frames, no switching operation is performed even if a single visible light image or intermittent visible light image meets the conditions.
[0054] By calculating the counter values, the score fluctuations of the visible light original sharpness score and infrared original sharpness score in a single frame / instantaneous moment can be filtered out, such as score changes caused by instantaneous light flicker, ensuring that the switching is triggered only when the image quality is high and stable, and avoiding false switching caused by instantaneous interference.
[0055] Based on the same inventive concept, this application also provides a train multi-band video adaptive switching device for implementing the train multi-band video adaptive switching method described above. The solution provided by this device is similar to the solution described in the above method; therefore, the specific limitations of one or more train multi-band video adaptive switching device embodiments provided below can be found in the limitations of the train multi-band video adaptive switching method described above, and will not be repeated here.
[0056] In one exemplary embodiment, such as Figure 4 As shown, a train multi-band video adaptive switching device 400 is provided. The train multi-band video adaptive switching device 400 includes: an acquisition module 401, an extraction module 402, a calculation module 403, a judgment module 404, and a switching module 405. Specifically, The acquisition module 401 is used to acquire dual-source video data of the track area in front of the train, which are synchronously collected by the first imaging unit and the second imaging unit. The extraction module 402 is used to extract the ROI region of each frame in the dual-source video data to obtain dual-source multi-frame target images; The calculation module 403 is used to calculate the sharpness of the dual-source multi-frame target image by using the image edge gradient evaluation algorithm to obtain the sharpness score of the dual-source multi-frame target image. The judgment module 404 is used to determine whether the sharpness score of the dual-source multi-frame target image triggers switching when the current output video source is determined, by adopting an asymmetric hysteresis comparison strategy, and to obtain the switching judgment result. The switching module 405 is used to perform a switching operation based on the switching judgment result and output single-source video data to the train obstacle detection system.
[0057] As an optional implementation, the dual-source video data includes visible light video output by the first imaging unit and infrared video output by the second imaging unit. The extraction module 402 is specifically used to perform grayscale processing on the image frames of the visible light video and the infrared video respectively to obtain grayscale visible light video frames and grayscale infrared video frames; extract the ROI regions of the grayscale visible light video frames and grayscale infrared video frames respectively along the central track extension direction of the image, and remove the blurred interference areas caused by the high-speed movement of the train at the roadside edge to obtain multiple frames of target visible light images and multiple frames of target infrared images.
[0058] As an optional implementation, the above-mentioned calculation module 403 is specifically used to: calculate the gradient values in the horizontal and / or vertical directions of multiple frames of target visible light images and multiple frames of target infrared images using the Sobel operator, to obtain the gradient value of each frame of visible light image and the gradient value of each frame of infrared image; filter the gradient values of each frame of visible light image and each frame of infrared image to obtain the effective gradient values of each frame of visible light image and each frame of infrared image; sum the effective gradient values of all visible light images in each frame to obtain the original sharpness score of a single frame of visible light; perform a moving average on the original sharpness scores of K consecutive frames of visible light image to obtain the visible light sharpness score; sum the effective gradient values of all infrared images in each frame to obtain the original sharpness score of a single frame of infrared image; and perform a moving average on the original sharpness scores of K consecutive frames of infrared image to obtain the infrared sharpness score.
[0059] As an optional implementation, the aforementioned judgment module 404 is specifically used to: if the current output video source is visible light, and the visible light clarity score is lower than a first preset clarity threshold and the infrared clarity score is greater than a set multiple of the visible light clarity score, trigger the switching to output a first result; if the current output video source is visible light or infrared, and both the visible light clarity score and the infrared clarity score are lower than a second preset clarity threshold, do not trigger the switching to output a second result; wherein the second preset clarity threshold is lower than the first preset clarity threshold; if the current output video source is infrared, and the visible light clarity score is greater than a set multiple of the infrared clarity score, trigger the switching to output a third result, where the set multiple is 1.1 to 2.0 times.
[0060] As an optional implementation, the above-mentioned train multi-band video adaptive switching device 400 also includes a counting module. The counting module is specifically used to increment the counter if switching is triggered when judging visible light video and infrared video frame by frame, and reset the counter to zero if switching is not triggered. When the counter continuously accumulates to a preset number of frames, switching is performed.
[0061] As an optional implementation, the switching module 405 is specifically used to: if the switching judgment result is the first result, switch the currently output visible light video to infrared video data; if the switching judgment result is the second result, maintain the current output video source and issue a visual loss alarm; if the switching judgment result is the third result, switch the currently output infrared video to visible light video.
[0062] This implementation method, by extracting the Region of Interest (ROI) of each frame in the dual-source video data, can eliminate the blurred interference areas at the roadside edges caused by the high-speed movement of the train, reducing misjudgments caused by normal motion blur and providing reliable image data for subsequent sharpness calculations. This makes the sharpness evaluation more accurate and better suited to obstacle detection needs. By using an image edge gradient evaluation algorithm to calculate the sharpness of the dual-source multi-frame target images, the true image sharpness can be objectively quantified, unaffected by ambient light intensity, and adaptable to complex conditions such as strong light, fog, nighttime, and tunnels, ensuring the accuracy of subsequent switching decisions. By using an asymmetric hysteresis comparison strategy to determine whether the sharpness score of the dual-source multi-frame target images triggers switching, a control logic of visible light priority, strict tangential infrared, and relaxed switchback to visible light can be implemented, significantly reducing frequent switching and ensuring stable output.
[0063] In one exemplary embodiment, a computer device is provided, which may be a server or a terminal, and its internal structure diagram may be as follows. Figure 5 As shown, the computer device includes a processor, memory, input / output (I / O) interfaces, and a communication interface. The processor, memory, and I / O interfaces are connected via a system bus, and the communication interface is also connected to the system bus via the I / O interfaces. The processor provides computational and control capabilities. The memory includes non-volatile storage media and internal memory. The non-volatile storage media stores the operating system, computer programs, and a database. The internal memory provides the environment for the operation of the operating system and computer programs stored in the non-volatile storage media. The database stores train multi-band video adaptive switching data. The I / O interfaces are used for information exchange between the processor and external devices. The communication interface is used for communication with external terminals via a network connection. When the computer program is executed by the processor, it implements a train multi-band video adaptive switching method.
[0064] Those skilled in the art will understand that Figure 5 The structure shown is merely a block diagram of a portion of the structure related to the present application and does not constitute a limitation on the computer device to which the present application is applied. Specific computer devices may include more or fewer components than those shown in the figure, or combine certain components, or have different component arrangements.
[0065] In one exemplary embodiment, a computer device is also provided, including a memory and a processor, wherein the memory stores a computer program, and the processor executes the computer program to implement the steps in the above-described method embodiments.
[0066] In one exemplary embodiment, a computer-readable storage medium is provided storing a computer program that, when executed by a processor, implements the steps in the above-described method embodiments.
[0067] In one exemplary embodiment, a computer program product is provided, including a computer program that, when executed by a processor, implements the steps in the above-described method embodiments.
[0068] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, data stored, data displayed, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties, and the collection, use and processing of the relevant data must comply with relevant regulations.
[0069] Those skilled in the art will understand that all or part of the processes in the above embodiments can be implemented by a computer program instructing related hardware. The computer program can be stored in a non-volatile computer-readable storage medium. When executed, the computer program can include the processes of the embodiments described above. Any references to memory, databases, or other media used in the embodiments provided in this application can include at least one of non-volatile and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetic random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory can include random access memory (RAM) or external cache memory, etc. By way of illustration and not limitation, RAM can take many forms, such as Static Random Access Memory (SRAM) or Dynamic Random Access Memory (DRAM).
[0070] The databases involved in the embodiments provided in this application may include at least one type of relational database and non-relational database. Non-relational databases may include, but are not limited to, blockchain-based distributed databases. The processors involved in the embodiments provided in this application may be general-purpose processors, central processing units, graphics processing units, digital signal processors, programmable logic devices, quantum computing-based data processing logic devices, etc., and are not limited to these.
[0071] The technical features of the above embodiments can be combined in any way. For the sake of brevity, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.
[0072] This document uses specific examples to illustrate the principles and implementation methods of this application. The descriptions of the above embodiments are only for the purpose of helping to understand the methods and core ideas of this application. Furthermore, those skilled in the art will recognize that, based on the ideas of this application, there will be changes in the specific implementation methods and application scope. Therefore, the content of this specification should not be construed as a limitation of this application.
Claims
1. A train multi-band video adaptive switching method, characterized in that, The train multi-band video adaptive switching method includes: Acquire dual-source video data of the track area in front of the train, which is simultaneously acquired by the first imaging unit and the second imaging unit; The ROI regions of each frame in the dual-source video data are extracted to obtain dual-source multi-frame target images; The image edge gradient evaluation algorithm is used to calculate the sharpness of the dual-source multi-frame target image to obtain the sharpness score of the dual-source multi-frame target image; Given a fixed current output video source, an asymmetric hysteresis comparison strategy is used to determine whether the sharpness score of the dual-source multi-frame target image triggers switching, and the switching determination result is obtained. Based on the switching judgment result, a switching operation is performed, and single-source video data is output to the train obstacle detection system. The dual-source video data is time-stamped and frame-aligned to ensure that the imaging times of the two video frames are consistent.
2. The method of claim 1, wherein, The dual-source video data includes visible light video output from the first imaging unit and infrared video output from the second imaging unit. Extracting the Region of Interest (ROI) of each frame from the dual-source video data to obtain dual-source multi-frame target images includes: The image frames of the visible light video and the infrared video are processed into grayscale to obtain grayscale visible light video frames and grayscale infrared video frames; The ROI regions of the grayscale visible light video frames and the grayscale infrared video frames are extracted along the central track extension direction of the image, and the blurred interference areas caused by the high-speed movement of the train at the roadside edge are removed to obtain multiple frames of target visible light images and multiple frames of target infrared images.
3. The method of claim 2, wherein, The image edge gradient evaluation algorithm is used to calculate the sharpness of the dual-source multi-frame target images to obtain sharpness scores for the dual-source multi-frame target images, including: The Sobel operator is used to calculate the gradient values in the horizontal and / or vertical directions of multiple frames of visible light images and multiple frames of infrared images of the target, respectively, to obtain the gradient value of each frame of visible light image and the gradient value of each frame of infrared image. The gradient values of each frame of visible light image and each frame of infrared image are filtered to obtain the effective gradient values of each frame of visible light image and each frame of infrared image. The effective gradient values of all visible light images in each frame are summed to obtain the original sharpness score of the single frame. The visible light sharpness score is obtained by performing a moving average on the raw visible light sharpness scores of K consecutive frames. The effective gradient values of all infrared images in each frame are summed to obtain the original sharpness score of a single frame. The infrared sharpness score is obtained by performing a moving average on the raw infrared sharpness scores of K consecutive frames.
4. The method of claim 3, wherein, Given a determined current output video source, an asymmetric hysteresis comparison strategy is employed to determine whether the sharpness score of the dual-source, multi-frame target image triggers a switch, yielding a switch determination result. A first threshold is set for switching from visible light to infrared, and no pre-threshold is set for switching from infrared to visible light, forming an asymmetric hysteresis judgment interval, including: If the current output video source is visible light, and the visible light clarity score is lower than the first preset clarity threshold and the infrared clarity score is greater than the set multiple of the visible light clarity score, the first result is switched to be output. If the current output video source is visible light or infrared, and both the visible light sharpness score and the infrared sharpness score are lower than the second preset sharpness threshold, the switch to output the second result will not be triggered; wherein the second preset sharpness threshold is lower than the first preset sharpness threshold. If the current output video source is infrared, and the visible light clarity score is greater than a set multiple of the infrared clarity score, a switch to output a third result is triggered, where the set multiple is 1.1 to 2.0 times.
5. The method of claim 4, wherein, The step of performing a switching operation based on the switching judgment result and outputting single-source video data to the train obstacle detection system includes: If the switching judgment result is the first result, the current output visible light video is switched to infrared video data; if the switching judgment result is the second result, the current output video source is maintained and a visual loss alarm is issued; if the switching judgment result is the third result, the current output infrared video is switched to visible light video.
6. The method of claim 1, wherein, The method further includes: When performing frame-by-frame judgment on visible light video and infrared video, if a switch is triggered, the counter is incremented by one; if no switch is triggered, the counter is reset to zero. When the counter continuously accumulates to the preset number of frames, a switch is executed.
7. A train multi-band video adaptive switching device, characterized in that, The train multi-band video adaptive switching device includes: The acquisition module is used to acquire dual-source video data of the track area in front of the train, which are synchronously collected by the first imaging unit and the second imaging unit. The extraction module is used to extract the ROI region of each frame of the dual-source video data to obtain dual-source multi-frame target images; The calculation module is used to calculate the sharpness of the dual-source multi-frame target images using an image edge gradient evaluation algorithm, and obtain the sharpness score of the dual-source multi-frame target images. The judgment module is used to determine whether the sharpness score of the dual-source multi-frame target image triggers switching when the current output video source is determined, using an asymmetric hysteresis comparison strategy, and obtains the switching judgment result. The switching module is used to perform a switching operation based on the switching judgment result and output single-source video data to the train obstacle detection system.
8. A computer device comprising: A memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that the processor executes the computer program to implement the steps of the train multi-band video adaptive switching method according to any one of claims 1-6.
9. A computer-readable storage medium having a computer program stored thereon, characterized in that, When executed by a processor, the computer program implements the steps of the train multi-band video adaptive switching method as described in any one of claims 1-6.
10. A computer program product, comprising a computer program, characterized in that, When executed by a processor, the computer program implements the steps of the train multi-band video adaptive switching method as described in any one of claims 1-6.