Rate control method, encoding method, device, equipment and storage medium

By determining the key pixel points and reference segmentation lines of the target detection frame in video encoding, accurately dividing the background area and adjusting the bit rate, the problem of non-ROI content being included in the ROI area frame is solved, thereby improving video compression quality and computational efficiency.

CN119342221BActive Publication Date: 2025-09-23BEIJING BAIDU NETCOM SCI & TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202411266723.6
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-09-10
Publication Date
2025-09-23
Estimated Expiration
2044-09-10

AI Technical Summary

Technical Problem

The existing technology may include non-ROI content in the ROI area frame, resulting in inaccurate bit rate control and affecting the video encoding compression effect.

Method used

By obtaining the key pixel points within the target detection frame, generating a reference segmentation line, determining the background area, and adjusting the bit rate of the background area, the rationality of the bit rate allocation is improved.

Benefits of technology

It achieves more precise bit rate control, improves the quality of video encoding compression, reduces the amount of calculation, and retains the edge details of the object to be detected.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119342221B_ABST
    Figure CN119342221B_ABST
Patent Text Reader

Abstract

The present disclosure proposes a rate control method, encoding method, device, equipment and storage medium, which relate to the field of image processing technology, especially to the field of video encoding and video communication technology. The specific implementation scheme is: obtaining the original image to be rate controlled, wherein the original image includes at least one target detection frame of the object to be detected; for any target detection frame, determining the key pixel points based on the target pixel points for displaying the object to be detected within the set range of the frame edge of the target detection frame; generating at least one reference segmentation line based on the key pixel points, and determining the background area within the target detection frame based on the reference segmentation line; and adjusting the rate of the background area within each target detection frame in the original image. This can make the target detection frame more accurate in identifying the object to be detected, and further adjust the rate of the background area, which can improve the rationality of the rate allocation and improve the compression quality of the video.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present disclosure relates to the field of image processing technology, and in particular to the field of video coding and video communication technology. Background Art

[0002] When current encoders perform video encoding compression, they usually use regions of interest (ROI) to perform bit rate control, which can provide users with a better subjective experience at the same bit rate.

[0003] However, due to differences in angles, positions, and other aspects of the detection object, some non-ROI content may be included in the ROI area frame. Summary of the Invention

[0004] The present disclosure provides a rate control method, an encoding method, an apparatus, a device, and a storage medium.

[0005] According to one aspect of the present disclosure, a rate control method is provided, the method comprising:

[0006] Acquire an original image to be rate controlled, wherein the original image includes at least one target detection frame of an object to be detected;

[0007] For any target detection frame, determine key pixels based on target pixels that are located within a set range of the target detection frame edge and are used to display the object to be detected;

[0008] generating at least one reference segmentation line according to the key pixel points, and determining a background area within the target detection frame according to the reference segmentation line;

[0009] The bit rate of the background area within each target detection frame in the original image is adjusted.

[0010] According to another aspect of the present disclosure, there is provided an encoding method, the method comprising:

[0011] Using the above-mentioned rate control method, the rate of the background area within each target detection frame in the original image is adjusted;

[0012] The original image is encoded based on the adjusted bit rate.

[0013] According to another aspect of the present disclosure, a rate control apparatus is provided, comprising:

[0014] An acquisition module, configured to acquire an original image to be rate controlled, wherein the original image includes at least one target detection frame of an object to be detected;

[0015] A key pixel point determination module is used to determine key pixels for any target detection frame based on target pixels located within a set range of the frame edge of the target detection frame and used to display the object to be detected;

[0016] a background area determination module, configured to generate at least one reference segmentation line according to the key pixel points, and determine a background area within the target detection frame according to the reference segmentation line;

[0017] The bit rate adjustment module is used to adjust the bit rate of the background area within each target detection frame in the original image.

[0018] According to another aspect of the present disclosure, there is provided an encoding device, the device comprising:

[0019] A bit rate adjustment module, configured to use the bit rate control device to adjust the bit rate of the background area within each target detection frame in the original image;

[0020] The encoding module is configured to encode the original image based on the adjusted bit rate.

[0021] It should be understood that the contents described in this section are not intended to identify the key or important features of the embodiments of the present disclosure, nor are they intended to limit the scope of the present disclosure. Other features of the present disclosure will become readily understood through the following description. BRIEF DESCRIPTION OF THE DRAWINGS

[0022] The accompanying drawings are used to better understand the present invention and do not constitute a limitation of the present invention.

[0023] Figure 1 A schematic diagram of a flow chart of a rate control method provided in an embodiment of the present disclosure;

[0024] Figure 2 is a schematic diagram according to a second embodiment of the present disclosure;

[0025] Figure 3 A schematic flow chart of another rate control method provided in an embodiment of the present disclosure;

[0026] Figure 4 A schematic flow chart of another rate control method provided in an embodiment of the present disclosure;

[0027] Figure 5 A schematic diagram of a flow chart of an encoding method provided in an embodiment of the present disclosure;

[0028] Figure 6 A flowchart of another encoding method provided by an embodiment of the present disclosure;

[0029] Figure 7 A schematic structural diagram of a rate control device provided in an embodiment of the present disclosure;

[0030] Figure 8 A schematic structural diagram of an encoding device provided in an embodiment of the present disclosure;

[0031] Figure 9 FIG. 1 is a schematic block diagram of an example electronic device for implementing an embodiment of the present disclosure. DETAILED DESCRIPTION

[0032] The following description of exemplary embodiments of the present disclosure is made in conjunction with the accompanying drawings, including various details of the embodiments of the present disclosure to facilitate understanding. These details should be considered as merely exemplary. Therefore, those skilled in the art will recognize that various changes and modifications may be made to the embodiments described herein without departing from the scope and spirit of the present disclosure. Similarly, for the sake of clarity and conciseness, descriptions of well-known functions and structures are omitted in the following description.

[0033] Image processing generally refers to digital image processing, a technique for analyzing images using computers to achieve desired results. A digital image is a large two-dimensional array captured by devices such as industrial cameras, video cameras, and scanners. The elements of this array are called pixels, and their values ​​are called pixel values.

[0034] Video encoding usually refers to the entire process of compressing raw video data into encoded data, making the video size smaller and facilitating video storage and transmission.

[0035] Video communication refers to a communication service that transmits video information, integrating voice, data, and video. It is increasingly used in video conferencing, remote video medical care, remote video education, and other areas.

[0036] Figure 1 A flow chart of a rate control method provided by an embodiment of the present disclosure. Figure 1 As shown, the bit rate control method includes but is not limited to the following steps:

[0037] Step 101: Acquire an original image to be rate controlled, wherein the original image includes at least one target detection frame of an object to be detected.

[0038] Optionally, the original image is an image that needs to be rate controlled, such as each video frame of a television program or a movie.

[0039] Optionally, the target detection frame can be a region of interest (ROI) detection frame. The ROI area is the most attention-grabbing area identified from the original image based on the characteristics of the human eye. For example, in a TV program or movie video frame, the user pays more attention to the face and less attention to the background such as the buildings next to the face. In these video frames, the face is the ROI area.

