Character superposition method, computer equipment, storage medium and sighting telescope display system
By generating OSD files and using EDA software to generate FPGA character overlay code, the problems of high complexity and difficulty in debugging FPGA character overlay are solved, and efficient overlay of characters of any size and color at any position in the image is achieved.
Patent Information
- Application Number
- CN202511008642.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-07-22
- Publication Date
- 2025-10-10
AI Technical Summary
The existing FPGA character overlay method has the problems of high complexity and difficulty in debugging when realizing the overlay of characters of any size and color at any valid position in the image.
By obtaining the resolution of the image to be processed and the information of the characters to be superimposed, an OSD file is generated, and the FPGA-based character superposition code is generated using EDA software. The code is loaded into the FPGA chip through the bit stream to realize the superposition of characters on the image.
It simplifies the complexity of FPGA character overlay, reduces debugging difficulty, improves development efficiency, and supports the overlay of characters of any size and color at any valid position with low latency.
Smart Images

Figure CN120769099A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of image display technology, and in particular to a character overlay method, computer equipment, storage medium and sighting display system. Background Art
[0002] With the widespread application of video technology, character overlay functionality is becoming increasingly popular. Character overlay allows for the addition of valid characters to video images, creating key annotations. Character overlay can also implement menu systems, presenting menu options on display devices. Users can interact with these options through input devices, enabling control of other peripherals. There are two traditional approaches to implementing character overlay using an FPGA (Field Programmable Gate Array). The first involves buffering a complete image frame into memory via an ARM (Advanced RISC Machine) or CPU (Central Processing Unit). The FPGA then overlays the character image from the memory onto the video image. This method can produce richer overlay content and effects, but it also requires a large memory capacity to buffer the complete image, resulting in low processing efficiency and high latency. The second approach involves storing the character library in the FPGA's internal ROM (Read Only Memory). While the FPGA performs high-speed image or video acquisition, character overlay is implemented through logic. This method requires only a single FPGA chip and offers low latency and strong real-time performance. However, as the number of overlayed characters increases, the programming logic becomes increasingly complex and debugging becomes increasingly difficult. Therefore, there is an urgent need for a method that can realize the superposition of characters of any size and color at any valid position in the image, and can simplify the complexity of FPGA character superposition and reduce the difficulty of debugging. Summary of the Invention
[0003] The purpose of the present invention is to provide a character overlay method, computer equipment, storage medium and sight display system, which can realize the overlay of characters of any size and color at any valid position of an image, and can simplify the complexity of FPGA character overlay, reduce the difficulty of debugging, and accelerate the progress of FPGA development.
[0004] The technical solutions provided by the present invention are as follows:
[0005] In a first aspect, the present application provides a method for superimposing characters on an image, comprising the steps of:
[0006] Acquiring the resolution of the image to be processed and the effective image area of the image to be processed;
[0007] Acquire character information of a character to be superimposed, the character information including font data information, size information, color information of the character to be superimposed, and position information of the character to be superimposed on the effective image area;
[0008] Generate a corresponding OSD file according to the resolution and the character information;
[0009] Generating a character overlay code based on FPGA according to the OSD file;
[0010] Instantiate the character overlay code into the video data stream module and generate an FPGA-based bit stream through EDA software;
[0011] The bit stream is loaded into the FPGA chip, and the display module is controlled to display the image containing the characters to be superimposed.
[0012] This solution obtains the resolution of the image to be processed and the character information of the characters to be superimposed, and can generate an OSD file containing the character information. Then, based on the OSD file, an FPGA-based character superposition code is generated. The character superposition code can be instantiated into the video data stream module, and an FPGA-based bit stream is generated through EDA software, so that the FPGA chip can control the display module to display the image containing the characters to be superimposed, thereby realizing the superposition of characters of any size and color at any valid position in the image. It can also simplify the complexity of FPGA character superposition, which is conducive to reducing debugging difficulty and accelerating FPGA development progress.
[0013] In some implementations, generating a corresponding OSD file according to the resolution and the character information includes:
[0014] The OSD file is sent to an executable JAR file package to generate the corresponding OSD file. The executable JAR file package includes a file configuration parsing module, a character ROM generation module and a pixel point extraction module.
[0015] In some implementations, the file configuration parsing module is used to configure and parse the OSD file to obtain the character information.
[0016] In some embodiments, the character ROM generation module is used to convert the dot matrix information of each character to be superimposed into ROM information based on the font data information of the character to be superimposed parsed by the file configuration parsing module, and calculate the ROM address starting position of each character to be superimposed based on the width and height of each character to be superimposed.
[0017] In some embodiments, the pixel point extraction module is used in the video processing pipeline to calculate the corresponding character ROM address and extract the corresponding pixel data based on the position of the current pixel, the starting position of the ROM address, and the position information of the character to be superimposed on the valid image area.
[0018] In some embodiments, the method further includes: setting up a plurality of processing modules, each of which is independent of each other and connected in series or in parallel in the video processing pipeline, and each character to be superimposed corresponds to one processing module to achieve superposition of multiple characters to be superimposed.
[0019] In a second aspect, the present application provides a computer device comprising a memory, a processor, and a computer program stored in the memory, wherein the processor executes the computer program to implement the steps of the character overlay method described in the first aspect.
[0020] In a third aspect, the present application provides a computer storage medium having a computer program or instruction stored thereon, which, when executed by a processor, implements the steps of the character overlay method described in the first aspect.
[0021] In a fourth aspect, the present application provides a sight display system, comprising a camera end and a display control end, wherein the camera end is used to acquire an image and send the image to the display control end;
[0022] The display and control end is used to display the image through the display module, and convert the control signal sent by the control module into a control instruction. Part of the control instruction is sent to the camera end, and the other part of the control instruction is superimposed on the image for display through the character overlay method described in the first aspect.
[0023] In some embodiments, the camera end is communicatively connected to the display and control end via a terahertz wireless short-range communication module.
[0024] The character overlay method, computer device, storage medium, and sight display system provided by the present invention have at least the following technical effects:
[0025] (1) This solution is easy to operate and can improve FPGA development efficiency. It can automatically generate FPGA character overlay code through character setting software, greatly reducing FPGA programming development time and debugging time.
[0026] (2) This solution can achieve the diversification of superimposed characters by setting the character font, size and color;
[0027] (3) This solution has a wider application range and can support the superposition of characters of any size and resolution;
[0028] (4) This solution takes up less resources and has low latency, and the same character only needs to be cached once in the ROM. BRIEF DESCRIPTION OF THE DRAWINGS
[0029] The preferred implementation scheme will be described below in a clear and understandable manner with reference to the accompanying drawings to further illustrate the above-mentioned characteristics, technical features, advantages and implementation methods of this solution.
[0030] Figure 1 This is a schematic diagram of the overall process of an embodiment of the present invention;
[0031] Figure 2 This is a schematic diagram of a character superimposition code generation process according to an embodiment of the present invention;
[0032] Figure 3 is a schematic diagram of a sighting system according to an embodiment of the present invention;
[0033] Figure 4 This is a schematic diagram of the display and control terminal of the aiming system according to one embodiment of the present invention. DETAILED DESCRIPTION
[0034] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the specific embodiments of the present invention will be described below with reference to the accompanying drawings. Obviously, the drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings and other embodiments can be obtained based on these drawings without inventive work.
[0035] To simplify the drawings, only the parts relevant to the present invention are schematically shown in each figure. They do not represent the actual structure of the product. Furthermore, to simplify the drawings and facilitate understanding, in some figures, only one of the components with the same structure or function is schematically depicted or labeled. As used herein, "one" not only means "only one" but also "more than one."
[0036] With the widespread application of video technology, character overlay functions are widely demanded. Character overlay can be used to add key annotations to video images by overlaying valid characters on them. Character overlay can also implement a menu system and present menu options on the display device. Users can interact through input devices to control other peripherals. There are two traditional ways to implement character overlay through FPGA (Field Programmable Gate Array): the first is to cache a complete frame of image into memory space through ARM (Advanced RISC Machine) or CPU (Central Processing Unit), and then the FPGA overlays the character image in the memory onto the video image. This method can present richer overlay content and effects. The second is to store the font library in its internal ROM (Read Only Memory) through the FPGA. While the FPGA is performing high-speed image or video acquisition, character overlay is implemented through logic. This method only requires a single FPGA chip to implement, and the overlaid character image has low latency and strong real-time performance.
[0037] However, the disadvantage of the first character superposition method mentioned above is that it requires a large-capacity memory to cache the complete image, and the superimposed image processing efficiency is low and the delay is large; the disadvantage of the second character superposition method mentioned above is that as the number of superimposed characters increases, its programming logic becomes more complex and debugging becomes more difficult. Therefore, there is an urgent need for a method that can realize the superposition of characters of any size and color at any valid position of the image, and can simplify the complexity of FPGA character superposition and reduce the difficulty of debugging. Based on the second character superposition method mentioned above, this solution proposes a software flow method for automatically generating FPGA character superposition code. This method can realize the superposition of characters of any size and color at any valid position of the image, and can simplify the complexity of FPGA character superposition, reduce the difficulty of debugging, and speed up the progress of FPGA development; at the same time, this method maintains the advantages of low delay and strong real-time performance of the superimposed characters in the second method of FPGA to realize character superposition, while also improving the richness of the superimposed content that can be presented by this method. Below, this solution will be described in detail with reference to the accompanying drawings:
[0038] In one embodiment, the reference Figure 1 and attached Figure 2 The present application provides a method for superimposing characters on an image, comprising the steps of:
[0039] S100, obtaining the resolution of the image to be processed and the effective image area of the image to be processed;
[0040] S200, obtaining character information of a character to be superimposed, the character information including font data information, size information, color information of the character to be superimposed, and position information of the character to be superimposed on the effective image area;
[0041] S300, generating a corresponding OSD file according to the resolution and character information;
[0042] S400, generating a character overlay code based on FPGA according to the OSD file;
[0043] S500, instantiating the character overlay code into the video data stream module, and generating an FPGA-based bit stream through EDA software;
[0044] S600: Load the bit stream into the FPGA chip, and control the display module to display the image containing the characters to be superimposed.
[0045] This solution first obtains the resolution of the image to be processed, determines the effective image area of the image to be processed, and sets the character information of the characters to be superimposed. The character information includes the number of the characters to be superimposed, font data information, size information, color information, and position information of the characters to be superimposed on the effective image area. According to the resolution of the image to be processed and the character information of the characters to be superimposed, an OSD file containing character information can be generated. In one example, the OSD file is an osd_info.json file, which is typically used to store configurations or information related to an on-screen display (OSD). In other embodiments, it can be adjusted according to actual needs and scenarios, and this application does not impose any restrictions.
[0046] Generate FPGA-based character overlay code based on the OSD file. In one specific implementation, generating the corresponding OSD file based on the resolution and character information includes: sending the OSD file to an executable JAR file package to generate the corresponding OSD file. The executable JAR file package includes a file configuration parsing module, a character ROM generation module, and a pixel extraction module. In one example, the executable JAR file package is gen_osd.jar. In other embodiments, the executable JAR file package can be adjusted according to actual needs and scenarios, and this application does not impose any restrictions.
[0047] The file configuration parsing module is used to configure and parse the OSD file to obtain character information, including character number, position, size, color, and font data. The character ROM generation module is used to convert the dot matrix information of each character to be superimposed into ROM information in SpinalHDL based on the font data information of the character to be superimposed analyzed by the file configuration parsing module, and calculate the ROM address starting position of each character to be superimposed based on the width and height of each character to be superimposed. The pixel extraction module is used in the video processing pipeline to calculate the corresponding character ROM address and extract the corresponding pixel data based on the current pixel position, the ROM address starting position, and the position information of the character to be superimposed on the valid image area.
[0048] By instantiating the obtained character overlay code into the video data stream module, an FPGA-based bit stream can be generated through EDA software. The video data stream module is a common module in the existing video processing pipeline, which is used to generate a video data stream corresponding to the image; loading the bit stream into the FPGA chip can control the display module to display the image containing the characters to be overlaid, thus completing the character overlay.
[0049] This solution obtains the resolution of the image to be processed and the character information of the characters to be superimposed, and can generate an OSD file containing the character information. Then, based on the OSD file, an FPGA-based character superposition code is generated. The character superposition code can be instantiated into the video data stream module, and an FPGA-based bit stream is generated through EDA software, so that the FPGA chip can control the display module to display the image containing the characters to be superimposed, thereby realizing the superposition of characters of any size and color at any valid position in the image. It can also simplify the complexity of FPGA character superposition, which is conducive to reducing debugging difficulty and accelerating FPGA development progress.
[0050] In summary, the character superposition method provided by the present invention has at least the following technical effects:
[0051] (1) This solution is easy to operate and can improve FPGA development efficiency. It can automatically generate FPGA character overlay code through character setting software, greatly reducing FPGA programming development time and debugging time.
[0052] (2) This solution can achieve the diversification of superimposed characters by setting the character font, size and color;
[0053] (3) This solution has a wider application range and can support the superposition of characters of any size and resolution;
[0054] (4) This solution takes up less resources and has low latency, and the same character only needs to be cached once in the ROM.
[0055] In a specific implementation, the present application may also set up several processing modules, each of which is independent of each other and connected in series or in parallel in the video processing pipeline. Each character to be superimposed corresponds to a processing module, thereby achieving the superposition of multiple characters to be superimposed.
[0056] In one embodiment, based on the above embodiments, the present application provides a sight display system, with reference to the attached specification. Figure 3 The sight display system includes a camera and a display and control terminal. The camera is used to capture external images through the movement and transmit the images to the display and control terminal. In one specific implementation, the sight display system is a terahertz wireless intelligent sight system. The camera communicates with the display and control terminal via a terahertz wireless short-range communication module. The movement's image and control interface is connected to the terahertz wireless short-range communication module via an interface module. The terahertz wireless short-range communication module transmits the movement in the same direction to the display and control terminal, and receives control signals from the display and control terminal.
[0057] The display and control end obtains the movement image through the terahertz wireless short-range communication module, and after the image processing control module processes the image, it is displayed through the display module. At the same time, the control signal sent by the control module is also processed by the image processing control module and converted into a control instruction. Part of the control instruction is sent to the camera end to control the movement through the terahertz wireless short-range communication module, and the other part of the control instruction is superimposed on the image for display through the character superimposition method of the first aspect. In one example, refer to the attached manual Figure 4 ,During the operation of the system, in order to intuitively help users to perform ,accurate control, the FPGA in the image processing and ,control module superimposes character images on the image displayed by the ,display module to form menu and status prompt characters. Figure 4 As can be seen in the image, characters such as "比较," "正," "热," and "移" are frequently used, appearing multiple times in menus and status prompts, and appearing in different locations on the image. Each character also has a light and dark color, representing unselected and selected states. Using the method of the present invention, the component codes for different characters are stored in ROM, and when called, they are assigned different color, size, and position parameters, allowing for more efficient menu generation. This reduces menu-related code and programming time by 60%, and reduces resource usage by 20%.
[0058] In one embodiment, based on the aforementioned embodiment, the present application provides a computer device, including a memory, a processor, and a computer program stored in the memory, and the processor executes the computer program to implement the steps of the character overlay method of the aforementioned embodiment.
[0059] In one embodiment, based on the aforementioned embodiment, the present application provides a computer storage medium having a computer program or instructions stored thereon, which implements the steps of the character overlay method of the aforementioned embodiment when the computer program or instructions are executed by a processor.
[0060] The processor may be a central processing unit (CPU), other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), field-programmable gate arrays (FPGA), other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. A general-purpose processor may be a microprocessor or any conventional processor, etc.
[0061] The memory can be an internal storage unit of the simulation system, such as a hard drive or memory of a smart device. The memory can also be an external storage device of the smart device, such as a plug-in hard drive, a Smart Media Card (SMC), a Secure Digital (SD) card, a Flash Card, etc. Furthermore, the memory is used to store the computer program and other programs and data required for the FPGA verification method. The memory can also be used to temporarily store data that has been output or is about to be output.
[0062] A communication bus is a circuit that connects the elements described and facilitates data transmission between them. For example, a central processing unit receives commands from other elements via a communication bus, decrypts the received commands, and performs calculations or data processing based on the decrypted commands. A memory may include program modules, such as a kernel, middleware, an application programming interface (API), and applications. These program modules may be composed of software, firmware, hardware, or at least two of these. An input / output interface forwards commands or data input by a user via an input / output interface (e.g., a sensor, keyboard, or touchscreen). A communication interface connects the artificial heart's tachymeter to other network devices, user devices, and networks. For example, the communication interface can connect to a network via a wired or wireless connection to connect to other external network devices or user devices. Wireless communication may include at least one of the following: Wi-Fi (Wi-Fi), Bluetooth (BT), Near Field Communication (NFC), Global Positioning System (GPS), and cellular communication. Wired communication may include at least one of the following: Universal Serial Bus (USB), High-Definition Multimedia Interface (HDMI), and RS-232. The network can be a telecommunications network or a communication network. The communication network can be a computer network, the Internet, the Internet of Things, or a telephone network. The FPGA verification device can be connected to the network via a communication interface, and the protocol used by the artificial heart's tachymeter device to communicate with other network devices can be supported by at least one of an application, an application programming interface (API), middleware, a kernel, and a communication interface.
[0063] The character overlay method of the present application can be implemented using program codes executable by a computing device. Thus, these can be stored in a storage device and executed by the computing device, or can be implemented by fabricating them into separate integrated circuit modules, or by fabricating multiple modules or steps into a single integrated circuit module. Thus, the present invention is not limited to any specific combination of hardware and software.
[0064] It should be noted that the above embodiments can be freely combined as needed. The above description is only a preferred embodiment of the present invention. It should be pointed out that those skilled in the art can make several improvements and modifications without departing from the principles of the present invention, and such improvements and modifications should also be considered within the scope of protection of the present invention.
Claims
1. A character superimposition method for superimposing characters on an image, characterized in that: Including steps: Acquiring the resolution of the image to be processed and the effective image area of the image to be processed; Acquire character information of a character to be superimposed, the character information including font data information, size information, color information of the character to be superimposed, and position information of the character to be superimposed on the effective image area; Generate a corresponding OSD file according to the resolution and the character information; Generating a character overlay code based on FPGA according to the OSD file; Instantiate the character overlay code into the video data stream module and generate an FPGA-based bit stream through EDA software; The bit stream is loaded into the FPGA chip, and the display module is controlled to display the image containing the characters to be superimposed.
2. The character superimposition method according to claim 1, wherein: Generating a corresponding OSD file according to the resolution and the character information includes: The OSD file is sent to an executable JAR file package to generate the corresponding OSD file. The executable JAR file package includes a file configuration parsing module, a character ROM generation module and a pixel point extraction module.
3. The character superimposition method according to claim 2, characterized in that: The file configuration and parsing module is used to configure and parse the OSD file to obtain the character information.
4. The character superimposition method according to claim 3, characterized in that: The character ROM generation module is used to convert the dot matrix information of each character to be superimposed into ROM information based on the font data information of the characters to be superimposed parsed by the file configuration parsing module, and calculate the ROM address starting position of each character to be superimposed based on the width and height of each character to be superimposed.
5. The character superimposition method according to claim 4, characterized in that: The pixel point extraction module is used in the video processing pipeline to calculate the corresponding character ROM address and extract the corresponding pixel data based on the position of the current pixel, the starting position of the ROM address, and the position information of the character to be superimposed on the effective image area.
6. The character superimposition method according to claim 1, wherein: Also includes: Several processing modules are provided, each of which is independent of each other and connected in series or in parallel in the video processing pipeline. Each character to be superimposed corresponds to one processing module, so as to realize the superposition of multiple characters to be superimposed.
7. A computer device comprising a memory, a processor, and a computer program stored in the memory, characterized in that: The processor executes the computer program to implement the steps of the character superimposition method according to any one of claims 1 to 6.
8. A computer storage medium having a computer program or instruction stored thereon, characterized in that: When the computer program or instruction is executed by a processor, the steps of the character superimposition method according to any one of claims 1 to 6 are implemented.
9. A sight display system, characterized in that: It includes a camera end and a display and control end, wherein the camera end is used to acquire images and send the images to the display and control end; The display and control end is used to display the image through the display module, and convert the control signal sent by the control module into a control instruction. Part of the control instruction is sent to the camera end, and the other part of the control instruction is superimposed on the image for display through the character overlay method described in any one of claims 1-6.
10. The character superimposition method according to claim 9, characterized in that: The camera end is connected to the display and control end through a terahertz wireless short-range communication module.