CN116546204A - Image coding method and device - Google Patents

Image coding method and device Download PDF

Info

Publication number
CN116546204A
CN116546204A CN202310573107.4A CN202310573107A CN116546204A CN 116546204 A CN116546204 A CN 116546204A CN 202310573107 A CN202310573107 A CN 202310573107A CN 116546204 A CN116546204 A CN 116546204A
Authority
CN
China
Prior art keywords
image
frame
decoded
data
coding
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
CN202310573107.4A
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.)
Zhejiang Dahua Technology Co Ltd
Original Assignee
Zhejiang Dahua 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 Zhejiang Dahua Technology Co Ltd filed Critical Zhejiang Dahua Technology Co Ltd
Priority to CN202310573107.4A priority Critical patent/CN116546204A/en
Publication of CN116546204A publication Critical patent/CN116546204A/en
Pending legal-status Critical Current

Links

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N19/00Methods or arrangements for coding, decoding, compressing or decompressing digital video signals
    • H04N19/10Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding
    • H04N19/134Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding characterised by the element, parameter or criterion affecting or controlling the adaptive coding
    • H04N19/136Incoming video signal characteristics or properties
    • H04N19/137Motion inside a coding unit, e.g. average field, frame or block difference
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N19/00Methods or arrangements for coding, decoding, compressing or decompressing digital video signals
    • H04N19/42Methods or arrangements for coding, decoding, compressing or decompressing digital video signals characterised by implementation details or hardware specially adapted for video compression or decompression, e.g. dedicated software implementation
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N19/00Methods or arrangements for coding, decoding, compressing or decompressing digital video signals
    • H04N19/50Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using predictive coding
    • H04N19/503Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using predictive coding involving temporal prediction
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N19/00Methods or arrangements for coding, decoding, compressing or decompressing digital video signals
    • H04N19/50Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using predictive coding
    • H04N19/503Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using predictive coding involving temporal prediction
    • H04N19/51Motion estimation or motion compensation

Landscapes

  • Engineering & Computer Science (AREA)
  • Multimedia (AREA)
  • Signal Processing (AREA)
  • Compression Or Coding Systems Of Tv Signals (AREA)

Abstract

The embodiment of the invention provides an image coding method and device, wherein the method comprises the following steps: sequentially carrying out dynamic target detection on the continuous images; under the condition that no dynamic target is detected in the continuous n-frame images, acquiring the coding data of the n-1 th frame image in the continuous n-frame images, wherein n is a preset value, and n is a positive integer greater than or equal to 2; the encoded data of the n-1 th frame image is determined as the encoded data of the n-th frame image of the consecutive n frame images. The invention solves the problem of coding resource waste caused by the same image information redundancy among frames in the related technology.

Description