[0040] Optionally, the object to be detected may be the object that requires the most attention in the original image, such as a face in the above video frame.

[0041] The shape of the target detection frame can be square, circular, elliptical or irregular, which is not limited here.

[0042] It can be understood that the original image includes at least one target detection frame of the object to be detected. When there are multiple objects to be detected and their target detection frames, each target detection frame can be screened, for example, a preset number of target detection frames with the largest area are selected for subsequent processing. For scenes with many target detection frames, target detection frames with too small an area can be screened out according to actual conditions.

[0043] Step 102 : For any target detection frame, key pixels are determined based on target pixels located within a set range of the target detection frame edge for displaying the object to be detected.

[0044] Optionally, the frame edge setting range can be a range composed of pixel points on any frame edge of the target detection frame. For example, when the target detection frame is a rectangle, the set of ranges composed of pixel points on any side of the four frame edges of the target detection frame can be used as the frame edge setting range; the frame edge setting range can also be a range composed of pixel points on any frame edge of the target detection frame and its neighboring pixel points. For example, when the target detection frame is a rectangle, the set of ranges composed of pixel points on any side of the four frame edges of the target detection frame and its neighboring pixel points can be used as the frame edge setting range.

[0045] The neighborhood pixel points may be 4 neighborhood pixel points, 8 neighborhood pixel points, or diagonal neighborhood pixel points, which is not limited here.

[0046] Optionally, for any target detection frame, the pixel point where the identified object to be detected is located in the original image is the target pixel point, and the object to be detected is composed of the target pixel points within the target detection frame.

[0047] Optionally, target pixels within the set range of the frame edge are screened to determine key pixels, which are used to characterize edge information of the object to be detected. For example, the target pixel at the edge of the frame edge can characterize the edge characteristics of the object to be detected, and one or more target pixels at the edge of the frame edge can be selected as key pixels.

[0048] Step 103: Generate at least one reference segmentation line based on the key pixel points, and determine the background area within the target detection frame based on the reference segmentation line.

[0049] Optionally, the reference segmentation line may be obtained by fitting key pixel points, wherein the reference segmentation line may be a straight line, a curve, or a broken line, which is not limited here.

[0050] It can be understood that the reference segmentation line obtained by fitting the key pixel points representing the edge information of the object to be detected can represent the edge contour of the object to be detected.

[0051] Optionally, the object to be detected and the background area within the target detection frame may be segmented by referring to the segmentation line to determine the background area within the target detection frame.

[0052] Step 104 : performing bit rate adjustment on the background area within each target detection frame in the original image.

[0053] It should be noted that the area within the target detection frame is the area that needs to be paid attention to and is identified in the original image. It is also the area where the encoder needs to retain more details during compression. During encoding, the bit rate of the area within the target detection frame is higher, which can retain more image details and image quality, while the bit rate of the area outside the target detection frame is lower, which may cause image distortion and quality degradation in this area.

[0054] Optionally, by determining the background area within the target detection frame and adjusting the bit rate within the background area to the bit rate of the area outside the target detection frame, the computing power of video encoding compression can be reduced and more bit rate can be allocated to the area where the object to be detected is located.

[0055] The rate control method proposed in the present disclosure obtains an original image to be rate controlled, wherein the original image includes at least one target detection frame of an object to be detected; for any target detection frame, determines key pixel points based on target pixel points for displaying the object to be detected within a set range of the frame edge of the target detection frame; generates at least one reference segmentation line based on the key pixel points, and determines the background area within the target detection frame based on the reference segmentation line; and adjusts the rate of the background area within each target detection frame in the original image. By determining the background area within the target detection frame with reference to the segmentation line, the target detection frame can be further segmented, making the target detection frame more accurate in identifying the object to be detected and better preserving the edge of the object to be detected, and further adjusting the rate of the background area, the rationality of the rate allocation can be improved, the computing power of video encoding compression can be reduced, a more accurate rate control effect can be achieved, and the compression quality of the video can be improved.

[0056] This disclosure also proposes another rate control method: Figure 2 This is a flow chart of another rate control method provided by an embodiment of the present disclosure. Figure 2 As shown, the bit rate control method includes but is not limited to the following steps:

[0057] Step 201: Acquire an original image to be rate controlled, wherein the original image includes at least one target detection frame of an object to be detected.

[0058] Optionally, the original image is an image that needs to be rate controlled, such as each video frame of a television program or a movie.

[0059] Optionally, the target detection frame can be a ROI detection frame. The ROI area is the most attention-grabbing area identified from the original image based on the characteristics of the human eye. For example, in a TV program or movie video frame, the user pays more attention to the face and less attention to the background such as the buildings next to the face. In these video frames, the face is the ROI area.

[0060] Optionally, the object to be detected may be the object that requires the most attention in the original image, such as a face in the above video frame.

[0061] In the embodiment of the present disclosure, the object to be detected is a human face, and the object to be detected is identified by face recognition technology to generate a target detection frame, such as face recognition algorithms such as OpenCV, neural network, and Matlab.

[0062] As an example, face recognition is performed using OpenCV. The specific steps include:

[0063] Obtain the original image and convert it from an RGB image to a grayscale image that is easier to process; perform preliminary processing on the grayscale image, such as resizing, cropping, blurring, and sharpening, according to actual conditions; perform contour detection on the grayscale image after preliminary processing or segment multiple objects in a single image so that the classifier can quickly detect objects and faces in the image; based on the common characteristics of the face, such as the eye area being darker than its adjacent pixels and the nose area being brighter than the eye area, use the face detection algorithm to find the location of the face in the image and frame the face with a rectangular frame.

[0064] In the embodiment of the present disclosure, the original image includes at least one target detection frame of an object to be detected. When there are multiple objects to be detected and their target detection frames, the three target detection frames with the largest areas are selected for subsequent processing. When the number of target detection frames is less than three, all identified target detection frames are subsequently processed.

[0065] Step 202: Determine target pixels within the set range of the edge of any target detection frame through image segmentation.

[0066] In the embodiment of the present disclosure, the frame edge setting range is the range composed of the pixel points where the rectangular frame edges of the target detection frame are located, that is, the collection of the ranges composed of the pixel points where any one of the four frame edges of the target detection frame is located.

[0067] As you can understand, image segmentation refers to the process of subdividing a digital image into multiple image subregions (collections of pixels). Image segmentation is often used to locate objects and boundaries (lines, curves, etc.) in an image. More precisely, image segmentation is the process of labeling each pixel in an image so that pixels with the same label share certain common visual properties. Pixels with common visual properties form a subregion, and adjacent subregions have significant differences in the measure of the common visual properties.

[0068] Among them, the image segmentation method can be: threshold-based segmentation, region growing, region splitting and merging, watershed algorithm, edge segmentation, histogram method, cluster analysis, wavelet transform, etc.

