CN115904371A - Instrument display method based on image interception - Google Patents

Instrument display method based on image interception Download PDF

Info

Publication number
CN115904371A
CN115904371A CN202211407153.9A CN202211407153A CN115904371A CN 115904371 A CN115904371 A CN 115904371A CN 202211407153 A CN202211407153 A CN 202211407153A CN 115904371 A CN115904371 A CN 115904371A
Authority
CN
China
Prior art keywords
function
instrument
picture
bitmap
window
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202211407153.9A
Other languages
Chinese (zh)
Inventor
张旭
莫宇诚
杨阳
郭树河
刘学敏
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Beijing Dongfang Ruifeng Aviation Technology Co ltd
Original Assignee
Beijing Dongfang Ruifeng Aviation Technology Co ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Beijing Dongfang Ruifeng Aviation Technology Co ltd filed Critical Beijing Dongfang Ruifeng Aviation Technology Co ltd
Priority to CN202211407153.9A priority Critical patent/CN115904371A/en
Publication of CN115904371A publication Critical patent/CN115904371A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D10/00Energy efficient computing, e.g. low power processors, power management or thermal management

Landscapes

  • Controls And Circuits For Display Device (AREA)

Abstract

The invention discloses an instrument display method based on image interception, which is used for improving the instrument display efficiency under an illusion engine 5. The method of the invention separately develops the instrument outside the illusion engine 5 program, and the instrument after being developed forms a separately displayed window and has a window handle of the instrument; starting an independent thread in a program of the phantom engine 5, setting a screenshot and a cache function in the independent thread, circularly intercepting an image from an instrument program window, storing the image into a bitmap format, storing the bitmap format into a picture cache of the phantom engine 5, and creating a picture display interface in the phantom engine 5 to display the instrument on a screen; and for a plurality of meters, sequentially displaying the meters according to the intercepted images according to the sequence. The invention adopts the intercepting type display instrument, ensures the independence and reusability of the instrument program, reduces the development difficulty of the illusion engine 5 program and improves the instrument display efficiency.

Description