Image coding method and device
Technical Field
The embodiment of the invention relates to the technical field of images, in particular to an image coding method and device.
Background
The existing image storage is to store the collected pictures after coding in real time after starting coding. However, the content of the pictures collected in many scenes is the same, for example, the pictures are all still pictures collected at night, which causes redundancy of hard disk storage, occupies a large amount of hard disk space, and stores the same pictures; and meanwhile, the waste of coding resources is also caused.
Aiming at the problem of coding resource waste caused by the same image information redundancy among frames in the related technology, no effective solution is proposed at present.
Disclosure of Invention
The embodiment of the invention provides an image coding method and device, which at least solve the problem of coding resource waste caused by the redundancy of the same image information among frames in the related technology.
According to an embodiment of the present invention, there is provided an image encoding method including: sequentially carrying out dynamic target detection on the continuous images;
under the condition that no dynamic target is detected in continuous n-frame images, acquiring the coding data of an n-1-th frame image in the continuous n-frame images, wherein n is a preset value, and n is a positive integer greater than or equal to 2;
and determining the encoded data of the n-1 th frame image as the encoded data of the n-th frame image in the continuous n-frame images.
In one exemplary embodiment, after determining the encoded data of the n-1 th frame image as the encoded data of the n-th frame image of the consecutive n frame images, the method includes: generating a target identifier, and storing the target identifier in a coding packet of the nth frame image, wherein the target identifier is used for indicating that coding data in the nth frame image is identical to coding data in the (n-1) th frame image.
In an exemplary embodiment, after determining the encoded data of the n-1 th frame image as the encoded data of the n-th frame image of the consecutive n frame images, the method further includes: determining the (n+i) -th frame image as a key frame when the dynamic target is detected by the (n+i) -th frame image and the dynamic target is not detected by any of the (n+i) -th frame image and the (n+i) -1-th frame image, wherein i is a positive integer greater than or equal to 1 and is less than or equal to n; and performing key frame coding on the n+i frame image to obtain coded data of the n+i frame image.
In an exemplary embodiment, after the key frame encoding of the n+i frame image, the method further includes: acquiring a key frame coding result of the n+i frame image; and coding the n+i+1 frame image by using the key frame coding result of the n+i frame image to obtain coding data of the n+i+1 frame image.
In an exemplary embodiment, after the determining the n+i frame image as the key frame, the method further includes: determining an n+i+j frame image as a key frame, wherein j is a preset value, j is a positive integer greater than or equal to 1, and j is smaller than n; and performing key frame coding on the n+i+j frame image to obtain coded data of the n+i+j frame image.
According to still another embodiment of the present invention, there is also provided an image decoding method including: judging whether the coded data of the image to be decoded is the same as the coded data of the image of the previous frame of the image to be decoded or not, and obtaining a judging result;
acquiring the decoding data of the image of the previous frame of the image to be decoded under the condition that the judging result is that the encoding data of the image to be decoded is the same as the encoding data of the image of the previous frame of the image to be decoded;
and determining the decoding data of the image of the previous frame of the image to be decoded as the decoding data of the image to be decoded.
In an exemplary embodiment, determining whether encoded data of an image to be decoded is the same as encoded data of an image of a frame preceding the image to be decoded, to obtain a determination result includes: acquiring an encoded packet of the image to be decoded; and under the condition that the target identification is analyzed in the coding packet, determining that the judging result is that the coding data of the image to be decoded is the same as the coding data of the image of the previous frame of the image to be decoded.
In an exemplary embodiment, the method further comprises: and displaying the image to be decoded according to the decoded data of the image of the previous frame of the image to be decoded under the condition that the decoded data of the image of the previous frame of the image to be decoded is determined as the decoded data of the image to be decoded.
According to still another embodiment of the present invention, there is also provided an image encoding apparatus including:
the detection module is used for sequentially carrying out dynamic target detection on the continuous images;
the acquisition module is used for acquiring the coding data of the n-1 th frame image in the continuous n frame images under the condition that no dynamic target is detected in the continuous n frame images, wherein n is a preset value and n is a positive integer greater than or equal to 2;
and the determining module is used for determining the coding data of the n-1 th frame image as the coding data of the n-th frame image in the continuous n-frame images.
According to still another embodiment of the present invention, there is also provided an image decoding apparatus including:
the judging module is used for judging whether the coded data of the image to be decoded is the same as the coded data of the image of the previous frame of the image to be decoded or not, and obtaining a judging result;
the acquisition module is used for acquiring the decoding data of the image of the previous frame of the image to be decoded under the condition that the judging result is that the encoding data of the image to be decoded is the same as the encoding data of the image of the previous frame of the image to be decoded;
and the determining module is used for determining the decoding data of the image of the previous frame of the image to be decoded as the decoding data of the image to be decoded.
According to a further embodiment of the invention, there is also provided a computer readable storage medium having stored therein a computer program, wherein the computer program is arranged to perform the steps of any of the method embodiments described above when run.
According to a further embodiment of the invention, there is also provided an electronic device comprising a memory having stored therein a computer program and a processor arranged to run the computer program to perform the steps of any of the method embodiments described above.
According to the invention, if no dynamic target is detected in the continuous n-frame images, no coding operation is performed on the n-th frame image in the continuous n-frame images, the coding data of the previous frame image in the n-th frame image is determined as the coding data of the n-th frame image, and each frame image is not required to be coded, so that repeated coding of the same image is reduced, the problem of coding resource waste caused by the same image information redundancy among frames in the related technology is solved, and the effect of saving coding resources is achieved.
Drawings
Fig. 1 is a block diagram of a mobile terminal hardware structure of an image encoding method according to an embodiment of the present invention;
fig. 2 is a flowchart of an image encoding method according to an embodiment of the present invention;
FIG. 3 is a schematic diagram of encoding of I-frame and P-frame images in accordance with an embodiment of the invention;
fig. 4 is a flowchart of an image encoding method according to an embodiment of the present invention;
FIG. 5 is a flow chart of image encoding according to an embodiment of the present invention;
FIG. 6 is a flow chart of image decoding according to an embodiment of the present invention;
FIG. 7 is a schematic diagram of image encoding according to an embodiment of the present invention;
fig. 8 is a block diagram of an image encoding apparatus according to an embodiment of the present invention;
fig. 9 is a block diagram of an image decoding apparatus according to an embodiment of the present invention.
Detailed Description
Embodiments of the present invention will be described in detail below with reference to the accompanying drawings in conjunction with the embodiments.
It should be noted that the terms "first," "second," and the like in the description and the claims of the present invention and the above figures are used for distinguishing between similar objects and not necessarily for describing a particular sequential or chronological order.
The method embodiments provided in the embodiments of the present application may be performed in a mobile terminal, a computer terminal or similar computing device. Taking the operation on a mobile terminal as an example, fig. 1 is a block diagram of a mobile terminal hardware structure of an image encoding method according to an embodiment of the present invention. As shown in fig. 1, a mobile terminal may include one or more (only one is shown in fig. 1) processors 102 (the processor 102 may include, but is not limited to, a microprocessor MCU or a processing device such as a programmable logic device FPGA) and a memory 104 for storing data, wherein the mobile terminal may also include a transmission device 106 for communication functions and an input-output device 108. It will be appreciated by those skilled in the art that the structure shown in fig. 1 is merely illustrative and not limiting of the structure of the mobile terminal described above. For example, the mobile terminal may also include more or fewer components than shown in fig. 1, or have a different configuration than shown in fig. 1.
The memory 104 may be used to store a computer program, for example, a software program of application software and a module, such as a computer program corresponding to an image encoding method in an embodiment of the present invention, and the processor 102 executes the computer program stored in the memory 104 to perform various functional applications and data processing, that is, to implement the above-mentioned method. Memory 104 may include high-speed random access memory, and may also include non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory. In some examples, the memory 104 may further include memory remotely located relative to the processor 102, which may be connected to the mobile terminal via a network. Examples of such networks include, but are not limited to, the internet, intranets, local area networks, mobile communication networks, and combinations thereof.
The transmission means 106 is arranged to receive or transmit data via a network. Specific examples of the network described above may include a wireless network provided by a communication provider of the mobile terminal. In one example, the transmission device 106 includes a network adapter (Network Interface Controller, simply referred to as NIC) that can connect to other network devices through a base station to communicate with the internet. In one example, the transmission device 106 may be a Radio Frequency (RF) module, which is configured to communicate with the internet wirelessly.
In this embodiment, there is provided an image encoding method, and fig. 2 is a flowchart of the image encoding method according to an embodiment of the present invention, as shown in fig. 2, the flowchart including the steps of:
step S202, sequentially carrying out dynamic target detection on continuous images;
in this embodiment, the DVR is a Digital Video Recorder digital video recorder or a digital hard disk recorder, and the back-end device of the hard disk recorder is externally connected with a plurality of shooting devices, and performs video acquisition through the shooting devices, the shooting devices send acquired data to the back-end device, and the back-end device performs encoding and saving on image data acquired in real time; the back-end equipment sequentially receives the continuous images acquired by the shooting equipment, sequentially codes and stores continuous multi-frame images, and displays the multi-frame images to form a video.
When receiving the image data of a frame of image, the back-end equipment performs dynamic detection on the image, namely judges whether a moving object exists in an image picture or not, namely performs dynamic target detection on continuous images before encoding the frame of image.
Step S204, under the condition that no dynamic target is detected in continuous n-frame images, acquiring the coding data of an n-1-th frame image in the continuous n-frame images, wherein n is a preset value and n is a positive integer greater than or equal to 2;
and step S206, determining the coding data of the n-1 th frame image as the coding data of the n-th frame image in the continuous n-frame images.
In this embodiment, n is a preset value, dynamic object detection is sequentially performed on each frame of image in the acquired video according to the acquired time sequence, and when no dynamic object is detected in any continuous n frame of images in all acquired image frames, the n-th frame of images in the continuous n frame of images will not perform actual encoding operation, but directly determine the encoding data of the previous frame of images as the encoding data of the n-th frame of images.
In addition, since the dynamic object detection is sequentially performed on the successive images and the encoded data of each frame is sequentially determined, the encoded data of the image of the previous frame of the nth frame is already determined when the encoded data of the image of the nth frame is determined.
Through the steps, if no dynamic target is detected in the continuous n-frame images, no coding operation is performed on the n-th frame image in the continuous n-frame images, the coding data of the previous frame image in the n-th frame image is determined as the coding data of the n-th frame image, and each frame image is not required to be coded, so that repeated coding of the same image is reduced, the problem of coding resource waste caused by the redundancy of the same image information among frames in the related technology is solved, and the effect of saving coding resources is achieved.
In the above embodiment, when the image is detected to have a moving object (moving object), the frame image is the same as the previous frame image when the frame image is detected to have no moving object, the encoded data of the frame may be determined as the encoded data of the previous frame image. That is, for any frame image, the condition that the frame image is not encoded is: no dynamic object is detected in the frame image and in the n-1 frame images between the frame images.
Optionally, a counter may be set, where the count value in the counter is used to represent the number of frames of images in which the dynamic object is not detected continuously, after each frame of image is detected by the dynamic object, the count value of the counter is updated, when the dynamic object is not detected, the count value of the counter is increased by 1 to obtain the count value corresponding to the frame of image, and when the dynamic object is detected, the count value of the counter is cleared, that is, the count value corresponding to the frame of image is 0. That is, each frame image corresponds to a count value, for example, the count value corresponding to the mth frame image among all frame images is s, where m is a positive integer greater than or equal to 1, and s is an integer greater than or equal to 0; when s=0, it indicates that a dynamic target is detected in the mth frame image; when s=1, the dynamic target is not detected in the mth frame image, and the dynamic target is detected in the previous frame of the mth frame image; when s is greater than 1, it means that no dynamic object is detected in any of the m-s+1-th to m-th frame images.
When the count value s corresponding to the m-th frame image is greater than or equal to the preset value n, the m-n+1-th frame image to the m-th frame image are all the n-th frame image in the continuous n-th frame image, if no dynamic target is detected in the continuous n-th frame images, the m-th frame image is the n-th frame image in the continuous n-th frame images, and no coding operation is performed on the m-th frame image (the n-th frame image in the continuous n-th frame images).
In an alternative embodiment, after determining the encoded data of the n-1 th frame image as the encoded data of the n-th frame image of the consecutive n frame images, the method includes: generating a target identifier, and storing the target identifier in a coding packet of the nth frame image, wherein the target identifier is used for indicating that coding data in the nth frame image is identical to coding data in the (n-1) th frame image.
In the present embodiment, when the n-th frame image coded data in the n-th frame image is determined as the n-1-th frame image coded data, the target flag is added to the n-th frame image, and the n-th frame image coded data is represented by the target flag as the n-1-th frame image coded data. The target mark is used for replacing the coded data of the nth frame image to be stored in the coded packet so as to be stored in the hard disk, thereby reducing the use amount of the hard disk and improving the utilization rate of the hard disk.
In an alternative embodiment, after determining the encoded data of the n-1 th frame image as the encoded data of the n-th frame image of the consecutive n frame images, the method further comprises: determining the (n+i) -th frame image as a key frame when the dynamic target is detected by the (n+i) -th frame image and the dynamic target is not detected by any of the (n+i) -th frame image and the (n+i) -1-th frame image, wherein i is a positive integer greater than or equal to 1 and is less than or equal to n; and performing key frame coding on the n+i frame image to obtain coded data of the n+i frame image.
In this embodiment, on the basis that the above-mentioned n-th frame image is not subjected to the encoding operation, in the multi-frame image subsequent to the n-th frame image, the dynamic target is detected in the n+i-th frame image for the first time, that is, the dynamic target is detected in the n+i-th frame image and is not detected in any of the n-th frame image to the n+i-1-th frame image, the n+i-th frame image needs to be subjected to the encoding operation to obtain the encoded data of the n+i-th frame image.
There are two coding modes for coding an image: key frame coding and forward reference coding, wherein the key frame coding is used for coding an I frame, the forward reference coding is used for coding a P frame, the I frame (key frame) and the P frame (forward reference frame) are two frame types corresponding to images during coding, the I frame images are independently coded to obtain corresponding coding data, and the corresponding coding data can be independently decoded according to the coding data during decoding; the P-frame image coding needs to code with reference to the I-frame, and the P-frame image can not be independently decoded, i.e., the P-frame image can not be decoded without the I-frame image, when decoding, the P-frame image is also decoded with reference to the coded data or the decoded data of the corresponding I-frame.
Fig. 3 is a schematic diagram of encoding I-frame and P-frame images according to an embodiment of the present invention, as shown in fig. 3, when encoding a video image with only I-frames and P-frames, a second preset threshold j is set, where the second preset threshold j is used to represent an interval between every two adjacent key frames, that is, after determining a key frame (I-frame), independently encoding the key frame, determining a j-1 frame image after the key frame as a P-frame, encoding with reference to the key frame, determining a j-th frame image after the key frame as a key frame, independently encoding with reference to the key frame, and so on, determining a key frame every j-frame image, and the rest of images as P-frame images, encoding with reference to the previous key frame.
And the one or more frames of images before the n+i frame of images are not subjected to coding operation, so that the n+i frame of images is forcedly determined to be a key frame in order to ensure the accuracy of coding, and the n+i frame of images is subjected to key frame coding.
That is, according to the above embodiment, when the encoding operation is not performed on the previous frame image of a certain frame image, the key frame encoding is performed on the certain frame image, so as to obtain the encoded data of the certain frame image.
In an alternative embodiment, after said key frame encoding of said n+i frame image, said method further comprises: acquiring a key frame coding result of the n+i frame image; and coding the n+i+1 frame image by using the key frame coding result of the n+i frame image to obtain coding data of the n+i+1 frame image.
In this embodiment, on the basis of performing key frame encoding on the n+i frame image, an encoding operation is also required for the n+i+1 frame image, in order to reduce the encoding rate, forward reference encoding is selected for the n+i+1 frame image, that is, encoded data of the n+i frame image is acquired, and encoded data of the n+i+1 frame image is obtained by referring to encoded data of the n+i frame image.
Optionally, forward reference encoding is performed on all the continuous j-1 frame images after the n+i frame images, namely, the encoded data of the n+i frame images are acquired, the continuous j-1 frame images after the n+i frame images are respectively encoded by referring to the encoded data of the n+i frame images, and the encoded data of the continuous j-1 frame images after the n+i frame images are obtained.
In an alternative embodiment, after said determining said n+i frame image as a key frame, said method further comprises: determining an n+i+j frame image as a key frame, wherein j is a preset value, j is a positive integer greater than or equal to 1, and j is smaller than n; and performing key frame coding on the n+i+j frame image to obtain coded data of the n+i+j frame image.
In this embodiment, when the encoding operation is performed on all the continuous images, it is periodic: that is, a key frame is determined every j frames, and key frame encoding is performed on the key frames, so that after the n+i frame image is determined as the key frame, the n+i+j frame image is determined as the key frame, and key frame encoding is performed on the n+i+j frame image, so as to obtain encoded data of the n+i+j frame image.
Note that since j is smaller than n, the n+i+1-th to n+i+j-th frame images include j-th frame images in total, and no moving object is detected in any of the n-th frame images, regardless of whether or not a moving object is detected in the j-th frame image, and therefore the n+i+j-th frame image is required to be subjected to an encoding operation.
After the n+i+j frame, if no dynamic object is detected in any of the n continuous frame images, no encoding operation is performed on the n continuous frame image, and if no dynamic object is detected in any of the n continuous frame images, it is necessary to perform key frame encoding or forward reference encoding on the subsequent image periodically according to the above encoding method.
Optionally, for any frame image, only if the frame image and the previous n-1 frame image of the frame image do not detect the dynamic object, no encoding operation is performed on the frame image, otherwise, the encoding operation is required to be performed on the frame image.
When a certain frame image is encoded, the frame type (key frame or forward reference frame) of the frame image needs to be judged first, including: and determining the frame image as a key frame in the case that the previous frame image of the frame image is not encoded, and performing key frame encoding on the frame image.
If the previous frame image of the frame image is coded, searching the previous image serving as a key frame (marked as a target key frame image), and performing forward reference coding on the frame image or key frame coding depends on the number of images between the frame image and the target key frame image, and when the number of images is smaller than j-1, the frame image needs to be determined as a forward reference frame, the frame image is subjected to forward reference frame coding, and the frame image refers to the coded data of the target key frame image to perform forward reference coding; when the number of images is greater than or equal to j-1, the frame image needs to be determined as a key frame, and key frame encoding is performed on the frame image.
According to still another embodiment of the present invention, there is also provided an image decoding method, fig. 4 is a flowchart of an image encoding method according to an embodiment of the present invention, as shown in fig. 4, the flowchart including the steps of:
step S402, judging whether the coded data of the image to be decoded is the same as the coded data of the image of the previous frame of the image to be decoded, and obtaining a judging result;
in this embodiment, an image in a video to be displayed is decoded frame by frame, where the image to be decoded is one frame of image in the video, and when determining the decoded data of the image to be decoded, the decoded data of the image to be decoded is already determined, and the encoded data of each frame of image in the video is determined by any embodiment of the image encoding method.
Step S404, when the determination result is that the encoded data of the image to be decoded is the same as the encoded data of the image of the previous frame of the image to be decoded, obtaining the decoded data of the image of the previous frame of the image to be decoded;
step S406, determining the decoded data of the image of the previous frame of the image to be decoded as the decoded data of the image to be decoded.
In this embodiment, by determining whether the encoded data of the image to be decoded and the encoded data of the image of the previous frame of the image to be decoded are the same, if the encoded data are the same, the decoded data of the image to be decoded and the image of the previous frame of the image to be decoded should be the same. And if the judgment result is that the coded data of the image to be decoded is the same as the coded data of the image of the previous frame of the image to be decoded, acquiring the decoded data of the image of the previous frame of the image to be decoded, and determining the decoded data of the image of the previous frame of the image to be decoded as the decoded data of the image to be decoded.
In an alternative embodiment, determining whether the encoded data of the image to be decoded is the same as the encoded data of the image of the previous frame of the image to be decoded, to obtain the determination result includes: acquiring an encoded packet of the image to be decoded; and under the condition that the target identification is analyzed in the coding packet, determining that the judging result is that the coding data of the image to be decoded is the same as the coding data of the image of the previous frame of the image to be decoded.
In this embodiment, a plurality of encoding packets are stored in the backend device, each frame of image corresponds to one encoding packet, if there is an image frame that performs an encoding operation in the encoding process, the corresponding encoding packet stores encoded data corresponding to the image, and the image frame that does not perform an encoding operation stores a target identifier in the corresponding encoding packet, where the target identifier is used to indicate that the image is identical to the encoded data of the previous frame of image.
Therefore, by analyzing whether the coded packet with the decoded image has the target identifier, whether the coded data of the image to be decoded is identical to the coded data of the image of the previous frame of the image to be decoded can be judged.
In an alternative embodiment, the method further comprises: and displaying the image to be decoded according to the decoded data of the image of the previous frame of the image to be decoded under the condition that the decoded data of the image of the previous frame of the image to be decoded is determined as the decoded data of the image to be decoded.
In this embodiment, the decoding data of the image to be decoded is determined as the decoding data of the frame previous to the image to be decoded, the decoding data of the frame previous to the image to be decoded is superimposed with the time stamp corresponding to the image to be decoded, and the image to be decoded is displayed.
Optionally, the coded packet of each frame of image also stores a corresponding timestamp.
It will be apparent that the embodiments described above are merely some, but not all, embodiments of the invention.
The invention is illustrated below with reference to examples:
fig. 5 is a schematic flow chart of image encoding according to an embodiment of the present invention, as shown in fig. 5, including:
step 501, video acquisition and dynamic detection;
the existing DVR back-end equipment can be externally connected with a plurality of cameras to collect videos, and after the video is collected, the data collected by the current channel can be subjected to mobile detection and coding storage.
Step 502, judging whether the current frame triggers dynamic detection, namely whether a dynamic target is detected, executing step 503 if the judging result is negative, otherwise executing step 505;
step 503, adding 1 to the target count value, judging whether the target count value is greater than a first preset threshold, executing step 504 if the judgment result is yes, otherwise, executing step 506;
step 504, the current frame is not encoded, and only the target identification is stored;
step 505, judging whether the previous frame of image is actually encoded, if yes, executing step 506, otherwise, executing step 507;
step 506, encoding the current frame;
and step 507, performing key frame coding on the current frame.
Encoding the current frame includes: under the condition that the previous frame image only stores the target identification, performing key frame coding on the current frame image, and assigning a target count value to be 0; the last frame is subjected to coding operation, and key frame coding or forward reference coding is selected according to the relation between the interval between the current frame and the last key frame and a second preset threshold j.
Fig. 6 is a schematic flow chart of image decoding according to an embodiment of the present invention, as shown in fig. 6, including:
step 601, reading and analyzing a coding packet corresponding to a current frame image stored in a hard disk;
step 602, judging whether the coded packet includes a target identifier, if yes, executing step 603, otherwise, executing step 604;
step 603, determining a time stamp corresponding to the current frame, overlapping the time stamp to the decoded data of the previous frame, and displaying the current frame image;
step 604, decoding is performed according to the encoded packet of the current frame.
Fig. 7 is a schematic diagram of image encoding according to an embodiment of the present invention, as shown in fig. 7, including:
encoding image frames in video can be divided into three types: normal coding, forcing I frame, storing target mark, assuming n is 25 and j is 20, in FIG. 7, normal coding is performed from 1 st frame to 33 th frame, if no motion detection trigger occurs in 10 th frame, the target count value starts to accumulate, and the picture is unchanged until 34 th frame, the target count value is accumulated to 25 and is greater than or equal to a first preset threshold value, then only one target mark is stored in the coding packet of 34 th frame image, no real coding is performed, the coding packet is marked as Fn, motion detection is triggered until 100 th frame image, at this time, the 100 th frame image is forced I frame coding, and then normal coding is performed according to the protocol until the next continuous n frame image is no motion detection trigger, and the above operation is repeated.
From the description of the above embodiments, it will be clear to a person skilled in the art that the method according to the above embodiments may be implemented by means of software plus the necessary general hardware platform, but of course also by means of hardware, but in many cases the former is a preferred embodiment. Based on such understanding, the technical solution of the present invention may be embodied essentially or in a part contributing to the prior art in the form of a software product stored in a storage medium (e.g. ROM/RAM, magnetic disk, optical disk) comprising instructions for causing a terminal device (which may be a mobile phone, a computer, a server, or a network device, etc.) to perform the method according to the embodiments of the present invention.
There is also provided in this embodiment an image encoding apparatus, fig. 8 is a block diagram of a structure of an image encoding apparatus according to an embodiment of the present invention, as shown in fig. 8, including:
the detection module 802 is configured to sequentially perform dynamic target detection on the continuous images;
an obtaining module 804, configured to obtain encoded data of an n-1 th frame image in continuous n frame images when no dynamic object is detected in the continuous n frame images, where n is a preset value, and n is a positive integer greater than or equal to 2;
a determining module 806, configured to determine the encoded data of the n-1 th frame image as the encoded data of the n-th frame image in the consecutive n frame images.
In an alternative embodiment, the apparatus is further configured to, after determining the encoded data of the n-1 th frame image as the encoded data of the n-th frame image of the consecutive n frame images: generating a target identifier, and storing the target identifier in a coding packet of the nth frame image, wherein the target identifier is used for indicating that coding data in the nth frame image is identical to coding data in the (n-1) th frame image.
In an alternative embodiment, the apparatus is further configured to determine, after determining the encoded data of the n-1 th frame image as the encoded data of the n-th frame image in the consecutive n frame images, the dynamic object to be detected in an n+i-th frame image, and determine the n+i-th frame image as a key frame in a case that the dynamic object is not detected in any of the n-th to n+i-1-th frame images, wherein the i is a positive integer greater than or equal to 1 and the i is less than or equal to n; and performing key frame coding on the n+i frame image to obtain coded data of the n+i frame image.
In an alternative embodiment, the apparatus is further configured to, after the key frame encoding of the n+i frame image, further comprise: acquiring a key frame coding result of the n+i frame image; and coding the n+i+1 frame image by using the key frame coding result of the n+i frame image to obtain coding data of the n+i+1 frame image.
In an alternative embodiment, the apparatus is further configured to, after said determining the n+i frame image as a key frame, further comprise: determining an n+i+j frame image as a key frame, wherein j is a preset value, j is a positive integer greater than or equal to 1, and j is smaller than n; and performing key frame coding on the n+i+j frame image to obtain coded data of the n+i+j frame image.
According to still another embodiment of the present invention, there is also provided an image decoding apparatus, fig. 9 is a block diagram of the structure of the image decoding apparatus according to an embodiment of the present invention, as shown in fig. 9, including:
a judging module 902, configured to judge whether encoded data of an image to be decoded is the same as encoded data of an image of a previous frame of the image to be decoded, so as to obtain a judging result;
an obtaining module 904, configured to obtain, when the determination result is that the encoded data of the image to be decoded is the same as the encoded data of the image of the previous frame of the image to be decoded, the decoded data of the image of the previous frame of the image to be decoded;
a determining module 906, configured to determine decoding data of an image of a previous frame of the image to be decoded as decoding data of the image to be decoded.
In an alternative embodiment, the apparatus is further configured to obtain an encoded packet of the image to be decoded; and under the condition that the target identification is analyzed in the coding packet, determining that the judging result is that the coding data of the image to be decoded is the same as the coding data of the image of the previous frame of the image to be decoded.
In an alternative embodiment, the apparatus is further configured to display the image to be decoded according to the decoded data of the image of the previous frame of the image to be decoded, in a case where the decoded data of the image of the previous frame of the image to be decoded is determined as the decoded data of the image to be decoded.
It should be noted that each of the above modules may be implemented by software or hardware, and for the latter, it may be implemented by, but not limited to: the modules are all located in the same processor; alternatively, the above modules may be located in different processors in any combination.
Embodiments of the present invention also provide a computer readable storage medium having a computer program stored therein, wherein the computer program is arranged to perform the steps of any of the method embodiments described above when run.
In one exemplary embodiment, the computer readable storage medium may include, but is not limited to: a usb disk, a Read-only memory (ROM), a random access memory (Random Access Memory, RAM), a removable hard disk, a magnetic disk, or an optical disk, or other various media capable of storing a computer program.
An embodiment of the invention also provides an electronic device comprising a memory having stored therein a computer program and a processor arranged to run the computer program to perform the steps of any of the method embodiments described above.
In an exemplary embodiment, the electronic apparatus may further include a transmission device connected to the processor, and an input/output device connected to the processor.
Specific examples in this embodiment may refer to the examples described in the foregoing embodiments and the exemplary implementation, and this embodiment is not described herein.
It will be appreciated by those skilled in the art that the modules or steps of the invention described above may be implemented in a general purpose computing device, they may be concentrated on a single computing device, or distributed across a network of computing devices, they may be implemented in program code executable by computing devices, so that they may be stored in a storage device for execution by computing devices, and in some cases, the steps shown or described may be performed in a different order than that shown or described herein, or they may be separately fabricated into individual integrated circuit modules, or multiple modules or steps of them may be fabricated into a single integrated circuit module. Thus, the present invention is not limited to any specific combination of hardware and software.
The above description is only of the preferred embodiments of the present invention and is not intended to limit the present invention, but various modifications and variations can be made to the present invention by those skilled in the art. Any modification, equivalent replacement, improvement, etc. made within the principle of the present invention should be included in the protection scope of the present invention.

