Flight instrument automatic test method and device based on picture difference detection
By sending the same driving data to the flight simulation instrument and the original instrument, and performing picture area difference detection and grayscale processing, the problems of inefficiency and human factors in traditional testing methods are solved, and automated and accurate flight simulation instrument testing is achieved.
Patent Information
- Application Number
- CN202510657617.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-05-21
- Publication Date
- 2025-08-08
- Estimated Expiration
- 2045-05-21
AI Technical Summary
Traditional flight simulation instrument testing methods rely on manual inspection, which are inefficient, insufficient coverage, and are susceptible to human factors, making it difficult to find nuances and reproduce complex logical scenarios.
By sending the same driving data to the flight simulation instrument and the original instrument at the same time, extracting and performing picture area difference detection, combining grayscale image processing and morphological operations, automating the detection and recording of the difference area.
It realizes efficient and accurate flight simulation instrument display consistency evaluation, reduces manual workload, can batch tests and quickly filter out problem scenarios, and supports multi-level automatic testing.
Smart Images

Figure CN120448278A_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the technical field of flight instrument testing, and in particular relates to a flight instrument automatic testing method and device based on image difference detection. Background Art
[0002] The realism and accuracy of flight simulator instruments significantly impact the quality of a high-end flight simulator. During the simulator instrument development process, ensuring the fidelity and accuracy of the instrument system's appearance, color, position, and logic has long plagued testers. Traditional flight simulator instrument testing methods often rely on manual inspection and subjective judgment, resulting in low test efficiency, insufficient test coverage, and test results susceptible to subjective factors. Traditional testing methods rely solely on inputting identical data into the flight simulator instruments and manually observing the differences between the original and replica screens to determine whether the appearance, color, position, and logic of each instrument display element are consistent. First, subtle differences in the screens are difficult to detect, requiring testers to spend a significant amount of time comparing each set of comparison screens. Second, comparisons can only be performed on a limited number of typical scenarios, otherwise the tester's workload would explode. Finally, when differences occur in complex test scenarios, testers often struggle to accurately document the patterns that cause problems. Consequently, even if problems are discovered, developers struggle to reproduce them and resolve them.
[0003] Existing technology (CN118733453A) discloses performing instrument display content testing based on test cases; obtaining a test screenshot of the corresponding content display effect on the vehicle instrument screen; comparing the test screenshot with the standard display image corresponding to the target test case, analyzing the similarity information, and outputting the target test result corresponding to the test instruction based on the relationship between the processing result and a threshold. This method uses a pre-prepared standard display image to perform a comparison test with the test screen generated by the instrument under test. In this method, the standard display image is pre-prepared or set and is a static image. If the test instrument undergoes changes such as software and hardware upgrades or appearance adjustments, testing will be impossible and the standard display image must be updated, which will increase testing costs and cause test inaccuracies. Summary of the Invention
[0004] In order to overcome the problems existing in the prior art, the present invention provides a flight instrument automatic testing method and device based on image difference detection, which are used to overcome the current defects.
[0005] An automated test method for flight simulation instruments based on image difference detection, the method comprising the steps of: S1 simultaneously sends the same drive data to the flight simulation instrument and the original instrument, the flight simulation instrument and the original instrument in the same drive data, to achieve real-time dynamic one-to-one correspondence between the two screens under each set of input conditions; S2 extracts the flight simulation instrument and the original instrument according to the drive data generated by the test screen area; S3 performs difference detection analysis and processing on the two extracted test screen areas to obtain the processing results; S4. Perform data analysis and reproduction on the processing results to achieve automated testing of flight simulation instruments.
[0006] According to the above aspects and any possible implementation manner, an implementation manner is further provided, wherein the driving data in S1 is generated by a data generator, and the data generator generates the driving data according to historical generation parameter data and a combination thereof.
[0007] According to the above aspects and any possible implementation, an implementation is further provided, wherein S2 specifically includes: S21. deploying the flight simulation instrument screen and the original instrument screen in the same proportion and size; S22 sets the screen capture interval, the dynamic picture of the flight simulation instrument generated by the drive data and the original instrument dynamic picture are captured to obtain a screen image; S23. Extract the screen area to be tested from the screen image.
[0008] According to the above aspects and any possible implementation, an implementation is further provided, wherein S3 specifically includes: S31 converts the two test screen areas into grayscale images; S32. Subtract the pixel values at the same coordinates in the two grayscale images to obtain a difference pixel value; S33 compares the difference pixel value with the set threshold value and performs binarization to obtain a binary image; S34. De-noising the binary image, performing contour detection, and drawing the contours of the difference areas.
[0009] According to the above aspects and any possible implementation, an implementation is further provided, wherein the conversion formula of the grayscale image is:
[0010] in, is the pixel value of the grayscale image of the flight simulation instrument to be tested screen area or the grayscale image of the original instrument to be tested screen area at the coordinate (x, y), R(x, y), G(x, y) and B(x, y) are the pixel value of the red component, the pixel value of the green component and the pixel value of the blue component of the flight simulation instrument to be tested screen area or the original instrument to be tested screen area at the coordinate (x, y), respectively.
[0011] According to the above aspects and any possible implementation, a further implementation is provided, wherein the formula for obtaining the difference pixel value in S32 is: , in, is the pixel value at coordinate (x,y), and are the pixel values of the grayscale image of the original instrument and the grayscale image of the flight simulation instrument at the coordinate (x, y).
[0012] According to the above aspects and any possible implementation, an implementation is further provided, wherein the formula used in the binarization process is as follows:
[0013] in: is the pixel value of the binarized image at coordinate (x,y), is the difference pixel value at coordinate (x, y), and T is the preset threshold.
[0014] The present invention also provides a flight simulation instrument automatic test device based on image difference detection, which is used to implement the method described above and includes the following modules: The sending module is used to send the same driving data to the flight simulation instrument and the original instrument at the same time; An extraction module, used for extracting the image area to be tested generated by the flight simulation instrument and the original instrument according to the driving data; The analysis and processing module is used to perform difference detection, analysis and processing on the two extracted test areas to obtain processing results; The analysis and reproduction module is used to perform data analysis and reproduction on the processing results to realize automated testing of flight simulation instruments.
[0015] The present invention further provides an electronic device, comprising: a memory storing executable instructions; A processor is configured to execute the executable instructions in the memory to implement the method.
[0016] The present invention also provides a computer storage medium, on which a computer program is stored. The computer program is executed by a processor to implement the method described above.
[0017] Beneficial effects of the present invention The present invention discloses an automated test method for flight simulation instruments based on screen difference detection, the method comprising the steps of: simultaneously sending the same drive data to the flight simulation instrument and the original instrument; extracting the test screen areas generated by the flight simulation instrument and the original instrument according to the drive data; performing difference detection analysis and processing on the two extracted test screen areas, and saving the processing results; and performing data analysis and reproduction using the processing results to achieve automated testing of the flight simulation instrument. The present invention integrates advanced image processing and difference detection technologies. By automatically traversing various extreme parameters of the data, different data combinations and other operating conditions through the test software, efficient and accurate comparison and analysis between the flight simulation instrument screen and the original instrument screen is achieved, thereby improving the efficiency and accuracy of the tester's evaluation of the consistency of the flight simulation instrument display. The software's automated detection and result recording functions can record data for problematic situations, making it easier for development engineers to reproduce and modify problematic situations. The present invention has the following beneficial effects: 1) Difference detection can accurately mark the differences between two images with high speed and precision, and does not require manual comparison by test personnel, thus saving a lot of time; 2) The automated program can test images in batches, quickly skipping flight simulation instruments without problems, and can accurately screen out problematic test scenarios, facilitating problem reproduction and modification; 3) By modifying the threshold, the tolerance limit for differences can be adjusted, thereby realizing multi-level automatic testing at the image element level, regional effect level, logic level, and other levels. BRIEF DESCRIPTION OF THE DRAWINGS
[0018] Figure 1 is a flow chart of the method of the present invention; Figure 2 This is a schematic diagram of the area to be tested of the original instrument of the present invention; Figure 3 A schematic diagram of the test area of the flight simulation instrument of the present invention; Figure 4 Schematic diagram of a binary image of the present invention; Figure 5 Schematic diagram of the result of difference calculation between the original instrument and the flight simulation instrument image; Figure 6 This is the difference comparison result diagram; Figure 7 (a) and (b) are the comparative difference diagrams of the present invention with larger and smaller threshold values, respectively; Figure 8 This is a schematic diagram showing the effect of the expansion operation of the present invention; Figure 9 This is a schematic diagram of the effect of the corrosion operation of the present invention. DETAILED DESCRIPTION
[0019] To better understand the technical solutions of the present invention, the present invention includes but is not limited to the specific embodiments described below. Similar technologies and methods should be considered within the scope of protection of the present invention. To further clarify the technical problems, technical solutions, and advantages to be solved by the present invention, the following detailed description is provided in conjunction with the accompanying drawings and specific embodiments.
[0020] It should be understood that the embodiments described herein are only a portion of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by persons of ordinary skill in the art without creative effort are within the scope of protection of the present invention.
[0021] The present invention provides a flight simulation instrument automated testing method based on image difference detection, the method comprising the steps of: S1 simultaneously sends the same drive data to the flight simulation instrument and the original instrument, the flight simulation instrument and the original instrument in the same drive data, to achieve real-time dynamic one-to-one correspondence between the two screens under each set of input conditions; S2 extracts the flight simulation instrument and the original instrument according to the drive data generated by the test screen area; S3. Perform difference detection analysis and processing on the two extracted test areas to obtain processing results; S4. Perform data analysis and reproduction on the processing results to achieve automated testing of flight simulation instruments.
[0022] In the present invention, the flight simulation instrument is used as the instrument to be tested, which is a flight instrument system independently developed. It can simulate real flight under various input data and display corresponding flight parameters in real time. The accuracy and stability of its functions need to be verified. Therefore, it needs to be tested to ensure that it is completely consistent with the display of the original instrument under all test conditions to verify the accuracy and reliability of its functions. The original instrument is the instrument to be imitated and serves as a reference instrument. During the test, the flight simulation instrument and the original instrument are under the same driving data, and the real-time dynamic one-to-one correspondence of the two screens under each set of input conditions is achieved. The original instrument is used to provide theoretically correct or fully verified flight parameter display content, and is used to ensure that the data in the test has a high degree of reliability. In the present invention, it is used to serve as a control standard in the test process of the flight simulation instrument. Through comparative analysis, it is verified whether the flight simulation instrument can accurately present a display result consistent with the original instrument under the same input conditions.
[0023] Specifically, if Figure 1As shown, the specific steps of the present invention include: 1. generating driving data; 2. collecting and processing instrument screens; 3. detecting, analyzing and processing differences; 4. analyzing and reproducing data. The specific process of each step is described below: 1. Generate drive data: The driving data is generated by a data generator. The function of the data generator is to build one or more structures containing information for driving the display parameters of the flight instruments to ensure that the flight simulation instruments and the original instruments operate under consistent input data, thereby testing the various display states of the flight simulation instruments. Alternatively, the data generator can also load saved results to reproduce the test results. Here, the primary flight display (PFD) is used as a flight simulation instrument, and its parameter structure is used as an example. This structure contains fields for the key flight parameters displayed on the primary flight instrument PFD. These parameters include but are not limited to the parameters described in Table 1.
[0024] Table 1. Related parameters of primary flight instruments
[0025] The working principle of the data generator is as follows: The working mode of the data generator: There are two working modes: parameter generation mode and parameter reading mode.
[0026] (1) In parameter generation mode: the data generator automatically generates data according to the range of each parameter, including traversal generation and random generation. Among them, traversal generation starts from the minimum value and increases in fixed steps according to the parameter range until the maximum value, thereby ensuring that the parameter values tested cover all possible situations, especially the tests of boundary values and extreme situations. By covering all possible parameters in the range from minimum to maximum value, the data generator can simulate various states during the flight process after inputting the flight simulation instrument. Subsequently, by performing a drive comparison analysis on the flight simulation instrument and the original instrument, it is ensured that the display logic of the flight simulation instrument is consistent with the specified standard of the corresponding display of the original instrument, thereby providing a guarantee for the comprehensiveness and reliability of the test.
[0027] Take the Altitude pressure altitude in Table 1 as an example: Parameter: Altitude (pressure altitude), unit: feet; Range: 1000-1500; Step: 1 foot; Generation process: Start from 1000 and increase by 1 each time until 1500; Generation sequence: 1000, 1001, 1002, 1003, ..., 1500.
[0028] Random generation involves randomly generating a certain number of data points within the parameter range. Each data point is generated independently and without any regularity. This method more closely reflects the dynamic fluctuations of a real-world flight environment and helps verify the stability of flight simulator instruments under nonlinear and irregular inputs.
[0029] Let's take the Altitude pressure data in Table 1 as an example: Parameter: Altitude (pressure altitude), in feet; Range: 1000-1500; Generation Strategy: Randomly generate 500 values; The generated results (example): 1050, 1002, 1166, 1356, ... Because the data is randomly generated, the values may vary from one time to the next. This generated data is used as input for flight simulator instrument parameters to fully test the display functions of the flight simulator instrument.
[0030] Therefore, the data in parameter generation mode is complete test data automatically created by the data generator based on the set range and frequency rules, and is subsequently used to verify the functional performance of flight simulation instruments under the full range of flight conditions.
[0031] (2) The parameter reading method is that the data generator generates a driving data pattern by loading existing test data from a saved history file. The core of this mode is to reproduce past test scenarios, which is particularly suitable for the following situations: Reproducing historical tests: Reproducing logically complex test scenarios to check problem location or confirm that the results after repair are in line with expectations; Comparative analysis: Combining the historical output data of flight simulation instruments to verify the display differences between flight simulation instruments and original instruments in specific scenarios; or debugging and optimization: Backtracking and repair testing at the fault point. The saved historical data is shown in Table 1. It is constructed by the data generator and the difference value is determined to be greater than or equal to the set threshold through difference analysis. The read historical data is the data in the saved test records, which is used to reproduce the problem in a targeted manner and conduct in-depth analysis.
[0032] The following is an example of reading a history file: Timestamp T1: Altitude = 0, Airspeed = 145 Timestamp T2: Altitude = 1000, Airspeed = 145 Timestamp T3: Altitude = 2000, Airspeed = 145.
[0033] The data generator's parameter combination mode combines multiple parameter values to generate diverse combinations of parameters, creating complex, multi-dimensional test data. This mode is used to simulate various flight conditions and environments, as well as the multi-parameter interactions of flight simulator instruments in real-world environments. This mode supports traversing the extreme values of each parameter while also covering a wide range of possible multi-parameter interactions.
[0034] Take the two parameters Altitude (pressure altitude) and Airspeed (indicated airspeed) as an example: Parameter 1: Altitude (pressure altitude), generated using traversal, ranging from 0 to 10,000, with a step size of 1,000; Parameter 2: Airspeed (indicates airspeed), randomly generated, ranging from 0 to 380; The generated combination process is: traverse Altitude from 0 to 10,000, increasing by 1,000 each time; for each Altitude value, randomly generate an Airspeed value.
[0035] The combined result generated by the above process is as follows: (Altitude=0, Airspeed=145) (Altitude=1000, Airspeed=350) (Altitude=2000, Airspeed=100)….
[0036] This combination can simulate complex flight conditions, such as low altitude and low speed, high altitude and high speed, and other actual situations.
[0037] For more complex flight conditions, the parameter combination can be a multi-parameter combination. Take the three parameters Altitude (pressure altitude), Vertical Speed (vertical speed) and Pitch (pitch angle) as an example: Parameter 1: Altitude (barometric altitude), range is 5000 to 10,000, step size is 1,000.
[0038] Parameter 2: Vertical Speed, range is -6,000 to 6,000, randomly generated.
[0039] Parameter 3: Pitch (pitch angle), range is -30° to 30°, randomly generated.
[0040] The resulting combinations are as follows: (Altitude=5000, Vertical Speed=1500, Pitch=12) (Altitude=6000, Vertical Speed=-3000, Pitch=-8) (Altitude=7000, Vertical Speed=4500, Pitch=5)….
[0041] Each combination corresponds to a specific flight state, such as climbing, descending, or adjusting attitude. Therefore, the data generator can cover test scenarios in a multi-dimensional parameter space through comprehensive combinations.
[0042] The data generator's synchronous data transmission method: Based on a preset parameter structure, parameter range, and generation rules, the data generator dynamically generates drive data for a single parameter or a combination of multiple parameters through parameter generation mode. This generation process includes traversal generation (covering all values within the parameter range) and / or random generation (randomly extracting multiple values within the range) to simulate various flight conditions and input conditions. Alternatively, the data generator loads generated test data from a saved history file through data reading mode to reproduce issues, verify repair results, or perform comparative analysis of display differences. Drive data is simultaneously transmitted by the data generator to both the flight simulation instrumentation and the original instrumentation, ensuring that the two sets of instruments operate synchronously with the same data input. Display discrepancies caused by time differences are avoided by precisely controlling the transmission time points and intervals.
[0043] Through these working modes of the data generator, the data generator can generate driving data that comprehensively traverses all parameter values and / or parameter combinations input to the flight simulation instruments and the original instruments, thereby greatly improving the test efficiency and coverage of various display states of the flight simulation instruments during testing. The differences between the flight simulation instruments and the original instruments can be fully discovered and recorded, which helps to locate and solve problems in a timely manner.
[0044] 2. Instrument screen acquisition and processing: Extract the flight simulation instrument to be tested screen area and the screen area displayed in the original instrument corresponding to the area. The two areas are as follows: Figure 2 and Figure 3 shown.
[0045] a. Deploy a consistent image First, the display screen of the flight simulation instrument and the display screen of the original instrument are set to the same ratio and size, for example, deployed on a target computer, to ensure that a detection area of the same size is provided for subsequent processing.
[0046] b. Set the image capture interval Set the screenshot to be taken every 1 second to balance the requirements of real-time performance and data processing volume, and capture the screen image on the computer. This operation ensures that the dynamic changes of the flight simulation instrument screen and the original instrument screen can be captured.
[0047] c.ROI region extraction Image processing technology is used to accurately extract two designated ROI (Region of Interest) areas from the captured screen image, namely the same screen area to be tested for the flight simulation instrument and the original instrument. The present invention also uses the display area corresponding to this area in the original instrument as the screen area to be tested. The image processing technology used here is an existing mature technology and will not be described in detail in this invention. The same conditions used during extraction include but are not limited to the same proportions and sizes when the flight simulation instrument and the original instrument are deployed; the two extracted ROI areas are consistent in size and position, and the regions of interest are consistent (for example, the area displaying the speed indicator). In other words, a certain area in the flight simulation instrument corresponds one-to-one with the area corresponding to the same area in the original instrument, and both the position and size ratio are consistent. In addition, the input conditions of the flight simulation instrument and the original instrument are the same at the same time.
[0048] 3. Difference detection, analysis and processing Since the data generator sends the same drive data to the flight simulation instrument and the original instrument at the same time, if there is no coding error in the flight simulation instrument, theoretically the flight simulation instrument and the original instrument should display exactly the same picture. Therefore, through difference detection, the inconsistencies between the display of the flight simulation instrument and the original instrument can be found, so as to check whether there is any coding error in the flight simulation instrument software.
[0049] When performing difference detection on the two extracted ROI regions of interest, the steps are as follows: a. Convert to grayscale: The two extracted ROIs are converted separately to obtain two corresponding grayscale images. This step simplifies the image data by removing color information and retaining only brightness information, thereby reducing computational complexity and improving processing speed.
[0050] The grayscale formula is as follows: (1) in: It represents the pixel value at the coordinate (x, y) of the grayscale image converted from the flight simulation instrument screen area to be tested or the corresponding original instrument screen area, where x and y are the position coordinate values of the pixel point in the image; R(x,y), G(x,y) and B(x,y) are the pixel value of the red component, the pixel value of the green component and the pixel value of the blue component of the flight simulation instrument screen area to be tested or the corresponding original instrument screen area at the coordinate (x,y).
[0051] b. Pixel comparison: Compare the pixel values of the processed grayscale image of the flight simulation instrument to be tested and the corresponding grayscale image of the original instrument screen area. This step uses the pixel difference method to directly algebraically subtract the pixel values of the same coordinates in the two grayscale images.
[0052] The specific calculation method of the pixel difference method is as follows: for two grayscale images, the pixel values are taken at the corresponding pixel positions, and then the difference operation is performed. Since the pixel values in the grayscale image are integers between 0 and 255, the result of the difference operation may be negative. Therefore, the absolute value of the result is taken to avoid the result being negative. The calculation result is as follows Figure 5 As shown, the calculation formula is as follows: (2) in, The pixel value at the coordinate (x, y) of the difference image formed by the grayscale image of the original instrument and the flight simulation instrument, that is, the difference pixel value; and are the pixel values of the grayscale images of the original instrument and the flight simulation instrument at coordinates (x, y), is the original instrument image, This is a flight simulation instrument image.
[0053] The present invention uses the pixel difference method as an example here for illustration. Other graphic image methods such as convolution can also be used here to perform difference operations on the pixels of two images, and the present invention is not limited thereto.
[0054] c. Set the difference threshold (binarization): The difference threshold T is a preset value. In the present invention, T is set to 10. By setting the threshold, the pixel value of the difference image is Perform binarization to make the difference areas more obvious, thus facilitating the control of detection sensitivity. Figure 4 The binary image formed is shown as follows, Figure 4 and Figure 5 The white parts represent the original instrument images and flight simulation instrument images The areas with large differences between the two images indicate that the content of the two images at these pixel locations is significantly different, so they appear to be ghosting. The ghosting part represents the difference between the two images detected. Figure 7 As shown, when the threshold is set to a small value, the original instrument image can be detected and flight simulation instrument images The threshold is set to a higher value, which is more sensitive to subtle differences between the two instruments. However, when the threshold is set too high, only significant differences can be detected, and subtle differences will be ignored. Therefore, according to actual needs, setting an appropriate threshold T can effectively help testers and developers more accurately identify and detect the differences between the images of the two instruments, thereby ensuring the reliability and accuracy of the simulation system. The binarization processing formula used is as follows: (3) in: is the pixel value of the binarized image at coordinate (x, y); The difference pixel value at coordinate (x, y); T is the preset threshold.
[0055] when When the difference pixel value at the coordinate (x, y) is greater than or equal to T, is 1, which is the value of 1 in the difference image It appears as a bright area; when When the difference pixel value at coordinate (x, y) is less than T, is 0, which is the value of 0 in the difference image In the following description, Described as a binarized image.
[0056] d. Morphological operations (opening and closing) and drawing the contours of the difference areas.
[0057] In this step, the obtained binary image is optimized. First, the binary image is removed by morphological opening and closing operations. The noise in the image is removed and small holes are filled to make the edge smoother. Then, the contour detection is performed on the smoothed image to obtain the binary image after morphological processing optimization. In the binary image after morphological processing optimization, all external contour points are detected and these contour points are fitted into the minimum circumscribed rectangle. Then, in the original instrument image By marking the bounding boxes of these different areas, the difference between the images of the flight simulation instrument and the original instrument can be visually displayed. In this way, all the differences between the display contents of the flight simulation instrument and the original instrument can be clearly located and visualized. The results are as follows: Figure 6 shown. Figure 6 and Figure 7For Figure 4 or Figure 5 This effect creates a ghost image effect whereby a border is added to the image after identifying the ghost image, indicating areas with significant differences. Ghosting occurs when the two images displayed on the two instruments are offset from each other. This causes some areas to appear as ghost images or have blurred edges when calculating the pixel difference.
[0058] The present invention uses image binarization to convert the original instrument image The foreground and background in the image are clearly segmented. The binarized image provides basic information for subsequent processing, clearly distinguishing the foreground (difference area) and the background. Then, through morphological operations, such as opening and closing operations, the quality of the binary image is further optimized to remove noise, fill holes and make the region boundaries smoother. The results after morphological processing are used as input for contour detection. In the contour detection stage, the foreground area in the morphologically processed binary image is searched, and all external contour points are extracted. Based on these contour points, the contour points of each area are fitted into the minimum circumscribed rectangle, and the coordinates of the four vertices of the rectangle are generated. Subsequently, these rectangular boxes are drawn to the original instrument image. On the instrument image, the boundaries of the difference areas are marked with a conspicuous color (such as red or other colors) to make the differences visually visible. Through this series of processing, all the differences between the original instrument image and the flight simulation instrument image can be displayed intuitively and accurately, making it easier to observe and analyze the differences. It has a pixel-level correspondence with the binary image. Therefore, the rectangular coordinates of the difference area extracted from the binary image can be directly mapped to the original instrument image. Mark on.
[0059] The opening and closing operations use expansion and corrosion operations. The specific process is as follows: set up It is a structural template. As the rectangle described above, a 3*3 pixel rectangular template is defined here, and its values are only 0 and 1.
[0060] Dilation operation: Use the dilation calculation method to dilate the 3*3 pixel rectangular template in the binary image. Move pixel by pixel. For the binary image Each position , if the rectangular template Any pixel in the binary image If the foreground (value is 1) overlaps, set The pixel value at is the foreground, that is, the value is 1; otherwise, set The pixel value at is the background, that is, the value is 0. Through the expansion operation, the binary image can be effectively filled The small holes in the foreground are expanded, and the edges of the foreground area are connected, making the processed image smoother and more complete. Figure 8 shown.
[0061] Binarized image and for The set of Z is an integer set, quilt Expansion, recorded as , then the expansion is defined as: (4) Indicates that Place the center of the image Pixel position The results are as follows Figure 8 shown.
[0062] Erosion operation: Use the erosion calculation method to convert the 3*3 pixel rectangular template into a binary image. Move pixel by pixel. For the binary image Each position , if all pixels within the rectangular template are completely contained in the binary image Foreground (value is 1), then set The pixel value at is foreground (1); otherwise, The pixel value at is set to background (0). Through the erosion operation, the binary image can be effectively removed. The small noise in the image is reduced, the foreground area is reduced, the edge of the processed image is smoother, and the narrowly connected foreground parts are separated. The results are as follows Figure 9 shown.
[0063] and for A collection of quilt Corrosion, recorded as , then corrosion is defined as: (5) Indicates that Place the center of the image Pixel position superior.
[0064] The opening operation is to corrode first and then expand. quilt Perform the opening operation and record it as , which is defined as: (6) The closing operation is expansion followed by corrosion, then quilt The closing operation is recorded as , which is defined as (7) Where, represents the corrosion operation, Represents an expansion operation.
[0065] d. Save the results If the pixel value of the difference image in the aforementioned step exceeds the threshold value T, it indicates that there are significant differences in the display between the original instrument and the flight simulation instrument, requiring further manual investigation and repair. Therefore, all information on this situation needs to be saved to facilitate manual processing by subsequent testers or developers. For cases where the pixel value is less than the threshold value T, the test is considered normal or there are small deviations that can be ignored, so no further processing is required, indicating that the flight simulation instrument and the original instrument are consistent in display, and the flight simulation instrument is considered normal and has passed this test. This step automatically filters by setting a threshold to distinguish between inconsistent and consistent situations, thereby reducing the workload of manual processing.
[0066] If the inconsistency exceeds threshold T, this test indicates a problem with the flight simulator instrument. The data involved in the test process is recorded and saved. This includes, but is not limited to, screenshots of the original instrument and the flight simulator instrument, along with their difference images, and the drive data generated by the data generator and input to the two instruments. This drive data includes, but is not limited to, drive parameters or structural parameters, and set thresholds. These records enable developers to accurately reproduce the problem scenario.
[0067] 4. Data Analysis and Reproduction Phase After the test is complete, the data analysis and reproduction phase begins. Using the saved test results as historical data, a data generator is used to read the driver parameters or structure parameters stored in the historical data to reproduce the problem scene. This allows development engineers to quickly reproduce the problem scenario, facilitating accurate diagnosis and correction, gaining a deeper understanding of the root cause, and providing precise problem reproduction scenarios for subsequent testing, greatly improving the efficiency of problem location and resolution. This process reduces the workload of manual analysis during testing. Testers or developers only need to reproduce the saved problematic situation to evaluate, judge, and modify it, thereby reducing the workload of manual testing.
[0068] This invention uses a real, original instrument (i.e., an instrument body used in a real aircraft, originally manufactured, industry- or user-approved and trusted) as a dynamic comparison benchmark and simultaneously drives both the original and simulated instruments for automated comparative testing. Using these two instruments for testing offers the following advantages: On the one hand, the present invention realizes a real-time dynamic one-to-one correspondence between the images of the original instrument and the flight simulation instrument under each set of input conditions by synchronously sending equivalent drive data to the original instrument and the flight simulation instrument. The standard image thus generated is directly derived from the real-time display of the original instrument, and truly reflects the actual display effect achieved by the hardware entity and internal software of the original instrument under a specific drive input, thereby ensuring that the comparison benchmark is completely consistent with the actual use scenario of the flight simulation instrument. Regardless of how the input data changes, the system can adaptively complete the comparison, fundamentally overcoming the limitation of the prior art that the static standard image solution that relies on pre-generated or obtained cannot adapt to complex test scenarios such as multi-parameter linkage and dynamic working conditions.
[0069] On the other hand, the method does not require manual maintenance and updating of the standard image library. The original instrument's image can always be updated synchronously with the flight simulation instrument. Regardless of equipment changes such as software and hardware upgrades and appearance adjustments, it can automatically adapt without manual repair or reconstruction of a large number of image libraries, so that the test benchmark is always strictly consistent with the flight simulation instrument, greatly reducing maintenance costs and the risk of misjudgment caused by untimely maintenance. At the same time, because the present invention uses the actual images generated by two real instruments as a comparison benchmark, it can effectively accommodate the natural differences in hardware details such as display resolution, color matching, and fonts, greatly improving the scientificity and robustness of the test results, and significantly reducing false alarms and missed detections caused by environmental changes or hardware differences.
[0070] Finally, the method of the present invention compares the images generated in real time by the flight simulation instrument and the original instrument, thereby ensuring that the images are accurately compared or aligned, and there is no problem of comparison probability, that is, the subsequent work is done after considering whether the two are accurately compared. Therefore, the comparison accuracy of the present invention can be regarded as 100%. Therefore, it is different from the prior art that needs to align the test screenshot of the vehicle and the standard display image corresponding to the target test case, and then perform subsequent processing based on the probability of alignment.
[0071] Furthermore, the present invention implements multi-level automatic difference detection for static images, dynamic transitions, animated displays, and complex logic linkages. During each test, all abnormal events are simultaneously recorded with the original drive data and the real-time images of the two instruments, providing powerful data support for subsequent problem analysis, tracing, and historical reproduction. This significantly improves the efficiency of problem location and repair in complex scenarios, resolving the difficulty of traditional standard image-based technologies in automatically tracking and reproducing problems in highly dynamic and complex working conditions.
[0072] In summary, the present invention overcomes many limitations of the existing technology by introducing real original instruments under homologous dynamic drive as a comparison benchmark, significantly improves the comprehensiveness, scientificity and engineering application value of automated testing of flight simulation instruments, and has wide industry applicability.
[0073] As an embodiment disclosed in the present invention, the present invention further discloses an automated test device for flight simulation instruments based on image difference detection, the device being used to implement the method described, comprising the following modules: The sending module is used to send the same driving data to the flight simulation instrument and the original instrument at the same time; An extraction module, used for extracting the image area to be tested generated by the flight simulation instrument and the original instrument according to the driving data; The analysis and processing module is used to perform difference detection, analysis and processing on the two extracted test areas to obtain processing results; The analysis and reproduction module is used to perform data analysis and reproduction on the processing results to realize automated testing of flight simulation instruments.
[0074] As an embodiment disclosed in the present invention, the present invention further discloses an electronic device, comprising: a memory storing executable instructions; A processor runs the executable instructions in the memory to implement the method described in the present invention.
[0075] As an embodiment disclosed in the present invention, the present invention further discloses a computer storage medium, on which a computer program is stored. The computer program is executed by a processor to implement the method described in the present invention.
[0076] The terms used in the embodiments of the present invention are only for the purpose of describing specific embodiments and are not intended to limit the present invention. The singular forms "a", "an", "the" and "the" used in the embodiments of the present invention and the appended claims are also intended to include plural forms unless the context clearly indicates otherwise.
[0077] The foregoing description shows and describes several preferred embodiments of the present invention. However, as previously stated, it should be understood that the present invention is not limited to the form disclosed herein and should not be construed as excluding other embodiments. Rather, the present invention can be used in various other combinations, modifications, and environments and can be modified within the scope of the application concept described herein by the teachings above or by techniques or knowledge in the relevant field. Modifications and variations made by those skilled in the art that do not depart from the spirit and scope of the present invention are intended to be protected by the appended claims.
Claims
1. A flight simulation instrument automation test method based on image difference detection, characterized in that: The method comprises the steps of: S1 simultaneously sends the same drive data to the flight simulation instrument and the original instrument, the flight simulation instrument and the original instrument in the same drive data, to achieve real-time dynamic one-to-one correspondence between the two screens under each set of input conditions; S2 extracts the flight simulation instrument and the original instrument according to the drive data generated by the test screen area; S3 performs difference detection analysis and processing on the two extracted test screen areas to obtain the processing results; S4. Perform data analysis and reproduction on the processing results to achieve automated testing of flight simulation instruments.
2. The method according to claim 1, characterized in that The driving data in S1 is generated by a data generator, and the data generator generates the driving data according to historical generation parameter data and combinations thereof.
3. The method according to claim 1, characterized in that The S2 specifically includes: S21. Deploy the flight simulation instrument screen and the original instrument screen in the same proportion and size; S22 sets the screen capture interval, the dynamic picture of the flight simulation instrument generated by the drive data and the original instrument dynamic picture are captured to obtain a screen image; S23. Extract the screen area to be tested from the screen image.
4. The method according to claim 3, characterized in that The S3 specifically includes: S31. The two areas of the screen to be tested are converted into grayscale images; S32. Subtract the pixel values at the same coordinates in the two grayscale images to obtain a difference pixel value; S33 compares the difference pixel value with the set threshold value and performs binarization to obtain a binary image; S34. De-noising the binary image, performing contour detection, and drawing the contours of the difference areas.
5. The method according to claim 4, characterized in that The conversion formula of the grayscale image is: , in: is the pixel value of the grayscale image of the flight simulation instrument to be tested screen area or the grayscale image of the original instrument to be tested screen area at the coordinate (x, y), R(x, y), G(x, y) and B(x, y) are the pixel value of the red component, the pixel value of the green component and the pixel value of the blue component of the flight simulation instrument to be tested screen area or the original instrument to be tested screen area at the coordinate (x, y), respectively.
6. The method according to claim 4, characterized in that The formula for obtaining the difference pixel value in S32 is: , in, is the pixel value at coordinate (x,y), and are the pixel values of the grayscale image of the original instrument and the grayscale image of the flight simulation instrument at the coordinate (x, y).
7. The method according to claim 4, characterized in that The formula used in the binarization process is as follows: , in: is the pixel value of the binarized image at coordinate (x,y), is the difference pixel value at coordinate (x, y), and T is the preset threshold.
8. An automatic test device for flight simulation instruments based on image difference detection, characterized in that: The device is used to implement the method according to any one of claims 1 to 7, and includes the following modules: The sending module is used to send the same driving data to the flight simulation instrument and the original instrument at the same time; An extraction module, used for extracting the image area to be tested generated by the flight simulation instrument and the original instrument according to the driving data; The analysis and processing module is used to perform difference detection, analysis and processing on the two extracted test areas to obtain processing results; The analysis and reproduction module is used to perform data analysis and reproduction on the processing results to realize automated testing of flight simulation instruments.
9. An electronic device, characterized in that: The electronic device comprises: a memory storing executable instructions; A processor, wherein the processor runs the executable instructions in the memory to implement the method according to any one of claims 1 to 7.
10. A computer storage medium, characterized in that The medium stores a computer program, which is executed by a processor to implement the method according to any one of claims 1 to 7.
Citation Information
Patent Citations
High-resolution remote sensing image variation detection method based on self-adaptive threshold division
CN101976437A
User interface information processing method and device, electronic equipment and storage medium
CN112612690A
Meteorological radar data simulation method and device
CN113945933A
Method and device for detecting uncertainty in simulation task, equipment and storage medium
CN114238050A
Simulation camera verification method, device and equipment, storage medium and program product
CN114299166A