Search

CN-122027885-A - Snapshot optimization method, equipment, medium and product based on open source hong Meng system

CN122027885ACN 122027885 ACN122027885 ACN 122027885ACN-122027885-A

Abstract

The invention discloses a snapshot optimization method, equipment, medium and product based on an open source HongMong system, wherein the method comprises the steps of caching a motion joint image expert group MJPEG video stream acquired by a camera in real time when the equipment enters a camera view mode; after receiving an image snapshot instruction, extracting target MJPEG single-frame data from a cached video stream; according to the camera parameters, the Huffman coding table and the image direction parameters, an application program reservation mark 0 section, a Huffman table definition section and an application program reservation mark 1 section are respectively constructed, the standard data structure is sequentially filled to generate JPEG additional data, and the standard JPEG file is spliced and output.

Inventors

  • YAN ZHIPENG

Assignees

  • 鸿湖万联(江苏)科技发展有限公司

Dates

Publication Date
20260512
Application Date
20260203

Claims (10)

  1. 1. A snapshot optimization method based on an open source hong system, which is executed by a photographing device pre-installed with the open source hong system, the method comprising: when detecting that photographing equipment enters a camera view finding mode, caching a motion joint image expert group (MJPEG) video stream acquired by a camera in real time; When an image snapshot instruction is detected, extracting target MJPEG single-frame data matched with the image snapshot instruction from a MJPEG video stream cached in real time; applying for a target cache region in the equipment memory, and establishing a standard data structure matched with a standard Joint Photographic Experts Group (JPEG) file in the target cache region, wherein the standard data structure comprises a plurality of data regions to be filled; Constructing a first data field according to photographing parameters of a camera, and constructing a second data field according to a predefined Huffman coding table; according to the preset image display direction, acquiring a field of a parameter construction direction label matched with the preset image display direction, and constructing a third data field related to image rotation according to the field of the direction label; filling the first data field, the second data field and the third data field into matched data areas in a standard data structure respectively to obtain JPEG additional data; And carrying out data splicing processing on the JPEG additional data and the target MJPEG single frame data to obtain target JPEG single frame data, and displaying the target JPEG single frame data as a response result of the image snapshot instruction.
  2. 2. The method of claim 1, further comprising, prior to constructing the first data field based on the photographing parameters of the camera: And constructing a standard JPEG file header in the target cache region, and filling the standard JPEG file header into a first data region of the standard data structure.
  3. 3. The method of claim 2, wherein constructing the first data field based on the photographing parameters of the camera comprises: initializing a construction application program to reserve a mark 0 section; according to the pixel density parameters of the camera, an application program is configured to reserve pixel density units and pixel density values in the mark 0 section; configuring the application program to reserve a fixed format identifier and version number field in a mark 0 section; calculating the total length of the data of the application program reservation mark 0 section according to the configured field content, filling the total length of the data into the application program reservation mark 0 section, and taking the current application program reservation mark 0 section as a first data field; Correspondingly, filling the first data field into the matched data area in the standard data structure comprises the following steps: the first data field is filled into a data section in the standard data structure that is adjacent to the standard JPEG file header.
  4. 4. A method according to claim 3, wherein constructing the second data field from a predefined huffman coding table comprises: configuring table information, a Huffman table bit table and a Huffman table value table of the coding table according to the predefined Huffman coding table, and taking the configured complete Huffman coding table as a second data field after calculating a filling segment length field; Correspondingly, filling the second data field into the matched data area in the standard data structure comprises the following steps: And filling the second data field into a data section adjacent to the first data field in a standard data structure.
  5. 5. The method of claim 4, wherein obtaining a field of a parameter construction direction tag matching a preset image display direction according to the preset image display direction, and constructing a third data field associated with image rotation according to the field of the direction tag, comprises: initializing a construction application program to reserve a mark 1 section; Filling parameters of the preset image display direction into a field of a direction label in the section 1 of the application program reservation mark according to the preset image display direction, and taking the section 1 of the current application program reservation mark as a third data field; Correspondingly, filling the third data field into the matched data area in the standard data structure comprises the following steps: And filling the third data field into a data section adjacent to the second data field in the standard data structure.
  6. 6. The method according to any one of claims 1-5, wherein performing data stitching processing on the JPEG additional data and the target MJPEG single frame data to obtain target JPEG single frame data, includes: Acquiring a starting offset, positioning a compressed data body in the target MJPEG single frame data based on the starting offset, and splicing the JPEG additional data and the compressed data body in the target MJPEG single frame data in sequence; And adding a file ending mark at the tail of the spliced data to form complete standard JPEG file data.
  7. 7. The method of claim 1, wherein obtaining the starting offset comprises: detecting whether the initial part of the target MJPEG single frame data comprises an application program reservation mark 0 section; If the target MJPEG single frame data is detected to contain the application program reservation mark 0 section, reading the length field of the target MJPEG single frame data and calculating the initial offset of a compressed data body of the target MJPEG single frame data; If the application reservation mark 0 segment is not detected in the target MJPEG single frame data, the start offset is set to the length of the file start mark.
  8. 8. An electronic device, the electronic device comprising: at least one processor, and A memory communicatively coupled to the at least one processor, wherein, The memory stores a computer program executable by the at least one processor to enable the at least one processor to perform the open source hong system-based snapshot optimization method of any one of claims 1-7.
  9. 9. A computer readable storage medium storing computer instructions for causing a processor to implement the open source hong system-based snapshot optimization method of any one of claims 1-7 when executed.
  10. 10. A computer program product, characterized in that it comprises a computer program which, when executed by a processor, implements a snapshot optimization method based on an open source hong system according to any one of claims 1-7.