Claims (12)

1. An image encoding method, comprising:
sequentially carrying out dynamic target detection on the continuous images;
under the condition that no dynamic target is detected in continuous n-frame images, acquiring the coding data of an n-1-th frame image in the continuous n-frame images, wherein n is a preset value, and n is a positive integer greater than or equal to 2;
and determining the encoded data of the n-1 th frame image as the encoded data of the n-th frame image in the continuous n-frame images.
2. The method according to claim 1, characterized by, after determining the encoded data of the n-1 th frame image as the encoded data of the n-th frame image of the consecutive n-frame images, comprising:
generating a target identifier, and storing the target identifier in a coding packet of the nth frame image, wherein the target identifier is used for indicating that coding data in the nth frame image is identical to coding data in the (n-1) th frame image.
3. The method according to claim 1, wherein after determining the encoded data of the n-1 th frame image as the encoded data of the n-th frame image of the consecutive n-frame images, the method further comprises:
determining the (n+i) -th frame image as a key frame when the dynamic target is detected by the (n+i) -th frame image and the dynamic target is not detected by any of the (n+i) -th frame image and the (n+i) -1-th frame image, wherein i is a positive integer greater than or equal to 1 and is less than or equal to n;
and performing key frame coding on the n+i frame image to obtain coded data of the n+i frame image.
4. A method according to claim 3, wherein after said key frame encoding of said n+i frame image, said method further comprises:
acquiring a key frame coding result of the n+i frame image;
and coding the n+i+1 frame image by using the key frame coding result of the n+i frame image to obtain coding data of the n+i+1 frame image.
5. A method according to claim 3, wherein after said determining said n+i-th frame image as a key frame, the method further comprises:
determining an n+i+j frame image as a key frame, wherein j is a preset value, j is a positive integer greater than or equal to 1, and j is smaller than n;
and performing key frame coding on the n+i+j frame image to obtain coded data of the n+i+j frame image.
6. An image decoding method, comprising:
judging whether the coded data of the image to be decoded is the same as the coded data of the image of the previous frame of the image to be decoded or not, and obtaining a judging result;
acquiring the decoding data of the image of the previous frame of the image to be decoded under the condition that the judging result is that the encoding data of the image to be decoded is the same as the encoding data of the image of the previous frame of the image to be decoded;
and determining the decoding data of the image of the previous frame of the image to be decoded as the decoding data of the image to be decoded.
7. The method of claim 6, wherein determining whether the encoded data of the image to be decoded is identical to the encoded data of the image of the previous frame of the image to be decoded, comprises:
acquiring an encoded packet of the image to be decoded;
and under the condition that the target identification is analyzed in the coding packet, determining that the judging result is that the coding data of the image to be decoded is the same as the coding data of the image of the previous frame of the image to be decoded.
8. The method of claim 6, wherein the method further comprises:
and displaying the image to be decoded according to the decoded data of the image of the previous frame of the image to be decoded under the condition that the decoded data of the image of the previous frame of the image to be decoded is determined as the decoded data of the image to be decoded.
9. An image encoding device, comprising:
the detection module is used for sequentially carrying out dynamic target detection on the continuous images;
the acquisition module is used for acquiring the coding data of the n-1 th frame image in the continuous n frame images under the condition that no dynamic target is detected in the continuous n frame images, wherein n is a preset value and n is a positive integer greater than or equal to 2;
and the determining module is used for determining the coding data of the n-1 th frame image as the coding data of the n-th frame image in the continuous n-frame images.
10. An image decoding apparatus, comprising:
the judging module is used for judging whether the coded data of the image to be decoded is the same as the coded data of the image of the previous frame of the image to be decoded or not, and obtaining a judging result;
the acquisition module is used for acquiring the decoding data of the image of the previous frame of the image to be decoded under the condition that the judging result is that the encoding data of the image to be decoded is the same as the encoding data of the image of the previous frame of the image to be decoded;
and the determining module is used for determining the decoding data of the image of the previous frame of the image to be decoded as the decoding data of the image to be decoded.
11. A computer readable storage medium, characterized in that a computer program is stored in the computer readable storage medium, wherein the computer program, when being executed by a processor, implements the steps of the method as claimed in any one of claims 1 to 5 or 6 to 8.
12. An electronic device comprising a memory, a processor and a computer program stored on the memory and executable on the processor, characterized in that the processor implements the steps of the method of any one of claims 1 to 5 or 6 to 8 when the computer program is executed.
CN202310573107.4A 2023-05-18 2023-05-18 Image coding method and device Pending CN116546204A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202310573107.4A CN116546204A (en) 2023-05-18 2023-05-18 Image coding method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202310573107.4A CN116546204A (en) 2023-05-18 2023-05-18 Image coding method and device

