Video image quality enhancement method and device, electronic equipment and medium
By converting video frames from RGB to YCbCr color space and adaptively adjusting the brightness enhancement coefficient, the problem of poor nighttime image processing and unobvious brightness enhancement in the existing technology is solved, and better video quality enhancement effects are achieved.
Patent Information
- Application Number
- CN202410306624.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-03-18
- Publication Date
- 2024-10-18
AI Technical Summary
Existing video quality enhancement technology is ineffective when processing darker nighttime images, is prone to halo phenomena, and cannot effectively increase the dynamic range and brightness of the image, resulting in local distortion problems.
Convert the video frame from RGB color space to YCbCr color space, keep the blue and red chroma components unchanged, obtain the brightness enhancement coefficient for global brightness enhancement, and perform local contrast enhancement on the global brightness enhanced frame to avoid excessive enhancement and local distortion.
It achieves adaptive brightness enhancement based on the brightness of the video frame, improves the video quality enhancement effect, and avoids the problems of local detail distortion and over-enhancement.
Smart Images

Figure CN118803299A_ABST
Abstract
Description
Technical Field
[0001] The present disclosure relates to the field of video processing technology, and in particular to a method, device, electronic device and medium for enhancing video quality. Background Art
[0002] In the related art, when enhancing the video quality, the video quality can be enhanced by the Retinex theory or by the RGB proportional gain method. However, in the above-mentioned technology, the processing effect of the overall dark night image by the Retinex theory is poor and the halo phenomenon is prone to occur. At the same time, the dynamic range of the image cannot be increased. Although the image can be enhanced to a certain extent by the RGB proportional gain method, it often causes a series of problems such as local distortion (noise), and the improvement of the brightness gain of the image is not obvious. In other words, the traditional video quality enhancement algorithm often cannot solve the problem of increasing the dynamic range of low-light images and improving the brightness of the image, as well as the problem of difficulty in recognition caused by uneven image illumination. Therefore, how to adaptively enhance the brightness of video frames according to the brightness of different video frames, and ensure that the video frames after brightness enhancement do not have the problems of over-enhancement and local distortion, so as to improve the enhancement effect of video quality, has become a problem to be solved urgently. Summary of the invention
[0003] The present disclosure provides a video quality enhancement method, device, electronic device and medium to at least solve the problem that the video quality enhancement method in the related art has poor effect.
[0004] The technical solution of the present disclosure is as follows:
[0005] According to a first aspect of an embodiment of the present disclosure, a video quality enhancement method is provided, comprising: obtaining a first video frame to be enhanced, and converting the first video frame from an RGB color space to a YCbCr color space to obtain a second video frame, wherein R is red, G is green, B is blue, Y is a brightness component, Cb is a blue chromaticity component, and Cr is a red chromaticity component; maintaining the blue chromaticity component and the red chromaticity component unchanged, obtaining brightness enhancement coefficients of different brightness components of the second video frame in the YCbCr color space, and performing global brightness enhancement on the second video frame according to the brightness enhancement coefficient to obtain a first enhanced video frame, and performing local contrast enhancement on the first enhanced video frame to obtain a second enhanced video frame; obtaining an enhanced YCbCr color space of the second enhanced video frame, converting the second enhanced video frame from the enhanced YCbCr color space to the RGB color space to obtain an enhanced third video frame.
[0006] According to a second aspect of an embodiment of the present disclosure, a video quality enhancement device is provided, comprising: a first acquisition module, used to acquire a first video frame to be enhanced, and convert the first video frame from an RGB color space to a YCbCr color space to obtain a second video frame, wherein R is red, G is green, B is blue, Y is a brightness component, Cb is a blue chromaticity component, and Cr is a red chromaticity component; an enhancement module, used to maintain the blue chromaticity component and the red chromaticity component unchanged, acquire brightness enhancement coefficients of different brightness components of the second video frame in the YCbCr color space, perform global brightness enhancement on the second video frame according to the brightness enhancement coefficient, acquire a first enhanced video frame, and perform local contrast enhancement on the first enhanced video frame, acquire a second enhanced video frame; a second acquisition module, used to acquire an enhanced YCbCr color space of the second enhanced video frame, convert the second enhanced video frame from the enhanced YCbCr color space to the RGB color space, and obtain an enhanced third video frame.
[0007] According to a third aspect of an embodiment of the present disclosure, an electronic device is provided, comprising: a processor; and a memory for storing executable instructions of the processor; wherein the processor is configured to execute the instructions to implement the video quality enhancement method as described in the first aspect of the embodiment of the present disclosure.
[0008] According to the fourth aspect of an embodiment of the present disclosure, a computer-readable storage medium is provided. When instructions in the computer-readable storage medium are executed by a processor of an electronic device, the electronic device is enabled to execute the video quality enhancement method as described in the first aspect of the embodiment of the present disclosure.
[0009] The technical solution provided by the embodiments of the present disclosure brings at least the following beneficial effects:
[0010] In the disclosed embodiment, a first video frame to be enhanced is obtained, and the first video frame is converted from an RGB color space to a YCbCr color space to obtain a second video frame, wherein R is red, G is green, B is blue, Y is a brightness component, Cb is a blue chroma component, and Cr is a red chroma component, and the blue chroma component and the red chroma component are maintained unchanged, and brightness enhancement coefficients of different brightness components of the second video frame in the YCbCr color space are obtained, and the second video frame is globally enhanced according to the brightness enhancement coefficient, and a first enhanced video frame is obtained, and local contrast enhancement is performed on the first enhanced video frame. , obtain a second enhanced video frame, obtain an enhanced YCbCr color space of the second enhanced video frame, convert the second enhanced video frame from the enhanced YCbCr color space to the RGB color space, and obtain an enhanced third video frame. Therefore, the present disclosure can adaptively determine the corresponding brightness enhancement coefficient according to different brightness components of the video frame in the YCbCr color space, perform global brightness enhancement on the video frame through different enhancement coefficients, and perform local contrast enhancement on the video frame after the global brightness enhancement, thereby avoiding the problems of local detail distortion and over-enhancement in the video frame, and improving the enhancement effect of the video frame image quality.
[0011] It is to be understood that the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the present disclosure. BRIEF DESCRIPTION OF THE DRAWINGS
[0012] The drawings herein are incorporated into and constitute a part of the specification, illustrate embodiments consistent with the present disclosure, and together with the description are used to explain the principles of the present disclosure, and do not constitute improper limitations on the present disclosure.
[0013] Figure 1 The figure is a flow chart of a method for enhancing video quality according to an exemplary embodiment.
[0014] Figure 2 is a flowchart of a method for enhancing video quality according to another exemplary embodiment.
[0015] Figure 3 is a flowchart of a method for enhancing video quality according to another exemplary embodiment.
[0016] Figure 4 is a flowchart of a method for enhancing video quality according to another exemplary embodiment.
[0017] Figure 5 The figure is a flow chart of a method for enhancing video quality according to an exemplary embodiment.
[0018] Figure 6 The figure is a block diagram of a video quality enhancement device according to an exemplary embodiment.
[0019] Figure 7 is a block diagram of an electronic device according to another exemplary embodiment. DETAILED DESCRIPTION
[0020] In order to enable ordinary persons in the art to better understand the technical solutions of the present disclosure, the technical solutions in the embodiments of the present disclosure will be clearly and completely described below in conjunction with the accompanying drawings.
[0021] It should be noted that the terms "first", "second", etc. in the specification and claims of the present disclosure and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchanged where appropriate, so that the embodiments of the present disclosure described herein can be implemented in an order other than those illustrated or described herein. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with the present disclosure. Instead, they are merely examples of devices and methods consistent with some aspects of the present disclosure as detailed in the appended claims.
[0022] The video quality enhancement method, device and electronic device proposed in the present disclosure are described in detail using embodiments below.
[0023] Figure 1 A flowchart of a method for enhancing video quality provided in an embodiment of the present application.
[0024] like Figure 1 As shown, the video quality enhancement method proposed in this embodiment includes the following steps:
[0025] S101, obtaining a first video frame to be enhanced, and converting the first video frame from an RGB color space to a YCbCr color space to obtain a second video frame, wherein R is red, G is green, B is blue, Y is a brightness component, Cb is a blue chroma component, and Cr is a red chroma component.
[0026] The first video frame to be enhanced is any video frame that needs to be enhanced.
[0027] Among them, the RGB color space is defined by the chromaticity of the three primary colors of red, green and blue, R for red, G for green, and B for blue.
[0028] Among them, the YCbCr color space is usually used for continuous image processing in movies or in digital photography systems. Y is the brightness component, Cb is the blue chrominance component, and Cr is the red chrominance component. In the YCbCr color space, the brightness component can be separated from the chrominance information.
[0029] It should be noted that the present disclosure does not limit the specific method of converting the first video frame from the RGB color space to the YCbCr color space to obtain the second video frame, and it can be selected according to actual conditions.
[0030] Optionally, a color space conversion formula for converting an RGB color space to a YCbCr color space may be obtained, and the color space conversion formula may be used to convert the first video frame from the RGB color space to the YCbCr color space to obtain a second video frame.
[0031] S102, maintaining the blue chromaticity component and the red chromaticity component unchanged, obtaining the brightness enhancement coefficients of different brightness components of the second video frame in the YCbCr color space, and performing global brightness enhancement on the second video frame according to the brightness enhancement coefficients to obtain a first enhanced video frame, and performing local contrast enhancement on the first enhanced video frame to obtain a second enhanced video frame.
[0032] Optionally, a pre-constructed brightness mapping function may be obtained, and a brightness enhancement coefficient may be obtained according to the brightness mapping function and different brightness components of the second video frame in the YCbCr color space.
[0033] The brightness mapping function is a brightness mapping function model in which the brightness enhancement coefficient is adaptively controlled, that is, the corresponding brightness enhancement coefficient can be obtained according to different brightness components of the video frame.
[0034] In the embodiment of the present disclosure, after the brightness enhancement coefficients of different brightness components of the second video frame in the YCbCr color space are obtained, the second video frame may be globally enhanced in brightness according to the brightness enhancement coefficients.
[0035] Optionally, after the brightness enhancement coefficient is obtained, the second video frame may be globally enhanced in brightness according to the brightness enhancement coefficient and a brightness enhancement image quality enhancement algorithm to obtain a first enhanced video frame.
[0036] It should be noted that the second video frame can be mapped to an optimal brightness through the brightness mapping function, but the brightness mapping function easily causes pixels to be overly concentrated in certain smaller intervals, causing local details of the brightness enhanced video frame to be distorted and over-enhancement to occur. Therefore, it is necessary to perform local contrast enhancement on the first enhanced video frame after global brightness enhancement to obtain the second enhanced video frame.
[0037] It should be noted that the present disclosure does not limit the specific method of performing local contrast enhancement on the first enhanced video frame to obtain the second enhanced video frame, and the method can be selected according to actual conditions.
[0038] Optionally, a contrast enhancement coefficient, a pixel mean of a pixel block in a target area, and pixels of a first enhanced video frame may be obtained, and local contrast enhancement may be performed on the first enhanced video frame according to the contrast enhancement coefficient, the pixel mean of a pixel block in a target area, and pixels of the first enhanced video frame to obtain a second enhanced video frame.
[0039] S103, obtaining an enhanced YCbCr color space of the second enhanced video frame, converting the second enhanced video frame from the enhanced YCbCr color space to an RGB color space, and obtaining an enhanced third video frame.
[0040] Optionally, a target brightness component of the second enhanced video frame may be obtained, and the target brightness component, a blue component, and a red component may be combined to obtain an enhanced YCbCr color space of the second enhanced video frame.
[0041] In the embodiment of the present disclosure, after the enhanced YCbCr color space is acquired, the second enhanced video frame may be converted from the enhanced YCbCr color space to the RGB color space to obtain an enhanced third video frame.
[0042] Optionally, a color space conversion formula for converting the YCbCr color space to the RGB color space may be obtained, and the second video frame may be converted from the enhanced YCbCr color space to the RGB color space using the color space conversion formula to obtain an enhanced third video frame.
[0043] In summary, the video quality enhancement method provided by the embodiment of the present disclosure obtains a first video frame to be enhanced, and converts the first video frame from the RGB color space to the YCbCr color space to obtain a second video frame, wherein R is red, G is green, B is blue, Y is a brightness component, Cb is a blue chroma component, and Cr is a red chroma component, and the blue chroma component and the red chroma component are maintained unchanged, and the brightness enhancement coefficients of different brightness components of the second video frame in the YCbCr color space are obtained, and the second video frame is globally enhanced according to the brightness enhancement coefficients, and a first enhanced video frame is obtained, and the first enhanced video frame is converted into a YCbCr color space. The enhanced video frame is locally contrast enhanced, a second enhanced video frame is obtained, an enhanced YCbCr color space of the second enhanced video frame is obtained, the second enhanced video frame is converted from the enhanced YCbCr color space to the RGB color space, and an enhanced third video frame is obtained. Therefore, the present disclosure can adaptively determine the corresponding brightness enhancement coefficient according to different brightness components of the video frame, perform global brightness enhancement on the video frame through different enhancement coefficients, and perform local contrast enhancement on the video frame after the global brightness enhancement, thereby avoiding the problems of local detail distortion and over-enhancement in the video frame, and improving the enhancement effect of the video frame image quality.
[0044] As a possible implementation, Figure 2As shown, based on the above embodiment, the specific process of obtaining the brightness enhancement coefficients of different brightness components of the second video frame in the YCbCr color space includes the following steps:
[0045] S201, obtaining a brightness mapping function.
[0046] As a possible implementation, Figure 3 As shown, based on the above embodiment, the specific process of obtaining the brightness mapping function includes the following steps:
[0047] S301, obtaining a sample brightness component and a sample brightness enhancement coefficient.
[0048] In an embodiment of the present disclosure, in order to improve the diversity of sample video frames, a set of sample video frames at different brightnesses may be obtained, each sample video frame in the set of sample video frames may be converted from an RGB color space to a YCbCr color space, and the brightness component of each sample video frame in the YCbCr color space may be used as a sample brightness component I.
[0049] It should be noted that the larger the number n of sample video frames is, the better the fitting effect of the brightness mapping function is. Optionally, the number n of sample video frames can be selected as 200, covering various scenes such as indoor, outdoor, cloudy, sunny, etc., to obtain a set of sample video frames at different brightness.
[0050] It should be noted that according to the Weber-Fechner law, the perception of image brightness can be expressed by a logarithmic function, and the brightness enhancement and image quality enhancement algorithm can be expressed by the following formula:
[0051] L en (x,y)=L1(x,y)·L2(x,y) (1)
[0052]
[0053]
[0054] Among them, L en (x, y) is the brightness value of the target pixel in the image after brightness mapping enhancement, L1(x, y) and L2(x, y) are multiplication factors; L(x, y) represents the current brightness value of the pixel in the image, L(x, y) max is the maximum value of pixel brightness in the initial image, L wmax is the maximum local brightness of the image, L w is the brightness value of the current local pixel, and b is the brightness enhancement coefficient (variable).
[0055] It should be noted that for different images to be enhanced, when the brightness enhancement effect is optimal, the corresponding enhancement coefficient has different values, wherein the value range of the brightness enhancement coefficient is [0.5, 2], and the larger the brightness enhancement coefficient, the weaker the image brightness enhancement.
[0056] It should be noted that after obtaining the value interval [0.5, 2] of the brightness enhancement coefficient, the value interval [0.5, 2] of the brightness enhancement coefficient can be divided according to the interval division strategy to obtain the brightness enhancement coefficient of the candidate sample.
[0057] For example, for sample video frame A, the value interval [0.5, 2] of the brightness enhancement coefficient is divided according to the interval division strategy to obtain candidate sample brightness enhancement coefficients 0.5, 0.6, 0.7...2 corresponding to sample video frame A.
[0058] In the embodiment of the present disclosure, after obtaining the candidate sample brightness enhancement coefficient, global brightness enhancement can be performed on each sample video frame according to the candidate sample brightness enhancement coefficient and through formula (1)-formula (3), to obtain a sample enhanced video frame, and the sample brightness enhancement coefficient can be determined from the candidate sample brightness enhancement coefficients according to the brightness value of the sample enhanced video frame.
[0059] Optionally, the first brightness threshold and the second brightness threshold of each sample video frame can be obtained, and the candidate sample brightness enhancement coefficient corresponding to a value greater than or equal to the first brightness threshold and less than the second brightness threshold can be used as the sample brightness enhancement coefficient. In this case, the brightness enhancement effect of the sample video frame is best.
[0060] S302, constructing an initial polynomial of the brightness mapping function.
[0061] In the embodiment of the present disclosure, the initial polynomial of the brightness mapping function is:
[0062] b=a0+a1I+…+a k I k (4)
[0063] Among them, a0...a k is the fitting coefficient, b is the brightness enhancement coefficient, and I is the brightness component.
[0064] S303, fitting the initial polynomial according to the sample brightness enhancement coefficient and the sample brightness component to obtain a brightness mapping function.
[0065] Optionally, the sample brightness component and the sample brightness enhancement coefficient may be associated to obtain a sample data group consisting of the sample brightness component and the sample brightness enhancement coefficient, and the initial polynomial may be fitted by the least squares method based on the sample data group to obtain a brightness mapping function.
[0066] For example, if the number of sample video frames is n, then n groups of sample brightness components and sample brightness enhancement coefficients can be obtained, and then the sample data groups (I1, b1), (I2, b2), (I n ,b n ), and then the initial polynomial can be fitted by the least square method according to the acquired sample data group to obtain the brightness mapping function.
[0067] The specific process of fitting the initial polynomial according to the sample brightness enhancement coefficient and the sample brightness component to obtain the brightness mapping function is explained below.
[0068] For n groups of sample data, the sum of the distances from each point in the n groups of sample data to the curve, that is, the sum of squared deviations, is as follows:
[0069]
[0070] In order to obtain the fitting coefficient value that meets the conditions, the coefficient a of formula (5) can be j (j=1,2,…,k) to find the partial derivative, and we get formula (6):
[0071]
[0072] After obtaining formula (6), formula (6) can be simplified. The simplification process is as follows:
[0073]
[0074] ......
[0076]
[0077] Furthermore, the fitting coefficient a and the sample brightness component I in the equation derived from equation (7) can be written into matrix forms A and I respectively, and then matrix expressions (8) and (9) can be obtained:
[0078]
[0079] A=[a0,a1,…,a k ] T (9)
[0080] By simplifying b in equation (6), we can get the matrix B:
[0081]
[0082] After obtaining matrices A, I and B, equation (4) can be converted into a vector form to obtain equation (11):
[0083] I×A=B(11)
[0084] After obtaining formula (11), the matrix A can be solved by matrix operation to obtain the fitting coefficient of the initial polynomial, that is, the brightness enhancement coefficient. Then, the brightness enhancement coefficient is substituted into formula (4) to obtain the brightness mapping function.
[0085] S202: Obtain a brightness enhancement coefficient according to the brightness mapping function and different brightness components of the second video frame in the YCbCr color space.
[0086] It should be noted that, for video frames to be enhanced at different brightnesses, the present disclosure can obtain brightness enhancement coefficients according to different brightness components through a brightness mapping function.
[0087] Optionally, the brightness component may be substituted into the brightness mapping function, and the brightness enhancement coefficient may be obtained according to the brightness mapping function and different brightness components of the second video frame in the YCbCr color space.
[0088] Further, after the brightness enhancement coefficient is obtained, the second video frame may be globally enhanced in brightness according to the brightness enhancement coefficient to obtain a first enhanced video frame.
[0089] In summary, the video quality enhancement method provided by the embodiment of the present disclosure obtains sample brightness components and sample brightness enhancement coefficients, constructs an initial polynomial of the brightness mapping function, associates the sample brightness components and the sample brightness enhancement coefficients to obtain a sample data group consisting of the sample brightness components and the sample brightness enhancement coefficients, and fits the initial polynomial by the least squares method according to the sample data group to obtain the brightness mapping function, and obtains the brightness enhancement coefficient according to the brightness mapping function and the different brightness components of the second video frame in the YCbCr color space. Therefore, the present disclosure ensures the diversity and comprehensiveness of data samples by obtaining sample video frames at different brightnesses as well as sample brightness components and sample brightness enhancement coefficients, and improves the accuracy and reliability of obtaining the brightness mapping function by fitting the initial polynomial by the least squares method according to the sample data group consisting of the sample brightness components and the sample brightness enhancement coefficients, laying a foundation for more accurately and adaptively determining the corresponding brightness enhancement coefficient according to the different brightness components of the video frame in the subsequent process.
[0090] As a possible implementation, Figure 4 As shown, based on the above embodiment, the specific process of performing local contrast enhancement on the first enhanced video frame to obtain the second enhanced video frame includes the following steps:
[0091] S401, obtaining a contrast enhancement coefficient, a pixel mean value of a pixel block in a target area, and pixels of a first enhanced video frame.
[0092] It should be noted that the present disclosure does not limit the setting of the contrast enhancement coefficient, which can be selected according to actual conditions.
[0093] Optionally, the first enhanced video frame can be divided into regions to obtain multiple sub-region pixel blocks of the first enhanced video frame, obtain the brightness value of each sub-region pixel block and the brightness threshold of the first enhanced video frame, determine the target region pixel block from the multiple sub-region pixel blocks according to the brightness value and the brightness threshold, and obtain the pixel mean of the target region pixel block based on the target region pixel block.
[0094] For example, the brightness value of each sub-region pixel block may be compared with the brightness threshold of the first enhanced video frame, and the sub-region pixel blocks having brightness values greater than the brightness value of each sub-region pixel block and the brightness threshold of the first enhanced video frame may be used as target region pixel blocks.
[0095] S402: Perform local contrast enhancement on the first enhanced video frame according to the contrast enhancement coefficient, the pixel mean value of the pixel block in the target area, and the pixels of the first enhanced video frame to obtain a second enhanced video frame.
[0096] In the embodiment of the present disclosure, after the contrast enhancement coefficient, the pixel mean of the target area pixel block and the pixels of the first enhanced video frame are obtained, local contrast enhancement may be performed on the first enhanced video frame to obtain a second enhanced video frame.
[0097] Optionally, the following formula may be used to perform local contrast enhancement on the first enhanced video frame to obtain a second enhanced video frame:
[0098]
[0099] Where, θ is the contrast enhancement coefficient, L avg is the pixel mean of the pixel block in the target area, L in are pixels of the first enhanced video frame.
[0100] In summary, the video quality enhancement method provided by the embodiment of the present disclosure obtains the contrast enhancement coefficient, the pixel mean of the pixel block in the target area, and the pixels of the first enhanced video frame, and performs local contrast enhancement on the first enhanced video frame according to the contrast enhancement coefficient, the pixel mean of the pixel block in the target area, and the pixels of the first enhanced video frame to obtain the second enhanced video frame. Therefore, the present disclosure performs local contrast enhancement on the video frame after global brightness enhancement through the local contrast enhancement formula, avoids the problems of local detail distortion and over-enhancement in the video frame, and improves the enhancement effect of the video frame quality.
[0101] The specific process of the video quality enhancement method proposed in the present disclosure is explained below.
[0102] For example, Figure 5 As shown, a video frame to be enhanced is obtained, and the video frame to be enhanced is converted from the RGB color space to the YCbCr color space. After the color space conversion, the brightness component Y of the video frame to be enhanced in the YCbCr color space can be obtained. The acquired sample data group is fitted by the least squares method to obtain a brightness mapping function. According to the brightness component of the video frame to be enhanced and the brightness mapping function, the corresponding brightness enhancement coefficient is determined. According to the brightness enhancement coefficient and the brightness enhancement image quality enhancement algorithm, the video frame to be enhanced is globally enhanced in brightness, and the video frame after global brightness enhancement is locally enhanced in contrast. The video frame after local contrast enhancement is combined with the blue chroma component Cb and the red chroma component Cr to obtain an enhanced YCbCr space, and then the enhanced YCbCr space is converted into the RGB space to obtain an enhanced video frame.
[0103] Optionally, for any video, the video quality enhancement method proposed in the present disclosure can be used to enhance the quality of the video frames constituting the video, thereby achieving video quality enhancement accordingly.
[0104] In summary, the video quality enhancement method provided by the embodiments of the present invention can adaptively determine the corresponding brightness enhancement coefficient according to the different brightness components of the video frame through the brightness mapping function and the different brightness components of the video frame, which can meet the real-time performance of real-time video transmission and the demand for network bandwidth. The video frame is globally enhanced in brightness through different enhancement coefficients, and the video frame after global brightness enhancement is locally contrast enhanced, thereby avoiding the problems of local detail distortion and over-enhancement in the video frame, and improving the enhancement effect of the video frame quality.
[0105] Figure 6 FIG. 1 is a block diagram of a video quality enhancement device according to an exemplary embodiment. Figure 6As shown, the video quality enhancement device 600 of the embodiment of the present disclosure may specifically include: a first acquisition module 601 , an enhancement module 602 , and a second acquisition module 603 .
[0106] The first acquisition module 601 is used to acquire a first video frame to be enhanced, and convert the first video frame from an RGB color space to a YCbCr color space to obtain a second video frame, wherein R is red, G is green, B is blue, Y is a brightness component, Cb is a blue chroma component, and Cr is a red chroma component;
[0107] an enhancement module 602, configured to maintain the blue chromaticity component and the red chromaticity component unchanged, obtain brightness enhancement coefficients of different brightness components of the second video frame in the YCbCr color space, perform global brightness enhancement on the second video frame according to the brightness enhancement coefficients to obtain a first enhanced video frame, and perform local contrast enhancement on the first enhanced video frame to obtain a second enhanced video frame;
[0108] The second acquisition module 603 is used to acquire the enhanced YCbCr color space of the second enhanced video frame, and convert the second enhanced video frame from the enhanced YCbCr color space to the RGB color space to obtain an enhanced third video frame.
[0109] In one embodiment of the present disclosure, the enhancement module 602 is used to: obtain a brightness mapping function; and obtain the brightness enhancement coefficient according to the brightness mapping function and different brightness components of the second video frame in the YCbCr color space.
[0110] In one embodiment of the present disclosure, the enhancement module 602 is further used to: obtain a sample brightness component and a sample brightness enhancement coefficient; construct an initial polynomial of the brightness mapping function; and fit the initial polynomial according to the sample brightness enhancement coefficient and the sample brightness component to obtain a brightness mapping function.
[0111] In one embodiment of the present disclosure, the enhancement module 602 is further used to: obtain a sample brightness component and a sample brightness enhancement coefficient; construct an initial polynomial of the brightness mapping function; and fit the initial polynomial according to the sample brightness enhancement coefficient and the sample brightness component to obtain a brightness mapping function.
[0112] In one embodiment of the present disclosure, the enhancement module 602 is further used to: obtain a set of sample video frames at different brightnesses, convert each sample video frame in the set of sample video frames from the RGB color space to the YCbCr color space; and use the brightness component of each sample video frame in the YCbCr color space as the sample brightness component.
[0113] In one embodiment of the present disclosure, the enhancement module 602 is used to: obtain a candidate sample brightness enhancement coefficient for each sample video frame; perform global brightness enhancement on each sample video frame according to the candidate sample brightness enhancement coefficient to obtain a sample enhanced video frame; and determine the sample brightness enhancement coefficient from the candidate sample brightness enhancement coefficients according to the brightness value of the sample enhanced video frame.
[0114] In one embodiment of the present disclosure, the enhancement module 602 is further used to: obtain a first brightness threshold and a second brightness threshold of a sample video frame; and use a candidate sample brightness enhancement coefficient that is greater than or equal to the first brightness threshold and less than the second brightness threshold as the sample brightness enhancement coefficient.
[0115] In one embodiment of the present disclosure, the enhancement module 602 is used to: obtain a contrast enhancement coefficient, a pixel mean of a pixel block in a target area, and pixels of the first enhanced video frame; perform local contrast enhancement on the first enhanced video frame according to the contrast enhancement coefficient, the pixel mean of the pixel block in the target area, and pixels of the first enhanced video frame to obtain a second enhanced video frame.
[0116] In one embodiment of the present disclosure, the enhancement module 602 is used to: divide the first enhanced video frame into regions to obtain multiple sub-region pixel blocks of the first enhanced video frame; obtain the brightness value of each sub-region pixel block and the brightness threshold of the first enhanced video frame; determine a target region pixel block from the multiple sub-region pixel blocks based on the brightness value and the brightness threshold; and obtain a pixel mean of the target region pixel block based on the target region pixel block.
[0117] In one embodiment of the present disclosure, the second acquisition module 603 is further used to: acquire a target brightness component of the second enhanced video frame; and merge the target brightness component, the blue component and the red component to acquire an enhanced YCbCr color space of the second enhanced video frame.
[0118] In the embodiments of the present disclosure, the specific manner in which each module in the video quality enhancement device in the above-mentioned embodiments performs operations has been described in detail in the embodiments of the video quality enhancement method, and will not be repeated here.
[0119] In summary, the video quality enhancement device provided by the embodiment of the present disclosure obtains a first video frame to be enhanced, and converts the first video frame from the RGB color space to the YCbCr color space to obtain a second video frame, wherein R is red, G is green, B is blue, Y is a brightness component, Cb is a blue chroma component, and Cr is a red chroma component, and the blue chroma component and the red chroma component are maintained unchanged, and the brightness enhancement coefficients of different brightness components of the second video frame in the YCbCr color space are obtained, and the second video frame is globally enhanced according to the brightness enhancement coefficient, and a first enhanced video frame is obtained, and the first enhanced video frame is locally enhanced. Contrast enhancement is performed, and a second enhanced video frame is obtained, and an enhanced YCbCr color space of the second enhanced video frame is obtained, and the second enhanced video frame is converted from the enhanced YCbCr color space to R GB color space, and obtain the enhanced third video frame. Therefore, the present invention can adaptively determine the corresponding brightness enhancement coefficient according to the different brightness components of the video frame in the YCbCr color space, perform global brightness enhancement on the video frame through different enhancement coefficients, and perform local contrast enhancement on the video frame after the global brightness enhancement, thereby avoiding the problems of local detail distortion and over-enhancement in the video frame and improving the enhancement effect of the video frame image quality.
[0120] Figure 7 is a block diagram of an electronic device 700 according to an exemplary embodiment.
[0121] like Figure 7 As shown, the electronic device 700 includes:
[0122] The memory 701 and the processor 702, a bus 703 connecting different components (including the memory 701 and the processor 702), the memory 701 stores a computer program, and when the processor 702 executes the program, the video quality enhancement method of the embodiment of the present disclosure is implemented.
[0123] Bus 703 represents one or more of several types of bus structures, including a memory bus or memory controller, a peripheral bus, an accelerated graphics port, a processor or a local bus using any of a variety of bus structures. For example, these architectures include but are not limited to Industry Standard Architecture (ISA) bus, Micro Channel Architecture (MAC) bus, Enhanced ISA bus, Video Electronics Standards Association (VESA) local bus and Peripheral Component Interconnect (PCI) bus.
[0124] The electronic device 700 typically includes a variety of electronic device readable media. These media can be any available media that can be accessed by the electronic device 700, including volatile and non-volatile media, removable and non-removable media.
[0125] The memory 701 may also include computer system readable media in the form of volatile memory, such as random access memory (RAM) 704 and / or cache memory 705. The electronic device 700 may further include other removable / non-removable, volatile / non-volatile computer system storage media. By way of example only, the storage system 706 may be used to read and write non-removable, non-volatile magnetic media ( Figure 7 not shown, usually called a "hard drive"). Although Figure 7 Not shown in the figure, a disk drive for reading and writing to a removable non-volatile disk (e.g., a "floppy disk"), and an optical disk drive for reading and writing to a removable non-volatile optical disk (e.g., a CD-ROM, a DVD-ROM, or other optical media) may be provided. In these cases, each drive may be connected to the bus 703 via one or more data medium interfaces. The memory 701 may include at least one program product having a set (e.g., at least one) of program modules that are configured to perform the functions of the various embodiments of the present disclosure.
[0126] A program / utility 708 having a set (at least one) of program modules 707 may be stored, for example, in the memory 701, such program modules 707 including but not limited to an operating system, one or more application programs, other program modules, and program data, each of which or some combination may include an implementation of a network environment. The program modules 707 generally perform the functions and / or methods of the embodiments described in the present disclosure.
[0127] The electronic device 700 may also communicate with one or more external devices 709 (e.g., keyboard, pointing device, display 711, etc.), one or more devices that enable a user to interact with the electronic device 800, and / or any device that enables the electronic device 700 to communicate with one or more other computing devices (e.g., network card, modem, etc.). Such communication may be performed through an input / output (I / O) interface 712. Furthermore, the electronic device 700 may also communicate with one or more networks (e.g., a local area network (LAN), a wide area network (WAN), and / or a public network, such as the Internet) through a network adapter 713. Figure 7 As shown, the network adapter 713 communicates with other modules of the electronic device 700 via the bus 703. It should be understood that, although not shown in the figure, other hardware and / or software modules can be used in conjunction with the electronic device 700, including but not limited to: microcode, device drivers, redundant processing units, external disk drive arrays, RAID systems, tape drives, and data backup storage systems.
[0128] The processor 702 executes various functional applications and data processing by running the programs stored in the memory 701 .
[0129] It should be noted that the implementation process and technical principles of the electronic device of this embodiment refer to the aforementioned explanation of the video quality enhancement method of the embodiment of the present disclosure, and will not be repeated here.
[0130] The electronic device provided by the embodiment of the present disclosure obtains a first video frame to be enhanced, and converts the first video frame from the RGB color space to the YCbCr color space to obtain a second video frame, wherein R is red, G is green, B is blue, Y is a brightness component, Cb is a blue chroma component, and Cr is a red chroma component, and the blue chroma component and the red chroma component are maintained unchanged, and the brightness enhancement coefficients of different brightness components of the second video frame in the YCbCr color space are obtained, and the second video frame is globally enhanced according to the brightness enhancement coefficient, and a first enhanced video frame is obtained, and the first enhanced video frame is locally compared. The method comprises the following steps: performing degree enhancement, obtaining a second enhanced video frame, obtaining an enhanced YCbCr color space of the second enhanced video frame, converting the second enhanced video frame from the enhanced YCbCr color space to the RGB color space, and obtaining an enhanced third video frame. Thus, the present invention can adaptively determine the corresponding brightness enhancement coefficient according to different brightness components of the video frame in the YCbCr color space, perform global brightness enhancement on the video frame through different enhancement coefficients, and perform local contrast enhancement on the video frame after the global brightness enhancement, thereby avoiding the problems of local detail distortion and over-enhancement in the video frame and improving the enhancement effect of the video frame image quality.
[0131] In order to implement the above embodiments, the present disclosure also proposes a computer-readable storage medium.
[0132] When the instructions in the computer-readable storage medium are executed by the processor of the electronic device, the electronic device can perform the above-mentioned video quality enhancement method. Optionally, the computer-readable storage medium can be a ROM, a random access memory (RAM), a CD-ROM, a magnetic tape, a floppy disk, an optical data storage device, etc.
[0133] Those skilled in the art will readily appreciate other embodiments of the present disclosure after considering the specification and practicing the invention disclosed herein. The present disclosure is intended to cover any variations, uses or adaptations of the present disclosure that follow the general principles of the present disclosure and include common knowledge or customary techniques in the art that are not disclosed in the present disclosure. The description and examples are to be considered exemplary only, and the true scope and spirit of the present disclosure are indicated by the following claims.
[0134] It should be understood that the present disclosure is not limited to the exact structures that have been described above and shown in the drawings, and that various modifications and changes may be made without departing from the scope thereof. The scope of the present disclosure is limited only by the appended claims.
Claims
1. A method for enhancing video quality, characterized in that: The method comprises: Obtain a first video frame to be enhanced, and convert the first video frame from an RGB color space to a YCbCr color space to obtain a second video frame, where R is red, G is green, B is blue, Y is a brightness component, Cb is a blue chroma component, and Cr is a red chroma component; Maintaining the blue chromaticity component and the red chromaticity component unchanged, obtaining brightness enhancement coefficients of different brightness components of the second video frame in the YCbCr color space, performing global brightness enhancement on the second video frame according to the brightness enhancement coefficient to obtain a first enhanced video frame, and performing local contrast enhancement on the first enhanced video frame to obtain a second enhanced video frame; An enhanced YCbCr color space of the second enhanced video frame is obtained, and the second enhanced video frame is converted from the enhanced YCbCr color space to the RGB color space to obtain an enhanced third video frame.
2. The method according to claim 1, characterized in that The obtaining of brightness enhancement coefficients of different brightness components of the second video frame in the YCbCr color space includes: Get the brightness mapping function; The brightness enhancement coefficient is obtained according to the brightness mapping function and different brightness components of the second video frame in the YCbCr color space.
3. The method according to claim 2, characterized in that The step of obtaining a brightness mapping function comprises: Obtain sample brightness component and sample brightness enhancement coefficient; Constructing an initial polynomial of the brightness mapping function; The initial polynomial is fitted according to the sample brightness enhancement coefficient and the sample brightness component to obtain a brightness mapping function.
4. The method according to claim 3, characterized in that The step of fitting the initial polynomial according to the sample brightness enhancement coefficient and the sample brightness component to obtain a brightness mapping function includes: Associating the sample brightness component with the sample brightness enhancement coefficient to obtain a sample data group consisting of the sample brightness component and the sample brightness enhancement coefficient; According to the sample data set, the initial polynomial is fitted by the least square method to obtain the brightness mapping function.
5. The method according to claim 3, characterized in that: The obtaining of the sample brightness component comprises: Acquire a set of sample video frames at different brightnesses, and convert each sample video frame in the set of sample video frames from the RGB color space to the YCbCr color space; The brightness component of each sample video frame in the YCbCr color space is used as the sample brightness component.
6. The method according to claim 5, characterized in that The step of obtaining the sample brightness enhancement coefficient comprises: Obtaining a candidate sample brightness enhancement coefficient for each sample video frame; Performing global brightness enhancement on each sample video frame according to the candidate sample brightness enhancement coefficient to obtain a sample enhanced video frame; The sample brightness enhancement coefficient is determined from the candidate sample brightness enhancement coefficients according to the brightness value of the sample enhanced video frame.
7. The method according to claim 6, characterized in that The step of determining the sample brightness enhancement coefficient from the candidate sample brightness enhancement coefficients according to the brightness value of the sample enhanced video frame comprises: Obtain a first brightness threshold and a second brightness threshold of a sample video frame; The candidate sample brightness enhancement coefficient that is greater than or equal to the first brightness threshold and less than the second brightness threshold is used as the sample brightness enhancement coefficient.
8. The method according to claim 1, characterized in that The locally enhancing the contrast of the first enhanced video frame to obtain a second enhanced video frame includes: Acquire a contrast enhancement coefficient, a pixel mean value of a pixel block in a target area, and pixels of the first enhanced video frame; According to the contrast enhancement coefficient, the pixel mean value of the pixel block in the target area and the pixels of the first enhanced video frame, local contrast enhancement is performed on the first enhanced video frame to obtain a second enhanced video frame.
9. The method according to claim 8, characterized in that The step of obtaining the pixel mean value of the pixel block in the target area includes: Dividing the first enhanced video frame into regions to obtain a plurality of sub-region pixel blocks of the first enhanced video frame; Acquire a brightness value of a pixel block in each sub-region and a brightness threshold of the first enhanced video frame; Determine a target area pixel block from the plurality of sub-area pixel blocks according to the brightness value and the brightness threshold; Based on the target area pixel block, a pixel mean value of the target area pixel block is obtained.
10. The method according to claim 1, characterized in that The obtaining of the enhanced YCbCr color space of the second enhanced video frame includes: Acquire a target brightness component of the second enhanced video frame; The target brightness component, the blue component, and the red component are combined to obtain an enhanced YCbCr color space of the second enhanced video frame.
11. A video quality enhancement device, characterized in that: The device comprises: A first acquisition module is used to acquire a first video frame to be enhanced, and convert the first video frame from an RGB color space to a YCbCr color space to obtain a second video frame, wherein R is red, G is green, B is blue, Y is a brightness component, Cb is a blue chroma component, and Cr is a red chroma component; an enhancement module, configured to maintain the blue chromaticity component and the red chromaticity component unchanged, obtain brightness enhancement coefficients of different brightness components of the second video frame in the YCbCr color space, perform global brightness enhancement on the second video frame according to the brightness enhancement coefficient, obtain a first enhanced video frame, and perform local contrast enhancement on the first enhanced video frame, obtain a second enhanced video frame; The second acquisition module is used to acquire an enhanced YCbCr color space of the second enhanced video frame, and convert the second enhanced video frame from the enhanced YCbCr color space to the RGB color space to obtain an enhanced third video frame.
12. The device according to claim 11, characterized in that The enhancement module is used to: Get the brightness mapping function; The brightness enhancement coefficient is obtained according to the brightness mapping function and different brightness components of the second video frame in the YCbCr color space.
13. The device according to claim 12, characterized in that The enhancement module is further used for: Obtain sample brightness component and sample brightness enhancement coefficient; Constructing an initial polynomial of the brightness mapping function; The initial polynomial is fitted according to the sample brightness enhancement coefficient and the sample brightness component to obtain a brightness mapping function.
14. The device according to claim 13, characterized in that The enhancement module is used to: Associating the sample brightness component with the sample brightness enhancement coefficient to obtain a sample data group consisting of the sample brightness component and the sample brightness enhancement coefficient; According to the sample data set, the initial polynomial is fitted by the least square method to obtain the brightness mapping function.
15. The device according to claim 13, characterized in that The enhancement module is further used for: Acquire a set of sample video frames at different brightnesses, and convert each sample video frame in the set of sample video frames from the RGB color space to the YCbCr color space; The brightness component of each sample video frame in the YCbCr color space is used as the sample brightness component.
16. The device according to claim 15, characterized in that The enhancement module is used to: Obtaining a candidate sample brightness enhancement coefficient for each sample video frame; Performing global brightness enhancement on each sample video frame according to the candidate sample brightness enhancement coefficient to obtain a sample enhanced video frame; The sample brightness enhancement coefficient is determined from the candidate sample brightness enhancement coefficients according to the brightness value of the sample enhanced video frame.
17. The device according to claim 16, characterized in that The enhancement module is further used for: Obtain a first brightness threshold and a second brightness threshold of a sample video frame; The candidate sample brightness enhancement coefficient that is greater than or equal to the first brightness threshold and less than the second brightness threshold is used as the sample brightness enhancement coefficient.
18. The device according to claim 11, characterized in that The enhancement module is used to: Acquire a contrast enhancement coefficient, a pixel mean value of a pixel block in a target area, and pixels of the first enhanced video frame; According to the contrast enhancement coefficient, the pixel mean value of the pixel block in the target area and the pixels of the first enhanced video frame, local contrast enhancement is performed on the first enhanced video frame to obtain a second enhanced video frame.
19. The device according to claim 18, characterized in that The enhancement module is used to: Dividing the first enhanced video frame into regions to obtain a plurality of sub-region pixel blocks of the first enhanced video frame; Acquire a brightness value of a pixel block in each sub-region and a brightness threshold of the first enhanced video frame; Determine a target area pixel block from the plurality of sub-area pixel blocks according to the brightness value and the brightness threshold; Based on the target area pixel block, a pixel mean value of the target area pixel block is obtained.
20. The device according to claim 11, characterized in that The second acquisition module is further used for: Acquire a target brightness component of the second enhanced video frame; The target brightness component, the blue component, and the red component are combined to obtain an enhanced YCbCr color space of the second enhanced video frame.
21. An electronic device, characterized in that: include: processor; a memory for storing executable instructions for the processor; The processor is configured to execute the instructions to implement the video quality enhancement method as described in any one of claims 1-10.
22. A computer-readable storage medium, characterized in that: When the instructions in the computer-readable storage medium are executed by a processor of an electronic device, the electronic device is enabled to execute the video quality enhancement method as described in any one of claims 1 to 10.
