[go: up one dir, main page]

CN115022641B - Image encoding, decoding method, electronic device and computer readable storage medium - Google Patents

Image encoding, decoding method, electronic device and computer readable storage medium Download PDF

Info

Publication number
CN115022641B
CN115022641B CN202210580450.7A CN202210580450A CN115022641B CN 115022641 B CN115022641 B CN 115022641B CN 202210580450 A CN202210580450 A CN 202210580450A CN 115022641 B CN115022641 B CN 115022641B
Authority
CN
China
Prior art keywords
current image
image
motion
processing mode
detection result
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.)
Active
Application number
CN202210580450.7A
Other languages
Chinese (zh)
Other versions
CN115022641A (en
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 CN202210580450.7A priority Critical patent/CN115022641B/en
Publication of CN115022641A publication Critical patent/CN115022641A/en
Application granted granted Critical
Publication of CN115022641B publication Critical patent/CN115022641B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

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/169Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding characterised by the coding unit, i.e. the structural portion or semantic portion of the video signal being the object or the subject of the adaptive coding
    • H04N19/17Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding characterised by the coding unit, i.e. the structural portion or semantic portion of the video signal being the object or the subject of the adaptive coding the unit being an image region, e.g. an object
    • 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/169Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding characterised by the coding unit, i.e. the structural portion or semantic portion of the video signal being the object or the subject of the adaptive coding
    • H04N19/17Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding characterised by the coding unit, i.e. the structural portion or semantic portion of the video signal being the object or the subject of the adaptive coding the unit being an image region, e.g. an object
    • H04N19/172Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding characterised by the coding unit, i.e. the structural portion or semantic portion of the video signal being the object or the subject of the adaptive coding the unit being an image region, e.g. an object the region being a picture, frame or field
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N19/00Methods or arrangements for coding, decoding, compressing or decompressing digital video signals
    • H04N19/44Decoders specially adapted therefor, e.g. video decoders which are asymmetric with respect to the encoder

Landscapes

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

Abstract

本申请公开了一种图像编码、解码方法、电子设备和计算机可读存储介质,该方法包括:获得当前图像,确定当前图像的参考图像检测结果;响应于参考图像检测结果为有参考图像,获得运动检测结果并基于运动检测结果选择处理方式对当前图像进行处理;其中,参考图像为整帧编码后的图像,当运动检测结果为有运动目标时,处理方式为对当前图像的至少部分区域进行编码,且部分区域包括运动目标;为处理后的当前图像设置与处理方式匹配的标志位。上述方案,能够提高编码压缩率和编码效率。

The present application discloses an image encoding and decoding method, an electronic device and a computer-readable storage medium, the method comprising: obtaining a current image, determining a reference image detection result of the current image; in response to the reference image detection result being a reference image, obtaining a motion detection result and selecting a processing method to process the current image based on the motion detection result; wherein the reference image is an image after encoding the entire frame, and when the motion detection result is a moving target, the processing method is to encode at least a part of the current image, and the part of the area includes the moving target; and setting a flag bit matching the processing method for the processed current image. The above scheme can improve the coding compression rate and coding efficiency.

Description

Image encoding method, image decoding method, electronic device, and computer-readable storage medium
Technical Field
The present application relates to the field of image encoding and decoding technologies, and in particular, to an image encoding and decoding method, an electronic device, and a computer readable storage medium.
Background
As the image quality of the image or video acquired by the image pickup device is higher, a higher requirement is put on the compression rate when the image is encoded. The existing image coding method generally codes images in images based on spatial redundancy features, and each complete image needs to be coded in sequence when the images are coded, so that the coding compression rate and the coding efficiency are not high. In view of this, how to improve the coding compression rate and coding efficiency is a problem to be solved.
Disclosure of Invention
The application mainly solves the technical problem of providing an image coding and decoding method, an electronic device and a computer readable storage medium, which can improve the coding compression rate and the coding efficiency.
In order to solve the technical problems, the first aspect of the application provides an image coding method, which comprises the steps of obtaining a current image, determining a reference image detection result of the current image, responding to the reference image detection result as a reference image, obtaining a motion detection result and selecting a processing mode to process the current image based on the motion detection result, wherein the reference image is an image after full-frame coding, when the motion detection result is a moving object, the processing mode is to code at least part of the area of the current image, the part of the area comprises the moving object, and setting a flag bit matched with the processing mode for the processed current image.
In order to solve the technical problems, a second aspect of the present application provides an image decoding method, which is applied to the image encoding method of the first aspect, and the method includes obtaining a current image to be decoded, determining a processing mode of the current image based on a flag bit matched with the processing mode, encoding at least a part of a region of the current image in response to the processing mode, decoding the encoded region to obtain a decoding sub-region, overlapping a timestamp corresponding to the current image and the decoding sub-region to a corresponding position on a reference image corresponding to the current image, obtaining a decoded current image, and taking the decoded current image as a new reference image.
In order to solve the technical problem, a third aspect of the application provides an electronic device, which comprises a memory and a processor, wherein the memory and the processor are mutually coupled, the memory stores program data, and the processor calls the program data to execute the method in the first aspect or the second aspect.
In order to solve the above technical problem, a fourth aspect of the present application provides a computer storage medium having stored thereon program data which when executed by a processor implements the method of the first or second aspect.
According to the scheme, after the current image is obtained, the reference image detection result of the current image is determined in the current image, wherein the reference image is an image after the whole frame of encoding, when the reference image detection result is the reference image, the motion detection result is obtained, the current image is processed based on the motion detection result, when the motion detection result is the moving target, the processing mode is to encode at least part of the area of the current image, the encoding compression rate is improved, for a scene with the moving target, the encoding consumption is effectively reduced, the encoding efficiency is improved, the encoded part of the area is decoded and then superimposed on the decoded reference image, and the whole image corresponding to the image with the processing mode of encoding at least part of the area can be obtained, so that the decoding efficiency is improved.
Drawings
In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings required for the description of the embodiments will be briefly described below, and it is apparent that the drawings in the following description are only some embodiments of the present application, and other drawings may be obtained according to these drawings without inventive effort for a person skilled in the art. Wherein:
FIG. 1 is a flow chart of an embodiment of an image encoding method of the present application;
FIG. 2 is a flow chart of another embodiment of the image encoding method of the present application;
FIG. 3 is a flowchart of an embodiment corresponding to the step S203 in FIG. 2;
fig. 4 is a schematic diagram of an application scenario of an embodiment corresponding to step S204 in fig. 2;
Fig. 5 is a schematic view of an application scenario of another embodiment corresponding to step S204 in fig. 2;
FIG. 6 is a flow chart of an embodiment of an image decoding method according to the present application;
FIG. 7 is a schematic diagram of an embodiment of an electronic device of the present application;
fig. 8 is a schematic diagram of a computer-readable storage medium according to an embodiment of the present application.
Detailed Description
The following description of the embodiments of the present application will be made clearly and completely with reference to the accompanying drawings, in which it is apparent that the embodiments described are only some embodiments of the present application, but not all embodiments. All other embodiments, which can be made by those skilled in the art based on the embodiments of the application without making any inventive effort, are intended to be within the scope of the application.
The terms "system" and "network" are often used interchangeably herein. The term "and/or" is merely an association relationship describing the associated object, and means that three relationships may exist, for example, a and/or B may mean that a exists alone, while a and B exist together, and B exists alone. In addition, the character "/" herein generally indicates that the front and rear associated objects are an "or" relationship. Further, "a plurality" herein means two or more than two.
The image encoding method provided by the application is used for encoding the original data of the image into a file in an image format, wherein the original data of the image can be video frames extracted from video data or images which are arranged in sequence, and the image decoding method provided by the application is used for decoding the file in the image format into the original data of the image for display.
Referring to fig. 1, fig. 1 is a flowchart of an embodiment of an image encoding method according to the present application, the method includes:
s101, obtaining a current image and determining a reference image detection result of the current image.
Specifically, a current image to be encoded is obtained, and reference image detection is performed on the current image to determine a reference image detection result of the current image. The reference image detection result comprises a reference image and a reference image, wherein the reference image is a completely coded image and is time-sequence before the current image.
In an application mode, after the reference image is referred once, the corresponding use count value of the reference image is accumulated once and cleared after the count threshold is accumulated, and whether the reference image which is completely encoded and can be referred by the current image exists before the current image or not is determined based on the use count value, so that the reference image detection result of the current image is obtained.
In an application scene, the reference image is an image after complete coding, when the reference image is used, the corresponding use count value of the reference image is added, when the use count value is added to exceed the count threshold, the current image is judged to have no reference image, so that the current image is coded in a whole frame later, the situation that the same reference image is used for a plurality of times is avoided, the coding compression rate is improved, and meanwhile, the probability of poor quality of the coded image is reduced.
And S102, responding to the reference image detection result as a reference image, obtaining a motion detection result and selecting a processing mode to process the current image based on the motion detection result, wherein the reference image is an image after the whole frame is encoded, and when the motion detection result is a moving object, the processing mode is to encode at least part of the area of the current image, and the part of the area comprises the moving object.
Specifically, when the reference image detection result is a reference image, a motion detection result is obtained, wherein the motion detection result includes no moving object and a moving object.
Further, the reference image is an image after the whole frame is encoded, when the motion detection result is that there is a moving object, the processing mode is that at least part of the area of the current image is encoded, and the part of the area comprises the moving object. That is, when a moving object is included in the current image, the processing is to encode at least a partial area of the current image, and the partial area includes the moving object.
Optionally, when the current image does not include the moving object, the processing manner is to follow the reference image corresponding to the current image.
In one application mode, when the motion detection result is that the motion target is not present and the reference image is present, the processing mode can be selected to follow the reference image corresponding to the current image and increment the use count value of the reference image once, and when the motion detection result is that the motion target is present and the reference image is present, the processing mode can be selected to encode at least part of the area of the current image and increment the use count value of the reference image once, so that the matched processing mode is selected based on the combination between different motion detection results and the reference image detection results.
Further, when the motion detection result is that a moving object exists, and when the partial region on the current image is encoded, the partial region comprises the moving object, so that the encoded partial region and the reference image are combined to decode a complete picture of the image and feed back the state of the moving object.
And S103, setting a flag bit matched with the processing mode for the processed current image.
Specifically, based on the combination of different motion detection results and reference image detection results, a matched processing mode is selected, each processing mode corresponds to a matched flag bit, and after the processing mode is selected, the flag bit matched with the processing mode is set for the current image, so that the processing mode of any image in encoding can be conveniently determined in decoding, and the decoding efficiency is improved.
Further, in the decoding process, the decoded partial region is overlapped on the decoded reference image, so that a complete image corresponding to the image which is processed in a mode of at least partially encoding the region can be obtained, and the decoding processing amount is reduced to improve the decoding efficiency.
In an application scene, the reference image is an image after full-frame coding, when the processing mode of the image is that the reference image is used or at least part of the area of the current image is coded, the use count value of the reference image corresponding to the image needs to be added, when the use count value of the reference image is added to exceed the count threshold value, the image is subjected to full-frame coding again to obtain a new reference image, and therefore when the use count value exceeds the count threshold value or the image is the first image to be coded, the reference image detection result of the current image is considered to be a reference-free image.
Further, whether the reference image detection result corresponds to the reference image is judged, if the reference image detection result is no reference image, the whole frame encoding is carried out on the current image so that the whole current image is used as a new reference image after being encoded, if the reference image detection result is the reference image, whether the motion detection result corresponds to a moving target is further judged, if the motion detection result is no moving target, the reference image corresponding to the current image is used, and if the motion detection result is the moving target, the partial region corresponding to the moving target in the current image is encoded, so that when the reference image exists in the current image, the encoding quantity of image encoding is effectively reduced, and the encoding compression rate and the encoding efficiency are improved.
According to the scheme, after the current image is obtained, the reference image detection result of the current image is determined in the current image, wherein the reference image is an image after the whole frame of encoding, when the reference image detection result is the reference image, the motion detection result is obtained, the current image is processed based on the motion detection result, when the motion detection result is the moving target, the processing mode is to encode at least part of the area of the current image, the encoding compression rate is improved, for a scene with the moving target, the encoding consumption is effectively reduced, the encoding efficiency is improved, the encoded part of the area is decoded and then superimposed on the decoded reference image, and the whole image corresponding to the image with the processing mode of encoding at least part of the area can be obtained, so that the decoding efficiency is improved.
Referring to fig. 2, fig. 2 is a flow chart of another embodiment of the image encoding method of the present application, the method includes:
s201, obtaining a current image and determining a reference image detection result of the current image.
Specifically, if the current image is an initial image of the whole video data, the reference image detection result of the current image is no reference image, and if a last completely encoded image with a time sequence before the current image is lost, the reference image detection result of the current image is no reference image.
S202, in response to the reference image detection result being no reference image, selecting a processing mode to carry out whole frame coding on the current image, and taking the current image after whole frame coding as a new reference image.
Specifically, when the reference image detection result is no reference image, the selection processing mode is to encode the whole frame of the current image, encode the whole picture of the current image by using an encoding algorithm, and take the current image after the whole frame encoding as a new reference image.
Further, when the reference image corresponds to the usage count value, the usage count value of the new reference image is cleared while the new reference image is obtained.
In one application mode, when the reference image detection result is no reference image, the selection processing mode is to encode the whole frame of the current image, encode the whole picture of the current image by using an encoding algorithm, take the current image after the whole frame encoding as a new reference image, and set the use count value of the new reference image to zero at the same time.
And S203, obtaining a motion detection result in response to the reference image detection result being the reference image.
Specifically, referring to fig. 3, fig. 3 is a flowchart of an embodiment corresponding to step S203 in fig. 2, where the motion detection result is determined based on the following steps, including:
s301, dividing the current image into a plurality of macro blocks, and determining sub-block detection results corresponding to the macro blocks.
Specifically, after the current image is obtained, the current image is divided into a plurality of macro blocks, and motion detection is performed on each macro block, so that sub-block detection results corresponding to the macro blocks are determined.
In an application scene, after a current image is obtained, dividing the current image into a plurality of macro blocks according to pixel sizes, wherein the pixel sizes of the macro blocks at the edge positions of the current image are self-adaptive, the pixel sizes of the macro blocks at the non-edge positions of the current image are preset pixel values, and performing motion detection on each macro block, so that a motion detection zone bit corresponding to a motion detection result in each macro block is output, and a sub-block detection result of each macro block is obtained based on the motion detection zone bit of each macro block, wherein the sub-block detection result is that a moving target and a non-moving target are present, and the macro blocks with the moving target are the moving macro blocks.
S302, determining that a motion detection result corresponding to the current image is a moving target according to the motion macro block which comprises at least one sub-block detection result in the current image and is the moving target.
Specifically, if at least one sub-block detection result in the current image is a motion macro block with a motion target, determining that the motion detection result corresponding to the current image is the motion target.
And S303, determining that the motion detection result corresponding to the current image is a motion-free target in response to the detection results of the sub-blocks corresponding to all the macro blocks corresponding to the current image being the motion-free target.
Specifically, if the sub-block detection results of all the macro blocks in the current image are the motion macro blocks without the motion target, determining that the motion detection result corresponding to the current image is the motion target.
And S204, responding to the motion detection result as no moving object, selecting a processing mode to follow the reference image corresponding to the current image, extracting the time stamp of the current image, and adding the use count value corresponding to the reference image.
Specifically, when the motion detection result is that no moving object exists and the reference frame detection result is that a reference frame exists, the coding mode is selected to follow the reference frame corresponding to the current frame, the time stamp in the current frame is extracted from the current frame to be stored, and the use calculation value corresponding to the reference frame is added on the basis of the prior art.
And S205, responding to the motion detection result as a moving object, selecting a processing mode to encode at least part of the area of the current image, thereby extracting at least the area corresponding to the object which moves from the current image, encoding the area, and adding the use calculation value corresponding to the reference image.
Specifically, when the motion detection result is that there is a moving object and the reference image detection result is that there is a reference image, the selection processing mode is to encode at least a partial region of the current image, extract a region corresponding to the object in the current image, which has moved, or extract a region corresponding to the object in the current image, which has moved, and its peripheral region, to perform partial encoding, so that only partial encoding is performed when there is a movement of the object in the current image, and since only partial encoding is performed, the partially encoded image needs to be decoded by superimposing the reference image when decoding, and therefore, the selection processing mode is to increment the usage count value corresponding to the reference image when encoding at least a partial region of the current image.
In an application mode, the step of encoding at least part of the current image comprises the steps of determining a motion boundary area corresponding to a motion macro block, expanding the motion boundary area outwards according to a preset macro block step length to obtain a region to be scratched, determining the position information of the region to be scratched in the current image, and encoding the region to be scratched in the current image based on encoding parameters matched with the position information.
Specifically, when the motion detection result is determined, the current image is divided into a plurality of macro blocks, when the current image is partially encoded, the motion boundary corresponding to the motion macro block is driven based on the position of the motion macro block, and the motion boundary region is outwards expanded according to the preset macro block step to obtain the region to be scratched, so that the range of the partial encoding is enlarged, the fault tolerance rate for judging the motion boundary region is improved, and the moving object is ensured to be in the region to be scratched.
Further, the position information of the region to be scratched in the current image is determined, and the coding parameters are adjusted so that the coding parameters are matched with the position information of the region to be scratched, and then the region to be scratched in the current image is coded.
In an application scene, determining a motion boundary area corresponding to a motion macro block, and expanding the motion boundary area outwards according to a preset macro block step length to obtain a region to be scratched, wherein the step of determining the motion boundary area based on all the motion macro blocks in response to the fact that the distance between any motion macro block and the motion macro block closest to the motion macro block is within a distance threshold value, and the step of dividing all the motion macro blocks into at least two motion macro block gathering regions based on the distance threshold value in response to the fact that the distance between at least two motion macro blocks and the motion macro block closest to the motion macro block exceeds the distance threshold value respectively determine the motion boundary areas respectively corresponding to the motion macro block gathering regions.
Specifically, whether the distance between any one motion macro block and the motion macro block closest to the motion macro block is within a distance threshold is judged, and if all the motion macro blocks and the motion macro block closest to the motion macro block are within the distance threshold, a motion boundary region is determined based on all the motion macro blocks, so that a region to be scratched is obtained. If the distance between at least two motion macro blocks and the motion macro block closest to the motion macro block exceeds a distance threshold, the motion macro blocks are divided according to the distance threshold to obtain at least two motion macro block gathering areas, wherein when the distance between N motion macro blocks and the motion macro block closest to the motion macro block exceeds the distance threshold, N motion macro block gathering areas are obtained, wherein the motion macro block gathering areas at least comprise one motion macro block, a motion boundary area is determined based on each motion macro block gathering area, so that a region to be scratched corresponding to each motion boundary area is obtained, and when the motion macro blocks are farther away from each other, different motion macro block gathering areas are respectively subjected to partial coding, so that the coding quantity of partial coding is reduced, and the compression rate of coding is improved.
In a specific application scenario, referring to fig. 4, fig. 4 is a schematic application scenario of an embodiment corresponding to step S204 in fig. 2, in which a moving macro block corresponds to a diagonal frame, a distance threshold is a distance between 4 moving macro blocks, a distance between any moving macro block and a nearest moving macro block is within the distance threshold, only one moving macro block gathering area is obtained, a one-dimensional array (the array is sequentially stored from left to right according to an image from top to bottom) is returned by the motion detection algorithm, each member in the array represents a motion state of one macro block, 1 is motion, 0 is no motion, coordinates of each moving macro block can be obtained through the array and the width of the image, then the ratio of the horizontal to vertical coordinates of all the coordinates is judged, the maximum and minimum values are respectively taken out, namely, an upper left corner and a lower right corner in the dashed line frame are taken as moving boundary areas, and after the moving boundary areas are obtained, a region to be scratched according to a preset macro block step length is obtained, namely, a region to be scratched by gray blocks in fig. 4.
In another specific application scenario, referring to fig. 5, fig. 5 is a schematic view of an application scenario of another embodiment corresponding to step S204 in fig. 2, where a moving macroblock corresponds to a diagonal frame, a distance threshold is a distance between 5 moving macroblocks, a distance between two regions corresponding to two moving macroblocks exceeds the distance threshold, and two aggregation regions are located between the moving macroblocks, so as to obtain two moving macroblock aggregation regions shown in a dashed frame in fig. 5, and thus, the two regions to be scratched are obtained by respectively expanding the two moving macroblock regions outwards according to a preset macroblock step length, that is, a region surrounded by a gray macroblock in fig. 5. Thus, when the distance between the motion macro block gathering areas is larger, the encoding can be divided into areas so as to reduce the encoding quantity of the non-motion areas, thereby improving the encoding compression rate.
Optionally, before the step of encoding at least a partial region of the current image, so as to extract at least a region corresponding to a moving object from the current image, and adding the usage count value corresponding to the reference image, the method further includes determining whether the total area of the region corresponding to the moving object exceeds a duty ratio threshold, and in response to the duty ratio threshold being exceeded, selecting the method to encode the current image in whole frame, so that the current image after the whole frame is used as a new reference image, and clearing the usage count value.
Specifically, when the motion detection result is that a moving object exists and the reference image detection result is that a reference image exists, whether the area of the area corresponding to the object which has moved accounts for the total area of the current image exceeds a duty ratio threshold value is judged, when the area exceeds the duty ratio threshold value, more and larger moving objects in the current image are judged, the whole frame of the current image is coded in a selection processing mode, the image is directly coded in other judging processes, the coding efficiency is improved, the moving objects are prevented from being lost, and when the duty ratio does not exceed the duty ratio threshold value, at least part of the area of the current image is coded in the selection processing mode.
In an application scene, when judging whether the area of the area corresponding to the moving target exceeds the total area of the current image or not, determining the ratio of the area corresponding to the moving target to the total area of the current image through the ratio of the moving macro block to all macro blocks corresponding to the current image.
And S206, in response to the usage count value exceeding the count threshold, encoding the whole frame of the current image and clearing the usage count value.
Specifically, when the usage count value corresponding to the reference image exceeds the count threshold, the current image is subjected to full-frame encoding while the usage count value is cleared, so that the phenomenon that the same reference image is used or referenced for too many times is avoided, inter-frame encoding errors are reduced, and waiting time during decoding is reduced.
S207, setting a flag bit matched with the processing mode for the processed current image.
Specifically, the processing mode corresponds to the matched flag bit, thereby facilitating efficient determination of the decoding mode at the time of decoding.
In an application mode, a first zone bit corresponding to a processing mode is set for carrying out whole frame coding on a current image in response to the processing mode, the processed current image and the first zone bit are packaged and stored, a second zone bit corresponding to the processing mode is set for carrying out follow-up of a reference image corresponding to the current image in response to the processing mode, a timestamp of the current image and the second zone bit are packaged and stored, a third zone bit corresponding to the processing mode is set for carrying out coding on at least part of the area of the current image in response to the processing mode, and position information and the processed part of the area and the third zone bit are packaged and stored.
Specifically, after a matched processing mode is selected for an image, the processed image is required to be packaged and stored, when the processing mode is to encode the whole frame of the current image, a first zone bit corresponding to the processing mode is set, the processed current image and the first zone bit are packaged and stored, when the processing mode is to follow a reference image corresponding to the current image, a second zone bit corresponding to the processing mode is set, a timestamp of the current image extracted before is packaged and stored with the second zone bit, when the processing mode is to encode at least part of the current image, a third zone bit corresponding to the processing mode is set, and position information corresponding to the processed part of the area and the processed part of the area are packaged and stored with the third zone bit, so that the superposition of the decoded part of the image area and the reference image can be determined during decoding, and the decoding accuracy is improved.
In an application scenario, when the processing manner is encoding at least a partial region of the current image, the partial region corresponds to the region to be scratched in the step S205, and the position information corresponding to the region to be scratched, the processed region to be scratched and the third flag bit are packaged and stored.
In this embodiment, after a current image is divided into a plurality of macro blocks and motion detection is performed, after a motion detection result and a reference image detection result are obtained, a proper processing mode is selected based on the motion detection result and the reference image detection result, so as to improve the encoding compression rate in the time domain, wherein when the processing mode is to encode at least a partial area of the current image, the distance between any one of the motion macro blocks and the nearest motion macro block is determined, thereby dividing a motion macro block gathering area and expanding the area to be scratched, the area to be scratched is encoded, when the distance between the motion macro block gathering areas is larger, the area encoding can be performed, so as to reduce the encoding quantity of a non-motion area, thereby improving the encoding compression rate, and when the processing mode is to encode a reference image corresponding to the current image, the encoding compression rate and the encoding efficiency are not required to be improved, when the processing mode is to encode the reference image corresponding to the current image, when the processing mode is to encode the whole frame encoding, the image is to encode the whole frame, so as to obtain a new reference image, the encoding quality is not required to be improved, and the encoding rate is not reduced more than the reference image is required.
Referring to fig. 6, fig. 6 is a flowchart illustrating an embodiment of an image decoding method according to the present application, wherein the image decoding method according to the present embodiment is applied to an image encoded by the image encoding method according to any one of the embodiments, and the method includes:
S601, obtaining a current image to be decoded, and determining the processing mode of the current image based on the zone bit matched with the processing mode.
Specifically, when the coded image is decoded, a current image to be decoded is obtained, and the processing mode of the current image in the coding process is determined based on the zone bit matched with the processing mode in the coding process.
And S602, responding to the processing mode to encode at least part of the area of the current image, decoding the encoded area to obtain a decoding subarea, superposing the timestamp corresponding to the current image and the decoding subarea on the corresponding position of the reference image corresponding to the current image to obtain a decoded current image, and taking the decoded current image as a new reference image.
Specifically, when the processing mode is to encode at least part of the area of the current image, decoding the encoded area to obtain a decoding subarea, and overlapping the decoding subarea on the current image, wherein the decoding subarea is overlapped and replaced based on the position information to display a moving target, and the timestamp of the current image is overlapped on the reference image of the current image to ensure that the timestamp is accurately displayed, and the decoded current image is used as a new reference image, so that the continuity and instantaneity of the image in continuous display are ensured.
In an application scene, the encoded region is obtained based on the region to be scratched in the embodiment, the encoded region corresponding to the region to be scratched is decoded to obtain a decoded sub-region, so that the decoded sub-region is superimposed into the current image based on the position information corresponding to the region to be scratched, the decoded image is used as a new reference image, and when the reference image is needed to be used by a subsequent image, a moving target in the current image can still be displayed.
Further, after the step of obtaining the current image to be decoded and determining the processing mode of the current image based on the zone bit matched with the processing mode, the method further comprises the steps of directly performing full-frame decoding on the current image to obtain the decoded current image in response to the processing mode of performing full-frame encoding on the current image, taking the decoded current image as a new reference image, and superposing a timestamp corresponding to the current image on the reference image corresponding to the current image in response to the processing mode of continuing to use the reference image corresponding to the current image to obtain the decoded current image.
Specifically, when the processing mode is that the current image is subjected to whole frame coding, the current image is directly subjected to whole frame decoding during decoding to obtain a decoded current image, the whole frame decoded current image is used as a new reference image, and after each whole frame decoded image is obtained, the whole frame decoded image is used as a new reference image and later images are referenced.
Further, when the processing mode is to follow the reference image corresponding to the current image, the current reference image is acquired, and the time stamp of the current image is superimposed on the reference image corresponding to the current image, so that the time stamp is accurately displayed, and the decoded current image is obtained.
It can be understood that when the video stream needs to be dragged for playback, if the processing mode of the playback initial image is full-frame encoding, full-frame decoding is performed from the current image, and if the processing mode of the playback initial image is along with the reference image or partial encoding corresponding to the current image, the reference image corresponding to the playback initial video can be necessarily obtained by searching up to at most the threshold number of images in the above embodiment from the current image, so that the picture of the playback initial image is obtained, and frame-by-frame display is performed from the playback initial image.
According to the scheme, if the processing mode of the current image is the reference image corresponding to the current image, only the stored time stamp is needed to be extracted, and if the processing mode of the current image is the encoding mode of at least part of the current image, the encoded region is decoded to obtain the decoded sub-region, and the decoded sub-region and the time stamp corresponding to the current image are overlapped on the reference image, so that the decoding efficiency is improved.
Referring to fig. 7, fig. 7 is a schematic structural diagram of an electronic device according to an embodiment of the present application, the electronic device 70 includes a memory 701 and a processor 702 coupled to each other, wherein the memory 701 stores program data (not shown), and the processor 702 invokes the program data to implement the method in any of the above embodiments, and the description of the related content is referred to the detailed description of the above method embodiments and is not repeated herein.
Referring to fig. 8, fig. 8 is a schematic structural diagram of an embodiment of a computer readable storage medium 80 according to the present application, where the computer readable storage medium 80 stores program data 800, and the program data 800 when executed by a processor implements the method in any of the above embodiments, and details of the related content are described in the above embodiments, which are not repeated herein.
The units described as separate units may or may not be physically separate, and units displayed as units may or may not be physical units, may be located in one place, or may be distributed over a plurality of network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the embodiment.
In addition, each functional unit in the embodiments of the present application may be integrated in one processing unit, or each unit may exist alone physically, or two or more units may be integrated in one unit. The integrated units may be implemented in hardware or in software functional units.
The integrated units, if implemented in the form of software functional units and sold or used as stand-alone products, may be stored in a computer readable storage medium. Based on such understanding, the technical solution of the present application may be embodied in essence or a part contributing to the prior art or all or part of the technical solution in the form of a software product stored in a storage medium, including several instructions for causing a computer device (which may be a personal computer, a server, or a network device, etc.) or a processor (processor) to execute all or part of the steps of the methods of the embodiments of the present application. The storage medium includes a U disk, a removable hard disk, a Read-Only Memory (ROM), a random access Memory (RAM, random Access Memory), a magnetic disk, an optical disk, or other various media capable of storing program codes.
The foregoing description is only of embodiments of the present application, and is not intended to limit the scope of the application, and all equivalent structures or equivalent processes using the descriptions and the drawings of the present application or directly or indirectly applied to other related technical fields are included in the scope of the present application.

Claims (11)

1. An image encoding method, the method comprising:
obtaining a current image and determining a reference image detection result of the current image;
The method comprises the steps of responding to a reference image detection result to obtain a motion detection result and selecting a processing mode to process the current image based on the motion detection result, wherein the reference image is an image after full-frame coding, when the motion detection result is a moving target, the processing mode is to code at least part of the area of the current image, and the part of the area comprises the moving target;
setting a flag bit matched with the processing mode for the processed current image;
the step of obtaining a motion detection result and selecting a processing mode to process the current image based on the motion detection result comprises the following steps:
Responding to the motion detection result as no moving object, selecting a reference image corresponding to the current image in a processing mode of using the reference image, extracting a time stamp of the current image, and adding a use count value corresponding to the reference image, or
Responding to the motion detection result as a moving object, selecting a processing mode to encode at least part of the area of the current image, thereby extracting at least the area corresponding to the object which moves from the current image to encode and adding the use count value corresponding to the reference image;
and in response to the usage count value exceeding a count threshold, performing full-frame encoding on the current image and clearing the usage count value.
2. The image encoding method according to claim 1, wherein after the step of obtaining the current image and determining the reference image detection result of the current image, further comprising:
And responding to the reference image detection result as no reference image, selecting a processing mode to carry out whole frame coding on the current image, and taking the current image after whole frame coding as a new reference image.
3. The image encoding method according to claim 1, wherein the selecting process is performed by encoding at least a part of the area of the current image, so as to extract at least an area corresponding to the object that has moved from the current image, and further includes, before the step of adding the usage count value corresponding to the reference image:
Determining whether the area of the area corresponding to the moving object occupies more than a threshold value of the occupied ratio;
And in response to the duty ratio threshold value being exceeded, selecting a processing mode to carry out full-frame coding on the current image, thereby taking the current image after full-frame coding as a new reference image and clearing the use count value.
4. The image encoding method according to claim 2, wherein the step of setting a flag bit matching the processing manner for the processed current image includes:
Responding to the processing mode to carry out full-frame coding on the current image, setting a first zone bit corresponding to the processing mode, and packaging and storing the processed current image and the first zone bit;
Responding to the processing mode of using the reference image corresponding to the current image, setting a second zone bit corresponding to the processing mode, and packaging and storing the timestamp of the current image and the second zone bit;
And in response to the processing mode, encoding at least part of the area of the current image, setting a third zone bit corresponding to the processing mode, and packaging and storing the position information corresponding to the part of the area and the processed part of the area with the third zone bit.
5. The image encoding method according to claim 1, wherein the motion detection result is determined based on the steps of:
dividing the current image into a plurality of macro blocks, and determining sub-block detection results corresponding to the macro blocks;
determining that a motion detection result corresponding to the current image is a moving target according to a motion macro block which comprises at least one sub-block detection result and is the moving target in the current image;
And determining that the motion detection result corresponding to the current image is a motion-free target in response to the detection results of all the sub-blocks corresponding to the macro blocks corresponding to the current image being the motion-free target.
6. The image encoding method according to claim 5, wherein the step of encoding at least a partial region of the current image comprises:
determining a motion boundary area corresponding to the motion macro block, and expanding the motion boundary area outwards according to a preset macro block step length to obtain a region to be scratched;
and determining the position information of the region to be scratched in the current image, and encoding the region to be scratched in the current image based on encoding parameters matched with the position information.
7. The image coding method according to claim 6, wherein the step of determining the motion boundary area corresponding to the motion macroblock, and expanding the motion boundary area outward according to a preset macroblock step length to obtain the region to be scratched includes:
Determining the motion boundary region based on all the motion macro blocks in response to the distance between any one of the motion macro blocks and the motion macro block closest to the motion macro block being within a distance threshold;
And in response to the distance between at least two motion macro blocks and the motion macro block closest to the motion macro block exceeding the distance threshold, dividing all the motion macro blocks into at least two motion macro block gathering areas based on the distance threshold, and respectively determining motion boundary areas respectively corresponding to the motion macro block gathering areas.
8. An image decoding method, characterized in that the method is applied to the image encoding method as claimed in any one of claims 1 to 7, comprising:
Obtaining a current image to be decoded, and determining a processing mode of the current image based on a flag bit matched with the processing mode;
and responding to the processing mode to encode at least part of the area of the current image, decoding the encoded area to obtain a decoding subarea, superposing the timestamp corresponding to the current image and the decoding subarea on the corresponding position of the reference image corresponding to the current image to obtain a decoded current image, and taking the decoded current image as a new reference image.
9. The image decoding method according to claim 8, wherein the step of obtaining the current image to be decoded and determining the processing mode of the current image based on the flag bit matched with the processing mode further comprises:
In response to the processing mode, performing full-frame coding on the current image, directly performing full-frame decoding on the current image to obtain a decoded current image, and taking the decoded current image as a new reference image;
and in response to the processing mode of using the reference image corresponding to the current image, overlapping the time stamp corresponding to the current image on the reference image corresponding to the current image to obtain the decoded current image.
10. An electronic device comprising a memory and a processor coupled to each other, wherein the memory stores program data and the processor invokes the program data to perform the method of any of claims 1-7 or 8-9.
11. A computer readable storage medium having stored thereon program data, which when executed by a processor implements the method of any of claims 1-7 or 8-9.
CN202210580450.7A 2022-05-25 2022-05-25 Image encoding, decoding method, electronic device and computer readable storage medium Active CN115022641B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202210580450.7A CN115022641B (en) 2022-05-25 2022-05-25 Image encoding, decoding method, electronic device and computer readable storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202210580450.7A CN115022641B (en) 2022-05-25 2022-05-25 Image encoding, decoding method, electronic device and computer readable storage medium

Publications (2)

Publication Number Publication Date
CN115022641A CN115022641A (en) 2022-09-06
CN115022641B true CN115022641B (en) 2025-06-13

Family

ID=83071385

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202210580450.7A Active CN115022641B (en) 2022-05-25 2022-05-25 Image encoding, decoding method, electronic device and computer readable storage medium

Country Status (1)

Country Link
CN (1) CN115022641B (en)

Families Citing this family (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115955566B (en) * 2023-03-03 2023-06-20 浙江大华技术股份有限公司 Encoding method and decoding method
CN119155452B (en) * 2024-11-18 2025-04-25 浙江大华技术股份有限公司 Image encoding and decoding method based on content generation, electronic device and storage medium

Citations (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102823247A (en) * 2010-03-30 2012-12-12 富士通株式会社 Image processing apparatus and image processing method

Family Cites Families (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP3934568B2 (en) * 2003-03-04 2007-06-20 松下電器産業株式会社 Video coding method and apparatus
US8019000B2 (en) * 2005-02-24 2011-09-13 Sanyo Electric Co., Ltd. Motion vector detecting device
JP5522174B2 (en) * 2009-08-21 2014-06-18 日本電気株式会社 Video encoding device
WO2012008037A1 (en) * 2010-07-15 2012-01-19 富士通株式会社 Moving image decoding apparatus, moving image decoding method, moving image encoding apparatus and moving image encoding method

Patent Citations (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102823247A (en) * 2010-03-30 2012-12-12 富士通株式会社 Image processing apparatus and image processing method

Also Published As

Publication number Publication date
CN115022641A (en) 2022-09-06

Similar Documents

Publication Publication Date Title
KR101350853B1 (en) Apparatus and method for reducing artifacts in images
CN115022641B (en) Image encoding, decoding method, electronic device and computer readable storage medium
CN101080930B (en) Motion vector calculation device and motion vector calculation method
US20100080472A1 (en) Image processing apparatus, moving image decoding apparatus, moving image encoding apparatus and method
US20100322309A1 (en) Method for spatial error concealment
TWI613910B (en) Method and encoder for video encoding of a sequence of frames
JP5478047B2 (en) Video data compression pre-processing method, video data compression method and video data compression system using the same
US8320700B2 (en) Apparatus and method of estimating scale ratio and noise strength of encoded image
WO2021114846A1 (en) Video noise cancellation processing method and apparatus, and storage medium
KR20140004022A (en) Method for reframing images of a video sequence, and apparatus for reframing images of a video sequence
CN110087075B (en) Image coding method, coding device and computer storage medium
CN111131837A (en) Motion compensation correction method, encoding method, encoder, and storage medium
CN116074537A (en) Encoding method, decoding method, electronic device, and computer-readable storage medium
CN107820095A (en) A kind of long term reference image-selecting method and device
WO2025036071A1 (en) Video coding method, apparatus and device, storage medium, and program product
KR20060111528A (en) Detection of Local Visual Spatial-temporal Details in Video Signals
CN110519597B (en) HEVC-based encoding method and device, computing equipment and medium
CN111277728A (en) Video detection method and device, computer-readable storage medium, and electronic device
CN110839157B (en) Image processing method and device
CN104994397B (en) Adaptive video preprocess method based on time-domain information
CN111713105B (en) A video image processing method, device and storage medium
CN115883933A (en) Video subtitle removal method, device, computer equipment and storage medium
CN116847090A (en) A parallel encoding and decoding method and system based on desktop video area of interest
CN116156186A (en) A temporal-spatial-domain cooperative preprocessing method and related device for video
Decombas et al. Seam carving for semantic video coding

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
GR01 Patent grant
GR01 Patent grant