Publications (1)

Publication Number Publication Date
CN116546204A true CN116546204A (en) 2023-08-04

Family

ID=87448649

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202310573107.4A Pending CN116546204A (en) 2023-05-18 2023-05-18 Image coding method and device

Country Status (1)

Country Link
CN (1) CN116546204A (en)

Similar Documents

Publication Publication Date Title
US10186297B2 (en) Reference and non-reference video quality evaluation
JP6421422B2 (en) Video analysis device, monitoring device, monitoring system, and video analysis method
CN105451031B (en) Video transcoding method and system
CN110830838A (en) Security protection high-definition video reverse broadcasting method and device
CN109714623B (en) Image display method and device, electronic equipment and computer readable storage medium
CN112165621B (en) Scene switching frame detection method and device, storage medium and electronic equipment
CN112818173B (en) Method and device for identifying associated object and computer readable storage medium
CN113542795A (en) Video processing method and device, electronic equipment and computer readable storage medium
CN103618911A (en) Video streaming providing method and device based on video attribute information
CN111131817A (en) Screen sharing method, device, storage medium and screen sharing system
CN111093079A (en) Image processing method and device
CN111447451A (en) Image coding and decoding method and device
CN111263113B (en) Data packet sending method and device and data packet processing method and device
CN116546204A (en) Image coding method and device
CN107734278B (en) Video playback method and related device
CN116781901A (en) Video stream dynamic decoding method, system, computer equipment and storage medium
CN110636334A (en) Data transmission method and system
CN112637538B (en) Smart tag method, system, medium, and terminal for optimizing video analysis
CN104462422A (en) Object processing method and device
CN111953981B (en) Encoding method and device, decoding method and device
CN112866805A (en) Video acceleration processing method and device and electronic equipment
CN109784226B (en) Face snapshot method and related device
KR100927353B1 (en) Video encoding and decoding method of mitigating data losses in an encoded video signal transmitted through a channel
CN112055174A (en) Video transmission method and device and computer readable storage medium
CN112351282A (en) Image data transmission method and device, nonvolatile storage medium and processor

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