[0069] In the embodiment of the present disclosure, for any target detection frame, target pixel points for displaying the object to be detected within a set range of the frame edge are determined by threshold segmentation.

[0070] It can be understood that the object to be detected is composed of all target pixels within the target detection frame. In the embodiment disclosed in the present invention, not all target pixels are segmented. Only target pixels within the set range of the frame edge are identified, which can simplify the segmentation process and reduce the amount of calculation.

[0071] Furthermore, according to the number of target pixels within the set range of any frame edge, step 203 or step 204 is selected for execution.

[0072] Step 203: For any frame edge, when the number of target pixel points is one, use the target pixel point as a key pixel point.

[0073] It is understandable that the face range identified by the target detection frame is more accurate. If there is only one target pixel, it means that the edge of the frame is tangent to the edge of the face, and some non-face areas may appear on both sides of the tangent part. At this time, the target pixel can represent the edge of the face range, so the target pixel is used as the key pixel.

[0074] Step 204 : For any frame edge, if there are multiple target pixels, traverse the target pixels on the frame edge, and select the starting target pixel and the ending target pixel in the traversal order as key pixels.

[0075] It is understandable that if there are multiple target pixels, it means that the face intersects with the target detection frame, and the target detection frame does not include a complete face. At this time, it is necessary to screen out key pixels representing the edge from multiple target pixels.

[0076] Optionally, for any frame edge, traverse the target pixel points on the frame edge within the set range of the frame edge, and filter the starting target pixel point and the ending target pixel point in the traversal order. In fact, the target pixel point and the ending target pixel point represent the edge position of the face on the frame edge, and the starting target pixel point and the ending target pixel point will be used as key pixel points.

[0077] By screening key pixel points among the target pixel points included in the frame edge setting range, the pixel points representing the edge information of the object to be detected can be determined within the target detection frame edge setting range. On the premise of only identifying some target pixel points, the edge of the object to be detected can be determined, thereby reducing the computational complexity of edge recognition.

[0078] Step 205 : generating at least one reference segmentation line according to the key pixel points, and determining a background area within the target detection frame according to the reference segmentation line.

[0079] For the description of the above step 205, please refer to the relevant description in the above embodiment, which will not be repeated here.

[0080] Step 206 : Obtain the target bit rate allocated to the reference area excluding the target detection frame in the original image; and adjust the bit rate of the background area to the target bit rate.

[0081] It should be noted that the area within the target detection frame is the area identified in the original image that needs to be paid attention to, and is also the area where the encoder needs to retain more details during compression. During encoding, the bit rate of the area within the target detection frame is higher, which can retain more image details and image quality, while the bit rate of the reference area outside the target detection frame is lower, which may cause image distortion and quality degradation in this area.

[0082] Optionally, a target bit rate allocated to the reference area is determined, and the bit rate in the background area is adjusted to the target bit rate.

[0083] By adjusting the bit rate of the background area within the target detection frame to the target bit rate that loses more details, the recognition accuracy of the object to be detected can be improved, the computing power of video encoding compression can be reduced, more bit rate can be allocated to the area where the object to be detected is located, and the compression quality of the video can be improved.

[0084] The rate control method proposed in the present disclosure obtains an original image to be rate controlled, wherein the original image includes at least one target detection frame of an object to be detected; within the frame edge setting range of any target detection frame, the target pixel point is determined by image segmentation; for any frame edge, when the number of target pixel points is one, the target pixel point is used as the key pixel point; for any frame edge, when the number of target pixel points is multiple, the target pixel points on the frame edge are traversed, and the starting target pixel point and the ending target pixel point are selected in the traversal order as the key pixel points; at least one reference segmentation line is generated according to the key pixel points, and the background area is determined within the target detection frame according to the reference segmentation line; the rate of the background area within each target detection frame in the original image is adjusted. By determining the background area within the target detection frame by the reference segmentation line, the target detection frame can be further segmented, the recognition accuracy of the object to be detected can be improved, the edge of the object to be detected can be better preserved, and the rate of the background area can be further adjusted, which can improve the rationality of rate allocation, reduce the computing power of video encoding compression, achieve more accurate rate control effect, and improve the compression quality of the video.

[0085] This disclosure also proposes another rate control method: Figure 3 This is a flow chart of another rate control method provided by an embodiment of the present disclosure. Figure 3 As shown, the bit rate control method includes but is not limited to the following steps:

[0086] Step 301: Acquire an original image to be rate controlled, wherein the original image includes at least one target detection frame of an object to be detected.

[0087] For the description of the above step 301, please refer to the relevant description in the above embodiment, which will not be repeated here.

[0088] Step 302 : For any target detection frame, key pixels are determined based on target pixels located within a set range of the target detection frame edge for displaying the object to be detected.

[0089] For the description of the above step 302, please refer to the relevant description in the above embodiment, which will not be repeated here.

[0090] Step 303 : For two adjacent frame edges, connect the two closest key pixel points located on different frame edges to generate a reference segmentation line.

[0091] Optionally, through screening, the number of key pixel points on any frame edge is one or two. For every two adjacent frame edges, the distance between the key pixel points on different frame edges is calculated. For example, the distance is calculated based on the position coordinates of the key pixel points in the original image. The two key pixel points with the closest distance are selected and connected to generate a straight line, which is the reference segmentation line.

[0092] Key pixels represent the edge information of the object to be detected. By connecting the key pixel points of adjacent frame edges, a reference segmentation line is generated, which can represent the edge contour of the edge to be detected. It serves as a reference for further segmentation of the target detection frame and improves the recognition accuracy of the object to be detected.

[0093] Step 304: Divide the target detection frame into multiple coding units; and determine the background area based on the positional relationship between each coding unit in the target detection frame and the reference segmentation line.

[0094] Optionally, the area within the target detection frame is divided into multiple coding units through quadtree blocking. The coding unit is the basic unit for the encoder to perform encoding, and the sizes are 8x8, 16x16, 32x32, and 64x64.

[0095] As a possible implementation method, a reference segmentation line that is closest to any coding unit is selected as the target segmentation line; a first positional relationship between the center pixel point of each target pixel point and the target segmentation line is obtained; a second positional relationship between any coding unit and the target segmentation line is obtained; when the second positional relationship is different from the first positional relationship, the pixel point in any coding unit is determined to be a background pixel point; and a background area is formed based on each background pixel point.

[0096] By obtaining the center pixel point of each target pixel point, the center position of the object to be detected can be represented as the position representation of the object to be detected. By comparing the first position relationship and the second position relationship, it can be determined whether the coding unit belongs to the object to be detected, thereby realizing the segmentation of the background area.

[0097] The second position relationship is obtained by the following steps:

[0098] Any pixel point in the coding unit is selected as a reference pixel point; and a second positional relationship is determined according to a positional relationship between the reference pixel point and any reference dividing line.

[0099] For example, the pixel point at the upper left corner of the coding unit is selected as the reference pixel point, and the second positional relationship is determined according to the positional relationship between the reference pixel point and any reference dividing line.