Description

Snapshot optimization method, equipment, medium and product based on open source hong Meng system Technical Field The invention relates to the technical field of open source hong Monte system development, in particular to a snapshot optimization method, equipment, medium and product based on an open source hong Monte system. Background With the rapid development of the Internet of things equipment and edge computing scenes, an open source hong Meng (OpenHarmony) system is used as a distributed operating system facing the full scene, and is increasingly widely applied to the fields of intelligent cameras, industrial vision and the like, and the scenes provide higher requirements on the instantaneity, the resource efficiency and the image quality of the camera snapshot. At present, although the scheme of processing MJPEG snapshot by using an open-source hong-Mongolian native camera frame can ensure the universality of functions, the scheme has obvious performance bottleneck in a specific scene. The current scheme relies on a complete video decoder to decode the MJPEG frame into an intermediate pixel format, and then, after rotation and other processing by a CPU or GPU, the JPEG encoder is called again for compression output. But the process has high resource occupancy rate, increased snapshot delay and obvious loss of image details. Disclosure of Invention The invention provides a snapshot optimization method, equipment, medium and product based on an open source hong Monte system, which are used for solving the technical problems of large resource consumption, high delay and image quality damage of the traditional snapshot flow of the open source hong Monte system. According to an aspect of the embodiment of the present invention, there is provided a snapshot optimization method based on an open source hong system, which is executed by a photographing apparatus having an open source hong system previously installed, the method including: when detecting that photographing equipment enters a camera view finding mode, caching a motion joint image expert group (MJPEG) video stream acquired by a camera in real time; When an image snapshot instruction is detected, extracting target MJPEG single-frame data matched with the image snapshot instruction from a MJPEG video stream cached in real time; applying for a target cache region in the equipment memory, and establishing a standard data structure matched with a standard Joint Photographic Experts Group (JPEG) file in the target cache region, wherein the standard data structure comprises a plurality of data regions to be filled; Constructing a first data field according to photographing parameters of a camera, and constructing a second data field according to a predefined Huffman coding table; according to the preset image display direction, acquiring a field of a parameter construction direction label matched with the preset image display direction, and constructing a third data field related to image rotation according to the field of the direction label; filling the first data field, the second data field and the third data field into matched data areas in a standard data structure respectively to obtain JPEG additional data; And carrying out data splicing processing on the JPEG additional data and the target MJPEG single frame data to obtain target JPEG single frame data, and displaying the target JPEG single frame data as a response result of the image snapshot instruction. According to another aspect of the embodiment of the present invention, there is provided a snapshot optimizing apparatus based on an open source hong system, configured in a photographing device having an open source hong system installed in advance, the apparatus comprising: The video stream real-time caching module is used for caching the motion joint image expert group (MJPEG) video stream acquired by the camera in real time when the photographing equipment is detected to enter a camera view mode; the target frame data extraction module is used for extracting target MJPEG single frame data matched with the image snapshot instruction from the MJPEG video stream cached in real time when the image snapshot instruction is detected; the memory management module is used for applying for a target cache region in the equipment memory, and establishing a standard data structure matched with a standard Joint Photographic Experts Group (JPEG) file in the target cache region, wherein the standard data structure comprises a plurality of data regions to be filled; the first data field construction module is used for constructing a first data field according to photographing parameters of the camera and constructing a second data field according to a predefined Huffman coding table; The third data field construction module is used for acquiring a field of a parameter construction direction label matched with the preset image display direction according to the preset image display direction, and constru