Instrument display method based on image interception
Technical Field
The invention belongs to the technical field of computers and virtual reality, and particularly relates to a display technology of instruments and similar objects with display contents on screens under a ghost engine 5, in particular to an instrument display method based on image capture.
Background
In the field of flight simulation, with the rapid development of computer graphics and hardware performance, virtual reality equipment gradually plays an increasingly large role. Compare in traditional flight analog machine, virtual reality equipment all has apparent advantage in price, operation maintenance cost, use flexibility, has the training function that partial traditional analog machine is difficult to realize even:
(1) For procedure Training by Flight trainees, or retraining pilots, training using high-level FTDs (Fixed tracking Devices) or FFS (Full Flight Simulators) is prohibitively expensive and unnecessary.
(2) The traditional simulator training focuses on training of flight skills, and is difficult to pay attention to the problem of attention distribution of pilots in the flight process.
(3) For a part of navigation airplanes, because the development and operation costs of the simulator are higher than the actual flight training costs, no simulator manufacturer is willing to develop the simulator of the model.
(4) Different from a traditional flight simulator, one device can only correspond to one model airplane, and the virtual reality device can flexibly configure the airplane model, the training subjects and other contents through software and has the flexibility which is difficult to compare with the traditional simulator.
In the field of virtual reality program development, the illusion engine 5 has the advantages of powerful function, high operation efficiency, low development cost and the like. Therefore, the virtual reality program can be developed by using the illusion engine 5 for the project such as flight simulation. Wherein the display of instrument type objects such as altimeters, airspeeds, horizon, etc. in a virtual reality program is an integral part of the simulation system. In general, the instruments are displayed in the illusion engine 5 by direct drawing, that is, the instrument display is developed by using the classes and functions built in the engine. However, this approach has the following drawbacks:
(1) The content on the meter display screen is usually complex and requires a lot of professional parameters to update the meter display in real time, so that complex image processing and logic processing are required under the illusion engine 5, and the meter display may reduce the overall operating efficiency of the program due to the complex processing.
(2) Because of the characteristics of the illusion engine 5, development work for display and update of the meter display contents is difficult, thereby reducing the development efficiency of the project.
(3) The instrument program has larger coupling with the illusion engine 5 program, and the maintenance cost is higher.
(4) The inability to use meters that have been developed in existing systems increases the amount of duplication of effort.
(5) The instruments in the developed ghost engine 5 program do not have reusability, and it is difficult for the instruments to function in other work environments after the instrument development in the ghost engine 5 engine is completed.
Disclosure of Invention
In order to overcome the defects of low running efficiency, difficult development and poor reusability of the instrument in the prior art, the invention provides an instrument display method based on image capture, which realizes the independent development of the instrument and then completes the display of the instrument content in a mode of capturing and mapping a picture into a program of the illusion engine 5 through the program.
The invention provides an instrument display method based on image interception, which comprises the following steps:
step 1: for a meter to be displayed, the illusion engine 5 obtains an image of a window of a separate meter program, including:
setting a screenshot function in the illusion engine 5, wherein the screenshot function acquires a handle of a meter program window through a window name, then calculates the width and the height of the window through the handle of the meter program window, obtains the display range of the acquired meter program window through the width and the height, and finally obtains a bitmap handle according to the display range. And executing a screenshot function to obtain an image in the current instrument program window display range.
Step 2: the illusion engine 5 calculates bitmap-related data based on the acquired bitmap handle;
a cache function is set in the illusion engine 5, and the functions realized by the cache function comprise: acquiring the number of bytes occupied by a single pixel in a bitmap file in the current equipment (system), setting the size of a color palette, setting the structure of an information header of the bitmap, allocating a memory for the content of the bitmap, setting a bitmap file header, caching the bitmap file header and the file content. And (3) after the cache function is executed, converting the image in the display range of the instrument program window intercepted in the step (1) into a bitmap format and caching the bitmap format into a memory.
And step 3: creating a new class of pictures in the illusion engine 5 for displaying the pictures;
a new picture class is created in the ghost engine 5 program and the screenshot function of step 1 and the caching function of step 2 are called in the code of the new class.
A blueprint class inherited from the new class is created in the illusion engine 5 editor, and a picture control is added to the blueprint script for displaying pictures. The newly created blueprint class is added as a picture object in the illusion engine 5 editor.
The position, rotation, zoom of the picture is set in the illusion engine 5 editor. The size and resolution of the picture are set in the blueprint script.
And 4, step 4: adding a picture loading function and a picture refreshing function in the frame cycle of the object of the new picture class;
and judging whether old picture data exists in the frame cycle, and if so, releasing the old picture data. And then, running an image loading function to load new image data into the image texture container. And then, operating a picture refreshing function, and refreshing the picture data in the picture texture container to a screen.
And 5: adding a multi-thread code into the illusion engine 5 program;
an independent thread is used for each displayed meter, and an intercept function and cache function code is run in each independent thread. The program runs so that the screenshot and cache function codes do not occupy the main thread running time and run in an independent thread. When a plurality of meters exist, the display of one meter is carried out by circularly executing the steps each time, and the operation efficiency is improved by sequentially rendering all the meters according to the sequence.
Compared with the prior art, the invention has the advantages and positive effects that:
(1) The method adopts the form of independent development and drawing of the instrument, and has no special requirements on the drawing program, so that no special limitation is imposed on the specific application technologies such as development technology, software tools, implementation schemes and the like, thereby avoiding the problem of difficulty in developing the instrument by using the illusion engine 5.
(2) The method of the invention realizes the decoupling of the instrument and the illusion engine 5 program, solves the problem of the universality of the instrument and simultaneously improves the maintainability of the instrument program code.
(3) By adopting the method, the instrument interface which is developed independently by OpenGL for example can be multiplexed quickly and used in the virtual reality program, so that the development cost is reduced.
(4) Because the instrument is drawn by the independent program through the method, only a result image needs to be obtained in the phantom engine 5, and instrument data is not required to be processed, so that the rendering complexity of the instrument image in the phantom engine 5 is reduced, and the rendering efficiency of the instrument is improved.
(5) The image interception mode realized by the method is lighter, higher in efficiency and better in real-time performance, and the problems that the traditional plug flow scheme is high in delay and poor in real-time performance, and the requirement that the delay of a person is less than 150ms in the flight simulation process of a loop cannot be guaranteed are solved.
Drawings
FIG. 1 is a flow chart of an implementation of a meter display method based on image interception according to the present invention;
FIG. 2 is a logical relationship diagram of a meter display window implemented by the present invention and a window implemented by UE 5.
Detailed Description
The following describes the instrument display method based on image capture according to the present invention, taking an instrument developed separately by using OpenGL as an example, and describes how to map the instrument to the illusion engine 5 program in detail with reference to the accompanying drawings. The method comprises the following specific steps:
the instrument display method based on image interception of the invention is described by the following 5 steps, and the whole method is shown in figure 1.
Step 1: the illusion engine 5 obtains content data of a window of the separate meter program.
The meter program is developed independently of the ghost engine 5 program. The developed meter forms a separately displayed window and has its own window handle. Where there are multiple meters, the distinction is made by different window names.
The screenshot function is set in the ghost engine 5 program. First, in a case where a meter developed by OpenGL alone is already present and opened, the screenshot function calls the query function to obtain a window handle of the meter program by a window name, and then obtains a window rectangle by the meter program window handle, and calculates the width and height of the window, for example, the width and height of a frameless window is 0.98 times the default width and height. The bitmap information object is then set using the calculated window width and height. And then acquiring the bitmap handle through the bitmap information object and the window handle. And finally, returning the corresponding bitmap handle to complete the image interception step.
And 2, step: the computation of bitmap-related data is implemented in the illusion engine 5.
A cache function is set in the program of the illusion engine 5, and the implementation of the cache function includes the following functional codes:
(1) acquiring the number of bytes occupied by a single pixel in a bitmap file in current equipment (system) and the size of a palette: and calling an equipment description table query function to acquire the number of bytes occupied by each pixel under the current display resolution, and calculating the number of bytes occupied by a single pixel in the bitmap file according to the number of bytes occupied by each pixel under the current display resolution. The calculation rule is that when the number of bytes occupied by each pixel under the current display resolution is less than or equal to 1, 4, 8, 24 or 32, the corresponding value is 1, 4, 8, 24 or 24. For example, when the number of bytes occupied by each pixel is 7 at the current display resolution, the number of bytes occupied by a single pixel in the bitmap file is 8. And then setting the size of the color palette according to the number of bytes. If the size of the color palette is pz, the number of bytes occupied by each pixel in the bitmap is bc, and the size of the bitmap structure is rgbq, then the calculation formula for obtaining the size of the color palette is as follows:
pz=((INT64)1<<bc)*rgbq
where "(INT 64) 1" is a mandatory conversion of the number 1 into a 64-bit shaped number in the C + + syntax and "< <" is a left shift operator in the C + + syntax.
(2) Structure of information header of setting bitmap: and (3) assigning values to data such as the width and the height of the bitmap, the number of bytes and the like in the bitmap information header according to the bitmap handle in the step (1), and calculating the size of the pixel bytes in the bitmap according to the width and the height of the bitmap and the number of bytes occupied by each pixel in the bitmap. If the size of the pixel byte in the bitmap is dw, the bitmap width is bw, the bitmap height is bh, the byte number occupied by each pixel in the bitmap is bc, and the calculation formula is as follows:
dw=((bw×bc+31)/32)×4×bh
(3) allocating memory for the content of the bitmap: and using a memory allocation function to allocate memory for the bitmap by using the size of the single pixel of the bitmap, the size of the color mixing plate and the size of the structure of the bitmap information head.
(4) Setting a bitmap file header: setting the file type as bitmap and assigning values for file header parameters such as bitmap file size.
(5) Caching a bitmap file header and file contents: and setting the size of a cache container according to the size of the bitmap file header and the size of the bitmap file, and copying the bitmap file header information and the bitmap file content into the cache container by using a memory copy function.
And after the step of executing the cache function, converting the image in the window display range intercepted in the step 1 into a bitmap format and caching the bitmap format into a memory.
And step 3: objects of a new picture class are created in the illusion engine 5 for displaying the pictures.
The method comprises the following specific steps:
(1) creating a new class in the illusion engine 5 program, creating a new image loading function in the code of the new class, and calling the intercepting function in the step 1 and the caching function in the step 2 in the function.
(2) A new user interface blueprint class is created in the illusion engine 5 editor and a picture control is added to the blueprint class. And (3) creating a new blueprint class, inheriting the new class in the step (1), and adding a user interface blueprint class in the new blueprint class for displaying pictures. The blueprint class just created is added as a picture object in the illusion engine 5 editor.
(3) The position, rotation, and scaling of the picture object are set using the editing function in the illusion engine 5 editor. And setting the resolution and the size of the picture in the user interface blueprint class. The picture does not have to be the same size as the original size and will be automatically sampled by the ghost engine 5 program and finally displayed on the screen by matrix transformation and rasterization.
And 4, step 4: and adding a picture loading function and a picture refreshing function in the frame cycle.
It is determined in the frame loop of the object of the new picture class created in step 3 whether there is old picture data, and if so, the old data is released. And then, operating a picture loading function to load new picture data into the picture texture container. And then, operating a picture refreshing function, refreshing the data in the picture texture container to a screen, and finishing the display and the update of the picture.
And 5: multi-threaded code is added to the ghost engine 5 program.
And adding a multi-thread code to enable the screenshot and the cache function code set by the invention to run in an independent thread. When the program runs, the screenshot and the cache function code do not occupy the running time of the main thread, but run in an independent thread. When a plurality of meters exist, the operation efficiency is improved by displaying one meter in a cycle at a time and displaying all the meters in sequence.
The method comprises the following specific steps:
(1) and sequentially adding the functions of initialization, storage, running, stopping and quitting of the multi-thread classes of the illusion engine 5. Declaring a picture object pointer container and an instrument window pointer container, declaring a storage function for storing the picture object pointer and the instrument window pointer, and requiring that the picture object pointer and the instrument window pointer have a one-to-one correspondence relationship in the containers. A frame order variable is declared for rendering the plurality of windows in sequence.
(2) And adding a container initialization code in the initialization function, and initializing a container for recording the picture object and the name of the meter window.
(3) Adding a save code in the save function, and saving the picture object pointer and the meter window pointer into a container according to the order correspondence, for example: and storing the picture object pointer and the meter window pointer of the height meter in the meter window at the position corresponding to the container index of 2. Therefore, when the value of the frame sequence variable is 2, the program can simultaneously acquire the picture object pointer and the instrument window pointer of the altimeter.
(4) And circularly executing the screenshot function in the step 1 and the cache function in the step 2 in the running function. And adding a status bit for identifying whether a new picture is intercepted or not, judging the status bit in the refresh function in the step 4, and refreshing the picture only when the new picture is intercepted.
(5) And adding frame sequence variable judgment in the operation function, and only intercepting the meters corresponding to the buffer frame sequence in each circulation. And accumulating the frame sequence after circulation, and if the frame is the last frame, the frame sequence is returned to 0. For example: if the frame order of the "altimeter" is 2, it means that the picture object pointer and the meter window name of the "altimeter" are both stored at the position corresponding to the container index of 2. If the frame index is 2 in one loop of the running function, the index only intercepts and caches the image of the altimeter. And sets the frame index to 3 after the truncation and buffering, and if 2 is already the end of the index value, sets the index value to 0.
(6) And emptying a container for recording the picture object and the instrument window name in the stop function.
The logic relationship of the instrument display based on image capture according to the present invention is described below with reference to fig. 2, taking a separately developed instrument using OpenGL as an example:
in the figure, a meter window is an existing original meter display carrier, which is developed and completed for OpenGL in the example of the present invention, and may also be developed and implemented by using other technologies. The ghost engine 5 program is the main part of the present invention. The meter sub-window is a mapping result of the meter window, which exists in attachment to the phantom engine 5 window. When the illusion engine 5 program runs, the image capturing and image caching operations are carried out on the instrument window, and the cached image is mapped into an instrument sub-window of the illusion engine 5 window.