[0100] By using reference pixels to represent coding units, the local part can represent the whole. The positional relationship of the coding units can be determined by the positional relationship of the reference pixels, which simplifies the calculation process and improves calculation efficiency.

[0101] As a possible implementation method, a coordinate axis is created based on the original image, and the straight line equation of the reference segmentation line within the coordinate axis is determined; the positional relationship is determined based on the coordinate position and straight line equation of each coding unit within the target detection frame; and the background area is determined based on the positional relationship.

[0102] According to the steps of obtaining the reference dividing line, it can be known that the reference dividing line is a straight line, and the straight line equation of the reference dividing line within the coordinate axis can be determined.

[0103] Optionally, the position coordinates of the reference pixel point are substituted into the line equation. If the result is greater than 0, it means that the representative pixel point is below the reference line; if the result is less than 0, it means that the representative pixel point is above the reference line.

[0104] By converting the position relationship into a simple functional relationship through coordinate position and straight line equation, the position relationship between each coding unit and the target segmentation line can be quickly determined.

[0105] By dividing the target detection frame into multiple coding units, the area included in the target detection frame can be fragmented. Further, based on the positional relationship between the position of the coding unit and the reference dividing line, the coding unit can be accurately classified to determine the coding unit belonging to the background area.

[0106] Step 305 : performing bit rate adjustment on the background area within each target detection frame in the original image.

[0107] For the description of the above step 305, please refer to the relevant description in the above embodiment, which will not be repeated here.

[0108] The rate control method proposed in the present disclosure obtains an original image to be rate controlled, wherein the original image includes at least one target detection frame of an object to be detected; for any target detection frame, key pixels are determined based on target pixels located within a set range of the frame edge of the target detection frame for displaying the object to be detected; for two adjacent frame edges, two key pixels located on different frame edges that are closest to each other are connected to generate a reference segmentation line; the target detection frame is divided into multiple coding units; the background area is determined based on the positional relationship between each coding unit in the target detection frame and the reference segmentation line; and the rate of the background area in each target detection frame in the original image is adjusted. By determining the background area in the target detection frame by reference to the segmentation line, the target detection frame can be further segmented, so that the target detection frame can more accurately identify the object to be detected and better retain the edge of the object to be detected, and the rate of the background area can be further adjusted, which can improve the rationality of rate allocation, reduce the computing power of video encoding compression, achieve a more accurate rate control effect, and improve the compression quality of the video.

[0109] This disclosure also proposes another rate control method: Figure 4 This is a flow chart of another rate control method provided by an embodiment of the present disclosure. Figure 4 As shown, the bit rate control method includes but is not limited to the following steps:

[0110] Step 401: Acquire an original image to be rate controlled, wherein the original image includes at least one target detection frame of an object to be detected.

[0111] For the description of the above step 401, please refer to the relevant description in the above embodiment, which will not be repeated here.

[0112] Step 402 : For any target detection frame, key pixels are determined based on target pixels located within a set range of the target detection frame edge for displaying the object to be detected.

[0113] For the description of the above step 402, please refer to the relevant description in the above embodiment, which will not be repeated here.

[0114] Step 403 : For two adjacent frame edges, connect the two closest key pixel points located on different frame edges to generate a reference segmentation line.

[0115] For the description of the above step 403, please refer to the relevant description in the above embodiment, which will not be repeated here.

[0116] Step 404: determine two frame edges intersecting the reference segmentation line; and form a background area based on the two frame edges and the reference segmentation line.

[0117] It is understandable that the object to be detected in the target detection frame is often located in the middle of the target detection frame, and the background area is more likely to appear at the corners of the target detection frame. Therefore, the reference segmentation line is used as the edge of the object to be detected, and the triangular area formed by the two frame edges intersecting the reference segmentation line and it is used as the background area.

[0118] By forming the background area with the two frame edges intersecting the reference segmentation line, the target detection frame can be further segmented, making the target detection frame more accurate in identifying the object to be detected.

[0119] Step 405 : performing bit rate adjustment on the background area within each target detection frame in the original image.

[0120] For the description of the above step 405, please refer to the relevant description in the above embodiment, which will not be repeated here.

[0121] The rate control method proposed in the present disclosure obtains an original image to be rate controlled, wherein the original image includes at least one target detection frame of an object to be detected; for any target detection frame, key pixels are determined based on target pixels located within a set range of the frame edge of the target detection frame for displaying the object to be detected; for two adjacent frame edges, two key pixels located on different frame edges that are closest to each other are connected to generate a reference dividing line; two frame edges intersecting with the reference dividing line are determined; a background area is formed based on the two frame edges and the reference dividing line; and the rate of the background area within each target detection frame in the original image is adjusted. By determining the background area within the target detection frame by the reference dividing line, the target detection frame can be further segmented, so that the target detection frame can more accurately identify the object to be detected and better retain the edge of the object to be detected, and the rate of the background area can be further adjusted, which can improve the rationality of rate allocation, reduce the computing power of video encoding compression, achieve a more accurate rate control effect, and improve the compression quality of the video.

[0122] The present disclosure also proposes an encoding method, Figure 5 A schematic diagram of a coding method provided in an embodiment of the present disclosure. Figure 5 As shown, the encoding method includes but is not limited to the following steps:

[0123] Step 501 : performing bit rate adjustment on the background area within each target detection frame in the original image.

[0124] The specific steps of bit rate adjustment can be found in the relevant description in the above embodiment of the bit rate control method, which will not be repeated here.

[0125] Step 502: Encode the original image based on the adjusted bit rate.

[0126] Optionally, the original image is encoded and compressed based on the adjusted bit rate by an encoder, wherein the larger the bit rate, the smaller the compression ratio when encoding the original image, the higher the quality of the processed picture, and the clearer the picture quality.

[0127] In the embodiment of the present disclosure, the encoder may be any one of HEVC (H.265), H.264, and AVS.

[0128] The encoding method proposed in this paper adjusts the bitrate of the background area within each target detection frame in the original image and encodes the original image based on the adjusted bitrate. This method can control the image quality of the original image based on the bitrate that achieves more precise bitrate control, thereby improving video compression quality without increasing computing power.

[0129] The present disclosure also proposes an encoding method, Figure 6 A flow chart of another encoding method provided by an embodiment of the present disclosure. Figure 6 As shown, the encoding method includes but is not limited to the following steps:

[0130] Step 601 : performing bit rate adjustment on the background area within each target detection frame in the original image.

[0131] Optionally, the original image is divided into a plurality of coding units, wherein the original image includes at least one target detection frame of an object to be detected.

[0132] Optionally, the original image is divided into multiple coding units through quadtree blocking. The coding unit is a basic unit for the encoder to perform encoding, and the sizes are 8x8, 16x16, 32x32, and 64x64.

[0133] The original image is an image that needs to be rate controlled, such as each video frame of a television program or a movie.

