Code rate control method and device, coding method and device, equipment and storage medium
By determining key pixel points and reference dividing lines in video encoding, dividing the background area and adjusting the bit rate, the problem of inaccurate area of interest division is solved, achieving more precise bit rate control and improving video compression quality.
Patent Information
- Application Number
- CN202411266723.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-10
- Publication Date
- 2025-01-21
- Estimated Expiration
- 2044-09-10
AI Technical Summary
During the video encoding process, the region of interest (ROI) is not classified accurately, resulting in some non-ROI content being included, affecting the effect of bit rate control.
By obtaining the target detection frame in the original image, the key pixel points are determined, the reference segmentation line is generated, the background area is divided, and the code rate of the background area is adjusted.
It improves the rationality of bit rate allocation, reduces the computing power of video encoding and compression, achieves more accurate bit rate control effects, and improves the compression quality of videos.
Smart Images

Figure CN119342221A_ABST
Abstract
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 a region 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 and positions of the detected objects, 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 according to target pixels for displaying the object to be detected that are located within a set range of the frame edge of the target detection frame;
[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 in each target detection frame in the original image is adjusted.
[0010] According to another aspect of the present disclosure, there is provided a coding method, the method comprising:
[0011] The above-mentioned bit rate control method is used to adjust the bit rate of the background area within each target detection frame in the original image;
[0012] The original image is encoded based on the adjusted bit rate.
[0013] According to another aspect of the present disclosure, there is provided a rate control device, comprising:
[0014] An acquisition module, used for acquiring 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 pixel points for any target detection frame according to target pixel points located within a frame edge setting range of the target detection frame for displaying the object to be detected;
[0016] A background area determination module, used to generate at least one reference segmentation line according to the key pixel points, and determine the background area in 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 in 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, used to use the bit rate control device to adjust the bit rate of the background area in each target detection frame in the original image;
[0020] The encoding module is used to encode the original image based on the adjusted bit rate.
[0021] It should be understood that the content described in this section is not intended to identify the key or important features of the embodiments of the present disclosure, nor is it intended to limit the scope of the present disclosure. Other features of the present disclosure will become easily understood through the following description. BRIEF DESCRIPTION OF THE DRAWINGS
[0022] The accompanying drawings are used to better understand the present solution and do not constitute a limitation of the present disclosure.
[0023] Figure 1 A schematic diagram of a flow chart of a rate control method provided by 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 diagram of a flow chart of another rate control method provided by an embodiment of the present disclosure;
[0026] Figure 4 A schematic diagram of a flow chart of another rate control method provided by 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 diagram of the structure of a bit rate control device provided in an embodiment of the present disclosure;
[0030] Figure 8 A schematic diagram of the structure of an encoding device provided in an embodiment of the present disclosure;
[0031] Fig. 9 is a schematic block diagram of an example electronic device for implementing an embodiment of the present disclosure. DETAILED DESCRIPTION
[0032] The following is a description of exemplary embodiments of the present disclosure in conjunction with the accompanying drawings, including various details of the embodiments of the present disclosure to facilitate understanding, which should be considered as merely exemplary. Therefore, it should be recognized by those of ordinary skill in the art 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, which is a technology that uses computers to analyze images to achieve the desired results. A digital image refers to a large two-dimensional array obtained by shooting with industrial cameras, video cameras, scanners and other equipment. The elements of the 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 the 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 fields.
[0036] Figure 1 A schematic diagram of a rate control method provided by an embodiment of the present disclosure. Figure 1 As shown, the code 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 box can be a region of interest (ROI) detection box. 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 needs the most attention in the original image, such as a face in the above video frame.
[0041] The shape of the target detection frame may be a square, a circle, an ellipse or an irregular shape, 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 according to 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.
[0044] Optionally, the frame edge setting range can be a range composed of pixel points of 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 of 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 of 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 of 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 are 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 in the target detection frame.
[0047] Optionally, target pixels included in the frame edge setting range 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 range can characterize the edge features of the object to be detected, and one or more target pixels at the edge of the frame edge range can be selected as key pixels.
[0048] Step 103: 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.
[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 in the target detection frame may be segmented by referring to the segmentation line to determine the background area in the target detection frame.
[0052] Step 104: adjust the bit rate of the background area in 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 area within the target detection frame has a higher bit rate and can retain more image details and image quality, while the area outside the target detection frame has a lower bit rate, 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 in 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, key pixels are determined according to target pixels located within a set range of the frame edge of the target detection frame for displaying the object to be detected; at least one reference segmentation line is generated according to the key pixels, and a background area is determined in the target detection frame according to 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, better retain the edge of the object to be detected, and further adjust the rate of the background area, 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.
[0056] The present disclosure also proposes another rate control method: Figure 2 FIG. 1 is a flow chart of another rate control method provided by an embodiment of the present disclosure. Figure 2 As shown, the code 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 box can be a ROI detection box. 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 needs the most attention in the original image, such as a face in the above video frame.
[0061] In the disclosed embodiment, 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 through OpenCV. The specific steps include:
[0063] Get the original image and convert it from an RGB image to a grayscale image that is easier to process; perform preliminary processing such as resizing, cropping, blurring, and sharpening on the grayscale image 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 picture; based on the common characteristics of the face, such as the eye area is darker than its adjacent pixels and the nose area is brighter than the eye area, use the face detection algorithm to find the position of the face in the image and frame the face with a rectangular frame.
[0064] In the disclosed embodiment, 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, within the set range of the frame edge of any target detection frame, determine the target pixel point by image segmentation.
[0066] In the disclosed embodiment, the frame edge setting range is a range composed of pixel points where the rectangular frame edges of the target detection frame are located, that is, a collection of ranges composed of pixel points where any side of the four frame edges of the target detection frame is located.
[0067] It can be understood that image segmentation refers to the process of subdividing a digital image into multiple image sub-regions (a collection of pixels). Image segmentation is usually used to locate objects and boundaries (lines, curves, etc.) in an image. More precisely, image segmentation is a process of labeling each pixel in an image, which makes pixels with the same label have some common visual characteristics. Pixels with common visual characteristics form a sub-region, and adjacent sub-regions have large differences under the measurement of common visual characteristics.
[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 disclosed embodiment, 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, but only the 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] Further, 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, the target pixel point is used as a key pixel point.
[0073] It can be understood that the face range identified by the target detection frame is more accurate. If there is only one target pixel, it means that the frame edge is tangent to the face edge, 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, when 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 the 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 face edge position 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, obtaining the target bit rate allocated to the reference area excluding the target detection frame in the original image; and adjusting 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 that is identified in the original image and needs to be paid attention to. It is also the area where the encoder needs to retain more details during compression. When encoding, the area within the target detection frame has a higher bit rate and can retain more image details and image quality, while the reference area outside the target detection frame has a lower bit rate, 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 the original image to be rate controlled, wherein the original image includes at least one target detection frame of the 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 point; at least one reference segmentation line is generated according to the key pixel point, and the background area is determined in the target detection frame according to the reference segmentation line; 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, the recognition accuracy of the object to be detected can be improved, the edge of the object to be detected can be better retained, 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] The present disclosure also proposes another rate control method: Figure 3 FIG. 1 is a flow chart of another rate control method provided by an embodiment of the present disclosure. Figure 3 As shown, the code 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 frame edge of the target detection frame and used to display 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, two key pixel points located on different frame edges and having the closest distance to each other are connected 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] The key pixels represent the edge information of the object to be detected. By connecting the key pixels of adjacent frame edges, a reference segmentation line is generated, which can represent the edge contour of the edge to be detected and serve as a reference for further segmentation of the target detection frame, thereby improving the recognition accuracy of the object to be detected.
[0093] Step 304, dividing the target detection frame into a plurality of coding units; and determining the background area according to 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 a basic unit for the encoder to perform encoding, and the sizes are 8x8, 16x16, 32x32, and 64x64.
[0095] As a possible implementation method, select a reference segmentation line that is closest to any coding unit as the target segmentation line; obtain a first positional relationship between a center pixel point of each target pixel point and the target segmentation line; obtain a second positional relationship between any coding unit and the target segmentation line; when the second positional relationship is different from the first positional relationship, determine that a pixel point in any coding unit is a background pixel point; and compose a background area based on each background pixel point.
[0096] By obtaining the central pixel point of each target pixel point, the central 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 segmentation line.
[0099] For example, a pixel point at the upper left corner of the coding unit is selected as a 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 representing coding units by reference pixels, the local part can represent the whole, and the positional relationship of coding units can be determined by the positional relationship of reference pixels, which simplifies the calculation process and improves calculation efficiency.
[0101] As a possible implementation, 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 straight line equation. If the result is greater than 0, it means that the representative pixel point is below the reference straight line; if the result is less than 0, it means that the representative pixel point is above the reference straight line.
[0104] By converting the position relationship into a simple functional relationship through coordinate positions and straight line equations, 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 positions of the coding units and the reference segmentation lines, the coding units can be accurately classified to determine the coding units belonging to the background area.
[0106] Step 305: adjust the bit rate of the background area in 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 according to target pixels located within a frame edge setting range of the target detection frame for displaying the object to be detected; for two adjacent frame edges, two closest key pixels located on different frame edges are connected to generate a reference segmentation line; the target detection frame is divided 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; 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, better retain the edge of the object to be detected, and further adjust the rate of the background area, 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] The present disclosure also proposes another rate control method: Figure 4 FIG. 1 is a flow chart of another rate control method provided by an embodiment of the present disclosure. Figure 4 As shown, the code 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 frame edge of the target detection frame and used to display 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, two key pixel points located on different frame edges and having the closest distance to each other are connected 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, determining two frame edges intersecting with the reference segmentation line; and forming a background area according to 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 the frame 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: adjust the bit rate of the background area in 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 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, the key pixel points are determined according to the target pixel points for displaying the object to be detected within the frame edge setting range of the target detection frame; for two adjacent frame edges, the two closest key pixel points located on different frame edges are connected to generate a reference segmentation line; two frame edges intersecting with the reference segmentation line are determined; a background area is formed according to the two frame edges 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, better retain the edge of the object to be detected, and further adjust the rate of the background area, which can improve the rationality of the 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 by 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, adjusting the bit rate of the background area in each target detection frame in the original image.
[0124] The specific steps of bit rate adjustment can refer to the relevant description in the above-mentioned 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 by an encoder based on the adjusted bit rate, 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 embodiments of the present disclosure, the encoder may be any one of HEVC (H.265), H.264, and AVS.
[0128] The encoding method proposed in the present disclosure adjusts the bit rate of the background area in each target detection frame in the original image; and encodes the original image based on the adjusted bit rate. The image quality of the original image can be controlled according to the bit rate that achieves a more accurate bit rate control effect, thereby improving the compression quality of the video without increasing computing power.
[0129] The present disclosure also proposes an encoding method, Figure 6 FIG. 1 is 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, adjusting the bit rate of the background area in 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] Among them, the target detection frame can be an 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 TV programs or movie video frames, users pay more attention to faces and less attention to backgrounds such as buildings next to the faces. In these video frames, the faces are the ROI areas.
[0135] Optionally, the object to be detected may be the object that needs the most attention in the original image, such as a face in the above video frame.
[0136] The shape of the target detection frame may be a square, a circle, an ellipse or an irregular shape, 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 that is identified in the original image and needs to be paid attention to. It is also the area where the encoder needs to retain more details during compression. When encoding, the area within the target detection frame has a higher bit rate and can retain more image details and image quality, while the reference area outside the target detection frame has a lower bit rate, which may cause image distortion and quality degradation in this area.
[0139] It should be noted that the value range of the quantization parameter (QP) is [0,51]. When QP takes the minimum value 0, it means the finest quantization; on the contrary, when QP takes the maximum value 51, it means the coarsest quantization. The bit rate can be controlled by adjusting the quantization parameter.
[0140] Optionally, the coding unit included in the target detection box corresponds to a first quantization parameter, the coding unit included in the reference area other than the target detection box 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 box 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 a 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 of 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 of 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 of 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 of 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 are 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 in the target detection frame.
[0146] Optionally, target pixels included in the frame edge setting range 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 range can characterize the edge features of the object to be detected, and one or more target pixels at the edge of the frame edge range 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 in the target detection frame may be segmented by referring to the segmentation line to determine the background area in 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, the first quantization parameter corresponding to the coding unit included in the background area is adjusted to the second quantization parameter, so that 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<the third quantization parameter<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, if the QP is small, most details in the image will be retained, and the corresponding bit rate is higher; if the QP is large, some details in the image will be lost, and the corresponding bit rate is lower, but the image distortion is higher and the compression quality is poor. In other words, the QP and the bit rate are inversely proportional.
[0155] Optionally, there is a corresponding relationship 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 through 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 allocated to each coding unit through 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 larger the bit rate, the smaller the compression ratio when encoding the original image, the higher the image quality obtained by processing, and the clearer the image quality.
[0159] In the embodiments 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 bit rate of the background area in each target detection frame in the original image; determines the corresponding bit rate according to 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 bit rate of each coding unit. By determining the background area in the target detection frame with reference to the dividing line, the target detection frame can be further divided, and the bit rate of the background area can be further adjusted, so that more bit rates can be allocated to more concerned areas, thereby improving the rationality of bit rate allocation. Furthermore, according to the bit rate that achieves a more accurate bit rate control effect, the picture quality of the original image is controlled, 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 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 used 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 used to determine key pixel points for any target detection frame according to target pixel points for displaying the object to be detected and located within a set range of the frame edge of the target detection frame;
[0166] A background region determination module 703 is used to generate at least one reference segmentation line according to the key pixel points, and determine the background region in the target detection frame according to the reference segmentation line;
[0167] The bit rate adjustment module 704 is used to adjust the bit rate of the background area in 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, when the number of target pixels is one, the target pixel is used as the key pixel;
[0171] For any frame edge, when there are multiple target pixels, the target pixels on the frame edge are traversed, and the starting target pixel and the ending target pixel are selected 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 encoding units;
[0175] The background area is determined according to the positional relationship between each coding unit in the target detection frame and the reference segmentation line.
[0176] Create a coordinate axis based on the original image, and determine a segmentation line equation of a reference segmentation line within the coordinate axis;
[0177] Determine the position relationship according to 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] Acquire a first positional relationship between a central pixel point of each target pixel point and a target segmentation line;
[0181] Acquire a second positional relationship between any encoding unit and the target segmentation line;
[0182] When the second position relationship is different from the first position relationship, determining a pixel point in any coding unit as a background pixel point;
[0183] The background area is formed according to each background pixel.
[0184] Select any pixel in the coding unit as a reference pixel;
[0185] The second positional relationship is determined according to the positional relationship between the reference pixel point and any reference segmentation line.
[0186] Determine two frame edges that intersect with the reference split 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 used 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 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, the key pixel points are determined according to the target pixel points for displaying the object to be detected within the frame edge setting range of the target detection frame; at least one reference segmentation line is generated according to the key pixel points, and the background area is determined in the target detection frame according to the reference segmentation line; 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, better retain the edge of the object to be detected, and further adjust the rate of the background area, which can improve the rationality of the 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.
[0192] An embodiment of the present disclosure further 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 Schematic diagram of the structure of a coding 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 in each target detection frame in the original image using the bit rate control device 700;
[0195] The encoding module 802 is used to encode the original image based on the adjusted bit rate.
[0196] In the embodiment of the present disclosure, the 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 the first quantization parameter before the bit rate adjustment to the second quantization parameter after the bit rate adjustment, and the second quantization parameter is the quantization parameter corresponding to the coding units included in the reference area other than the target detection frame in the original image; the coding module 802 is used to:
[0197] Determine a corresponding bit rate according to a first quantization parameter or a 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 the present disclosure adjusts the bit rate of the background area in each target detection frame in the original image; and encodes the original image based on the adjusted bit rate. It can control the picture quality of the original image according to the bit rate that achieves a more accurate bit rate control effect, and improve the compression quality of the video without increasing the 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] Fig. 9 A schematic block diagram of an example electronic device 900 that can be used to implement an embodiment 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 processing, cellular phones, smart phones, wearable devices, and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely examples and are not intended to limit the implementation of the present disclosure described and / or required herein.
[0202] like Fig. 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 to a RAM (Random Access Memory) 903. In the RAM 903, various programs and data required for the operation of the device 900 can also be stored. 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] A number of 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 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 through a computer network such as the Internet and / or various telecommunication networks.
[0204] The computing unit 901 may be a variety of general and / or special 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 Units), various dedicated AI (Artificial Intelligence) computing chips, various computing units running machine learning model algorithms, DSP (Digital Signal Processor), and any appropriate processor, controller, microcontroller, etc. The computing unit 901 performs the various methods and processes described above, such as a rate control method or an encoding method. For example, in some embodiments, the rate control method or the encoding method may be implemented as a computer software program, which is tangibly included in a machine-readable medium, such as a storage unit 908. In some embodiments, part or all of the computer program may 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 may be executed. 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 above herein may 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 may include: being implemented in one or more computer programs that may be executed and / or interpreted on a programmable system including at least one programmable processor that may be a dedicated or general-purpose programmable processor that may receive data and instructions from a storage system, at least one input device, and at least one output device, and may 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 may be written in any combination of one or more programming languages. These program codes may be provided to a processor or controller of a general-purpose computer, a special-purpose computer, or other programmable data processing device, so that the program code, when executed by the processor or controller, enables the functions / operations specified in the flow chart and / or block diagram to be implemented. The program code may be executed entirely on the machine, partially on the machine, partially on the machine and partially on a remote machine as a stand-alone software package, 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 equipment. 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 device, or any suitable combination of the foregoing. More specific examples of machine-readable storage media may include electrical connections based on one or more lines, portable computer disks, hard disks, RAM, ROM, EPROM (Electrically Programmable Read-Only-Memory) or flash memory, optical fiber, CD-ROM (Compact Disc Read-Only Memory), optical storage devices, magnetic storage devices, 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 may 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 a 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 may 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 the server are generally remote from each other and usually interact through a communication network. The relationship between the client and the server is generated by computer programs running on the corresponding computers and having a client-server relationship with each other. The server may be a cloud server, also known as a cloud computing server or cloud host, which is a host product in the cloud computing service system to solve the defects of difficult management and weak business scalability in traditional physical hosts and VPS services ("Virtual Private Server", or "VPS" for short). The server may also be a server of a distributed system, or a server combined with a blockchain.
[0211] It should be noted that artificial intelligence is a discipline that studies how computers can simulate certain human thought processes and intelligent behaviors (such as learning, reasoning, thinking, planning, etc.), and includes both hardware-level and software-level technologies. Artificial intelligence hardware technologies generally include technologies such as sensors, dedicated artificial intelligence chips, cloud computing, distributed storage, and big data processing; artificial intelligence software technologies mainly include computer vision technology, speech recognition technology, natural language processing technology, as well as machine learning / deep learning, big data processing technology, knowledge graph technology, and other major directions.
[0212] It should be understood that the various forms of processes shown above can be used to reorder, add or delete steps. For example, the steps recorded in this disclosure can be executed in parallel, sequentially or in different orders, as long as the desired results of the technical solutions disclosed in this disclosure can be achieved, and this document does not limit this.
[0213] The above specific implementations do not constitute a limitation on the protection scope of the present disclosure. It should be understood by those skilled in the art that various modifications, combinations, sub-combinations and substitutions can be made according to design requirements and other factors. Any modification, equivalent substitution and improvement made within the spirit and principle of the present disclosure shall be included in the protection scope of the present 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 according to target pixels for displaying the object to be detected that are located within a set range of the frame edge of the target detection frame; 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 in each target detection frame in the original image is adjusted.
2. The method according to claim 1, wherein: The determining of key pixel points according to target pixel points located on the edge of the target detection frame includes: Determining the target pixel point by image segmentation within a frame edge setting range 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 the number of the 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.
3. The method according to claim 1 or 2, wherein: The generating at least one reference segmentation line according to the key pixel point comprises: For two adjacent frame edges, two key pixel points located on different frame edges and having the closest distance to each other are connected to generate the reference segmentation line.
4. The method according to claim 1 or 2, wherein: Determining the background area in 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 encoding 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 the background area is determined according to the positional relationship between each coding unit in the target detection frame and the reference segmentation line, including: 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 encoding unit in 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 central 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 position relationship is different from the first position relationship, determining a 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 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 one of the reference segmentation lines.
8. The method according to claim 1 or 2, wherein: Determining the background area in the target detection frame according to the reference segmentation line includes: Determine two frame edges that intersect the reference segmentation 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 in each target detection frame in the original image includes: Obtaining a target bit rate allocated to a reference area other than 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, the method comprising: Adopting the method as described in any one of claims 1 to 9, adjusting the bit rate of the background area in 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, and the coding units in the background area of the target detection frame are adjusted from a first quantization parameter before the bit rate adjustment to a second quantization parameter after the bit rate adjustment, where the second quantization parameter is a quantization parameter corresponding to the coding units included in the reference area other than 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 a first quantization parameter or a 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, used for acquiring 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 pixel points for any target detection frame according to target pixel points located within a frame edge setting range of the target detection frame for displaying the object to be detected; A background area determination module, used to generate at least one reference segmentation line according to the key pixel points, and determine the background area in 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 in 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: On the frame edge of any target detection frame, determining the target pixel points corresponding to the object to be detected by image segmentation; 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 the number of the 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.
14. The device according to claim 12 or 13, wherein: The background area determination module is used to: For two adjacent frame edges, two key pixel points located on different frame edges and having the closest distance to each other 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 encoding 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 encoding unit in the target detection frame and the segmentation 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 central 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 position relationship is different from the first position relationship, determining a 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 one of the reference segmentation lines.
19. The device according to claim 12 or 13, wherein: The background area determination module is used to: Determine two frame edges that intersect the reference segmentation 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 other than 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, the device comprising: A bit rate adjustment module, configured to adjust the bit rate of the background area in each target detection frame in the original image using the device according to any one of claims 12 to 20; The encoding module is used 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, and the coding units in the background area of the target detection frame are adjusted from a first quantization parameter before the bit rate adjustment to a second quantization parameter after the bit rate adjustment, where the second quantization parameter is a quantization parameter corresponding to the coding units included in the reference area other than the target detection frame in the original image; The encoding module is used for: Determining a corresponding bit rate according to a first quantization parameter or a 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 executable 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 execute 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-9, or to execute the method according to any one of claims 10-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 executes the method according to any one of claims 10 to 11.
Citation Information
Patent Citations
Target detection and recognition method for water surface panoramic images
CN107844750A
Video compression method and device, video compression equipment and storage device
CN111787398A
Video coding method and device, equipment and medium
CN113301336A
Method for adjusting positioning deviation of crack detection frame on pavement of nuclear power plant
CN113989238A
Vehicle target collision point selection method and device, terminal and storage medium
CN116721404A