Claims (4)

1. An instrument display method based on image interception is characterized by comprising the following steps:
step 1: the illusion engine 5 acquires an image in an independent instrument program window of an instrument to be displayed for the instrument;
setting a screenshot function in the illusion engine 5, wherein the screenshot function acquires a handle of an instrument program window, calculates the width and height of the window through the handle of the instrument program window, obtains the display range of the acquired instrument program window from the width and height, and obtains a bitmap handle according to the display range; executing a screenshot function to obtain an image in a current instrument program window display range;
step 2: the illusion engine 5 calculates bitmap-related data based on the acquired bitmap handle;
setting a cache function in the illusion engine 5, wherein the cache function realizes the functions of: acquiring the number of bytes occupied by a single pixel in a bitmap file of the current equipment or system, setting the size of a color palette, setting the structure of an information header of a bitmap, allocating a memory for the content of the bitmap, setting a bitmap file header, and caching the bitmap file header and the file content; executing a cache function to convert the image acquired in the step 1 into a bitmap format and cache the bitmap format in a memory;
and step 3: creating a new class of pictures in the illusion engine 5 for displaying the pictures;
calling the screenshot function and the cache function in the code for setting the new picture class;
creating a blueprint class inherited from the new picture class in the illusion engine 5 editor, and adding a picture control in the blueprint script; adding a newly created blueprint class as a picture object in an editor of the illusion engine 5, and setting the position of the picture; setting the resolution and the size of the picture in the blueprint script;
and 4, step 4: adding a picture loading function and a picture refreshing function in the frame cycle of the object of the new picture class;
judging whether old picture data exists in the frame cycle, and if so, releasing the old picture data; then, running an image loading function to load new image data into an image texture container; then, operating a picture refreshing function, and refreshing the picture data in the picture texture container to a screen;
and 5: adding a multi-thread code into a virtual engine 5 program, using an independent thread for each displayed instrument, and running a screenshot function and a cache function code in each independent thread; when more than 1 meter is to be displayed, the steps are executed circularly according to the sequence, and meter display is performed in sequence.
2. The meter display method based on image interception according to claim 1, wherein in step 2, when the number of bytes occupied by a single pixel in the bitmap file is calculated, the number of bytes occupied by each pixel under the current display resolution of the current device or system is calculated, and when the number of bytes is less than or equal to 1, 4, 8, 24 or 32, the number of bytes bc occupied by a single pixel in the bitmap file of the current device or system is correspondingly taken as 1, 4, 8, 24 or 24; then, setting the size pz of the color matching plate according to the byte number bc; pz = ((INT 64) 1< < bc) > rgbq, where rgbq is the bitmap structure size, (INT 64) 1 denotes the forced conversion of the number 1 to a 64-bit integer number, and < < denotes the left shift operator.
3. The meter display method based on image interception according to claim 1 or 2, wherein said step 2, setting the structure of the information header of the bitmap, comprises: and determining the width bw and the height bh of the bitmap according to the bitmap handle, and determining the number dw of the pixel bytes in the bitmap.
4. The instrument display method based on image interception according to claim 1, characterized in that said step 5 comprises the following steps:
(1) sequentially adding an initialization function, a storage function, an operation function, a stop function and an exit function of the multi-thread class of the illusion engine 5; declaring a picture object pointer container and an instrument window pointer container, declaring a storage function for storing a picture object pointer and an instrument window pointer, and requiring that the picture object pointer and the instrument window pointer have a one-to-one correspondence relationship in the container; declaring a frame order variable for sequentially displaying a plurality of meter windows;
(2) adding a container initialization code in an initialization function, and initializing a container for recording picture objects and instrument window names;
(3) adding a storage code in a storage function, and storing the picture object pointer and the instrument window pointer into a container according to the sequence corresponding relation;
(4) circularly executing the screenshot function and the cache function in the running function, adding a status bit for identifying whether a new picture is intercepted or not, judging the status bit in the picture refreshing function, and refreshing the picture only when the new picture is intercepted;
(5) adding frame sequence variable judgment in the operation function, and only intercepting the meters corresponding to the buffer frame sequence in each cycle; accumulating the frame sequence after circulation, and resetting the frame sequence to be 0 if the current frame is the last frame;
(6) and emptying a container for recording the picture object and the instrument window name in the stop function.
CN202211407153.9A 2022-11-10 2022-11-10 Instrument display method based on image interception Pending CN115904371A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202211407153.9A CN115904371A (en) 2022-11-10 2022-11-10 Instrument display method based on image interception

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202211407153.9A CN115904371A (en) 2022-11-10 2022-11-10 Instrument display method based on image interception