[0134] The target detection frame may be an ROI detection frame. The ROI region is the most attention-grabbing region identified from the original image based on the characteristics of the human eye. For example, in a TV program or movie video frame, the user pays more attention to the face and less attention to the background, such as the buildings next to the face. In these video frames, the face is the ROI region.

[0135] Optionally, the object to be detected may be the object that requires the most attention in the original image, such as a face in the above video frame.

[0136] The shape of the target detection frame can be square, circular, elliptical or irregular, which is not limited here.

[0137] It can be understood that the original image includes at least one target detection frame of the object to be detected. When there are multiple objects to be detected and their target detection frames, each target detection frame can be screened, for example, a preset number of target detection frames with the largest area are selected for subsequent processing. For scenes with many target detection frames, target detection frames with too small an area can be screened out according to actual conditions.

[0138] It should be noted that the area within the target detection frame is the area identified in the original image that needs to be paid attention to, and is also the area where the encoder needs to retain more details during compression. During encoding, the bit rate of the area within the target detection frame is higher, which can retain more image details and image quality, while the bit rate of the reference area outside the target detection frame is lower, which may cause image distortion and quality degradation in this area.

[0139] It should be noted that the quantization parameter (QP) ranges from [0, 51]. When QP takes the minimum value of 0, it indicates the finest quantization. On the contrary, when QP takes the maximum value of 51, it indicates the coarsest quantization. Bit rate control can be achieved by adjusting the quantization parameter.

[0140] Optionally, the coding unit included in the target detection frame corresponds to a first quantization parameter, the coding unit included in the reference area other than the target detection frame in the original image corresponds to a second quantization parameter, and the first quantization parameter is less than or equal to the second quantization parameter.

[0141] For example, when the encoder is High Efficiency Video Coding (HEVC), the first quantization parameter corresponding to the coding unit included in the target detection frame is 18, and the second quantization parameter corresponding to the coding unit included in the reference area is 28.

[0142] Furthermore, a background area within the target detection frame is obtained, wherein the background area is determined based on at least one reference segmentation line generated by key pixel points, and the key pixel points are determined based on target pixel points located within a set range of the frame edge of the target detection frame for displaying the object to be detected.

[0143] Optionally, the frame edge setting range can be a range composed of pixel points on any frame edge of the target detection frame. For example, when the target detection frame is a rectangle, the set of ranges composed of pixel points on any side of the four frame edges of the target detection frame can be used as the frame edge setting range; the frame edge setting range can also be a range composed of pixel points on any frame edge of the target detection frame and its neighboring pixel points. For example, when the target detection frame is a rectangle, the set of ranges composed of pixel points on any side of the four frame edges of the target detection frame and its neighboring pixel points can be used as the frame edge setting range.

[0144] The neighborhood pixel points may be 4 neighborhood pixel points, 8 neighborhood pixel points, or diagonal neighborhood pixel points, which is not limited here.

[0145] Optionally, for any target detection frame, the pixel point where the identified object to be detected is located in the original image is the target pixel point, and the object to be detected is composed of the target pixel points within the target detection frame.

[0146] Optionally, target pixels within the set range of the frame edge are screened to determine key pixels, which are used to characterize edge information of the object to be detected. For example, the target pixel at the edge of the frame edge can characterize the edge characteristics of the object to be detected, and one or more target pixels at the edge of the frame edge can be selected as key pixels.

[0147] Optionally, the reference segmentation line may be obtained by fitting key pixel points, wherein the reference segmentation line may be a straight line, a curve, or a broken line, which is not limited here.

[0148] It can be understood that the reference segmentation line obtained by fitting the key pixel points representing the edge information of the object to be detected can represent the edge contour of the object to be detected.

[0149] Optionally, the object to be detected and the background area within the target detection frame may be segmented by referring to the segmentation line to determine the background area within the target detection frame.

[0150] As an example, the first quantization parameter corresponding to the coding unit included in the background area is adjusted to the second quantization parameter. Optionally, by determining the background area within the target detection frame and adjusting the first quantization parameter corresponding to the coding unit included in the background area to the second quantization parameter, the bit rate in the background area can be adjusted to the bit rate of the reference area that loses more details, reducing the computing power of video encoding compression and allocating more bit rate to the area where the object to be detected is located.

[0151] As another example, the first quantization parameter corresponding to the coding unit in the background area is adjusted to a third quantization parameter, wherein the first quantization parameter is less than the third quantization parameter and is less than the second quantization parameter.

[0152] It can be understood that by increasing the first quantization parameter corresponding to the coding unit in the background area, the bit rate of the background area can be reduced and the quantization can be coarser. At the same time, the third quantization parameter is less than the second quantization parameter, which can make the bit rate of the background area and the reference area have a certain difference, thereby achieving a smooth transition of the edge of the object to be detected.

[0153] Step 602: Determine a corresponding bit rate according to the first quantization parameter or the second quantization parameter corresponding to each coding unit in the original image.

[0154] Optionally, the quantization parameter (QP) reflects the compression of spatial details. For example, a small QP preserves most image details, resulting in a higher bitrate. A large QP loses some image details, resulting in a lower bitrate but higher image distortion and poorer compression quality. In other words, QP and bitrate are inversely proportional.

[0155] Optionally, there is a correspondence between the quantization parameter and the bit rate, which can be obtained by looking up a table. That is, the bit rate corresponding to the first quantization parameter or the second quantization parameter corresponding to each coding unit in the original image can be determined by the adjusted quantization parameter.

[0156] As an example, when the first quantization parameter corresponding to the coding unit in the background area is adjusted to the third quantization parameter, the bit rate corresponding to the first quantization parameter or the second quantization parameter or the third quantization parameter corresponding to each coding unit in the original image can also be determined by the adjusted quantization parameter.

[0157] Step 603: Encode the original image based on the code rate of each coding unit.

[0158] Optionally, a corresponding bit rate is assigned to each coding unit using the adjusted quantization parameter, and an encoder is used to encode and compress each coding unit in the original image based on the corresponding bit rate. The higher the bit rate, the lower the compression ratio when encoding the original image, resulting in higher image quality and clearer image quality.

[0159] In the embodiment of the present disclosure, the encoder may be any one of HEVC (H.265), H.264, and AVS.

[0160] The corresponding bit rate is determined by the quantization parameters corresponding to each coding unit, which can provide the encoder with a data basis for coding compression and achieve the expected coding effect.

[0161] The encoding method proposed in the present disclosure adjusts the bitrate of the background area within each target detection frame in the original image; determines the corresponding bitrate based on the first quantization parameter or the second quantization parameter corresponding to each coding unit in the original image; and encodes the original image based on the bitrate of each coding unit. By determining the background area within the target detection frame with reference to the dividing line, the target detection frame can be further segmented, and the bitrate of the background area can be further adjusted. A larger bitrate can be allocated to the area of ​​greater interest, thereby improving the rationality of the bitrate allocation. Furthermore, the original image is subjected to picture quality control based on the bitrate that achieves a more precise bitrate control effect, which can improve the compression quality of the video without increasing computing power.

[0162] An embodiment of the present disclosure further proposes a rate control device. Since the rate control device proposed in the embodiment of the present disclosure corresponds to the rate control methods proposed in the above-mentioned embodiments, the implementation methods of the above-mentioned rate control methods are also applicable to the rate control device proposed in the embodiment of the present disclosure and will not be described in detail in the following embodiments.

[0163] Figure 7 This is a schematic diagram of the structure of a bit rate control device provided by an embodiment of the present disclosure. Figure 7 As shown, the bit rate control device 700 includes: an acquisition module 701 , a key pixel point determination module 702 , a background area determination module 703 and a bit rate adjustment module 704 .

[0164] An acquisition module 701 is configured to acquire an original image to be rate controlled, wherein the original image includes at least one target detection frame of an object to be detected;

[0165] A key pixel point determination module 702 is configured to determine key pixels for any target detection frame based on target pixels located within a set range of the target detection frame edge for displaying the object to be detected;

[0166] A background region determination module 703 is configured to generate at least one reference segmentation line based on the key pixels, and determine the background region within the target detection frame based on the reference segmentation line;

[0167] The bit rate adjustment module 704 is used to adjust the bit rate of the background area within each target detection frame in the original image.

[0168] In the embodiment of the present disclosure, the key pixel point determination module 702 is used to:

[0169] On the edge of any target detection frame, determine the target pixel points corresponding to the object to be detected through image segmentation;

[0170] For any frame edge, if the number of target pixels is one, the target pixel is used as the key pixel;

[0171] For any frame edge, if there are multiple target pixels, traverse the target pixels on the frame edge, and select the starting target pixel and the ending target pixel in the traversal order as key pixels.

[0172] In the embodiment of the present disclosure, the background area determination module 703 is used to:

[0173] For two adjacent frame edges, the two closest key pixel points on different frame edges are connected to generate a reference segmentation line.

[0174] Divide the target detection box into multiple coding units;

[0175] The background area is determined based on the positional relationship between each coding unit in the target detection frame and the reference segmentation line.

[0176] Creating a coordinate axis based on the original image and determining a dividing line equation of a reference dividing line within the coordinate axis;

[0177] Determine the positional relationship based on the coordinate position of each coding unit in the target detection frame and the segmentation line equation;

[0178] Determine the background area based on the position relationship.

[0179] Select the reference segmentation line closest to any coding unit as the target segmentation line;

[0180] Obtaining a first positional relationship between a center pixel point of each target pixel point and a target segmentation line;

[0181] Obtaining a second positional relationship between any coding unit and the target segmentation line;

[0182] When the second positional relationship is different from the first positional relationship, determining a pixel point in any coding unit as a background pixel point;

[0183] The background area is composed according to each background pixel point.

[0184] Select any pixel in the coding unit as a reference pixel;

[0185] A second positional relationship is determined according to a positional relationship between the reference pixel point and any reference segmentation line.

[0186] Determine the two frame edges that intersect with the reference dividing line;

[0187] The background area is formed according to the two frame edges and the reference dividing line.

[0188] In the embodiment of the present disclosure, the bit rate adjustment module 704 is configured to:

[0189] Obtain the target bit rate allocated to the reference area excluding the target detection frame in the original image;

[0190] Adjust the bitrate of the background area to the target bitrate.

[0191] The rate control device proposed in the present disclosure obtains an original image to be rate controlled, wherein the original image includes at least one target detection frame of an object to be detected; for any target detection frame, determines key pixel points based on target pixel points for displaying the object to be detected within a set range of the frame edge of the target detection frame; generates at least one reference segmentation line based on the key pixel points, and determines the background area within the target detection frame based on the reference segmentation line; and adjusts the rate of the background area within each target detection frame in the original image. By determining the background area within the target detection frame with the reference segmentation line, the target detection frame can be further segmented, making the target detection frame more accurate in identifying the object to be detected and better preserving the edge of the object to be detected, and further adjusting the rate of the background area, the rationality of the rate allocation can be improved, the computing power of video encoding compression can be reduced, a more accurate rate control effect can be achieved, and the compression quality of the video can be improved.

[0192] An embodiment of the present disclosure also proposes a coding device. Since the coding device proposed in the embodiment of the present disclosure corresponds to the coding methods proposed in the above-mentioned embodiments, the implementation methods of the above-mentioned coding methods are also applicable to the coding device proposed in the embodiment of the present disclosure and will not be described in detail in the following embodiments.

[0193] Figure 8 This is a schematic diagram of the structure of an encoding device provided by an embodiment of the present disclosure. Figure 8 As shown, the encoding device 800 includes: a bit rate adjustment module 801 and an encoding module 802.

[0194] The bit rate adjustment module 801 is used to adjust the bit rate of the background area within each target detection frame in the original image using the bit rate control device 700;

[0195] The encoding module 802 is configured to encode the original image based on the adjusted bit rate.

[0196] In the embodiment of the present disclosure, an original image is divided into a plurality of coding units, and the coding units in the background area of ​​the target detection frame are adjusted from a first quantization parameter before bit rate adjustment to a second quantization parameter after bit rate adjustment. The second quantization parameter is a quantization parameter corresponding to the coding units included in a reference area excluding the target detection frame in the original image. The encoding module 802 is configured to:

[0197] Determining a corresponding bit rate according to the first quantization parameter or the second quantization parameter corresponding to each coding unit in the original image;

[0198] The original image is encoded based on the code rate of each coding unit.

[0199] The encoding device proposed in this disclosure adjusts the bitrate of the background area within each target detection frame in the original image and encodes the original image based on the adjusted bitrate. This allows for image quality control based on a bitrate that achieves more precise bitrate control, improving video compression quality without increasing computing power.

[0200] According to an embodiment of the present disclosure, the present disclosure also provides an electronic device, a readable storage medium, and a computer program product.

[0201] Figure 9 A schematic block diagram of an example electronic device 900 that can be used to implement embodiments of the present disclosure is shown. The electronic device is intended to represent various forms of digital computers, such as laptop computers, desktop computers, workstations, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The electronic device can also represent various forms of mobile devices, such as personal digital assistants, cellular phones, smartphones, wearable devices, and other similar computing devices. The components shown herein, their connections and relationships, and their functions are provided as examples only and are not intended to limit the implementation of the present disclosure described and / or claimed herein.

[0202] like Figure 9 As shown, the device 900 includes a computing unit 901, which can perform various appropriate actions and processes according to a computer program stored in a ROM (Read-Only Memory) 902 or a computer program loaded from a storage unit 908 into a RAM (Random Access Memory) 903. Various programs and data required for the operation of the device 900 can also be stored in the RAM 903. The computing unit 901, the ROM 902, and the RAM 903 are connected to each other via a bus 904. An I / O (Input / Output) interface 905 is also connected to the bus 904.

[0203] Various components in the device 900 are connected to the I / O interface 905, including an input unit 906, such as a keyboard, a mouse, etc.; an output unit 907, such as various types of displays, speakers, etc.; a storage unit 908, such as a magnetic disk, an optical disk, etc.; and a communication unit 909, such as a network card, a modem, a wireless communication transceiver, etc. The communication unit 909 allows the device 900 to exchange information / data with other devices via a computer network such as the Internet and / or various telecommunication networks.

[0204] The computing unit 901 can be various general-purpose and / or specialized processing components with processing and computing capabilities. Some examples of the computing unit 901 include, but are not limited to, a CPU (Central Processing Unit), a GPU (Graphic Processing Unit), various specialized AI (Artificial Intelligence) computing chips, various computing units that run machine learning model algorithms, a DSP (Digital Signal Processor), and any suitable processor, controller, microcontroller, etc. The computing unit 901 performs the various methods and processes described above, such as the rate control method or the encoding method. For example, in some embodiments, the rate control method or the encoding method can be implemented as a computer software program that is tangibly contained in a machine-readable medium, such as the storage unit 908. In some embodiments, part or all of the computer program can be loaded and / or installed on the device 900 via the ROM 902 and / or the communication unit 909. When the computer program is loaded into the RAM 903 and executed by the computing unit 901, one or more steps of the rate control method or the encoding method described above can be performed. Alternatively, in other embodiments, the computing unit 901 may be configured to execute the rate control method or the encoding method in any other appropriate manner (eg, by means of firmware).

[0205] Various embodiments of the systems and techniques described herein can be implemented in digital electronic circuit systems, integrated circuit systems, FPGAs (Field Programmable Gate Arrays), ASICs (Application-Specific Integrated Circuits), ASSPs (Application-Specific Standard Products), SOCs (System on Chips), CPLDs (Complex Programmable Logic Devices), computer hardware, firmware, software, and / or combinations thereof. These various embodiments can include being implemented in one or more computer programs that are executable and / or interpreted on a programmable system that includes at least one programmable processor, which can be a special-purpose or general-purpose programmable processor that can receive data and instructions from a storage system, at least one input device, and at least one output device, and transmit data and instructions to the storage system, the at least one input device, and the at least one output device.

[0206] The program code for implementing the method of the present disclosure can be written in any combination of one or more programming languages. These program codes can be provided to a processor or controller of a general-purpose computer, a special-purpose computer, or other programmable data processing device so that when the program code is executed by the processor or controller, the functions / operations specified in the flow chart and / or block diagram are implemented. The program code can be executed entirely on the machine, partially on the machine, as a stand-alone software package, partially on the machine and partially on a remote machine, or entirely on a remote machine or server.

[0207] In the context of the present disclosure, a machine-readable medium may be a tangible medium that may contain or store a program for use by or in conjunction with an instruction execution system, device, or apparatus. A machine-readable medium may be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium may include, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, device, or apparatus, or any suitable combination of the foregoing. More specific examples of machine-readable storage media may include an electrical connection based on one or more wires, a portable computer disk, a hard disk, RAM, ROM, EPROM (Electrically Programmable Read-Only-Memory) or flash memory, optical fiber, CD-ROM (Compact Disc Read-Only Memory), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.

[0208] To provide interaction with a user, the systems and techniques described herein can be implemented on a computer having: a display device (e.g., a CRT (Cathode-Ray Tube) or LCD (Liquid Crystal Display) monitor) for displaying information to the user; and a keyboard and pointing device (e.g., a mouse or trackball) through which the user can provide input to the computer. Other types of devices can also be used to provide interaction with the user; for example, the feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user can be received in any form (including acoustic input, voice input, or tactile input).

[0209] The systems and techniques described herein can be implemented in a computing system that includes backend components (e.g., as a data server), or a computing system that includes middleware components (e.g., an application server), or a computing system that includes frontend components (e.g., a user computer with a graphical user interface or web browser through which a user can interact with implementations of the systems and techniques described herein), or a computing system that includes any combination of such backend components, middleware components, or frontend components. The components of the system can be interconnected by any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include: LAN (Local Area Network), WAN (Wide Area Network), the Internet, and blockchain networks.

[0210] A computer system may include a client and a server. The client and server are generally remote from each other and typically interact via a communication network. This client-server relationship is established by computer programs running on the respective computers, establishing a client-server relationship. The server may be a cloud server, also known as a cloud computing server or cloud host, a host product within the cloud computing service ecosystem that addresses the management difficulties and limited scalability of traditional physical hosts and VPS services ("Virtual Private Servers" or simply "VPS"). The server may also be a server in a distributed system or a server integrated with blockchain.

[0211] It's important to note that artificial intelligence (AI) is the study of how computers can simulate certain human thought processes and intelligent behaviors (such as learning, reasoning, thinking, and planning). This encompasses both hardware and software technologies. AI hardware technologies generally include sensors, specialized AI chips, cloud computing, distributed storage, and big data processing. AI software technologies primarily encompass computer vision, speech recognition, natural language processing, machine learning / deep learning, big data processing, and knowledge graphs.

[0212] It should be understood that the various forms of the processes shown above can be used to reorder, add, or delete steps. For example, the steps described in this disclosure can be performed in parallel, sequentially, or in a different order, as long as the desired results of the technical solutions disclosed in this disclosure can be achieved. This is not a limitation herein.

[0213] The above specific embodiments do not constitute a limitation on the scope of protection of this disclosure. Those skilled in the art will appreciate that various modifications, combinations, sub-combinations, and substitutions may be made based on design requirements and other factors. Any modifications, equivalent substitutions, and improvements made within the spirit and principles of this disclosure shall be included within the scope of protection of this disclosure.

Claims

1. A rate control method, the method comprising: Acquire an original image to be rate controlled, wherein the original image includes at least one target detection frame of an object to be detected; For any target detection frame, determine key pixels based on target pixels that are located within a set range of the target detection frame edge and are used to display the object to be detected; generating at least one reference segmentation line according to the key pixel points, and determining a background area within the target detection frame according to the reference segmentation line; The bit rate of the background area within each target detection frame in the original image is adjusted.

2. The method according to claim 1, wherein The determining of key pixels based on target pixels for displaying the object to be detected within a set range of a frame edge of the target detection frame includes: Determining the target pixel point by image segmentation within a set range of a frame edge of any target detection frame; For any frame edge, when the number of the target pixel is one, the target pixel is used as the key pixel; For any frame edge, when there are multiple target pixels, the target pixels within the set range of the frame edge are traversed, and the starting target pixel point and the ending target pixel point are filtered in the traversal order as the key pixel points.

3. The method according to claim 1 or 2, wherein: Generating at least one reference segmentation line according to the key pixel points includes: For two adjacent frame edges, the two closest key pixel points located within the set range of different frame edges are connected to generate the reference segmentation line.

4. The method according to claim 1 or 2, wherein: Determining the background area within the target detection frame according to the reference segmentation line includes: Dividing the target detection frame into a plurality of coding units; The background area is determined according to the positional relationship between each coding unit in the target detection frame and the reference segmentation line.

5. The method according to claim 4, wherein The reference segmentation line is a straight line, and determining the background area according to the positional relationship between each coding unit in the target detection frame and the reference segmentation line includes: Creating a coordinate axis based on the original image, and determining a straight line equation of the reference segmentation line within the coordinate axis; Determining the positional relationship according to the coordinate positions of each coding unit within the target detection frame and the straight line equation; The background area is determined according to the positional relationship.

6. The method according to claim 4, wherein: The determining the background area according to the positional relationship between each coding unit in the target detection frame and the reference segmentation line includes: Select the reference segmentation line closest to any coding unit as the target segmentation line; Acquire a first positional relationship between a center pixel point of each target pixel point and the target segmentation line; Acquire a second positional relationship between any one of the encoding units and the target segmentation line; When the second positional relationship is different from the first positional relationship, determining the pixel point in any coding unit as a background pixel point; The background area is composed according to the background pixels.

7. The method according to claim 6, wherein: The acquiring of the second positional relationship between any one of the encoding units and the target segmentation line includes: Selecting any pixel in the coding unit as a reference pixel; The second positional relationship is determined according to the positional relationship between the reference pixel point and any reference dividing line.

8. The method according to claim 1 or 2, wherein: Determining the background area within the target detection frame according to the reference segmentation line includes: Determine two frame edges that intersect with the reference dividing line; The background area is formed according to the two frame edges and the reference segmentation line.

9. The method according to claim 1 or 2, wherein: The bit rate adjustment of the background area within each target detection frame in the original image includes: Obtaining a target bit rate allocated to a reference area excluding a target detection frame in the original image; The bit rate of the background area is adjusted to the target bit rate.

10. A coding method, comprising: Adopting the method according to any one of claims 1 to 9, adjusting the bit rate of the background area within each target detection frame in the original image; The original image is encoded based on the adjusted bit rate.

11. The method according to claim 10, wherein: The original image is divided into a plurality of coding units, the coding units included in the target detection frame correspond to a first quantization parameter, the coding units in the background area of ​​the target detection frame are adjusted from the first quantization parameter before bit rate adjustment to a second quantization parameter after bit rate adjustment, and the second quantization parameter is the quantization parameter corresponding to the coding units included in a reference area excluding the target detection frame in the original image; Encoding the original image based on the adjusted bit rate includes: Determining a corresponding bit rate according to the first quantization parameter or the second quantization parameter corresponding to each coding unit in the original image; The original image is encoded based on the code rates of the encoding units.

12. A rate control device, comprising: An acquisition module, configured to acquire an original image to be rate controlled, wherein the original image includes at least one target detection frame of an object to be detected; A key pixel point determination module is used to determine key pixels for any target detection frame based on target pixels located within a set range of the frame edge of the target detection frame and used to display the object to be detected; a background area determination module, configured to generate at least one reference segmentation line according to the key pixel points, and determine a background area within the target detection frame according to the reference segmentation line; The bit rate adjustment module is used to adjust the bit rate of the background area within each target detection frame in the original image.

13. The device according to claim 12, wherein The key pixel point determination module is used to: Determine the target pixel points corresponding to the object to be detected by image segmentation within the set range of the frame edge of any target detection frame; For any frame edge, when the number of the target pixel is one, the target pixel is used as the key pixel; For any frame edge, when there are multiple target pixels, the target pixels within the set range of the frame edge are traversed, and the starting target pixel point and the ending target pixel point are filtered in the traversal order as the key pixel points.

14. The device according to claim 12 or 13, wherein The background area determination module is used to: For two adjacent frame edges, the two closest key pixel points located within the set range of different frame edges are connected to generate the reference segmentation line.

15. The device according to claim 12 or 13, wherein The background area determination module is used to: Dividing the target detection frame into a plurality of coding units; The background area is determined according to the positional relationship between each coding unit in the target detection frame and the reference segmentation line.

16. The device according to claim 15, wherein The background area determination module is used to: Creating a coordinate axis based on the original image, and determining a segmentation line equation of the reference segmentation line within the coordinate axis; Determining the positional relationship according to the coordinate positions of each coding unit within the target detection frame and the dividing line equation; The background area is determined according to the positional relationship.

17. The device according to claim 15, wherein The background area determination module is used to: Select the reference segmentation line closest to any coding unit as the target segmentation line; Acquire a first positional relationship between a center pixel point of each target pixel point and the target segmentation line; Acquire a second positional relationship between any one of the encoding units and the target segmentation line; When the second positional relationship is different from the first positional relationship, determining the pixel point in any coding unit as a background pixel point; The background area is composed according to the background pixels.

18. The device according to claim 17, wherein The background area determination module is used to: Selecting any pixel in the coding unit as a reference pixel; The second positional relationship is determined according to the positional relationship between the reference pixel point and any reference dividing line.

19. The device according to claim 12 or 13, wherein The background area determination module is used to: Determine two frame edges that intersect with the reference dividing line; The background area is formed according to the two frame edges and the reference segmentation line.

20. The device according to claim 12 or 13, wherein The bit rate adjustment module is used to: Obtaining a target bit rate allocated to a reference area excluding a target detection frame in the original image; The bit rate of the background area is adjusted to the target bit rate.

21. An encoding device, comprising: a bit rate adjustment module, configured to adjust the bit rate of the background area within each target detection frame in the original image using the apparatus according to any one of claims 12 to 20; The encoding module is configured to encode the original image based on the adjusted bit rate.

22. The device according to claim 21, wherein The original image is divided into a plurality of coding units, the coding units included in the target detection frame correspond to a first quantization parameter, the coding units in the background area of ​​the target detection frame are adjusted from the first quantization parameter before bit rate adjustment to a second quantization parameter after bit rate adjustment, and the second quantization parameter is the quantization parameter corresponding to the coding units included in a reference area excluding the target detection frame in the original image; The encoding module is used to: Determining a corresponding bit rate according to the first quantization parameter or the second quantization parameter corresponding to each coding unit in the original image; The original image is encoded based on the code rates of the encoding units.

23. An electronic device comprising: at least one processor; as well as a memory communicatively connected to the at least one processor; wherein, The memory stores instructions that can be executed by the at least one processor, and the instructions are executed by the at least one processor to enable the at least one processor to perform the method of any one of claims 1-9, or the method of any one of claims 10-11.

24. A non-transitory computer-readable storage medium storing computer instructions, wherein: The computer instructions are used to enable the computer to execute the method according to any one of claims 1 to 9, or to execute the method according to any one of claims 10 to 11.

25. A computer program product, comprising a computer program, wherein when the computer program is executed by a processor, the computer program implements the method according to any one of claims 1 to 9, or performs the method according to any one of claims 10 to 11.

Citation Information

Patent Citations

  • Video compression method and device, video compression equipment and storage device

    CN111787398A

  • Video coding method and device, equipment and medium

    CN113301336A