Video data processing method, device, equipment and storage medium
By storing video images in the resource cache area in the video surveillance device and reading preset image data for overlay, the memory consumption and time delay problems caused by dot matrix font library calls are solved, and more efficient video overlay processing performance is achieved.
Patent Information
- Application Number
- CN202211456992.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-11-21
- Publication Date
- 2025-02-18
- Estimated Expiration
- 2042-11-21
AI Technical Summary
In existing video surveillance devices, calling the dot matrix font library will consume more memory space and there will be time delays, which will affect the performance of video overlay processing.
By acquiring and storing video images into the resource cache, reading preset image data and superimposing them into the video images, replacing the call of the dot matrix font library, thereby reducing CPU resource consumption and time delay.
It improves the performance of video overlay processing, reduces memory space consumption and time delay, and improves the overall video overlay processing performance.
Smart Images

Figure CN116095400B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the technical field of image processing, and in particular to a video data processing method, apparatus, device and storage medium. Background Art
[0002] With the continuous development of science and technology, video surveillance technology has been applied to various fields, promoting the orderly operation of various industries in society. Among them, character overlay technology (OSD, On Screen Display) is widely used in the field of video surveillance. It changes the brightness and color value of the pixels on the video image to superimpose specific text or patterns (such as time, direction indication, distance mark, etc.) on the video, so that users can obtain the desired information on the video.
[0003] In some surveillance equipment, the solution to superimpose specific text on the video is mainly to use the method of calling the dot matrix font library. The staff first saves the required dot matrix font library in the flash memory. During the startup process of the surveillance equipment, the entire dot matrix font library will be loaded from the flash memory to the memory.
[0004] In the process of implementing the present application, the inventors found that there are at least the following problems in this technology: the method of calling the dot matrix font library will consume more memory space, and there is a certain time delay when calling the font library interface, which will affect the performance of video overlay processing in real-time video processing. Summary of the invention
[0005] In order to improve the performance of video overlay processing and reduce the time consumption of video overlay processing, the present application provides a video data processing method, device, equipment and storage medium.
[0006] In a first aspect, the present application provides a video data processing method, which adopts the following technical solution: the method comprises: acquiring a video image;
[0007] Storing the video image in a preset resource buffer area;
[0008] Read preset image data;
[0009] superimposing the image data onto the video image to obtain a processed video image;
[0010] The processed video image is sent to a video output channel for display.
[0011] Through the above technical solution, after acquiring the video image data, the video data processing system first stores the video image in the resource cache area, then reads the preset image data, and superimposes the read image data on the video image in the resource cache area to obtain a processed video image, and sends the processed video image to the video output channel for display via the display. The video data processing system uses picture data instead of calling the dot matrix font library, which can quickly perform image superposition processing, helping to reduce the consumption of CPU resources; in addition, reducing the call of the dot matrix font library interface reduces the time consumption of image processing, and overall improves the performance of video superposition processing.
[0012] In a specific possible implementation, initializing the camera unit;
[0013] Controlling the camera unit to capture video images;
[0014] Creating a video processing channel based on the video image;
[0015] Assigning the video images to the video processing channels accordingly;
[0016] Get CAN command;
[0017] Parsing the CAN command to obtain a corresponding parsing result, wherein the parsing result at least includes a channel number corresponding to the video processing channel;
[0018] The corresponding video image is searched according to the channel number.
[0019] Through the above technical solution, the video data processing system parses the CAN command, obtains the video processing channel corresponding to the video image that the user currently wants to display, and searches for the corresponding video image according to the video processing channel. After the video data processing system establishes a data transmission connection with multiple camera units, the video data processing system can accurately display the video image according to the user's requirements, thereby improving the applicability of the video data processing system.
[0020] In a specific possible implementation scheme, the video overlay area is initialized to form a video overlay area information list;
[0021] Traverse the video overlay area information list and initialize the video overlay area information;
[0022] Traversing the video processing channels, and mounting the video overlay area information to the corresponding video processing channels;
[0023] Searching for corresponding video overlay area information according to the acquired video image;
[0024] The image data is superimposed on the video image according to the video superimposition area information.
[0025] Through the above technical solution, the video data processing system first initializes the video overlay area to form a corresponding video overlay area information list, and then traverses the video overlay area information list to mount the video overlay area information in the video overlay area information list to the corresponding video processing channel, so that the video data processing system can overlay the preset image data on the video image according to certain standards, which helps to improve the overall overlay effect and enhances the applicability of the video data processing system.
[0026] In a specific feasible implementation scheme, a CAN communication monitoring thread is started;
[0027] Initialize CAN data receiving buffer;
[0028] Initialize CAN interface;
[0029] Set the filtering rules corresponding to CAN communication;
[0030] The CAN command is obtained from the CAN interface according to a preset clock signal timing.
[0031] Through the above technical solution, the video data processing system uses the CAN communication monitoring thread to monitor the CAN instructions. Once the corresponding CAN instructions are obtained, the video data processing system will filter the corresponding CAN instructions according to the set filtering rules, which helps to filter out some data information that is not a CAN instruction, reduce the situation where the video data processing system spends resources to process worthless data information, and thus improve the efficiency and fluency of the video data processing system.
[0032] In a specific possible implementation scheme, the video overlay area information at least includes the number of overlay areas, the width of the overlay area, the height of the overlay area, the position of the overlay area, and the display style of the overlay area.
[0033] Through the above technical solution, the video overlay area information initialized by the video data processing system includes information such as the number, width, and height of the overlay areas, so that the video data processing system can make corresponding adjustments to the image data, optimize the overlay effect of the image data, and help ensure the aesthetics of the processed video image.
[0034] In a specific possible implementation scheme, obtaining parameters corresponding to the video image;
[0035] Judging the rationality of the video superimposed area information according to the parameters corresponding to the video image;
[0036] If the video superimposed area information is determined to be reasonable, the image data is superimposed on the video image according to the video superimposed area information.
[0037] Through the above technical solution, before superimposing the image data on the acquired video image according to the generated video superposition area information, the video data processing system will check the rationality of the video superposition area information according to the image data and the relevant parameters of the video image, and filter out some image data that do not meet the requirements for superposition processing and the video superposition area information of the video image, so that the final superposition effect can meet the user's needs, reduce the possibility of the final superposition failure due to the unreasonable setting of the video superposition area information, and further improve the applicability of the video data processing system.
[0038] In a specific possible implementation, the legality of the CAN command is judged;
[0039] If the CAN command is legal, the CAN command is stored in the CAN data receiving buffer area;
[0040] If the CAN command is illegal, the CAN command is discarded.
[0041] Obtain CAN instructions from the CAN data buffer.
[0042] Make a rational judgment on the video overlay area information.
[0043] Through the above technical solution, after receiving the CAN command, the video data processing system will decrypt the CAN command, verify its legality, and filter the CAN commands that are not used to switch video data, thereby reducing the situation where the video data processing system spends resources to process worthless CAN commands, thereby improving the efficiency and fluency of the video data processing system.
[0044] In a second aspect, the present application provides a video data processing device, which adopts the following technical solution: the device comprises:
[0045] A video image acquisition module, used for acquiring video images;
[0046] A video image cache module, used for storing the video image in a preset resource cache area;
[0047] An image data reading module, used for reading preset image data;
[0048] An image data superposition module, used for superimposing the image data onto the video image to obtain a processed video image;
[0049] The video image display module is used to send the processed video image to the video output channel for display.
[0050] In a third aspect, the present application provides a computer device, which adopts the following technical solution: it includes a memory and a processor, and the memory stores a computer program that can be loaded by the processor and execute any of the above-mentioned video data processing methods.
[0051] In a fourth aspect, the present application provides a computer-readable storage medium, which adopts the following technical solution: storing a computer program that can be loaded by a processor and execute any of the above-mentioned video data processing methods.
[0052] In summary, the present application includes at least one of the following beneficial technical effects:
[0053] 1. After acquiring the video image data, the video data processing system first stores the video image in the resource cache area, then reads the preset image data, and superimposes the read image data on the video image in the resource cache area to obtain a processed video image, and sends the processed video image to the video output channel for display via the display. The video data processing system can quickly perform image superposition processing by using picture data instead of calling the dot matrix font library, which helps to reduce the consumption of CPU resources; in addition, reducing the calling of the dot matrix font library interface reduces the time consumption of image processing, and improves the performance of video superposition processing as a whole;
[0054] 2. The video data processing system first initializes the video overlay area to form a corresponding video overlay area information list, and then traverses the video overlay area information list to mount the video overlay area information in the video overlay area information list to the corresponding video processing channel, so that the video data processing system can overlay the preset image data on the video image according to certain standards, which helps to improve the overall overlay effect and enhance the applicability of the video data processing system. BRIEF DESCRIPTION OF THE DRAWINGS
[0055] Figure 1 It is a flowchart of the video data processing method in an embodiment of the present application.
[0056] Figure 2 It is a structural block diagram of the video data processing device in an embodiment of the present application.
[0057] Reference numerals: 301, video image acquisition module; 302, video image cache module; 303, image data reading module; 304, image data overlay module; 305, video image display module. DETAILED DESCRIPTION
[0058] The following is combined with Figure 1-2 This application is described in further detail.
[0059] The embodiment of the present application discloses a video data processing method. The method is applied to a video data processing system, and the instructions corresponding to the method are preset and stored in a control unit of the video data processing system. The video data processing system includes a camera unit for acquiring video images, a resource buffer for temporarily storing video images, and a plurality of image data to be superimposed are stored, and data transmission is performed between the camera unit and the video data processing system.
[0060] like Figure 1 As shown, the method comprises the following steps:
[0061] S10, acquiring a video image.
[0062] Specifically, the video data processing system will first generate a startup instruction and send the generated startup instruction to the corresponding camera unit. In this embodiment, the camera unit can be a device such as a camera that can record image data for a long time. After the camera unit is started, the video data processing system will initialize the camera unit and set relevant parameters of the camera unit, such as resolution, bit rate, frame rate, backlight compensation and other parameters. After the relevant parameters of the camera unit are configured, the video data processing system will control the camera unit to start shooting, and the camera unit will transmit the captured video image to the video data processing system in real time. Since there are more than one camera units that establish data transmission with the video data processing system, the video data processing system will create a video processing channel for the video image after obtaining the video image transmitted by the camera unit. It should be noted that the created video processing channel is in a one-to-one correspondence with the video image. In short, the video data processing system can query the video image corresponding to the video processing channel according to the number of the video processing channel; at the same time, the video data processing system can also query the corresponding video processing channel according to the video image.
[0063] At the same time, the video data processing system will start the CAN communication monitoring thread. The CAN communication video data processing system is an IOS internationally standardized serial communication protocol. The CAN video data processing system has the characteristics of high performance and reliability, and is widely used in industrial automation, ships, medical equipment, industrial equipment, etc. The emergence of the CAN video data processing system provides a strong technical support for the distributed control video data processing system to realize real-time and reliable data communication between nodes. When the video data processing system starts the CAN communication monitoring thread, it will first initialize the CAN data receiving buffer and the CAN interface, so that the CAN data receiving buffer and the CAN interface are in a normal use state. Then the video data processing system will set the filtering rules corresponding to the CAN communication, so that the video data processing system can identify and filter the information data transmitted in the line, so that the video data processing system can give priority to processing the required data instead of recording all unnecessary content, and it also helps to save the storage space of the CAN data buffer. After the video data processing system completes the initialization of the CAN communication monitoring thread, it will obtain the CAN instruction from the CAN interface according to the preset clock signal. It should be noted that in this embodiment, the CAN instruction is mainly used to inform the video data processing system which camera unit's video image will be collected for processing, superposition and display.
[0064] After obtaining the CAN instruction, the video data processing system will filter the CAN instruction according to the set filtering rules corresponding to the CAN communication, and filter out the CAN instructions that meet the preset filtering rules; after obtaining the CAN instruction that does not meet the filtering rules, the video data processing system will parse the CAN instruction, wherein the CAN instruction is divided into two parts: one part is the information part, and the other part is the data part. The first two bytes of the CAN instruction are the information part, and the first eleven bits are the identifier. The first eight bits in the identifier are used for receiving judgment, which should contain the destination address of this CAN instruction, followed by an RTR bit (should be set to 0), and finally four D data length bits, that is, the actual length of the data sent. The remaining eight bytes are the data part, which stores the data information carried by the CAN instruction. In this embodiment, the data part of the CAN instruction at least includes the number of the video processing channel corresponding to the video image that the staff wants to switch, and the video data processing system searches for the video image corresponding to the video processing channel according to the number of the video processing channel obtained by parsing the CAN instruction. Therefore, the staff can send a CAN instruction to the video data processing system to control the video data processing system to switch the video image, so that the staff can freely select the video image that needs to be displayed at present.
[0065] S20, storing the video image in a preset resource buffer area.
[0066] Specifically, after the video data processing system learns from the data content of the CAN instruction that the staff wants to display the video image at the current time point, the video data processing system will transmit data with the camera unit corresponding to the video image to obtain the video image captured by the camera unit, and store the acquired video image in a resource cache area pre-set in the video data processing system. It should be noted that the resource cache area only stores the video image that the current video data processing system needs to display on the monitor.
[0067] S30, reading preset image data.
[0068] Specifically, after the video data processing system stores the video image to be displayed in the resource cache area, it will then search for image data matching the video image in a preset image database. The image database stores image data that needs to be superimposed on the video image. It should be noted that when the staff stores the image data in the image database, they will modify the file name of the image data so that the image data corresponds one-to-one with the video image to be superimposed, so that the video data processing system can accurately superimpose the image data on the corresponding video image.
[0069] S40, superimposing the image data into the video image.
[0070] Specifically, the staff will first send the parameter data corresponding to the video overlay area to the video data processing system through input devices such as keyboards. The video data processing system will initialize the video overlay area according to the received parameter data to form a video overlay area information list. Then the video data processing system will traverse the entire video overlay area information list to initialize the video overlay area information. Then the video data processing system will then traverse the current video processing channel that has been created, and mount the initialized video overlay area information to the corresponding video processing channel, that is, to correspond several video overlay area information in the video overlay area information list to the video processing channel one by one. Since the overlay effects corresponding to different video images are different, therefore, the step of mounting the initialized video overlay area information to the corresponding video processing channel is crucial. According to the obtained video image, the corresponding video overlay area information is searched. It is worth mentioning that in this application, the video overlay area information at least includes the number of overlay areas, the width of the overlay area, the height of the overlay area, the position of the overlay area, and the display style of the overlay area. The video data processing system will modify the acquired image data according to the video overlay area information corresponding to the video image, and again overlay the modified image data to the video image located in the resource buffer area according to the video overlay area information.
[0071] S50, sending the processed video image to a video output channel for display.
[0072] Specifically, after the video data processing system superimposes the image data on the corresponding video image, the video data processing system will forward the video image superimposed with the image data to the video output channel, so that the video image that has completed the superimposition operation can be displayed on the monitor. In other words, the corresponding image data will be superimposed on the video image displayed on the monitor at this time. The video data processing system can quickly perform superimposition processing on the image data by using picture data instead of calling the dot matrix font library, which helps to reduce the consumption of CPU resources; in addition, reducing the call of the dot matrix font library interface reduces the time consumption of image processing, and overall improves the performance of video superimposition processing.
[0073] In one embodiment, considering that the parameter data input into the video data processing system by the staff may not be consistent with the corresponding image data and the parameter data corresponding to the video image, resulting in the failure of image data superposition, the image data is superimposed onto the video image according to the video superposition area information, and specifically the following steps may be performed:
[0074] The video data processing system will first obtain the parameters corresponding to the video image, and judge the rationality of the video overlay area information based on the parameters corresponding to the video image and the image data. For example, the width value corresponding to the image data is 15 inches, and the height value is 10 inches, while the corresponding overlay area width and overlay area height are both 20 inches, which is obviously unreasonable. At this time, the video data processing system will determine that the video overlay area information is unreasonable, and then generate an alarm signal, and send the alarm signal to the staff's smart terminal. If the video overlay area information is determined to be reasonable, the video data processing system will overlay the image data into the video image according to the video overlay area information. This reduces the situation where image data overlay fails due to unreasonable settings of the video overlay area information, thereby improving the applicability of the video data processing system.
[0075] In one embodiment, considering that there are some CAN instructions whose data content is not for switching video channels, after obtaining the CAN instruction from the CAN interface according to the preset clock signal timing, the following steps may also be performed;
[0076] After receiving the CAN instruction, the video data processing system will decrypt the CAN instruction and determine whether its data content is used to switch video data. If the content of the received CAN instruction is used to switch video data, the video data processing system will store the CAN instruction in the CAN data receiving buffer; if the content of the received CAN instruction is not used to switch video data, the video data processing system will discard the CAN instruction, which helps to reduce the situation where the video data processing system spends resources to process worthless CAN instructions, thereby improving the efficiency and fluency of the video data processing system.
[0077] Figure 1 FIG. 1 is a flow chart of a video data processing method in one embodiment. It should be understood that although Figure 1 The steps in the flowchart are shown in sequence as indicated by the arrows, but the steps are not necessarily executed in the order indicated by the arrows; unless otherwise specified in this document, there is no strict order restriction for the execution of the steps, and the steps may be executed in other orders; and Figure 1 At least part of the steps may include multiple sub-steps or multiple stages. These sub-steps or stages are not necessarily executed at the same time, but can be executed at different times. The execution order of these sub-steps or stages is not necessarily sequential, but can be executed in turn or alternately with other steps or at least part of the sub-steps or stages of other steps.
[0078] Based on the above method, an embodiment of the present application also discloses a video data processing device.
[0079] like Figure 2 As shown, the device includes the following modules:
[0080] A video image acquisition module, used for acquiring video images;
[0081] A video image cache module, used to store video images in a preset resource cache area;
[0082] An image data reading module, used for reading preset image data;
[0083] An image data superposition module, used for superimposing the image data onto the video image to obtain a processed video image;
[0084] The video image display module is used to send the processed video image to the video output channel for display.
[0085] In one embodiment, the video image acquisition module is further used to initialize the camera unit;
[0086] Control the camera unit to collect video images;
[0087] Creating a video processing pipeline based on video images;
[0088] Assigning video images to video processing channels accordingly;
[0089] Get CAN command;
[0090] Parse the CAN command to obtain a corresponding parsing result, where the parsing result at least includes a channel number corresponding to the video processing channel;
[0091] Find the corresponding video image according to the channel number.
[0092] In one embodiment, the image data superposition module is further used to initialize the video superposition area and form a video superposition area information list;
[0093] Traverse the video overlay area information list and initialize the video overlay area information;
[0094] Traverse the video processing channels and mount the video overlay area information to the corresponding video processing channels;
[0095] Searching for corresponding video overlay area information according to the acquired video image;
[0096] The image data is superimposed onto the video image according to the video superimposition area information.
[0097] In one embodiment, the video image acquisition module is further used to start a CAN communication monitoring thread;
[0098] Initialize CAN data receiving buffer;
[0099] Initialize CAN interface;
[0100] Set the filtering rules corresponding to CAN communication;
[0101] The CAN command is obtained from the CAN interface according to the preset clock signal timing.
[0102] In one embodiment, the image data superposition module is also used for the video superposition area information to at least include the number of superposition areas, the width of the superposition area, the height of the superposition area, the position of the superposition area and the display style of the superposition area.
[0103] In one embodiment, the image data reading module is further used to obtain parameters corresponding to the video image;
[0104] Judging the rationality of the video overlay area information according to the parameters corresponding to the video image;
[0105] If the video superimposition area information is determined to be reasonable, the image data is superimposed on the video image according to the video superimposition area information.
[0106] In one embodiment, the video image acquisition module is also used to determine the legality of the CAN command;
[0107] If the CAN command is legal, the CAN command is stored in the CAN data receiving buffer;
[0108] If the CAN command is illegal, the CAN command will be discarded.
[0109] Get CAN commands from the CAN data buffer.
[0110] Make reasonable judgment on the video overlay area information
[0111] The embodiment of the present application also discloses a computer device.
[0112] Specifically, the computer device includes a memory and a processor, and the memory stores a computer program that can be loaded by the processor and execute the above-mentioned video data processing method.
[0113] The embodiment of the present application also discloses a computer-readable storage medium.
[0114] Specifically, the computer-readable storage medium stores a computer program that can be loaded by a processor and execute the video data processing method as described above. The computer-readable storage medium includes, for example: a USB flash drive, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk, and other media that can store program codes.
[0115] This specific embodiment is merely an explanation of the present invention and is not a limitation of the present invention. After reading this specification, those skilled in the art may make non-creative modifications to the present embodiment as needed. However, as long as they are within the scope of the claims of the present invention, they are protected by the patent law.
Claims
1. A video data processing method, characterized in that: The method is applied to a video data processing system, and the method comprises: Acquire video images; Storing the video image in a preset resource buffer area; Read the preset image data in the flash memory; superimposing the image data onto the video image to obtain a processed video image; The processed video image is sent to a video output channel for display; the video data processing system includes a camera unit for acquiring video images, and the acquiring of video images specifically includes: Initialize the camera unit; Controlling the camera unit to capture video images; Creating a video processing channel based on the video image; Assigning the video images to the video processing channels accordingly; Get CAN command; Parsing the CAN command to obtain a corresponding parsing result, wherein the parsing result at least includes a channel number corresponding to the video processing channel; Searching for a corresponding video image according to the channel number; superimposing the image data onto the video image specifically includes: Initialize the video overlay area and form a video overlay area information list; Traversing the video overlay area information list to initialize the video overlay area information; the video overlay area information at least includes the number of overlay areas, the width of the overlay area, the height of the overlay area, the position of the overlay area, and the display style of the overlay area; Traversing the video processing channels, and mounting the video overlay area information to the corresponding video processing channels; Searching for corresponding video overlay area information according to the acquired video image; According to the video superimposition area information, superimposing the image data into the video image specifically includes: Acquire parameters corresponding to the video image; the parameters corresponding to the video image include a width value and a height value; Judging the rationality of the video overlay area information according to the video image and parameters corresponding to the image data; If the video superimposed area information is determined to be reasonable, the image data is superimposed on the video image according to the video superimposed area information.
2. The method according to claim 1, characterized in that The obtaining of the CAN instruction specifically includes: Start the CAN communication monitoring thread; Initialize CAN data receiving buffer; Initialize CAN interface; Set the filtering rules corresponding to CAN communication; The CAN command is obtained from the CAN interface according to a preset clock signal timing.
3. The method according to claim 2, characterized in that After acquiring the CAN instruction from the CAN interface according to the preset clock signal timing, the method further includes: Judging the legality of the CAN command; If the CAN command is legal, the CAN command is stored in the CAN data receiving buffer area; If the CAN command is illegal, the CAN command is discarded; Obtaining CAN instructions from the CAN data receiving buffer; Make a rational judgment on the video overlay area information.
4. A video data processing device, characterized in that: The device comprises: The video image acquisition module is used to acquire video images; initialize the camera unit; control the camera unit to acquire video images; create a video processing channel according to the video image; assign the video image to the video processing channel; acquire CAN instructions; parse the CAN instructions to obtain corresponding parsing results, which at least include the channel number corresponding to the video processing channel; and search for the corresponding video image according to the channel number; A video image cache module, used for storing the video image in a preset resource cache area; An image data reading module is used to read preset image data; and is also used to obtain parameters corresponding to the video image; the parameters corresponding to the video image include a width value and a height value; according to the parameters corresponding to the video image, the rationality of the video superposition area information is judged; if the video superposition area information is judged to be reasonable, the image data is superimposed on the video image according to the video superposition area information; An image data superposition module is used to superimpose the image data onto the video image to obtain a processed video image; it is also used to initialize the video superposition area to form a video superposition area information list; it traverses the video superposition area information list to initialize the video superposition area information; it traverses the video processing channel to mount the video superposition area information to the corresponding video processing channel; it searches for the corresponding video superposition area information according to the acquired video image; it superimposes the image data onto the video image according to the video superposition area information; it is also used for the video superposition area information to at least include the number of superposition areas, the width of the superposition area, the height of the superposition area, the position of the superposition area and the display style of the superposition area; The video image display module is used to send the processed video image to the video output channel for display.
5. A computer device, characterized in that: The method comprises a memory and a processor, wherein the memory stores a computer program which can be loaded by the processor and executes any one of the methods according to claims 1 to 3.
6. A computer-readable storage medium, characterized in that: A computer program is stored which can be loaded by a processor and execute the method according to any one of claims 1 to 3.
Citation Information
Patent Citations
Image superposition method and device
CN110913262A
Network control 3G-SDI high-definition characters superimposer
CN203675196U