Publications (1)

Publication Number Publication Date
CN115904371A true CN115904371A (en) 2023-04-04

Family

ID=86494892

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202211407153.9A Pending CN115904371A (en) 2022-11-10 2022-11-10 Instrument display method based on image interception

Country Status (1)

Country Link
CN (1) CN115904371A (en)

Similar Documents

Publication Publication Date Title
US10074206B1 (en) Network-optimized graphics library for virtualized graphics processing
US6380935B1 (en) circuit and method for processing render commands in a tile-based graphics system
US9495722B2 (en) Developer controlled layout
EP1775681A2 (en) High-level program interface for graphic operations
US10699427B2 (en) Method and apparatus for obtaining sampled positions of texturing operations
US11941752B2 (en) Streaming a compressed light field
US12112428B2 (en) Shader binding management in ray tracing
US11501467B2 (en) Streaming a light field compressed utilizing lossless or lossy compression
US20170358054A1 (en) Eliminating off screen passes using memoryless render target
US10733689B2 (en) Data processing
US20080163263A1 (en) Method for acquisition of gdi and direct x data
CN114741081A (en) Cross-operation environment display output sharing method based on heterogeneous cache access
CN114998087B (en) Rendering method and device
US6756989B1 (en) Method, system, and computer program product for filtering a texture applied to a surface of a computer generated object
CN116821040A (en) Display acceleration method, device and medium based on GPU direct memory access
US20130063464A1 (en) Primitive rendering using a single primitive type
CN115904371A (en) Instrument display method based on image interception
US8203567B2 (en) Graphics processing method and apparatus implementing window system
CN111752505A (en) Real-time image capturing method, system and storage medium for VR
CN109872268A (en) A kind of high bit rate remote sensing satellite initial data fast vision method in real time
CN112882960A (en) Data acquisition method and device
Kelleher Pixelvision architecture
US20240070962A1 (en) Graphics processing method and system
WO2023087827A1 (en) Rendering method and apparatus
Rost Using OpenGL for imaging

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination