Method and electronic device for enhancing video quality
By analyzing the resolution, dynamic range and high-frequency information of the video to be played, the image quality enhancement processing is carried out in a targeted manner, and the problem of poor video quality in the existing technology is solved, and the video quality is significantly improved and the user experience is improved.
Patent Information
- Application Number
- CN202410186845.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-11-22
- Publication Date
- 2025-05-23
- Estimated Expiration
- 2042-11-22
AI Technical Summary
The prior art is difficult to effectively improve the quality of videos in video playback devices, resulting in poor viewing experience for users.
By analyzing the resolution, dynamic range and high-frequency information of the video to be played, the image quality enhancement processing is carried out in a targeted manner, including the enhancement processing of the brightness channel data and the enhancement processing of the detailed information.
It significantly improves the video quality of the video to be played and improves the user's viewing experience.
Smart Images

Figure CN118803356B_ABST
Abstract
Description
[0001] This application is a divisional application of the Chinese patent application submitted to the State Intellectual Property Office on November 22, 2022, with application number 202211468041.4 and application name "Method and electronic device for enhancing video quality". Technical Field
[0002] The present application relates to the field of image processing, and in particular, to a method and electronic device for enhancing video quality. Background Art
[0003] With the popularization of electronic devices and wireless networks, video applications are being used more and more widely. Users can usually capture videos through electronic devices and upload them to video applications for video sharing. Currently, due to factors such as the poor processing power of the electronic devices that capture videos, or the poor shooting skills of the users who capture videos, or the poor network transmission environment of the videos, the video quality in the electronic devices that play the videos is poor, resulting in a poor experience for users when watching videos.
[0004] Therefore, how to enhance the video quality of the played video and improve the video quality has become an urgent problem to be solved. Summary of the invention
[0005] The present application provides a method and electronic device for enhancing video quality, which can intelligently analyze the reasons why the video quality of a video to be played is poor; thereby targetedly performing image quality enhancement processing on the video to be played, thereby improving the video quality of the video to be played.
[0006] In a first aspect, a method for enhancing video quality is provided, which is applied to an electronic device, comprising:
[0007] Get the video to be played;
[0008] Displaying a first display interface, wherein the first display interface includes the video to be played;
[0009] Detecting a play operation on the video to be played;
[0010] In response to the playing operation, determining whether a first parameter of the to-be-played video is less than a first preset threshold, the first parameter including resolution;
[0011] If the first parameter is less than a first preset threshold, determine whether a second parameter of the video to be played meets a first preset condition; the second parameter includes a value of a dynamic range and a value of high-frequency information, the first preset condition includes that the value of the dynamic range of the video to be played is less than a second preset threshold, and / or the value of the high-frequency information of the video to be played is less than a third preset threshold, the value of the high-frequency information is a cumulative value of high-frequency information in a frequency domain image of the video to be played, and the high-frequency information includes edge information and detail information of an image in the video to be played;
[0012] Performing enhancement processing on the to-be-played video based on the first parameter and / or the second parameter to generate an enhanced video;
[0013] Display or save the enhanced video.
[0014] Based on the scheme of the present application, by acquiring a video to be played; displaying a first display interface, the first display interface includes the video to be played and a first control, the first control is used to indicate that the video to be played is enhanced; detecting a play operation on the first control; first determining whether a first parameter of the video to be played is less than a first preset threshold, the first parameter includes a resolution; if the first parameter is less than the first preset threshold, then determining whether a second parameter of the video to be played meets a first preset condition; enhancing the video to be played based on the first parameter and / or the second parameter to generate an enhanced video; displaying or saving the enhanced video; it can be understood that, in an embodiment of the present application, before performing image quality enhancement processing on the video to be played, the video to be played can be analyzed first; factors affecting the video quality of the video to be played are determined; when the factors affecting the video quality of the video to be played are determined, the image quality enhancement processing is then performed on the video to be played in a targeted manner, thereby improving the video quality of the video to be played; compared with the existing method of directly enhancing a certain aspect of the video to be played, the scheme in the embodiment of the present application can intelligently analyze the reason for the poor video quality of the video to be played; thereby, the image quality enhancement processing is performed on the video to be played in a targeted manner to improve the video quality of the video to be played.
[0015] In a possible implementation, performing enhancement processing on the to-be-played video based on the first parameter and / or the second parameter to generate the enhanced video includes:
[0016] If the first parameter is less than a first preset threshold, performing the enhancement processing on the brightness channel data of the to-be-played video based on the first parameter to generate the enhanced video;
[0017] If the first parameter is less than a first preset threshold and the second parameter of the video to be played meets a first preset condition, the brightness channel data of the video to be played is enhanced based on the first parameter and the second parameter to generate the enhanced video.
[0018] In combination with the first aspect, in some implementations of the first aspect, the step of performing enhancement processing on the to-be-played video based on the first parameter and / or the second parameter to generate the enhanced video includes:
[0019] The enhancement processing is performed on the brightness channel data of the video to be played based on the first parameter and / or the second parameter to generate the enhanced video.
[0020] In the scheme of the present application, when enhancing the video to be played, only the Y channel data of the video to be played can be enhanced; on the one hand, since the method for enhancing video quality provided in the embodiment of the present application can be applied to real-time processing, only the Y channel data of the video to be played is enhanced, which can improve the processing efficiency of the electronic device in performing enhanced video quality; on the other hand, since the user's eyes are usually more sensitive to brightness, only the Y channel data of the video to be played is enhanced, which can significantly improve the user's viewing experience of the video.
[0021] In combination with the first aspect, in some implementations of the first aspect, if the first parameter is less than a first preset threshold, determining whether the second parameter of the to-be-played video satisfies a first preset condition further includes:
[0022] If the value of the resolution is greater than or equal to the first preset threshold, obtaining a classification label of the video to be played;
[0023] Determine whether the classification label belongs to a preset label, wherein the preset label includes a first label and a second label;
[0024] If the classification label belongs to the first label, determine whether the value of the dynamic range of the video to be played is less than the second preset threshold and whether it satisfies a second preset condition, wherein the second preset condition of the value of the dynamic range is used to indicate that the value is greater than the second preset threshold based on the proportion of the number of pixels in the first grayscale interval in the histogram of the video to be played;
[0025] The step of performing enhancement processing on the to-be-played video based on the first parameter and / or the second parameter to generate an enhanced video includes:
[0026] If the value of the dynamic range is less than the second preset threshold and satisfies the second preset condition, the dynamic range is determined to be the second parameter, and the video to be played is enhanced based on the value of the dynamic range to generate the enhanced video.
[0027] It should be understood that the first label may refer to a label of a shooting scene with bright light areas and dark light areas; for example, the first label may include: a label of an indoor light source shooting scene, a label of a night scene shooting scene, a label of a sky shooting scene, or a label of a glass wall (for example, a glass wall with higher saturation).
[0028] In the scheme of the present application, the first label refers to the label of the shooting scene that requires dynamic range enhancement; if the video to be played belongs to the first label, it can be further determined whether the video to be played requires dynamic range enhancement processing; thereby improving the dynamic range in the video to be played.
[0029] In an embodiment of the present application, it can be determined whether the value of the resolution of the video to be played is less than a first preset threshold value; if the resolution of the video to be played is greater than or equal to the first preset threshold value, it can be indicated that the resolution is not a factor affecting the video quality of the video to be played; further, it can be determined whether the video to be played belongs to a preset scene (for example, a first label); if the label of the video to be played is the first label, it can be determined whether the dynamic range is a factor affecting the video quality of the video to be played; for example, if the classification label belongs to the first label, it is determined whether the value of the dynamic range satisfies the second preset condition; it can be understood that it is determined whether the proportion of the number of pixels in the first grayscale interval in the video to be played is greater than the second preset threshold value (for example, 0.6); if the proportion of the number of pixels in the first grayscale interval (for example, the middle grayscale area; for example, the interval with a grayscale value of [[100,155]]) in the video to be played is greater than the second preset threshold value, it means that the proportion of the middle grayscale pixels in the video to be played is large; at this time, there is a problem of overall graying and insufficient transparency in the video to be played; the dynamic range can be determined as a factor affecting the video quality of the video to be played.
[0030] In combination with the first aspect, in some implementations of the first aspect, determining whether the value of the dynamic range of the video to be played is less than the second preset threshold includes:
[0031] Determine whether the proportion of the number of pixels in the first grayscale interval in the histogram of the video to be played is greater than a fourth preset threshold.
[0032] In combination with the first aspect, in some implementations of the first aspect, the enhancing the video to be played based on the value of the dynamic range to generate the enhanced video includes:
[0033] Obtaining a percentage value of the number of pixels in the first grayscale interval;
[0034] Obtaining a first value and a second value based on a ratio of the number of pixels in the first grayscale interval;
[0035] Based on the first value, the second value and the preset coordinate data, a mapping relationship is obtained, where the mapping relationship is used to indicate a correlation relationship between an input grayscale value and an output grayscale value;
[0036] The enhancement processing is performed on the video to be played based on the mapping relationship to generate the enhanced video.
[0037] In a possible implementation, the mapping relationship may also be a broken line, or a table, or a function, etc.; this application does not impose any limitation on this.
[0038] In combination with the first aspect, in some implementations of the first aspect, performing the enhancement processing on the to-be-played video based on the mapping relationship to generate the enhanced video includes:
[0039] The enhancement processing is performed on the brightness channel of the video to be played based on the mapping relationship to generate the enhanced video.
[0040] In combination with the first aspect, in some implementations of the first aspect, the mapping relationship is a mapping curve; if the proportion of the number of pixels in the first grayscale interval is proportional to the curvature of the mapping curve.
[0041] In conjunction with the first aspect, in some implementations of the first aspect, the method further includes:
[0042] If the classification label belongs to the second label, determining whether the percentage value of the high-frequency information of the video to be played is less than a third preset threshold;
[0043] The step of performing enhancement processing on the to-be-played video based on the first parameter and / or the second parameter to generate an enhanced video includes:
[0044] If the proportion of the high-frequency information is less than a third preset threshold, the video to be played is enhanced based on the value of the high-frequency information, and the enhanced video is generated to determine the high-frequency information as the second parameter.
[0045] It should be understood that the second label may refer to a label of a scene with rich texture information. For example, the second label may include: a landscape label, a building label, a pottery label, a handicraft label, a hand-woven product label, etc.
[0046] It should also be understood that the second tag refers to the tag of the shooting scene that needs detail enhancement; if the video to be played belongs to the second tag, it can be further determined whether the video to be played needs detail enhancement processing; thereby improving the detail information in the video to be played.
[0047] In the scheme of the present application, when the resolution of the video to be played is greater than or equal to the first preset threshold, it can be understood that the reason affecting the video quality is not a resolution problem; if the label of the video to be played is the second label; at this time, it can be determined whether the reason affecting the video quality is high-frequency information (for example, less high-frequency information leads to blurred details); if the proportion of high-frequency information of the video to be played is less than the third preset threshold, it can be determined that the factor affecting the video quality of the video to be played is high-frequency information.
[0048] In combination with the first aspect, in some implementations of the first aspect, the enhancing the video to be played based on the value of the high-frequency information to generate the enhanced video; and the enhancing the brightness channel data of the video to be played based on the second parameter to generate the enhanced video, including:
[0049] Generate a frequency graph of the video to be played by performing Fourier transform processing on the brightness channel data of the video to be played;
[0050] Determine, based on the frequency graph, a cumulative value of a high-frequency region in the frequency graph, where the cumulative value of the high-frequency region is a value obtained by traversing each pixel point in the high-frequency region;
[0051] Obtaining a Laplace sharpening coefficient based on the cumulative value of the high-frequency area, a preset slope value, and a preset intercept value;
[0052] Obtaining a first video based on the Laplace sharpening coefficient and the second-order gradient image of the video to be played;
[0053] The video to be played is fused with the first video to generate the enhanced video.
[0054] In combination with the first aspect, in some implementations of the first aspect, determining whether the first parameter of the to-be-played video is less than a first preset threshold includes:
[0055] Determine whether the first parameter of each frame of data in the to-be-played video is less than the first preset threshold.
[0056] In combination with the first aspect, in some implementations of the first aspect, determining whether the first parameter of the to-be-played video is less than a first preset threshold includes:
[0057] Determine whether the first parameter of the preset frame data in the video to be played is less than the first preset threshold.
[0058] In combination with the first aspect, in some implementations of the first aspect, determining whether the second parameter of the video to be played meets the first preset condition includes:
[0059] Determine whether the second parameter of each frame of data in the to-be-played video satisfies the first preset condition.
[0060] In combination with the first aspect, in some implementations of the first aspect, determining whether the second parameter of the video to be played meets the first preset condition includes:
[0061] Determine whether the second parameter of the preset frame data in the video to be played meets the first preset condition.
[0062] In combination with the first aspect, in some implementations of the first aspect, the detecting a play operation on the to-be-played video includes:
[0063] Displaying a second display interface, wherein the second display interface includes a first prompt box, wherein the first prompt box is used to prompt whether to perform the enhancement processing on the video to be played, and the first prompt box includes a first control, wherein the first control is used to indicate whether to perform the enhancement processing on the video to be played;
[0064] In response to the playing operation, determining whether a first parameter of the to-be-played video is less than a first preset threshold value includes:
[0065] detecting a first operation on the first control;
[0066] In response to the first operation, it is determined whether the first parameter of the video to be played is less than the first preset threshold.
[0067] In combination with the first aspect, in some implementations of the first aspect, when saving the enhanced video, the method further includes:
[0068] A second prompt box is displayed, and the second prompt box is used to prompt the storage method of the enhanced video; wherein the storage method includes: a first storage method and a second storage method, the first storage method means that the enhanced video replaces the video to be played, and the second storage method means that the enhanced video is stored in a first storage area, and the first storage area is different from the storage area storing the video to be played.
[0069] In combination with the first aspect, in some implementations of the first aspect, obtaining the video to be played includes:
[0070] Acquire the video to be played in the electronic device; or,
[0071] The video to be played sent by a first electronic device is received, where the first electronic device is a capture device for the video to be played.
[0072] In one possible implementation, the first electronic device can capture the video to be played, and the first electronic device can send the video to be played to the electronic device; for example, the first electronic device can be a device for capturing the video to be played; the electronic device can be a device for receiving the video to be played; the first electronic device can send the video to be played to the electronic device through a third-party chat software.
[0073] In a possible implementation, the electronic device may locally obtain the video to be played.
[0074] In a possible implementation, the electronic device may obtain the video to be played from the server.
[0075] In a second aspect, an electronic device is provided, comprising a module / unit for executing the first aspect or any one of the methods for enhancing video quality in the first aspect.
[0076] In a third aspect, an electronic device is provided, the electronic device comprising one or more processors and a memory; the memory is coupled to the one or more processors, the memory is used to store a computer program code, the computer program code comprises a computer instruction, and the one or more processors call the computer instruction to cause the electronic device to execute:
[0077] Get the video to be played;
[0078] Displaying a first display interface, wherein the first display interface includes the video to be played;
[0079] Detecting a play operation on the video to be played;
[0080] In response to the playing operation, determining whether a first parameter of the to-be-played video is less than a first preset threshold, the first parameter including resolution;
[0081] If the first parameter is less than a first preset threshold, determine whether a second parameter of the video to be played meets a first preset condition; the second parameter includes a value of a dynamic range and a value of high-frequency information, the first preset condition includes that the value of the dynamic range of the video to be played is less than a second preset threshold, and / or the value of the high-frequency information of the video to be played is less than a third preset threshold, the value of the high-frequency information is a cumulative value of high-frequency information in a frequency domain image of the video to be played, and the high-frequency information includes edge information and detail information of an image in the video to be played;
[0082] Performing enhancement processing on the to-be-played video based on the first parameter and / or the second parameter to generate an enhanced video;
[0083] Display or save the enhanced video.
[0084] In combination with the third aspect, in some implementations of the third aspect, the one or more processors call the computer instructions to cause the electronic device to execute:
[0085] The enhancement processing is performed on the brightness channel data of the video to be played based on the first parameter and / or the second parameter to generate the enhanced video.
[0086] In combination with the third aspect, in some implementations of the third aspect, the one or more processors call the computer instructions to cause the electronic device to execute:
[0087] Obtaining the classification label of the video to be played;
[0088] Determine whether the classification label belongs to a preset label, wherein the preset label includes a first label and a second label;
[0089] If the classification label belongs to the first label, determining whether the value of the dynamic range of the video to be played is less than the second preset threshold, the value of the dynamic range being obtained based on the proportion of the number of pixels in the first grayscale interval in the histogram of the video to be played;
[0090] The step of performing enhancement processing on the to-be-played video based on the first parameter and / or the second parameter to generate an enhanced video includes:
[0091] If the value of the dynamic range is less than the second preset threshold, the video to be played is enhanced based on the value of the dynamic range to generate the enhanced video.
[0092] In combination with the third aspect, in some implementations of the third aspect, the one or more processors call the computer instructions to cause the electronic device to execute:
[0093] Determine whether the proportion of the number of pixels in the first grayscale interval in the histogram of the video to be played is greater than a fourth preset threshold.
[0094] In combination with the third aspect, in some implementations of the third aspect, the one or more processors call the computer instructions to cause the electronic device to execute:
[0095] Obtaining a percentage value of the number of pixels in the first grayscale interval;
[0096] Obtaining a first value and a second value based on a ratio of the number of pixels in the first grayscale interval;
[0097] Based on the first value, the second value and the preset coordinate data, a mapping relationship is obtained, where the mapping relationship is used to indicate a correlation relationship between an input grayscale value and an output grayscale value;
[0098] The enhancement processing is performed on the video to be played based on the mapping relationship to generate the enhanced video.
[0099] In combination with the third aspect, in some implementations of the third aspect, the one or more processors call the computer instructions to cause the electronic device to execute:
[0100] The enhancement processing is performed on the brightness channel of the video to be played based on the mapping relationship to generate the enhanced video.
[0101] In combination with the third aspect, in some implementations of the third aspect, the mapping relationship is a mapping curve, and the proportion of the number of pixels in the first grayscale interval is proportional to the curvature of the mapping curve.
[0102] In combination with the third aspect, in some implementations of the third aspect, the one or more processors call the computer instructions to cause the electronic device to execute:
[0103] If the classification label belongs to the second label, determining whether the value of the high-frequency information of the video to be played is less than a third preset threshold;
[0104] The step of performing enhancement processing on the to-be-played video based on the first parameter and / or the second parameter to generate an enhanced video includes:
[0105] If the proportion of the high-frequency information is less than a third preset threshold, the to-be-played video is enhanced based on the value of the high-frequency information to generate the enhanced video.
[0106] In combination with the third aspect, in some implementations of the third aspect, the one or more processors call the computer instructions to cause the electronic device to execute:
[0107] Generate a frequency graph of the video to be played by performing Fourier transform processing on the brightness channel data of the video to be played;
[0108] Determine, based on the frequency graph, a cumulative value of a high-frequency region in the frequency graph, where the cumulative value of the high-frequency region is a value obtained by traversing each pixel point in the high-frequency region;
[0109] Obtaining a Laplace sharpening coefficient based on the cumulative value of the high-frequency area, a preset slope value, and a preset intercept value;
[0110] Obtaining a first video based on the Laplace sharpening coefficient and the second-order gradient image of the video to be played;
[0111] The video to be played is fused with the first video to generate the enhanced video.
[0112] In combination with the third aspect, in some implementations of the third aspect, the one or more processors call the computer instructions to cause the electronic device to execute:
[0113] Determine whether the first parameter of each frame of data in the to-be-played video is less than the first preset threshold.
[0114] In combination with the third aspect, in some implementations of the third aspect, the one or more processors call the computer instructions to cause the electronic device to execute:
[0115] Determine whether the first parameter of the preset frame data in the video to be played is less than the first preset threshold.
[0116] In combination with the third aspect, in some implementations of the third aspect, the one or more processors call the computer instructions to cause the electronic device to execute:
[0117] Determine whether the second parameter of each frame of data in the to-be-played video satisfies the first preset condition.
[0118] In combination with the third aspect, in some implementations of the third aspect, the one or more processors call the computer instructions to cause the electronic device to execute:
[0119] Determine whether the second parameter of the preset frame data in the video to be played meets the first preset condition.
[0120] In combination with the third aspect, in some implementations of the third aspect, the one or more processors call the computer instructions to cause the electronic device to execute:
[0121] Displaying a second display interface, wherein the second display interface includes a first prompt box, wherein the first prompt box is used to prompt whether to perform the enhancement processing on the video to be played, and the first prompt box includes a first control, wherein the first control is used to indicate whether to perform the enhancement processing on the video to be played;
[0122] In response to the playing operation, determining whether a first parameter of the to-be-played video is less than a first preset threshold value includes:
[0123] detecting a first operation on the first control;
[0124] In response to the first operation, it is determined whether the first parameter of the video to be played is less than the first preset threshold.
[0125] In combination with the third aspect, in some implementations of the third aspect, when saving the enhanced video, the one or more processors call the computer instructions to cause the electronic device to execute:
[0126] Displaying a second prompt box, where the second prompt box is used to prompt the storage method of the enhanced video;
[0127] Among them, the storage method includes: a first storage method and a second storage method, the first storage method is a storage method for replacing the video to be played with the enhanced video, and the second storage method is a storage method for storing the enhanced video in a first storage area, and the first storage area is different from the storage area for storing the video to be played.
[0128] In combination with the third aspect, in some implementations of the third aspect, the one or more processors call the computer instructions to cause the electronic device to execute:
[0129] Acquire the video to be played in the electronic device; or,
[0130] The video to be played sent by a first electronic device is received, where the first electronic device is a capture device for the video to be played.
[0131] In a fourth aspect, an electronic device is provided, comprising one or more processors and a memory; the memory is coupled to the one or more processors, the memory is used to store computer program code, the computer program code comprises computer instructions, and the one or more processors call the computer instructions to enable the electronic device to execute the first aspect or any one of the methods in the first aspect.
[0132] In a fifth aspect, a chip system is provided, which is applied to an electronic device, and the chip system includes one or more processors, and the processor is used to call computer instructions so that the electronic device executes the first aspect or any one of the methods in the first aspect.
[0133] In a sixth aspect, a computer-readable storage medium is provided, wherein the computer-readable storage medium stores a computer program code. When the computer program code is executed by an electronic device, the electronic device executes the first aspect or any one of the methods in the first aspect.
[0134] In a seventh aspect, a computer program product is provided, the computer program product comprising: a computer program code, when the computer program code is executed by an electronic device, the electronic device executes the first aspect or any one of the methods in the first aspect.
[0135] Based on the scheme of the present application, by acquiring a video to be played; displaying a first display interface, the first display interface includes the video to be played and a first control, the first control is used to indicate that enhanced processing is to be performed on the video to be played; detecting a first play operation on the first control; first determining whether a first parameter of the video to be played is less than a first preset threshold, the first parameter including a resolution; determining a second parameter of the first parameter of the video to be played that satisfies a first preset condition, the first parameter including at least two of resolution, dynamic range and high-frequency information; if the first parameter is less than the first preset threshold, then determining whether the second parameter of the video to be played satisfies the first preset condition; enhancing the video to be played based on the first parameter and / or the second parameter, and generating an enhanced video. Video; display or save the enhanced video; it can be understood that, in the embodiments of the present application, before the image quality enhancement processing is performed on the video to be played, the video to be played can be analyzed first; the factors affecting the video quality of the video to be played are determined; when the factors affecting the video quality of the video to be played are determined, the image quality enhancement processing is then performed on the video to be played in a targeted manner, thereby improving the video quality of the video to be played; compared with the existing method of directly enhancing a certain aspect of the video to be played, the scheme in the embodiments of the present application can intelligently analyze the reasons for the poor video quality of the video to be played; thereby, the image quality enhancement processing is performed on the video to be played in a targeted manner, thereby improving the video quality of the video to be played. BRIEF DESCRIPTION OF THE DRAWINGS
[0136] Figure 1 is a schematic diagram of a hardware system of an electronic device applicable to the present application;
[0137] Figure 2 is a schematic diagram of a software system for an electronic device applicable to the present application;
[0138] Figure 3 is a schematic diagram of an application scenario applicable to an embodiment of the present application;
[0139] Figure 4 is a schematic flow chart of a method for enhancing video quality provided in an embodiment of the present application;
[0140] Figure 5 is a schematic flow chart of another method for enhancing video quality provided in an embodiment of the present application;
[0141] Figure 6is a schematic diagram of a contrast enhancement algorithm processing provided by an embodiment of the present application;
[0142] Figure 7 is a curve schematic diagram for mapping processing provided in an embodiment of the present application;
[0143] Figure 8 is a schematic diagram of an adaptive sharpness algorithm processing provided by an embodiment of the present application;
[0144] Fig. 9 is a schematic diagram of original data and a frequency domain diagram corresponding to the original data provided in an embodiment of the present application;
[0145] Fig.10 is a schematic diagram of generating a detail-enhanced image provided by an embodiment of the present application;
[0146] Fig.11 It is an interactive flow chart of another method for enhancing video quality provided by an embodiment of the present application;
[0147] Fig.12 is a schematic diagram of a graphical user interface provided in an embodiment of the present application;
[0148] Fig.13 is a schematic diagram of another graphical user interface provided in an embodiment of the present application;
[0149] Fig.14 is a schematic diagram of another graphical user interface provided in an embodiment of the present application;
[0150] Fig.15 is a schematic diagram of another graphical user interface provided in an embodiment of the present application;
[0151] Fig.16 is a schematic diagram of another graphical user interface provided in an embodiment of the present application;
[0152] Fig.17 is a schematic diagram of another graphical user interface provided in an embodiment of the present application;
[0153] Fig.18 is a schematic diagram of another graphical user interface provided in an embodiment of the present application;
[0154] Fig.19 is a schematic diagram of another graphical user interface provided in an embodiment of the present application;
[0155] Fig. 20 is a schematic diagram of another graphical user interface provided in an embodiment of the present application;
[0156] Fig.21 is a schematic diagram of another graphical user interface provided in an embodiment of the present application;
[0157] Fig. 22 is a schematic diagram of another graphical user interface provided in an embodiment of the present application;
[0158] Fig.23 It is a structural schematic diagram of an electronic device provided in an embodiment of the present application;
[0159] Fig.24 It is a structural schematic diagram of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0160] In the embodiments of the present application, the following terms "first", "second", etc. are used for descriptive purposes only and are not to be understood as indicating or implying relative importance or implicitly indicating the number of the indicated technical features. Thus, a feature defined as "first" or "second" may explicitly or implicitly include one or more of the features. In the description of the present embodiment, unless otherwise specified, "plurality" means two or more.
[0161] In order to facilitate the understanding of the embodiments of the present application, the relevant concepts involved in the embodiments of the present application are first briefly described.
[0162] 1. Dynamic Range
[0163] Dynamic range is used to describe the range of tonal details that a camera can capture in an image, usually from the lowest value to the highest overflow value. Simply put, dynamic range describes the ratio between the brightest and darkest tones recorded by a camera in a single frame.
[0164] 2. Histogram
[0165] Histograms can be used to describe the grayscale distribution of the entire image; the horizontal axis of the histogram can represent the grayscale value (0 to 255); the vertical axis of the histogram can represent the number of pixels with the same grayscale value in the image; the brightness, grayscale distribution and contrast of the image can be intuitively displayed through the histogram.
[0166] 3. Image super resolution (SR)
[0167] Super-resolution processing refers to the process of restoring a high-resolution (HR) image from a low-resolution (LR) image.
[0168] 4. Fourier Transform
[0169] Fourier transform refers to an algorithm for expressing a function that meets certain conditions as a linear combination of trigonometric functions (sine and / or cosine functions) or their integrals.
[0170] 5. Fast Fourier Transform (FFT)
[0171] Fast Fourier Transform refers to an efficient and fast computational method for computing the Discrete Fourier Transform using electronic devices.
[0172] 6. Discrete Cosine Transform (DCT)
[0173] Discrete cosine transform refers to an algorithm that approximates an image by summing a set of cosine functions of different frequencies and amplitudes. It is actually the real part of Fourier transform.
[0174] 7. Laplace sharpening algorithm
[0175] The Laplace sharpening algorithm refers to an algorithm that uses the Laplace operator to enhance the edge of an image.
[0176] Among them, the Laplace operator is an image neighborhood enhancement algorithm derived by second-order differential based on the grayscale calculation of pixels in the image neighborhood. The basic idea is: when the grayscale of the central pixel in the neighborhood is lower than the average grayscale of other pixels in its neighborhood, the grayscale of this central pixel should be further reduced. When the grayscale of the central pixel in the neighborhood is higher than the average grayscale of other pixels in its neighborhood, the grayscale of this central pixel should be further increased.
[0177] The method for enhancing video quality and the electronic device in the embodiments of the present application will be described below in conjunction with the accompanying drawings.
[0178] Figure 1 A hardware system of an electronic device suitable for the present application is shown.
[0179] The electronic device 100 can be a mobile phone, a smart screen, a tablet computer, a wearable electronic device, an in-vehicle electronic device, an augmented reality (AR) device, a virtual reality (VR) device, a laptop computer, an ultra-mobile personal computer (UMPC), a netbook, a personal digital assistant (PDA), a projector, etc. The embodiment of the present application does not impose any restrictions on the specific type of the electronic device 100.
[0180] The electronic device 100 may include a processor 110, an external memory interface 120, an internal memory 121, a universal serial bus (USB) interface 130, a charging management module 140, a power management module 141, a battery 142, an antenna 1, an antenna 2, a mobile communication module 150, a wireless communication module 160, an audio module 170, a speaker 170A, a receiver 170B, a microphone 170C, an earphone interface 170D, a sensor module 180, a button 190, a motor 191, an indicator 192, a camera 193, a display screen 194, and a subscriber identification module (SIM) card interface 195, etc. The sensor module 180 may include a pressure sensor 180A, a gyroscope sensor 180B, an air pressure sensor 180C, a magnetic sensor 180D, an acceleration sensor 180E, a distance sensor 180F, a proximity light sensor 180G, a fingerprint sensor 180H, a temperature sensor 180J, a touch sensor 180K, an ambient light sensor 180L, a bone conduction sensor 180M, etc.
[0181] It should be noted that Figure 1 The structure shown does not constitute a specific limitation on the electronic device 100. In other embodiments of the present application, the electronic device 100 may include Figure 1 More or fewer components than those shown, or the electronic device 100 may include Figure 1 Combinations of some of the components shown, or the electronic device 100 may include Figure 1 Subassemblies of some of the components shown. Figure 1 The components shown may be implemented in hardware, software, or a combination of software and hardware.
[0182] The processor 110 may include one or more processing units. For example, the processor 110 may include at least one of the following processing units: an application processor (AP), a modem processor, a graphics processing unit (GPU), an image signal processor (ISP), a controller, a video codec, a digital signal processor (DSP), a baseband processor, and a neural-network processing unit (NPU). Among them, different processing units may be independent devices or integrated devices. The controller may generate an operation control signal according to the instruction opcode and the timing signal to complete the control of fetching and executing instructions.
[0183] The processor 110 may also be provided with a memory for storing instructions and data. In some embodiments, the memory in the processor 110 is a cache memory. The memory may store instructions or data that the processor 110 has just used or cyclically used. If the processor 110 needs to use the instruction or data again, it may be directly called from the memory. This avoids repeated access, reduces the waiting time of the processor 110, and thus improves the efficiency of the system.
[0184] Exemplarily, the processor 110 can be used to execute the method for enhancing video quality of an embodiment of the present application; for example, obtaining a video to be played; displaying a first display interface, the first display interface including the video to be played; detecting a play operation on the video to be played; in response to the play operation, determining whether a first parameter of the video to be played is less than a first preset threshold, the first parameter including resolution; if the first parameter is less than the first preset threshold, determining whether a second parameter of the video to be played satisfies a first preset condition; the second parameter includes a value of a dynamic range and a value of high-frequency information, the first preset condition includes that the value of the dynamic range of the video to be played is less than the second preset threshold, and / or that the value of the high-frequency information of the video to be played is less than a third preset threshold, the value of the high-frequency information is the cumulative value of the high-frequency information in the frequency domain image of the video to be played, and the high-frequency information includes edge information and detail information of the image in the video to be played; enhancing the video to be played based on the first parameter and / or the second parameter to generate an enhanced video; displaying or saving the enhanced video.
[0185] Figure 1 The connection relationship between the modules shown is only a schematic illustration and does not constitute a limitation on the connection relationship between the modules of the electronic device 100. Optionally, the modules of the electronic device 100 may also adopt a combination of multiple connection modes in the above embodiments.
[0186] The wireless communication function of the electronic device 100 can be implemented through components such as the antenna 1, the antenna 2, the mobile communication module 150, the wireless communication module 160, the modem processor, and the baseband processor.
[0187] Antenna 1 and antenna 2 are used to transmit and receive electromagnetic wave signals. Each antenna in electronic device 100 can be used to cover a single or multiple communication frequency bands. Different antennas can also be reused to improve the utilization of antennas. For example, antenna 1 can be reused as a diversity antenna for a wireless local area network. In some other embodiments, the antenna can be used in combination with a tuning switch.
[0188] The electronic device 100 can realize the display function through the GPU, the display screen 194 and the application processor. The GPU is a microprocessor for image processing, which connects the display screen 194 and the application processor. The GPU is used to perform mathematical and geometric calculations for graphics rendering. The processor 110 may include one or more GPUs, which execute program instructions to generate or change display information.
[0189] Display screen 194 may be used to display images or videos.
[0190] Exemplarily, in an embodiment of the present application, the display screen 194 may be used to display the second image.
[0191] The electronic device 100 can realize the shooting function through the ISP, the camera 193, the video codec, the GPU, the display screen 194 and the application processor.
[0192] The ISP is used to process the data fed back by the camera 193. For example, when taking a photo, the shutter is opened, and light is transmitted to the camera photosensitive element through the camera. The light signal is converted into an electrical signal, and the camera photosensitive element transmits the electrical signal to the ISP for processing and converts it into an image visible to the naked eye. The ISP can perform algorithm optimization on the noise, brightness and color of the image. The ISP can also optimize the exposure and color temperature of the shooting scene and other parameters. In some embodiments, the ISP can be set in the camera 193.
[0193] The camera 193 (also referred to as a lens) is used to capture static images or videos. It can be triggered to start by application instructions to realize the photo function, such as taking pictures of any scene. The camera may include components such as an imaging lens, a filter, and an image sensor. The light emitted or reflected by the object enters the imaging lens, passes through the filter, and finally converges on the image sensor. The imaging lens is mainly used to focus the light emitted or reflected by all objects in the camera angle (also referred to as the scene to be photographed, the target scene, or the scene image that the user expects to shoot) to form an image; the filter is mainly used to filter out excess light waves in the light (for example, light waves other than visible light, such as infrared); the image sensor can be a charge coupled device (CCD) or a complementary metal oxide semiconductor (CMOS) phototransistor. The image sensor is mainly used to perform photoelectric conversion on the received light signal, convert it into an electrical signal, and then transmit the electrical signal to the ISP to convert it into a digital image signal. The ISP outputs the digital image signal to the DSP for processing. The DSP converts the digital image signal into an image signal in a standard RGB, YUV, etc. format.
[0194] In some embodiments, the electronic device 100 may include 1 or N cameras 193 , where N is a positive integer greater than 1.
[0195] Among them, the camera 193 can be located on the front of the electronic device 100 or on the back of the electronic device 100. The specific number and arrangement of the cameras can be set according to needs, and this application does not impose any restrictions.
[0196] The digital signal processor is used to process digital signals, and can process not only digital image signals but also other digital signals. For example, when the electronic device 100 is selecting a frequency point, the digital signal processor is used to perform Fourier transform on the frequency point energy.
[0197] Video codecs are used to compress or decompress digital videos. The electronic device 100 may support one or more video codecs. Thus, the electronic device 100 may play or record videos in a variety of coding formats, such as Moving Picture Experts Group (MPEG) 1, MPEG2, MPEG3, and MPEG4.
[0198] The gyro sensor 180B can be used to determine the motion posture of the electronic device 100. In some embodiments, the angular velocity of the electronic device 100 around three axes (i.e., the x-axis, the y-axis, and the z-axis) can be determined by the gyro sensor 180B. The gyro sensor 180B can be used for anti-shake shooting. For example, when the shutter is pressed, the gyro sensor 180B detects the angle of the electronic device 100 shaking, calculates the distance that the lens module needs to compensate based on the angle, and allows the lens to offset the shaking of the electronic device 100 through reverse movement to achieve anti-shake. The gyro sensor 180B can also be used in scenes such as navigation and somatosensory games.
[0199] The acceleration sensor 180E can detect the magnitude of the acceleration of the electronic device 100 in various directions (generally the x-axis, y-axis and z-axis). When the electronic device 100 is stationary, the magnitude and direction of gravity can be detected. The acceleration sensor 180E can also be used to identify the posture of the electronic device 100 as an input parameter for applications such as horizontal and vertical screen switching and pedometers.
[0200] The distance sensor 180F is used to measure the distance. The electronic device 100 can measure the distance by infrared or laser. In some embodiments, for example, in a shooting scene, the electronic device 100 can use the distance sensor 180F to measure the distance to achieve fast focusing.
[0201] The ambient light sensor 180L is used to sense the ambient light brightness. The electronic device 100 can adaptively adjust the brightness of the display screen 194 according to the perceived ambient light brightness. The ambient light sensor 180L can also be used to automatically adjust the white balance when taking pictures. The ambient light sensor 180L can also cooperate with the proximity light sensor 180G to detect whether the electronic device 100 is in a pocket to prevent accidental touches.
[0202] The fingerprint sensor 180H is used to collect fingerprints. The electronic device 100 can use the collected fingerprint characteristics to realize functions such as unlocking, accessing application locks, taking photos, and answering calls.
[0203] The touch sensor 180K is also called a touch control device. The touch sensor 180K can be set on the display screen 194. The touch sensor 180K and the display screen 194 form a touch screen, which is also called a touch control screen. The touch sensor 180K is used to detect touch operations acting on or near it. The touch sensor 180K can pass the detected touch operation to the application processor to determine the type of touch event. Visual output related to the touch operation can be provided through the display screen 194. In other embodiments, the touch sensor 180K can also be set on the surface of the electronic device 100 and set at a different position from the display screen 194.
[0204] The hardware system of the electronic device 100 is described in detail above, and the software system of the electronic device 100 is introduced below.
[0205] Figure 2 It is a schematic diagram of a software system of an electronic device provided in an embodiment of the present application.
[0206] like Figure 2 As shown, the system architecture may include an application layer 210 , an application framework layer 220 , a hardware abstraction layer 230 , a driver layer 240 and a hardware layer 250 .
[0207] Exemplarily, the application layer 210 may include a gallery application and a video player application.
[0208] Optionally, the application layer 210 may also include camera application, calendar, call, map, navigation, WLAN, Bluetooth, music, video, short message and other applications.
[0209] Exemplarily, the application framework layer 220 provides an application programming interface (API) and a programming framework for the application programs of the application layer; the application framework layer may include some predefined functions.
[0210] For example, the application framework layer 220 includes a window manager, a content provider, a view system, a resource manager, and a notification manager.
[0211] Among them, the window manager is used to manage window programs; the window manager can obtain the size of the display screen, determine whether there is a status bar, lock the screen, and capture the screen.
[0212] Content providers are used to store and retrieve data and make it accessible to applications. Data can include video, images, audio, calls made and received, browsing history and bookmarks, and phone books.
[0213] The view system includes visual controls, such as controls for displaying text and controls for displaying images. The view system can be used to build applications. A display interface can be composed of one or more views. For example, a display interface including a text notification icon can include a view for displaying text and a view for displaying images.
[0214] The resource manager provides various resources for applications, such as localized strings, icons, images, layout files, and video files.
[0215] The notification manager enables applications to display notification information in the status bar. It can be used to convey notification-type messages and can disappear automatically after a short stay without user interaction. For example, the notification manager is used for download completion notifications and message reminders. The notification manager can also manage notifications that appear in the system's top status bar in the form of icons or scrolling text, such as notifications from applications running in the background. The notification manager can also manage notifications that appear on the screen in the form of dialog windows, such as prompting text messages in the status bar, emitting reminder sounds, vibrating electronic devices, and flashing indicator lights.
[0216] Exemplarily, the hardware abstraction layer 230 is used to abstract the hardware.
[0217] For example, the hardware abstraction layer 230 includes a video decoding post-processing module, and the video decoding post-processing module is used to execute the method for enhancing video quality in the embodiment of the present application.
[0218] Exemplarily, the driver layer 240 is used to provide drivers for different hardware devices.
[0219] For example, the driver layer may include a display screen driver, a decoder driver, a central processing unit driver, or a neural network processor driver.
[0220] Exemplarily, the hardware layer 250 is located at the bottom layer of the software system.
[0221] For example, the hardware layer 250 may include a display screen, a decoder, a central processing unit and a neural network processor; wherein the display screen is used to display video; the decoder is used to decompress video data; the central processing unit can be used to execute specific algorithmic processing of video data in a method for enhancing video quality; and the neural network processor is used to execute algorithms related to the neural network model in a method for enhancing video quality.
[0222] Currently, due to factors such as poor processing capabilities of electronic devices that capture videos, poor shooting skills of users that capture videos, or poor network transmission environments when transmitting videos, the video quality in electronic devices that play videos is poor, resulting in a poor user experience when watching videos.
[0223] For example, when the shooting capability of the electronic device used to capture the video is limited, even if the resolution of the image in the user-generated content (UGC) video is high, if the dynamic range of the image in the video is small, that is, the contrast angle is low, the video with a high dynamic range cannot be played, affecting the user's viewing experience.
[0224] For example, when limited by the shooting capability of the electronic device used to capture the video, or limited by the user's shooting skills, the image in the UGC video in the video may have problems such as blurred details, affecting the user's viewing experience.
[0225] For example, when the captured video includes a portrait, there may be problems such as blurred edges of the hair area or eyebrow area of the portrait; or, when the captured video includes museum exhibits or handicrafts, the texture details in the exhibits or handicrafts are blurred.
[0226] For example, when limited by the network transmission environment, in order to ensure the smoothness of the video, the server usually gives priority to transmitting low-definition videos with a higher compression ratio; due to the low video clarity, the user's viewing experience is affected.
[0227] For example, Figure 3 As shown, the first electronic device 260 is an original video acquisition device; due to poor shooting technology, or poor processing capability of the first electronic device 260, the quality of the original video acquired is poor, such as Figure 3 As shown in (a); the first electronic device 260 sends the collected original video to one or more electronic devices 100 through the communication network; the electronic device 100 is the playback end of the original video; for example, the original video is sent to the family group through the chat application, such as Figure 3 As shown in (b); the electronic device 100 detects the operation of clicking to play the original video, such as Figure 3(c) in the figure; after the electronic device detects the operation of clicking to play the original video, the electronic device displays a playback display interface, and the video quality displayed in the playback display interface is poor, such as Figure 3 As shown in (d) in the figure, the user's experience of watching the video is poor.
[0228] In view of this, the embodiment of the present application provides a method and an electronic device for enhancing video quality; in the embodiment of the present application, by acquiring a video to be played; displaying a first display interface, the first display interface includes the video to be played and a first control, the first control is used to indicate that the video to be played is enhanced; detecting a first operation on the first control; determining a second parameter that satisfies a first preset condition in the first parameter of the video to be played, the first parameter includes at least two of resolution, dynamic range and high-frequency information; enhancing the video to be played based on the second parameter to generate an enhanced video; displaying or saving the enhanced video; it can be understood that, in the embodiment of the present application, before the video to be played is enhanced, the video to be played can be analyzed; factors affecting the video quality of the video to be played are determined; when the factors affecting the video quality of the video to be played are determined, the video to be played is enhanced in a targeted manner, thereby improving the video quality of the video to be played; compared with the existing method of directly enhancing a certain aspect of the video to be played, the scheme in the embodiment of the present application can intelligently analyze the reason for the poor video quality of the video to be played; thereby, the video to be played is enhanced in a targeted manner to improve the video quality of the video to be played.
[0229] The following is an example of an application scenario of the method for enhancing video quality provided in the embodiment of the present application.
[0230] The method for enhancing video quality in the embodiment of the present application can be applied to playing videos in a local electronic device; for example, it can be applied to an electronic device playing a local video; or an electronic device playing a video received from another electronic device; or an electronic device playing a live video.
[0231] Optionally, the method for enhancing video quality provided in the embodiment of the present application can be applied to videos played in real time by electronic devices; it can be understood that when a video is played in an electronic device, the quality of the played video is enhanced in real time; so that the video displayed in the electronic device is the video after the quality enhancement processing.
[0232] Optionally, the method for enhancing video quality in the embodiment of the present application may also be applied to a video call scenario, wherein the video call scenario may include but is not limited to the following scenarios:
[0233] Video calls, video conferencing applications, long and short video applications, video live broadcast applications, video online course applications, portrait intelligent mirror application scenarios, system camera recording function video recording, video surveillance, or smart cat-eye and other portrait shooting scenarios, etc.
[0234] It should be understood that the above is an example of an application scenario and does not limit the application scenario of the present application.
[0235] Combine the following Figures 4 to 22 The method for enhancing video quality provided in the embodiment of the present application is described in detail.
[0236] Figure 4 is a schematic flow chart of a method for enhancing video quality provided by an embodiment of the present application. The method can be Figure 1 The electronic device shown is executed; the method 300 includes S310 to S370, and S310 to S370 are described in detail below.
[0237] S310: Obtain the video to be played.
[0238] Optionally, obtaining a video to be played includes:
[0239] Obtain a video to be played in an electronic device; or,
[0240] A video to be played sent by a first electronic device is received, where the first electronic device is a device for collecting the video to be played.
[0241] Exemplarily, the first electronic device can capture the video to be played, and the first electronic device can send the video to be played to the electronic device; for example, the first electronic device can be a device for capturing the video to be played; the electronic device can be a device for receiving the video to be played; the first electronic device can send the video to be played to the electronic device through a third-party chat software.
[0242] Exemplarily, the electronic device may locally obtain the video to be played.
[0243] Exemplarily, the electronic device may obtain the video to be played from the server.
[0244] S320: Display a first display interface.
[0245] Among them, the first display interface includes the video to be played.
[0246] Optionally, the first display interface can be as follows Figure 3 As shown in (b), the first display interface includes the video to be played.
[0247] S330: Detect a play operation on the video to be played.
[0248] Alternatively, if Figure 3 As shown in (c) in FIG. 1 , the play operation may be an operation of clicking a play control of the video to be played.
[0249] Optionally, the play operation may also refer to an operation of instructing by voice to play the video to be played; or, the play operation may refer to an operation of instructing by other means to play the video to be played; this application does not make any display on this.
[0250] S340: In response to the play operation, determine whether a first parameter of the video to be played is less than a first preset threshold.
[0251] The first parameter includes resolution.
[0252] Optionally, the first preset threshold may be 360P.
[0253] In an embodiment of the present application, before performing image quality enhancement processing on the video to be played, the video to be played may be analyzed first; for example, it may be determined first whether the resolution of the video to be played is less than a first preset threshold; and then other factors of the video to be played may be analyzed.
[0254] Exemplarily, in an embodiment of the present application, it can be determined first whether the value of the resolution of the video to be played is less than the first preset threshold; if the resolution of the video to be played is less than the first preset threshold, S350 is executed; it can be understood that before enhancing the video to be played, the priority of analyzing the resolution of the video to be played is higher than the priority of analyzing the high-frequency information or dynamic range of the video to be played.
[0255] In an embodiment of the present application, when analyzing a video to be played, priority may be given to determining the resolution of the video to be played; since resolution usually has a greater impact on image quality, when determining factors affecting the video quality of the video to be played in an embodiment of the present application, priority may be given to determining whether resolution is a factor affecting video quality; if the resolution of the video to be played is less than a first preset threshold, it indicates that resolution is a factor affecting video quality.
[0256] Optionally, when it is determined that the factor affecting the video quality of the video to be played is the resolution, the video to be played may be subjected to super-resolution processing to obtain a super-resolution processed video; that is, an enhanced processed video. Figure 5 The relevant description of S403 is not repeated here.
[0257] Exemplarily, the super-resolution algorithm may include: an interpolation-based method, a reconstruction-based method, or a learning-based method.
[0258] Exemplarily, the super-resolution algorithm based on the reconstruction method may include: super-resolution reconstruction based on a single image and super-resolution reconstruction based on an image sequence.
[0259] Exemplarily, super-resolution processing of the video to be played can be achieved based on a convolutional neural network (GAN) or a generative adversarial network (GAN); this implementation method can also refer to the relevant description of the super-resolution algorithm processing in patent application number 202210599727.0.
[0260] Optionally, determining whether a first parameter of the video to be played is less than a first preset threshold includes:
[0261] Determine whether a first parameter of each frame of data in the video to be played is less than a first preset threshold.
[0262] Exemplarily, the judgment is made based on the frame-by-frame data in the video to be played; it can be understood that, based on the frame-by-frame data in the video to be played, it is determined that the first parameter of each frame data in the video to be played is less than the first preset threshold value; for example, assuming that the video to be played includes 10 frames of data, namely the 1st frame data to the 10th frame data; it can be judged separately whether the first parameter of each frame data from the 1st frame data to the 10th frame data is less than the first preset threshold value.
[0263] Optionally, determining whether a first parameter of the video to be played is less than a first preset threshold includes:
[0264] Determine whether a first parameter of preset frame data in the video to be played is less than a first preset threshold.
[0265] Exemplarily, the judgment is made based on preset frame data in the video to be played; for example, assuming that the video to be played includes 20 frames of data, it can be determined based on the first parameter of the 1st frame data whether it is less than the first preset threshold value. If the first parameter of the 1st frame data is less than the first preset threshold value, it can be considered that the first parameters of the 1st frame data to the 10th frame data are less than the first preset threshold value; similarly, it can be determined based on whether the first parameter of the 11th frame data is less than the first preset threshold value. If the first parameter of the 11th frame data is less than the first preset threshold value, it can be considered that the first parameters of the 11th frame data to the 20th frame data are all less than the first preset threshold value.
[0266] S350: If the first parameter is less than the first preset threshold, determine whether the second parameter of the video to be played meets the first preset condition.
[0267] Among them, the second parameter includes the value of the dynamic range and the value of the high-frequency information, the first preset condition includes that the value of the dynamic range of the video to be played is less than the second preset threshold, and / or the value of the high-frequency information of the video to be played is less than the third preset threshold, the value of the high-frequency information is the cumulative value of the high-frequency information in the frequency domain image of the video to be played, and the high-frequency information includes edge information and detail information of the image in the video to be played.
[0268] Optionally, determining whether a second parameter of the video to be played satisfies a first preset condition includes:
[0269] Determine whether a second parameter of each frame of data in the video to be played satisfies a first preset condition.
[0270] Optionally, determining whether a second parameter of the video to be played satisfies a first preset condition includes:
[0271] Determine whether a second parameter of the preset frame data in the video to be played meets a first preset condition.
[0272] S360: Enhance the video to be played based on the first parameter and / or the second parameter to generate an enhanced video.
[0273] Optionally, performing enhancement processing on the to-be-played video based on the first parameter and / or the second parameter to generate the enhanced video includes:
[0274] If the first parameter is less than a first preset threshold, performing the enhancement processing on the brightness channel data of the to-be-played video based on the first parameter to generate the enhanced video;
[0275] If the first parameter is less than a first preset threshold and the second parameter of the video to be played meets a first preset condition, the brightness channel data of the video to be played is enhanced based on the first parameter and the second parameter to generate the enhanced video.
[0276] In an embodiment of the present application, before performing image quality enhancement processing on the video to be played, the video to be played can be analyzed first; factors affecting the video quality of the video to be played are determined; after determining the factors affecting the video quality of the video to be played, the image quality enhancement processing can be performed on the video to be played in a targeted manner, thereby improving the video quality of the video to be played; compared with the existing method of directly performing enhancement processing on a certain aspect of the video to be played, the scheme in the embodiment of the present application can intelligently analyze the reasons for the poor video quality of the video to be played; thereby, the image quality enhancement processing can be performed on the video to be played in a targeted manner, thereby improving the video quality of the video to be played.
[0277] Optionally, performing enhancement processing on the to-be-played video based on the first parameter and / or the second parameter to generate the enhanced video includes:
[0278] The brightness channel data of the video to be played is enhanced based on the first parameter and / or the second parameter to generate an enhanced video.
[0279] In an embodiment of the present application, when enhancing the video to be played, only the Y channel data of the video to be played can be enhanced; on the one hand, since the method for enhancing video quality provided in the embodiment of the present application can be applied to real-time processing, only the Y channel data of the video to be played is enhanced. The processing efficiency of the electronic device for enhancing video quality can be improved; on the other hand, since the user's eyes are usually more sensitive to brightness, only the Y channel data of the video to be played is enhanced, which can significantly improve the user's viewing experience of the video.
[0280] Optionally, if the first parameter is less than a first preset threshold, determining whether a second parameter of the video to be played meets a first preset condition includes:
[0281] Get the category label of the video to be played;
[0282] Determine whether the classification label belongs to a preset label, where the preset label includes a first label and a second label;
[0283] If the classification label belongs to the first label, determine whether the value of the dynamic range of the video to be played is less than a second preset threshold, where the value of the dynamic range is obtained based on the proportion of the number of pixels in the first grayscale interval in the histogram of the video to be played;
[0284] Performing enhancement processing on the video to be played based on the first parameter and / or the second parameter to generate an enhanced video includes:
[0285] If the value of the dynamic range is less than the second preset threshold, the video to be played is enhanced based on the value of the dynamic range to generate an enhanced video.
[0286] Exemplarily, the first label may refer to a label of a shooting scene with bright light areas and dark light areas; for example, the first label may include: a label of an indoor light source shooting scene, a label of a night scene shooting scene, a label of a sky shooting scene, or a label of a glass wall (for example, a glass wall with higher saturation).
[0287] It should be understood that the first tag refers to the tag of the shooting scene that requires dynamic range enhancement; if the video to be played belongs to the first tag, it can be further determined whether the video to be played requires dynamic range enhancement processing; thereby improving the dynamic range in the video to be played.
[0288] Optionally, determining whether a value of a dynamic range of the video to be played is less than a second preset threshold includes:
[0289] Determine whether the proportion of the number of pixels in the first grayscale interval in the histogram of the video to be played is greater than a fourth preset threshold.
[0290] Optionally, enhancing the video to be played based on the value of the dynamic range to generate an enhanced video includes:
[0291] Obtaining a percentage value of the number of pixels in the first grayscale interval;
[0292] Obtaining a first value and a second value based on a ratio of the number of pixels in the first grayscale interval;
[0293] Based on the first value, the second value and the preset coordinate data, a mapping relationship is obtained, where the mapping relationship is used to indicate the correlation relationship between the input grayscale value and the output grayscale value;
[0294] The video to be played is enhanced based on the mapping relationship to generate an enhanced video.
[0295] Based on the mapping relationship, the video to be played is enhanced to generate an enhanced video, including:
[0296] The brightness channel of the video to be played is enhanced based on the mapping relationship to generate an enhanced video.
[0297] It should be understood that if the number of pixels in the lower grayscale area of the histogram of the video to be played is smaller, it means that the number of darker pixels in the brightness space is smaller; if the number of pixels in the higher grayscale area of the histogram of the video to be played is smaller, it means that the number of brighter pixels in the brightness space is smaller; when the number of darker pixels and the number of brighter pixels in the video to be played are both small, the contrast of the video to be played is low; it can be understood that the video to be played presents a gray display state, and the brighter image areas and the darker image areas cannot be displayed.
[0298] In an embodiment of the present application, it can be determined whether the value of the resolution of the video to be played is less than a first preset threshold value; if the resolution of the video to be played is greater than or equal to the first preset threshold value, it can be indicated that the resolution is not a factor affecting the video quality of the video to be played; further, it can be determined whether the video to be played belongs to a preset scene (for example, a first label, or a second label); if the label of the video to be played is the first label, it can be determined whether the dynamic range is a factor affecting the video quality of the video to be played; for example, if the classification label belongs to the first label, it is determined whether the value of the dynamic range is less than the second preset threshold value; it can be understood that it is determined whether the proportion of the number of pixels in the first grayscale interval in the video to be played is greater than a fourth preset threshold value (for example, 0.6); if the proportion of the number of pixels in the first grayscale interval (for example, the middle grayscale area; for example, the interval with a grayscale value of [100,155]) in the video to be played is greater than the fourth preset threshold value, it means that the proportion of the middle grayscale pixels in the video to be played is large; at this time, there is a problem of graying of the entire picture and insufficient transparency in the video to be played; the dynamic range can be determined as a factor affecting the video quality of the video to be played.
[0299] Optionally, the implementation can be found in Figure 5 The relevant description of S407 is not repeated here.
[0300] Optionally, the mapping relationship is a mapping curve, and the proportion of the number of pixels in the first grayscale interval is proportional to the curvature of the mapping curve.
[0301] Optionally, it also includes:
[0302] If the classification label belongs to the second label, determining whether the value of the high-frequency information of the video to be played is less than a third preset threshold;
[0303] Performing enhancement processing on the video to be played based on the first parameter and / or the second parameter to generate an enhanced video includes:
[0304] If the proportion of the high-frequency information is less than a third preset threshold, the video to be played is enhanced based on the value of the high-frequency information to generate an enhanced video.
[0305] Exemplarily, the second label may be a label of a scene with rich texture information.
[0306] For example, the second label may include: a landscape label, a building label, a pottery label, a handicraft label, a handicraft label, a hand-woven product label, etc.
[0307] It should be understood that the second tag refers to the tag of the shooting scene that needs detail enhancement; if the video to be played belongs to the second tag, it can be further determined whether the video to be played needs detail enhancement processing; thereby improving the detail information in the video to be played.
[0308] Optionally, enhancing the video to be played based on the value of the high-frequency information to generate an enhanced video includes:
[0309] Generate a frequency graph of the video to be played by performing Fourier transform processing on the brightness channel data of the video to be played;
[0310] Determine the cumulative value of the high-frequency area in the frequency map based on the frequency map, where the cumulative value of the high-frequency area is a value obtained by traversing each pixel point in the high-frequency area;
[0311] Based on the accumulated value of the high-frequency area, the preset slope value and the preset intercept value, a Laplace sharpening coefficient is obtained;
[0312] Obtaining a first video based on a Laplace sharpening coefficient and a second-order gradient image of the video to be played;
[0313] The video to be played is fused with the first video to generate an enhanced video.
[0314] Optionally, in an embodiment of the present application, the user does not need to manually adjust the first parameter and / or the second parameter of the video to be played; the electronic device can automatically analyze the video quality of the video to be played; and based on the analysis result, automatically perform video enhancement processing on the video to be played based on the first parameter and / or the second parameter.
[0315] S370: Display or save the enhanced video.
[0316] Optionally, the video to be played may be enhanced in real time, and the enhanced video may be played.
[0317] Optionally, after the video to be played is enhanced, the enhanced video can be saved; when the video needs to be played later, the enhanced video can be played.
[0318] Optionally, in an embodiment of the present application, the priority of analyzing the resolution of the video to be played is higher than the priority of analyzing the dynamic range of the video to be played; the priority of analyzing the dynamic range of the video to be played is higher than the priority of analyzing the high-frequency information of the video to be played. Optionally, in the case of saving the enhanced video, it also includes:
[0319] A second prompt box is displayed, and the second prompt box is used to prompt the storage method of the enhanced video; wherein the storage method includes: a first storage method and a second storage method, the first storage method refers to replacing the video to be played with the enhanced video, and the second storage method refers to storing the enhanced video in a first storage area, and the first storage area is different from the storage area for storing the video to be played.
[0320] For example, the second prompt box can be Fig.16 The prompt box 720 shown in (c) in FIG. 7 ; the first storage method may refer to the storage method of “overwrite original image”; the second storage method may refer to the storage method of “save as”.
[0321] Optionally, the implementation method can be found in the following Fig.16 The description of (c) in the above will not be repeated here.
[0322] Optionally, detecting a playback operation on a video to be played includes:
[0323] Displaying a second display interface, the second display interface includes a first prompt box, the first prompt box is used to prompt whether to enhance the video to be played, the first prompt box includes a first control, the first control is used to indicate to enhance the video to be played;
[0324] In response to the play operation, determining whether a first parameter of the video to be played is less than a first preset threshold value includes:
[0325] detecting a first operation on a first control;
[0326] In response to the first operation, it is determined whether a first parameter of the video to be played is less than a first preset threshold.
[0327] For example, the second display interface may be as follows: Fig.21 As shown in (d) in FIG. 1 , the first prompt box can be Fig.21 740 shown in (d) in FIG. 740 ; the first control may be the control 741 in the prompt box 740 .
[0328] Based on the scheme of the present application, by acquiring a video to be played; displaying a first display interface, the first display interface includes the video to be played and a first control, the first control is used to indicate that enhanced processing is to be performed on the video to be played; detecting a first play operation on the first control; first determining whether a first parameter of the video to be played is less than a first preset threshold, the first parameter including a resolution; determining a second parameter of the first parameter of the video to be played that satisfies a first preset condition, the first parameter including at least two of resolution, dynamic range and high-frequency information; if the first parameter is less than the first preset threshold, then determining whether the second parameter of the video to be played satisfies the first preset condition; enhancing the video to be played based on the first parameter and / or the second parameter, and generating an enhanced video. Video; display or save the enhanced video; it can be understood that, in the embodiments of the present application, before the image quality enhancement processing is performed on the video to be played, the video to be played can be analyzed first; the factors affecting the video quality of the video to be played are determined; when the factors affecting the video quality of the video to be played are determined, the image quality enhancement processing is then performed on the video to be played in a targeted manner, thereby improving the video quality of the video to be played; compared with the existing method of directly enhancing a certain aspect of the video to be played, the scheme in the embodiments of the present application can intelligently analyze the reasons for the poor video quality of the video to be played; thereby, the image quality enhancement processing is performed on the video to be played in a targeted manner, thereby improving the video quality of the video to be played.
[0329] Figure 5 is a schematic flow chart of a method for enhancing video quality provided by an embodiment of the present application. The method can be Figure 1 The electronic device shown is executed; the method 400 includes S401 to S413, and S401 to S413 are described in detail below.
[0330] S401: Obtain video data.
[0331] Optionally, when the electronic device playing the video obtains the video data, the video data stored in the video server may be obtained; or, the video data stored in the local device may be obtained; this application does not impose any limitation on this.
[0332] S402: Analyze the video data.
[0333] Optionally, when parsing the video data, the acquired video data may be parsed frame by frame.
[0334] Exemplarily, a decoder may be called, and the decoder may be used to decompress the digital video.
[0335] S403, determine whether the resolution is less than a first preset threshold; if so, execute S404; if not, execute S406.
[0336] Optionally, judgment can be made frame by frame based on the parsed original data; determine whether the resolution of each frame of original data is less than a first preset threshold; if the resolution of a frame of original data is less than the first preset threshold, execute S404; if the resolution of a frame of original data is greater than or equal to the first preset threshold, execute S406.
[0337] Optionally, the first preset threshold may be 360P.
[0338] In an embodiment of the present application, after parsing the video data, the resolution of the original data in the video can be judged first; since the resolution usually has a greater impact on image quality, the resolution can have a higher priority in judging the factors affecting video quality in an embodiment of the present application.
[0339] S404: Super-resolution algorithm processing.
[0340] Optionally, if the resolution of a frame of original data is less than a first preset threshold, a super-resolution algorithm is performed on the frame of original data; by performing super-resolution algorithm processing on the frame of original data, super-resolution processed data can be obtained, thereby improving the resolution of the image in the video.
[0341] Optionally, the super-resolution algorithm may include: an interpolation-based method, a reconstruction-based method, or a learning-based method.
[0342] Among them, the interpolation-based method refers to first estimating the relative motion information between each frame image, obtaining the pixel values of the high-resolution image at non-uniformly spaced sampling points, then obtaining the pixel values on the high-resolution grid through non-uniform interpolation, and finally using image restoration technology to remove blur and reduce noise; the reconstruction-based method refers to establishing the correspondence between the high-resolution details of the image at low resolution by studying the expression form of the high-resolution details at low resolution; characterizing this mapping relationship according to the model; the learning-based method refers to calculating the prior knowledge between high resolution and low resolution based on training samples, and establishing a mapping model between the two.
[0343] Optionally, the super-resolution algorithm based on the reconstruction method may include: super-resolution reconstruction based on a single image and super-resolution reconstruction based on an image sequence.
[0344] Among them, super-resolution reconstruction based on a single image refers to seeking matching details of the image to be processed from given external resources through some prior model or matching mechanism, and adding it to the original image to achieve resolution improvement; super-resolution reconstruction based on image sequence refers to using the overlapping information between multiple low-resolution images to estimate the detailed content of the image by complementing each other.
[0345] Optionally, super-resolution processing of the original data can be achieved based on a convolutional neural network (CNN) or a generative adversarial network (GAN) network; this implementation method can also refer to the relevant description of the super-resolution algorithm processing in patent application number 202210599727.0.
[0346] S405: Display on the display screen.
[0347] Exemplarily, the data processed based on super-resolution is displayed on a display screen, that is, the video processed based on super-resolution is displayed.
[0348] In an embodiment of the present application, an electronic device that plays a video can perform image quality enhancement processing on the video in real time while playing the video, so that the video played in the electronic device is a video after image quality enhancement processing; the video quality is improved, thereby improving the user's viewing experience.
[0349] S406, determine whether it belongs to a preset scene; if it belongs to a preset scene, execute S407 or S410; if it does not belong to a preset scene, execute S413.
[0350] It should be understood that the preset scene may include scene 1 and scene 2; when it is determined through S406 that a frame of original data belongs to the preset scene, if it belongs to scene 1 in the preset scene, S407 is executed; if it belongs to scene 2 in the preset scene, S410 is executed.
[0351] It should be noted that scene 1 refers to a shooting scene with bright light areas and dark light areas.
[0352] Exemplarily, scene 1 includes: an indoor light source shooting scene, a night scene shooting scene, a sky shooting scene, or a glass wall (eg, a glass wall with a high saturation).
[0353] For example, night scene shooting scenes include: light source billboards in night scenes.
[0354] For example, sky shooting scenes include: sunny day, sunset.
[0355] It should be understood that scene 1 refers to a shooting scene that needs to be contrast enhanced; if a frame of raw data belongs to scene 1, then contrast enhancement processing can be performed on this frame of raw data, thereby improving the dynamic range of the raw data.
[0356] It should be noted that scene 2 refers to a scene with rich texture information; it can be understood that scene 2 is rich in high-frequency information.
[0357] Exemplarily, scene 2 includes: scenery, architecture, ceramics, handicrafts, hand-woven products, etc.; wherein scenery may include green plants, green land, forests, etc.; ceramics may include exhibits with rich texture details, etc.; handicrafts may include hair accessories with specific and fine decorations, etc.
[0358] It should be understood that scene 2 refers to a shooting scene that needs to be enhanced in detail; if a frame of raw data belongs to scene 2, detail enhancement processing can be performed on this frame of raw data, thereby improving the detail information of the raw data.
[0359] Optionally, the label of each frame of raw data may be identified through scene recognition; based on the label of the raw data, it is determined whether a frame of raw data belongs to the first preset scene.
[0360] For example, if the label of the original data is the same as the label of the first preset scene, it means that the original data belongs to the first preset scene; if the label of the original data is different from the label of the first preset scene, it means that the original data does not belong to the first preset scene.
[0361] S407, determining whether the histogram satisfies the first condition; if the histogram satisfies the first condition, executing S408; if the histogram does not satisfy the first condition, executing S409.
[0362] Optionally, when the resolution of the original data is greater than or equal to the first preset threshold, it can be understood that the reason affecting the video quality is not a resolution problem; first, the original data is subjected to scene recognition, if the image label of the original data is the label of scene 1; for example, the scene label is light or sky, etc., then the reason affecting the video quality may be the dynamic range: at this time, a histogram statistics can be performed on the image corresponding to the original data, and the histogram statistics results can be used to determine whether the reason affecting the image quality is the dynamic range; if so, S408 is executed, and a contrast enhancement algorithm is executed to enhance the contrast of the image in the video and then transmit it to the display screen for display; if not, S409 is executed, and no processing is performed on the image corresponding to the original data, and the original data is directly transmitted to the display screen for display.
[0363] Exemplarily, a histogram may be obtained based on the original data; and whether the first condition is satisfied is determined based on the histogram.
[0364] It should be understood that the histogram can be used to describe the grayscale distribution of the entire image; for example, the x-axis of the histogram can represent the grayscale value (0 to 255); the y-axis of the histogram can represent the number of pixels with the same grayscale value in the image; therefore, the brightness, grayscale distribution and contrast of the image can be intuitively displayed through the histogram.
[0365] Optionally, the first condition may be that a proportion of a middle value area [X1, X2] of the histogram is greater than a threshold value 1.
[0366] Exemplarily, the first condition may be that the proportion of the middle area [100, 155] of the histogram is greater than 0.6.
[0367] For example, a histogram of the raw data can be plotted as Figure 6 As shown in (c), grayscale area 420 represents the number of pixels in the lower grayscale area of the histogram; grayscale area 430 represents the number of pixels in the higher grayscale area of the histogram; grayscale area 440 represents the number of pixels in the middle grayscale area of the histogram; the first condition may refer to the ratio of the total number of pixels in the grayscale area 440 to the total number of pixels being greater than 0.6.
[0368] It should be noted that, generally speaking, the smaller the grayscale value, the darker the pixel in the brightness space; the larger the grayscale value, the brighter the pixel in the brightness space.
[0369] It should be understood that under normal circumstances, the larger the proportion of the middle area of the grayscale value in the histogram of a frame of image, the more pixels in the whole image are in the middle grayscale; that is, the number of pixels in the whole image that are too low grayscale or too high grayscale is small, and the image will appear gray as a whole and lack of transparency; therefore, the image needs to be contrast enhanced.
[0370] S408: contrast enhancement algorithm processing.
[0371] It should be understood that if the number of pixels in the lower grayscale area in the histogram of the original data is smaller, it means that the number of darker pixels in the brightness space is smaller; if the number of pixels in the higher grayscale area in the histogram of the original data is smaller, it means that the number of brighter pixels in the brightness space is smaller; when the number of darker pixels and the number of brighter pixels in the original data are both small, the contrast in the image corresponding to the original data is low; it can be understood that the image presents a gray display state, and the brighter image area and the darker image area cannot be displayed; for example, Figure 6 As shown in (a) in the figure, by processing the original data with a contrast enhancement algorithm, data with increased contrast can be obtained, that is, data with an enhanced dynamic range, so that brighter and darker areas can be displayed in the image, such as Figure 6 As shown in (b) in .
[0372] Optionally, the original data may be mapped using a one-dimensional lookup table to obtain data with enhanced dynamic range.
[0373] Exemplarily, the one-dimensional lookup table can be a curve, or a broken line, or a table, or a function, etc.; the Y channel data of the original data can be mapped through the one-dimensional curve, that is, the Y channel data of the original data can be converted to obtain Y channel data with enhanced dynamic range.
[0374] For example, a one-dimensional lookup table is used as a curve for illustration; for example, Figure 6 As shown, the data after contrast enhancement processing can be obtained by mapping the Y channel data of the original data; wherein, Figure 6 (a) in the figure represents the image corresponding to the original data. Figure 6 (b) in the figure shows the image corresponding to the data after contrast enhancement processing; Figure 6 (c) in the figure shows the histogram of the original data; Figure 6 (d) in FIG. 4 shows a curve 450 used for mapping processing; Figure 6 (e) in FIG. 4 represents a histogram of the data after contrast enhancement processing; the pixels represented by the Y channel data of the original data are multiplied by the curve 450 to obtain the data after contrast enhancement processing.
[0375] It should be understood that the function of the curve 450 is to make the darker area of the Y channel data in the original data darker and make the brighter area of the Y channel data in the original data brighter, thereby improving the contrast of the Y channel data of the original data.
[0376] In an embodiment of the present application, when performing contrast enhancement algorithm processing on raw data, only the Y channel data of the raw data may be processed by the contrast enhancement algorithm; on the one hand, since the method for enhancing video quality provided by the embodiment of the present application can be applied to real-time processing, only performing contrast enhancement algorithm processing on the Y channel data of the raw data can improve the processing efficiency of the electronic device in performing enhanced video quality; on the other hand, since the user's eyes are usually more sensitive to brightness, only performing contrast enhancement algorithm processing on the Y channel data of the raw data can significantly improve the user's viewing experience of the video.
[0377] For example, Figure 6As shown in (d), curve 450 includes point A, point B, point C, point D and point E; wherein, the coordinate of point A is (0,0); the coordinate of point B is (127,127); the coordinate of point C is (255,255); the coordinate of point D is (50,d); the coordinate of point E is (200,e); wherein, d=50*(1-0.5*R); e=200+55*0.5*R; R represents the proportion of the middle gray value interval [100,155] of the histogram of the original data; according to the relationship between d, e and R, it can be seen that R is in inverse proportion and direct proportion to d; the three points ADB and BEC are fitted by a broken line or a quadratic function; and curve 450 is obtained.
[0378] Optionally, combined Figure 6 (c) and Figure 7 As shown, if the number of pixels 420 in the lower grayscale area of the histogram is smaller and / or the number of pixels 430 in the lower grayscale area of the histogram is smaller, the curvature of the curve used for contrast enhancement algorithm processing is larger; it can be understood that if the number of pixels in the lower grayscale interval is smaller and / or if the number of pixels in the higher grayscale interval is smaller, the coefficient required for contrast enhancement of the original data is larger (or the degree is higher), and the curvature of the corresponding mapping curve is larger; as shown in FIG. Figure 7 The curve 450 and the curve 451 are shown in FIG. 4 ; the curvature of the curve 451 is greater than the curvature of the curve 450 .
[0379] Optionally, the contrast enhancement algorithm processing may be a tone mapping processing (Tone mapping); the tone mapping processing is used to map colors from an original tone (eg, a low dynamic range) to a target tone (eg, a high dynamic range).
[0380] In an embodiment of the present application, when the resolution of the original data in the video is greater than or equal to the first resolution threshold, and the shooting scene belongs to scene 1 in the preset scene, that is, the shooting scene of the original data includes a bright light area and a dark light area, the histogram distribution of the original data can be judged; when the histogram distribution meets the first condition, that is, the number of pixels in the middle grayscale area of the histogram is greater than the threshold 1, the original data is processed by a contrast enhancement algorithm, thereby enhancing the contrast of the original data and improving the dynamic range of the original data.
[0381] In an embodiment of the present application, when the raw data is processed by a contrast enhancement algorithm, the degree to which the raw data is processed by the contrast enhancement algorithm (for example, determining mapping removal) can be determined based on the image classification label corresponding to the raw data (for example, scene 1) and the histogram distribution of the image corresponding to the raw data (for example, the histogram satisfies the first condition); and the dynamic range in the image corresponding to the raw data is enhanced.
[0382] Optionally, the data in the YUV color space processed by the contrast enhancement algorithm may be converted into the RGB color space and transmitted to a display screen for display.
[0383] Optionally, the data in the YUV color space processed by the contrast enhancement algorithm can be converted into a storage format and stored in an electronic device; during playback, the data in the storage format can be decoded, the decoded data in the YUV color space can be converted into an RGB color space, and transmitted to a display screen for display.
[0384] Exemplarily, the storage formats include but are not limited to: mp4, mkv, wmv, avi, etc.
[0385] Optionally, when storing data processed by the contrast enhancement algorithm, the data may be stored locally on the electronic device; alternatively, the data processed by the adaptive sharpness algorithm may be sent to a cloud server and automatically updated and deleted periodically.
[0386] S409: Output original data.
[0387] Exemplarily, when a frame of raw data has a resolution greater than or equal to a first preset threshold, belongs to scene 1 among preset scenes, and the histogram distribution does not satisfy the first condition, the raw data may be transmitted to a display screen for display.
[0388] It should be understood that the original data may refer to data obtained after parsing the video data in S402; for example, the original data may refer to data in a YUV color space corresponding to the video data.
[0389] S410, judging whether the frequency distribution satisfies the second condition; if the frequency distribution satisfies the second condition, executing S411; if the frequency distribution does not satisfy the second condition, executing S412.
[0390] Optionally, when the resolution of the original data is greater than or equal to the first preset threshold, it can be understood that the reason affecting the video quality is not a resolution problem; first, the original data is subjected to scene recognition, if the image label of the original data is the label of scene 2; for example, the scene label is scenery or architecture, etc., then the reason affecting the video quality may be blurred details in the image: at this time, the original data can be converted into time-frequency to obtain a frequency domain graph; the frequency domain graph is used to determine whether the reason affecting the image quality is blurred details; if so, S411 is executed to execute adaptive sharpness algorithm processing, and the detailed information of the image in the video is enhanced and then transmitted to the display screen for display; if not, S412 is executed, and no processing is performed on the image corresponding to the original data, and the original data is directly transmitted to the display screen for display.
[0391] Optionally, when the resolution of the original data is greater than or equal to a first preset threshold and the original data belongs to scene 2 among the preset scenes, it is determined whether the frequency distribution of the original data satisfies a second condition.
[0392] It should be understood that, generally speaking, the less high-frequency information there is in the frequency domain diagram of a frame of an image, the less detail information there is in the entire image. Since there is less high-frequency information, detail information in the image may be blurred. Therefore, it is necessary to perform detail information enhancement processing on the image (for example, using an adaptive sharpening algorithm).
[0393] Optionally, the second condition may be that the cumulative value of the high frequency part in the frequency domain graph is less than a threshold 2.
[0394] Exemplarily, the second condition may be that the cumulative value of the high frequency part in the frequency domain graph is less than 7,000,000.
[0395] For example, the first area and the second area can be determined in the frequency domain image, the first area is the low-frequency part, that is, the image area of 1 / 16 of the center of the frequency domain image; it can be understood that, assuming that the size of the frequency domain image is L*S, the center of the first area is the same as the center of the frequency domain image, and the first area is an image area of 1 / 4L*1 / 4S; the part of the frequency domain image other than the first area is the second area; in the second area, the pixel value of each pixel is traversed, and all values are added to obtain the cumulative value of the high-frequency part; sumFFT=sum(pixel Value); wherein sumFFT represents the cumulative value of the high-frequency part.
[0396] S411: Adaptive sharpness algorithm processing.
[0397] Optionally, when the resolution of a frame of original data is greater than or equal to a first preset threshold, and belongs to scene 2 in the preset scene, and the frequency distribution satisfies the second condition, the original data can be processed by an adaptive sharpness algorithm to obtain data with increased details.
[0398] It should be understood that the adaptive sharpness algorithm processing is to enhance the detail information in the image; since when the original data belongs to scene 2 in the preset scene, the shooting scene usually includes rich detail information; by performing adaptive sharpness algorithm processing on the original data, the detail information of the image in the video can be improved.
[0399] Optionally, the detail part of the picture may be sharpened by a Laplace sharpening algorithm to obtain an image with enhanced details; wherein the enhancement coefficient of the Laplace sharpening algorithm may be determined by frequency domain statistical results.
[0400] S412: Output original data.
[0401] Exemplarily, when the resolution of a frame of original data is greater than or equal to the first preset threshold, and belongs to scene 2 in the preset scenes, and the frequency distribution does not meet the second condition, the original data can be transmitted to the display screen for display.
[0402] It should be understood that the original data may refer to data obtained after parsing the video data in S402; for example, the original data may refer to data in a YUV color space corresponding to the video data.
[0403] S413. Output original data.
[0404] Exemplarily, when the resolution of a frame of original data is greater than or equal to a first preset threshold and does not belong to a preset scene, the original data can be transmitted to a display screen for display.
[0405] It should be understood that the original data may refer to data obtained after parsing the video data in S402; for example, the original data may refer to data in a YUV color space corresponding to the video data.
[0406] In an embodiment of the present application, before performing image quality enhancement processing on the original data of the video, the original data of the video can be analyzed first; factors affecting the video quality of the original data of the video are determined; and when the factors affecting the video quality of the original data of the video are determined, the original data of the video is then targetedly enhanced, thereby improving the video quality of the original data of the video; compared with the existing method of directly performing enhancement processing on a certain aspect of the original data of the video, the scheme in the embodiment of the present application can intelligently analyze the reasons for the poor video quality of the original data of the video; thereby, the original data of the video is targetedly enhanced to improve the video quality of the video.
[0407] Figure 8 It is a schematic flow chart of an adaptive sharpness algorithm processing method provided in an embodiment of the present application; the method 500 includes S510 to S540; S510 to S540 are described in detail below.
[0408] S510: Perform time-frequency conversion on the original data to obtain a frequency domain graph.
[0409] Optionally, the time-frequency conversion process refers to a process of converting from the time domain to the frequency domain; wherein the time-frequency conversion process may include: cosine transform, Fourier transform or fast Fourier transform, etc.
[0410] For example, the original data may be data in a YUV color space, and the data in the YUV color space may be subjected to a time-frequency conversion process to obtain a frequency domain graph corresponding to the original data.
[0411] For example, Fig. 9 (a) shows the image corresponding to the original data; Fig. 9 (b) in FIG. 5 shows the frequency domain diagram corresponding to the original data.
[0412] S520: Determine a high-frequency information region in the frequency domain image.
[0413] For example, the center of the frequency domain image may be determined, the center of the frequency domain image may be taken as the center of the high-frequency information region, and the image region whose length and width are changed to 1 / 4 of the frequency domain image may be determined as the low-frequency information region; Fig. 9 The area 541 shown in (b) is the low-frequency information area; the area other than the low-frequency information area in the frequency domain diagram is the high-frequency information area.
[0414] It should be understood that for the frequency domain diagram, the closer to the center point, the lower the frequency domain; the brighter the white center point, the larger the proportion of the corresponding frequency domain.
[0415] S530: Count the cumulative value of the high-frequency information area.
[0416] Exemplarily, in the high-frequency information area, the pixel value of each pixel is traversed, and all values are added to obtain the cumulative value of the high-frequency information; sumFFT=sum(pixel Value); wherein sumFFT represents the cumulative value of the high-frequency information.
[0417] S540: Obtain detail-enhanced image data based on the sharpening coefficient.
[0418] Exemplarily, the Laplace sharpening coefficient R1=-K*sumFFT+b; wherein K and b are preset thresholds; for example, K may refer to FFTslope; and b may refer to FFTintercept.
[0419] For example, the FFTslope value can be: 1 / 4000000; the FFTintercept value can be 2.
[0420] Optionally, the Laplace sharpening coefficient R1 can be limited to a preset range [K1, K2]; if the value of R1 exceeds the preset range, the maximum value K1 is taken; or, the minimum value K2 is taken; for example, if R1 is less than K1, the value of R1 is K1; if R1 is greater than K2, the value of R1 is K2.
[0421] In an embodiment of the present application, the Laplace sharpening coefficient R1 can be limited to a preset range [K1, K2] to avoid a large Laplace sharpening coefficient R1, which results in a strong degree of sharpening; or a small Laplace sharpening coefficient R1, which results in a weaker degree of sharpening; the original data of the video is processed for sharpness based on the Laplace sharpening coefficient R1, thereby improving the video quality.
[0422] Optionally, the image data after the sharpening process, that is, the image data with enhanced details, may be obtained based on the original data, the sharpening coefficient R1 and the second-order gradient image of the original data.
[0423] It should be understood that the second-order gradient image of the original data refers to the derivative of the grayscale change of the image corresponding to the original data, which can highlight the edge detail information in the image; the second-order gradient image based on the original data can obtain more edge detail information; the original data can be enhanced through the edge detail information to improve the detail information in the original data.
[0424] Alternatively, if Fig.10 As shown, image 550 is the image of the original data object; image 560 is the second-order gradient image of the original data; image 570 is the image corresponding to the detail-enhanced image data; image 570 is obtained by multiplying the Laplace sharpening coefficient R1 with image 560 and fusing it with image 550.
[0425] For example, detail-enhanced image data=original data+R1*second-order gradient image of the original data.
[0426] In an embodiment of the present application, when performing adaptive sharpness algorithm processing on the original data, adaptive sharpness algorithm processing can be performed only on the Y channel data of the original data; on the one hand, since the method for enhancing video quality provided in the embodiment of the present application can be applied to real-time processing, only performing adaptive sharpness algorithm processing on the Y channel data of the original data can improve the processing efficiency of the electronic device in performing enhanced video quality; on the other hand, since the user's eyes are usually more sensitive to brightness, only performing adaptive sharpness algorithm processing on the Y channel data of the original data can significantly improve the user's video viewing experience.
[0427] Optionally, the detail enhanced data processed by the adaptive sharpness algorithm may be transmitted to a display screen for display, thereby displaying a detail enhanced image.
[0428] For example, data in the YUV color space processed by an adaptive sharpness algorithm may be converted into an RGB color space and transmitted to a display screen for display.
[0429] Optionally, the data in the YUV color space processed by the adaptive sharpness algorithm can be converted into a storage format and stored in an electronic device; during playback, the data in the storage format can be decoded, the decoded YUV color space data can be converted into an RGB color space, and transmitted to a display screen for display.
[0430] Exemplarily, the storage formats include but are not limited to: mp4, mkv, wmv, avi, etc.
[0431] Optionally, when storing data processed by the adaptive sharpness algorithm, the data may be stored locally on the electronic device; or, the data processed by the adaptive sharpness algorithm may be sent to a cloud server and automatically updated and deleted regularly.
[0432] In an embodiment of the present application, when the original data is processed by an adaptive sharpness algorithm, the degree of adaptive sharpness algorithm processing on the original data can be determined based on the image classification label corresponding to the original data (for example, scene 2) and the high-frequency information distribution of the image corresponding to the original data (for example, the frequency distribution satisfies the second condition); and the detail information in the image corresponding to the original data is enhanced.
[0433] S412: Output original data.
[0434] Exemplarily, when the resolution of a frame of original data is greater than or equal to the first preset threshold, and belongs to scene 2 in the preset scenes, and the frequency distribution does not meet the second condition, the original data can be transmitted to the display screen for display.
[0435] It should be understood that the original data may refer to data obtained after parsing the video data in S402; for example, the original data may refer to data in a YUV color space corresponding to the video data.
[0436] S413. Output original data.
[0437] Exemplarily, when the resolution of a frame of original data is greater than or equal to a first preset threshold and does not belong to a preset scene, the original data may be transmitted to a display screen for display.
[0438] It should be understood that the original data may refer to data obtained after parsing the video data in S402; for example, the original data may refer to data in a YUV color space corresponding to the video data.
[0439] Optionally, the above-mentioned determination step may be performed based on frame-by-frame data; the determination step includes: S403, S406, S407 or S410.
[0440] Exemplarily, S403 is executed based on frame-by-frame data for illustration; for example, assuming that 10 frames of original data are obtained after parsing the video data, namely, the 1st frame of original data to the 10th frame of original data; it can be determined whether the resolution of each frame of original data from the 1st frame of original data to the 10th frame of original data is less than the first preset threshold value; if the resolution of a frame of original data is less than the first preset threshold value, S404 is executed for the frame of original data; if the resolution of a frame of original data is greater than or equal to the first preset threshold value, S406 is executed for the frame of original data.
[0441] Optionally, the above-mentioned judgment step can judge the original data based on a preset number of frames; it can be understood that the original data is judged at intervals of a preset time length; wherein the judgment step includes: S403, S406, S407 or S410.
[0442] Exemplarily, the execution of S403 based on frame-by-frame data is used as an example for explanation; for example, assuming that 20 frames of data are obtained after parsing the video data, it can be determined based on the original data of the first frame whether the resolution is less than the first preset threshold; if the resolution of the original data of the first frame is less than the first preset threshold, S404 is executed for the original data of the first frame to the tenth frame; if the resolution of the original data of the first frame is greater than or equal to the first preset threshold, S406 is executed for the original data of the first frame to the tenth frame; similarly, it can be determined based on the original data of the 11th frame whether the resolution is less than the first preset threshold; if the resolution of the original data of the 11th frame is less than the first preset threshold, S404 is executed for the original data of the 11th frame to the 20th frame; if the resolution of the original data of the 11th frame is greater than or equal to the first preset threshold, S406 is executed for the original data of the 11th frame to the 20th frame.
[0443] Optionally, the priority order of the factors affecting the video quality in S401 to S413 from high to low may be: video clarity (eg, resolution of original data), video dynamic range, and video detail blur.
[0444] Optionally, the electronic device may include a video playback application, a decoder, a video decoding post-processing module, a neural network processor, a central processing unit or a display screen; Fig.11 The interactive flow chart of the method for enhancing video quality provided in the embodiment of the present application is described; the method can be Figure 1 The electronic device shown is executed; the method includes S601 to S627, and S601 to S627 are described in detail below.
[0445] S601: The video playback application obtains video data.
[0446] Optionally, the video playback application may refer to a gallery application; or, the video playback application may refer to a third-party video playback application; this application does not impose any limitation on this.
[0447] S602: The video playback application program calls the decoder to run.
[0448] Exemplarily, the video playback application may send a first instruction to the decoder, where the first instruction is used to run the decoder.
[0449] S603: The decoder is used to decode the video data to obtain original data in the YUV color space.
[0450] Optionally, the decoder may be used to decompress the digital video.
[0451] Optionally, the decoder may send the raw data to a video decoding post-processing module.
[0452] S604, the video decoding post-processing module is used to determine whether the resolution of the original data is less than a first preset threshold; if so, execute S605; if not, execute S609.
[0453] It should be understood that the implementation of S604 can be found in Figure 5 The relevant description of S403 will not be repeated here.
[0454] Optionally, the video decoding post-processing module may be located in a camera application abstraction layer in an electronic device, such as Figure 2 shown.
[0455] S605: The video decoding post-processing module is used to send a first control instruction to the central processing unit.
[0456] Optionally, when the resolution of the original video is less than a first preset threshold, the video decoding post-processing module is used to send a first control instruction to the central processing unit; the first control instruction is used to instruct the central processing unit to run a super-resolution processing algorithm.
[0457] Optionally, in one possible implementation, if a neural network model is used in the super-resolution processing algorithm, the video decoding post-processing module can be used to send control instructions to the neural network processor so that the neural network controller executes the super-resolution processing algorithm; this application does not impose any limitations on this.
[0458] S606: The central processing unit is used to call a super-resolution algorithm for processing to obtain data after super-resolution processing.
[0459] Optionally, the CPU can be used to perform super-resolution algorithm processing on the raw data. For specific implementation methods, see Figure 5 The relevant description of S404 will not be repeated here.
[0460] S607: The central processing unit is used to send the super-resolution processed data to the video playback application.
[0461] S608: The video playback application is used to control the display screen to display the data after super-resolution processing.
[0462] Exemplarily, the video playback application may be used to send a control instruction to a display screen, and the control instruction is used to instruct the display screen to display data processed with super resolution, that is, to display a video processed with super resolution.
[0463] S609, the video decoding post-processing module is used to send a second control instruction to the neural network processor.
[0464] Optionally, when the resolution of the original video is greater than or equal to a first preset threshold, the video decoding post-processing module is used to send a second control instruction to the neural network processor; the second control instruction is used to instruct the neural network controller to identify the scene label of the original data.
[0465] S610, the neural network processor is used to call the scene recognition model to obtain the label of the original data.
[0466] Exemplarily, the scene recognition model may be a classification model; by inputting the original data into the classification model, a scene classification label of the original data may be obtained.
[0467] S611, the neural network processor is used to send the label of the original data to the video decoding post-processing module.
[0468] S612, the video decoding post-processing module is used to determine whether it belongs to a preset scene; if so, execute S613 or S621; if not, execute S622.
[0469] For example, the preset scenes may include scene 1 and scene 2; if it is determined based on the label of the original data that the original data belongs to scene 1, S613 is executed; if it is determined based on the label of the original data that the original data belongs to scene 2, S621 is executed. Figure 5 The relevant description of S406 will not be repeated here.
[0470] S613: The video decoding post-processing module is used to send a third control instruction to the central processing unit.
[0471] Exemplarily, when the resolution of the original data is greater than or equal to a first preset threshold and the label of the original data belongs to scene 1 in the preset scene, the video decoding post-processing module is used to send a third control instruction to the central processing unit; wherein the third control instruction is used to instruct the central processing unit to calculate the histogram of the original data.
[0472] S614: The central processing unit is used to calculate a histogram of the original data.
[0473] S615: The central processing unit is used to send the histogram to the video decoding post-processing module.
[0474] S616, the video decoding post-processing module is used to determine whether the histogram distribution meets the first condition; if the first condition is met, execute S617; if the first condition is not met, execute S622.
[0475] Optionally, the implementation of S616 can refer to Figure 5 The relevant description of S407 is not repeated here.
[0476] S617: The video decoding post-processing module is used to send a fourth control instruction to the central processing unit.
[0477] The fourth control instruction is used to instruct the central processing unit to perform contrast enhancement algorithm processing on the original data.
[0478] Exemplarily, when the resolution of the original data is greater than or equal to the first preset threshold, the label of the original data belongs to scene 1 in the preset scene, and the distribution of the histogram meets the first condition, the video decoding post-processing module is used to send a fourth control instruction to the central processing unit.
[0479] S618: The central processing unit is used to call the contrast enhancement algorithm for processing to obtain contrast enhanced data.
[0480] Optionally, the CPU can be used to perform contrast enhancement algorithm processing on the raw data. For specific implementation methods, see Figure 5 The relevant description of S408 will not be repeated here.
[0481] S619: The central processing unit is used to send the data after the contrast enhancement process to the video playback application.
[0482] S620: The video playback application is used to control the display screen to display the data after contrast enhancement processing.
[0483] Exemplarily, the video playback application may be used to send a control instruction to a display screen, where the control instruction is used to instruct the display screen to display data after contrast enhancement processing; that is, to display a video with a high dynamic range.
[0484] S621, the video decoding post-processing module is used to determine whether the frequency distribution meets the second condition; if the second condition is met, execute S624; if the second condition is not met, execute S622.
[0485] Optionally, the implementation of S621 can refer to Figure 5 The relevant description of S410 is not repeated here.
[0486] S622: The video decoding post-processing module is used to send a first notification message to the video playback application.
[0487] Exemplarily, when the resolution of the original data is greater than or equal to a first preset threshold, and the label of the original data belongs to scene 2 in the preset scene, and the frequency distribution does not meet the second condition, the video decoding post-processing module is used for the video playback application to send a first notification message; wherein the first notification message is used to instruct the video playback application to control the display screen to display the original data; it can be understood that the video playback application controls the display screen to display the unprocessed video.
[0488] S623: The video playback application controls the display screen to display original data.
[0489] S624: The video decoding post-processing module is used to send a fifth control instruction to the central processing unit.
[0490] The fifth control instruction is used to instruct the central processing unit to perform adaptive sharpness algorithm processing on the original data.
[0491] Exemplarily, when the resolution of the original data is greater than or equal to the first preset threshold, the label of the original data belongs to scene 2 in the preset scene, and the frequency distribution satisfies the second condition, the video decoding post-processing module is used to send a fifth control instruction to the central processing unit.
[0492] S625, the central processing unit is used to call the adaptive sharpness algorithm for processing to obtain sharpness processed data.
[0493] Optionally, the CPU can be used to process the raw data using an adaptive sharpness algorithm. For details, see Figure 5 The relevant description of S411 will not be repeated here.
[0494] S626: The central processing unit is used to send the sharpness-processed data to the video playback application.
[0495] S627. The video playback application is used to control the display screen to display the data after the sharpness processing.
[0496] Exemplarily, the video playback application may be used to send a control instruction to a display screen, where the control instruction is used to instruct the display screen to display data after sharpness processing, that is, to display a video with enhanced details.
[0497] Optionally, in the above S601 to S627, Figure 5 The same parts apply to Figures 5 to 10 The relevant description in will not be repeated here.
[0498] In an embodiment of the present application, before performing image quality enhancement processing on the original data of the video, the original data of the video can be analyzed first; factors affecting the video quality of the original data of the video are determined; and when the factors affecting the video quality of the original data of the video are determined, the original data of the video is then targetedly enhanced, thereby improving the video quality of the original data of the video; compared with the existing method of directly performing enhancement processing on a certain aspect of the original data of the video, the scheme in the embodiment of the present application can intelligently analyze the reasons for the poor video quality of the original data of the video; thereby, the original data of the video is targetedly enhanced to improve the video quality of the video.
[0499] Combine the following Figures 12 to 22 The interface schematic diagram provided in the embodiment of the present application is described by way of example.
[0500] For example, Fig.12 As shown, Fig.12 The graphical user interface (GUI) shown in (a) is a desktop 701 of the electronic device; the electronic device detects that the user clicks on a control 702 of the gallery application on the desktop, such as Fig.12 As shown in (b); after the electronic device detects that the user clicks the control 702 of the gallery application on the desktop, the display is as shown in Fig.12 The gallery display interface 703 shown in (c) of FIG. 703 includes all photo icons and video icons. The electronic device detects that the user clicks the video icon 704, such as Fig.12 As shown in (d); after the electronic device detects that the user clicks the video icon 704, the video display interface 705 is displayed, such as Fig.13 As shown in (a); in the video display interface 705, the video icon 706; the electronic device detects the user's operation of clicking the video icon 706, such as Fig.13 After the electronic device detects the operation of clicking the video icon 706, a playback display interface 707 is displayed, and the playback display interface 707 includes an editing control 708, such as Fig.13 As shown in (c) in FIG. 1 , the electronic device detects the operation of clicking the edit control 708, such as Fig.13 As shown in (d) in the figure; after the electronic device detects that the editing control 708 is clicked, the editing display interface 709 is displayed; the editing display interface 709 includes an enhancement processing control 710; the enhancement processing control 710 is used to perform video enhancement processing, such as Fig.14 As shown in (a); the electronic device detects the operation of clicking the enhanced processing control 710, such as Fig.14As shown in (b); after the electronic device detects the operation of clicking the enhanced processing control 710, the enhanced editing interface 711 is displayed; the enhanced editing interface 711 includes a resolution adjustment control 712 and a frame rate adjustment control, such as Fig.14 As shown in (c) in FIG. 1 , the electronic device detects the operation of clicking the resolution adjustment control 712, such as Fig.14 As shown in (d); for example, the electronic device detects the operation of moving the resolution adjustment control 712 from 720P to 1080P, and displays the enhanced editing display interface 713, such as Fig.15 As shown in (a) in FIG. 1 ; after the editing is completed, the electronic device detects the operation of clicking the return control, such as Fig.15 As shown in (b) of FIG. 1 ; after the electronic device detects the operation of clicking the return control, the enhanced editing interface 714 is displayed; the enhanced editing interface 714 includes a prompt box 715, and the prompt box 715 is used to remind the user "whether to abandon the current zoom"; the prompt box 715 also includes a cancel option 716 and a discard option 717, as shown in FIG. Fig.15 As shown in (c) in the figure; optionally, if the electronic device detects the operation of clicking the cancel option 716, the electronic device returns to the enhanced editing display interface 713; if the electronic device detects the operation of clicking the abandon option 717, the electronic device returns to the editing display interface 709.
[0501] Optionally, the enhanced editing display interface also includes an export control 718, such as Fig.16 As shown in (a) in FIG. 1 ; the electronic device detects the operation of clicking the export control 718, such as Fig.16 As shown in (b) in the figure; after the electronic device detects the operation of clicking the export control 718, a display interface 719 is displayed; the display interface 719 includes a prompt box 720; the prompt box 720 is used to prompt how to export the video; for example, the prompt box 720 includes a prompt message "Please select a save method" and a prompt message "After selecting "Overwrite the original image", you can find the corresponding original in "Recently Deleted"; the prompt box 720 also includes a cancel option, an overwrite original option and a save option, such as Fig.16 As shown in (b); optionally, if the electronic device detects the operation of clicking the cancel option, the electronic device cancels the export of the enhanced video; if the electronic device detects the operation of clicking the overwrite original image option, the electronic device stores the enhanced video in the storage area of the original video, that is, replaces the original video with the enhanced video; if the electronic device detects the operation of the save option, the electronic device can display the selectable storage area information for save.
[0502] Alternatively, if Figures 12 to 16As shown in the interface diagram, the user can enhance the video quality through the editing controls in the playback display interface, that is, trigger the electronic device to execute the method for enhancing video quality provided in the embodiment of the present application.
[0503] For example, Fig.17 As shown, Fig.17 The graphical user interface (GUI) shown in (a) is the desktop 721 of the electronic device; the electronic device detects that the user clicks the control 722 of the gallery application on the desktop, such as Fig.17 As shown in (b); after the electronic device detects that the user clicks the control 722 of the gallery application on the desktop, the display is as follows Fig.17 The gallery display interface 723 shown in (c) of FIG. 7 includes all photo icons and video icons. The electronic device detects that the user clicks the video icon 724, such as Fig.17 As shown in (d); after the electronic device detects that the user clicks the video icon 724, the video display interface 725 is displayed, showing Fig.18 As shown in (a); in the video display interface 725, the video icon 726; the electronic device detects the operation of clicking the video icon 726, such as Fig.18 After the electronic device detects the operation of clicking the video icon 726, it displays the playback display interface 727, which includes the enhanced processing control 728, as shown in (c) of 18; the electronic device detects the operation of clicking the enhanced processing control 728, as shown in (c) of 18; Fig.18 Optionally, after the electronic device detects the operation of clicking the enhanced processing control 728, the electronic device may display an editing display interface, such as Fig.14 As shown in (a) of the figure; for subsequent editing operations on the original video, please refer to Figures 14 to 16 The relevant description will not be repeated here; alternatively, after the electronic device detects the operation of clicking the enhanced processing control 728, the electronic device can automatically execute the method for enhancing video quality provided in the embodiment of the present application.
[0504] Alternatively, if Fig.18 As shown in the interface diagram, the user can enhance the video quality through the enhancement controls in the playback display interface, that is, trigger the electronic device to execute the method for enhancing video quality provided in the embodiment of the present application.
[0505] For example, the electronic device detects the operation of clicking the icon of the video in the gallery and displays the play display interface 729; the play display interface 729 includes more controls 730, such as Fig.19 As shown in (a); the electronic device detects the operation of clicking more controls 730, such as Fig.19 As shown in (b); after the electronic device detects the operation of clicking more controls 730, a display interface 731 is displayed; the display interface 731 includes a prompt box 732, and the prompt box 732 includes a video enhancement option, such as Fig.19 As shown in (c) in FIG. 1 ; the electronic device detects the operation of clicking the video enhancement option in the prompt box 732, such as Fig.19 Optionally, after the electronic device detects the operation of clicking the enhancement option, the electronic device may display an editing display interface, such as Fig.14 As shown in (a) of the figure; for subsequent editing operations on the original video, please refer to Figures 14 to 16 The related description is not repeated here; alternatively, after the electronic device detects the operation of clicking the enhancement option, the electronic device can automatically execute the method for enhancing video quality provided in the embodiment of the present application.
[0506] Alternatively, if Fig.19 As shown in the interface diagram, the user can enhance the video quality through the video enhancement option in the more controls in the playback display interface, that is, trigger the electronic device to execute the method for enhancing video quality provided in the embodiment of the present application.
[0507] Exemplarily, after the electronic device detects the operation of clicking more controls, a prompt box 733 is displayed; the prompt box 733 includes setting options, such as Fig. 20 As shown in (a) of FIG. 1 ; the electronic device detects the operation of clicking the setting option in the prompt box 733, such as Fig. 20 After the electronic device detects the operation of clicking the setting option in the prompt box 733, the setting display interface 734 is displayed, and the setting display interface includes a video enhancement control 735, such as Fig. 20 As shown in (c) in FIG. 1 ; the electronic device detects the operation of clicking the video enhancement control 735, such as Fig. 20 Optionally, after the electronic device detects the operation of clicking the video enhancement control 735, the electronic device may display an editing display interface, such as Fig.14 As shown in (a) of the figure; for subsequent editing operations on the original video, please refer to Figures 14 to 16 The relevant description is not repeated here; alternatively, after the electronic device detects the operation of clicking the video enhancement control 735, the electronic device can automatically execute the method for enhancing video quality provided in the embodiment of the present application.
[0508] Alternatively, if Fig. 20 As shown in the interface diagram, the user can enhance the video quality through the setting controls in the more controls in the playback display interface, that is, trigger the electronic device to execute the method for enhancing video quality provided in the embodiment of the present application.
[0509] In an embodiment of the present application, before an electronic device plays a video (for example, plays a locally stored video or plays a received video), the electronic device may display a prompt message; the prompt is used to indicate whether to perform video enhancement processing.
[0510] Exemplarily, the electronic device displays a video display interface 736, which includes a video icon 737; the electronic device detects an operation of clicking the video icon 737, such as Fig.21 As shown in (a); after the electronic device detects the operation of clicking the video icon 737, the play display interface 738 is displayed; the play display interface 738 includes a play control 739, such as Fig.21 As shown in (b); the electronic device detects the operation of clicking the play control 739, such as Fig.21 As shown in (c) in the figure; after the electronic device detects the operation of clicking the play control 739, the electronic device displays a prompt box 740, which is used to prompt whether to perform video enhancement; the prompt box 740 includes a yes option 741 and a no option 742, such as Fig.21 As shown in (d) in the figure; optionally, if the electronic device detects the operation of clicking yes option 741, the electronic device executes the method for enhancing video quality provided in the embodiment of the present application, that is, the electronic device plays the video after the video quality enhancement processing; if the electronic device detects the operation of clicking no option 742, the electronic device plays the original video, that is, the unprocessed video.
[0511] Exemplarily, the chat interface 743 includes a video 744, such as Fig. 22 As shown in (a) in FIG. 7 ; the electronic device detects the operation of clicking the play control in the video 744, such as Fig. 22 As shown in (b) in FIG. 1 ; after the electronic device detects the operation of clicking the play control in the video 744, the play display interface is displayed; the play display interface includes a prompt box 745, and the prompt box 745 is used to prompt whether to perform video enhancement; the prompt box 745 includes a yes option 746 and a no option 747, such as Fig. 22 As shown in (c) in the figure; optionally, if the electronic device detects the operation of clicking yes option 745, the electronic device executes the method for enhancing video quality provided in the embodiment of the present application, that is, the electronic device plays the video after the video quality enhancement processing; if the electronic device detects the operation of clicking no option 747, the electronic device plays the original video, that is, the unprocessed video.
[0512] In an embodiment of the present application, before performing image quality enhancement processing on the video to be played, the video to be played can be analyzed first; factors affecting the video quality of the video to be played are determined; after determining the factors affecting the video quality of the video to be played, the image quality enhancement processing can be performed on the video to be played in a targeted manner, thereby improving the video quality of the video to be played; compared with the existing method of directly performing enhancement processing on a certain aspect of the video to be played, the scheme in the embodiment of the present application can intelligently analyze the reasons for the poor video quality of the video to be played; thereby, the image quality enhancement processing can be performed on the video to be played in a targeted manner, thereby improving the video quality of the video to be played.
[0513] It should be understood that the above examples are intended to help those skilled in the art understand the embodiments of the present application, rather than to limit the embodiments of the present application to the specific numerical values or specific scenarios illustrated. Those skilled in the art can obviously make various equivalent modifications or changes based on the above examples, and such modifications or changes also fall within the scope of the embodiments of the present application.
[0514] Combination of the above Figures 1 to 22 The method for enhancing the image quality of a video provided by the embodiment of the present application is described in detail; Figure 23 to Figure 24 The device embodiments of the present application are described in detail. It should be understood that the device in the embodiments of the present application can execute the various methods of the aforementioned embodiments of the present application, that is, the specific working processes of the following various products can refer to the corresponding processes in the aforementioned method embodiments.
[0515] Fig.23 800 is a schematic diagram of a structure of an electronic device provided in an embodiment of the present application. The electronic device 800 includes a processing module 810 and a display module 820 .
[0516] Among them, the processing module 810 is used to obtain the video to be played; the display module 820 is used to display a first display interface, and the first display interface includes the video to be played; the processing module 810 is also used to detect the playback operation of the video to be played; in response to the playback operation, determine whether the first parameter of the video to be played is less than a first preset threshold, and the first parameter includes resolution; if the first parameter is less than the first preset threshold, determine whether the second parameter of the video to be played meets the first preset condition; the second parameter includes a dynamic range value and a high-frequency information value, and the first preset condition includes that the dynamic range value of the video to be played is less than the second preset threshold, and / or the high-frequency information value of the video to be played is less than the third preset threshold, and the high-frequency information value is the cumulative value of the high-frequency information in the frequency domain image of the video to be played, and the high-frequency information includes the edge information and detail information of the image in the video to be played; based on the first parameter and / or the second parameter, the video to be played is enhanced to generate an enhanced video; display or save the enhanced video.
[0517] Optionally, as an embodiment, the processing module 810 is specifically configured to:
[0518] The enhancement processing is performed on the brightness channel data of the video to be played based on the first parameter and / or the second parameter to generate the enhanced video.
[0519] Optionally, as an embodiment, the processing module 810 is specifically configured to:
[0520] Obtaining the classification label of the video to be played;
[0521] Determine whether the classification label belongs to a preset label, wherein the preset label includes a first label and a second label;
[0522] If the classification label belongs to the first label, determining whether the value of the dynamic range of the video to be played is less than the second preset threshold, the value of the dynamic range being obtained based on the proportion of the number of pixels in the first grayscale interval in the histogram of the video to be played;
[0523] The step of performing enhancement processing on the to-be-played video based on the first parameter and / or the second parameter to generate an enhanced video includes:
[0524] If the value of the dynamic range is less than the second preset threshold, the video to be played is enhanced based on the value of the dynamic range to generate the enhanced video.
[0525] Optionally, as an embodiment, the processing module 810 is specifically configured to:
[0526] Determine whether the proportion of the number of pixels in the first grayscale interval in the histogram of the video to be played is greater than a fourth preset threshold.
[0527] Optionally, as an embodiment, the processing module 810 is specifically configured to:
[0528] Obtaining a percentage value of the number of pixels in the first grayscale interval;
[0529] Obtaining a first value and a second value based on a ratio of the number of pixels in the first grayscale interval;
[0530] Based on the first value, the second value and the preset coordinate data, a mapping relationship is obtained, where the mapping relationship is used to indicate a correlation relationship between an input grayscale value and an output grayscale value;
[0531] The enhancement processing is performed on the video to be played based on the mapping relationship to generate the enhanced video.
[0532] Optionally, as an embodiment, the processing module 810 is specifically configured to:
[0533] The enhancement processing is performed on the brightness channel of the video to be played based on the mapping relationship to generate the enhanced video.
[0534] Optionally, as an embodiment, the mapping relationship is a mapping curve, and the proportion of the number of pixels in the first grayscale interval is proportional to the curvature of the mapping curve.
[0535] Optionally, as an embodiment, the processing module 810 is further configured to:
[0536] If the classification label belongs to the second label, determining whether the value of the high-frequency information of the to-be-played video is less than a third preset threshold;
[0537] The step of performing enhancement processing on the to-be-played video based on the first parameter and / or the second parameter to generate an enhanced video includes:
[0538] If the proportion of the high-frequency information is less than a third preset threshold, the to-be-played video is enhanced based on the value of the high-frequency information to generate the enhanced video.
[0539] Optionally, as an embodiment, the processing module 810 is specifically configured to:
[0540] Generate a frequency graph of the video to be played by performing Fourier transform processing on the brightness channel data of the video to be played;
[0541] Determine, based on the frequency graph, a cumulative value of a high-frequency region in the frequency graph, where the cumulative value of the high-frequency region is a value obtained by traversing each pixel point in the high-frequency region;
[0542] Obtaining a Laplace sharpening coefficient based on the cumulative value of the high-frequency area, a preset slope value, and a preset intercept value;
[0543] Obtaining a first video based on the Laplace sharpening coefficient and the second-order gradient image of the video to be played;
[0544] The video to be played is fused with the first video to generate the enhanced video.
[0545] Optionally, as an embodiment, the processing module 810 is specifically configured to:
[0546] Determine whether the first parameter of each frame of data in the to-be-played video is less than the first preset threshold.
[0547] Optionally, as an embodiment, the processing module 810 is specifically configured to:
[0548] Determine whether the first parameter of the preset frame data in the video to be played is less than the first preset threshold.
[0549] Optionally, as an embodiment, the processing module 810 is specifically configured to:
[0550] Determine whether the second parameter of each frame of data in the to-be-played video satisfies the first preset condition.
[0551] Optionally, as an embodiment, the processing module 810 is specifically configured to:
[0552] Determine whether the second parameter of the preset frame data in the video to be played meets the first preset condition.
[0553] Optionally, as an embodiment, the detecting a play operation on the to-be-played video includes:
[0554] Displaying a second display interface, wherein the second display interface includes a first prompt box, wherein the first prompt box is used to prompt whether to perform the enhancement processing on the video to be played, and the first prompt box includes a first control, wherein the first control is used to indicate whether to perform the enhancement processing on the video to be played;
[0555] In response to the playing operation, determining whether a first parameter of the to-be-played video is less than a first preset threshold value includes:
[0556] detecting a first operation on the first control;
[0557] In response to the first operation, it is determined whether the first parameter of the video to be played is less than the first preset threshold.
[0558] Optionally, as an embodiment, in the case of saving the enhanced video, the processing module 810 is further used to:
[0559] Displaying a second prompt box, where the second prompt box is used to prompt the storage method of the enhanced video;
[0560] Among them, the storage method includes: a first storage method and a second storage method, the first storage method is a storage method for replacing the video to be played with the enhanced video, and the second storage method is a storage method for storing the enhanced video in a first storage area, and the first storage area is different from the storage area for storing the video to be played.
[0561] Optionally, as an embodiment, the processing module 810 is specifically configured to:
[0562] Acquire the video to be played in the electronic device; or,
[0563] The video to be played sent by a first electronic device is received, where the first electronic device is a capture device for the video to be played.
[0564] It should be noted that the electronic device 800 is implemented in the form of a functional module. The term "module" here can be implemented in the form of software and / or hardware, and is not specifically limited to this.
[0565] For example, a "module" may be a software program, a hardware circuit, or a combination of the two that implements the above functions. The hardware circuit may include an application specific integrated circuit (ASIC), an electronic circuit, a processor (such as a shared processor, a dedicated processor, or a group processor, etc.) and a memory for executing one or more software or firmware programs, a combined logic circuit, and / or other suitable components that support the described functions.
[0566] Therefore, the units of each example described in the embodiments of the present application can be implemented by electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of the present application.
[0567] Fig.24 A structural schematic diagram of an electronic device provided by the present application is shown. Fig.24 The dotted line in the figure indicates that the unit or the module is optional; the electronic device 900 can be used to implement the method described in the above method embodiment.
[0568] The electronic device 900 includes one or more processors 901, which can support the electronic device 900 to implement the method for enhancing video quality in the method embodiment. The processor 901 can be a general-purpose processor or a special-purpose processor. For example, the processor 901 can be a central processing unit (CPU), a digital signal processor (DSP), an application specific integrated circuit (ASIC), a field programmable gate array (FPGA), or other programmable logic devices, such as discrete gates, transistor logic devices, or discrete hardware components.
[0569] The processor 901 may be used to control the electronic device 900, execute software programs, and process data of the software programs. The electronic device 900 may also include a communication unit 905 to implement input (reception) and output (transmission) of signals.
[0570] For example, the electronic device 900 may be a chip, the communication unit 905 may be an input and / or output circuit of the chip, or the communication unit 905 may be a communication interface of the chip, and the chip may be a component of a terminal device or other electronic devices.
[0571] For another example, the electronic device 900 may be a terminal device, and the communication unit 905 may be a transceiver of the terminal device, or the communication unit 905 may be a transceiver circuit of the terminal device.
[0572] The electronic device 900 may include one or more memories 902 on which a program 904 is stored. The program 904 can be executed by the processor 901 to generate instructions 903, so that the processor 901 executes the method for enhancing video quality described in the above method embodiment according to the instructions 903.
[0573] Optionally, data may also be stored in the memory 902 .
[0574] Optionally, the processor 901 may also read data stored in the memory 902 . The data may be stored at the same storage address as the program 904 , or may be stored at a different storage address from the program 904 .
[0575] The processor 901 and the memory 902 may be provided separately or integrated together, for example, integrated on a system on chip (SOC) of the terminal device.
[0576] Exemplarily, the memory 902 can be used to store a related program 904 of the method for enhancing video quality provided in an embodiment of the present application, and the processor 901 can be used to call the related program 904 of the method for enhancing video quality stored in the memory 902 when executing the method for enhancing video quality, and execute the method for enhancing video quality in an embodiment of the present application; for example, obtaining a video to be played; displaying a first display interface, the first display interface including the video to be played; detecting a play operation on the video to be played; in response to the play operation, determining whether a first parameter of the video to be played is less than a first preset threshold, the first parameter including resolution; if the first parameter is less than the first preset threshold, determining whether a second parameter of the video to be played meets a first preset condition; the second parameter includes a value of a dynamic range and a value of high-frequency information, the first preset condition includes that the value of the dynamic range of the video to be played is less than the second preset threshold, and / or, the value of the high-frequency information of the video to be played is less than the third preset threshold, the value of the high-frequency information is the cumulative value of the high-frequency information in the frequency domain image of the video to be played, and the high-frequency information includes edge information and detail information of the image in the video to be played; enhancing the video to be played based on the first parameter and / or the second parameter to generate an enhanced video; displaying or saving the enhanced video.
[0577] The present application also provides a computer program product, which, when executed by the processor 901, implements the method for enhancing video quality of any method embodiment in the present application.
[0578] The computer program product may be stored in the memory 902 , for example, a program 904 , which is converted into an executable target file that can be executed by the processor 901 after preprocessing, compiling, assembling, linking and other processing processes.
[0579] The present application also provides a computer-readable storage medium on which a computer program is stored, and when the computer program is executed by a computer, the method for enhancing video quality described in any method embodiment of the present application is implemented. The computer program can be a high-level language program or an executable target program.
[0580] The computer-readable storage medium is, for example, a memory 902. The memory 902 may be a volatile memory or a nonvolatile memory, or the memory 902 may include both a volatile memory and a nonvolatile memory. Among them, the nonvolatile memory may be a read-only memory (ROM), a programmable read-only memory (PROM), an erasable programmable read-only memory (EPROM), an electrically erasable programmable read-only memory (EEPROM), or a flash memory. The volatile memory may be a random access memory (RAM), which is used as an external cache. By way of example and not limitation, many forms of RAM are available, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), double data rate synchronous dynamic random access memory (DDR SDRAM), enhanced synchronous dynamic random access memory (ESDRAM), synchronous link dynamic random access memory (SLDRAM), and direct rambus RAM (DR RAM).
[0581] Those of ordinary skill in the art will appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of this application.
[0582] Those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working processes of the systems, devices and units described above can refer to the corresponding processes in the aforementioned method embodiments and will not be repeated here.
[0583] In the several embodiments provided in the present application, it should be understood that the disclosed systems, devices and methods can be implemented in other ways. For example, the embodiments of the electronic device described above are only schematic. For example, the division of the modules is only a logical function division. There may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be an indirect coupling or communication connection through some interfaces, devices or units, which can be electrical, mechanical or other forms.
[0584] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0585] In addition, each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit.
[0586] It should be understood that in the various embodiments of the present application, the size of the serial number of each process does not mean the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of the present application.
[0587] In addition, the term "and / or" in this article is only a description of the association relationship of the associated objects, indicating that there can be three relationships. For example, A and / or B can represent: A exists alone, A and B exist at the same time, and B exists alone. In addition, the character " / " in this article generally indicates that the associated objects before and after are in an "or" relationship.
[0588] If the functions are implemented in the form of software functional units and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present application can be essentially or partly embodied in the form of a software product that contributes to the prior art. The computer software product is stored in a storage medium and includes several instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the methods described in the various embodiments of the present application. The aforementioned storage media include: various media that can store program codes, such as USB flash drives, mobile hard disks, read-only memories (ROM), random access memories (RAM), magnetic disks or optical disks.
[0589] The above is only a specific implementation of the present application, but the protection scope of the present application is not limited thereto. Any technician familiar with the technical field can easily think of changes or substitutions within the technical scope disclosed in the present application, which should be included in the protection scope of the present application. Therefore, the protection scope of the present application should be based on the protection scope of the claims. In short, the above is only a preferred embodiment of the technical solution of the present application, and is not used to limit the protection scope of the present application. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of the present application should be included in the protection scope of the present application.
Claims
1. A method for enhancing video quality, It is characterized in that Electronic devices used for playing videos, including: Displaying a first display interface, wherein the first display interface includes a video to be played; Detecting a play operation on the video to be played; In response to the playback operation, when a first parameter of the video to be played is less than a first preset threshold, the video to be played is enhanced by using a first algorithm based on the first parameter to generate an enhanced video; or, when the first parameter is greater than or equal to the first preset threshold, the video to be played is enhanced by using a second algorithm based on the first parameter and / or a second parameter to generate an enhanced video; Display or save the enhanced video; Among them, the first parameter includes resolution, the second parameter includes the numerical value of the dynamic range of the video to be played and the numerical value of the high-frequency information, the numerical value of the high-frequency information is the cumulative value of the high-frequency information in the frequency domain image of the video to be played, and the high-frequency information includes edge information and detail information of the image in the video to be played.
2. The method according to claim 1, It is characterized in that When the first parameter is greater than or equal to the first preset threshold, using a second algorithm to enhance the video to be played based on the first parameter and / or the second parameter includes: When the first parameter is greater than or equal to the first preset threshold and the second parameter satisfies a first preset condition, enhancing the video to be played by using the second algorithm based on the first parameter and / or the second parameter; The first preset condition includes that the value of the dynamic range of the video to be played is less than a second preset threshold, and / or the value of the high-frequency information of the video to be played is less than a third preset threshold.
3. The method according to claim 1, It is characterized in that The first algorithm is a super-resolution algorithm, and the second algorithm includes a contrast enhancement algorithm and / or an adaptive sharpness algorithm.
4. The method according to claim 3, It is characterized in that When the first parameter is greater than or equal to the first preset threshold and the second parameter satisfies a first preset condition, enhancing the video to be played by using the second algorithm based on the first parameter and / or the second parameter includes: When the first parameter is greater than or equal to the first preset threshold and the value of the dynamic range of the video to be played is less than the second preset threshold, based on the value of the dynamic range, using a contrast enhancement algorithm to enhance the video to be played; When the first parameter is greater than or equal to the first preset threshold and the value of the high-frequency information of the video to be played is less than a third preset threshold, an adaptive sharpness algorithm is used to enhance the video to be played based on the value of the high-frequency information.
5. The method according to claim 1, It is characterized in that When the first parameter is greater than or equal to the first preset threshold, enhancing the video to be played by using a second algorithm based on the first parameter and / or the second parameter, including: When the first parameter is greater than or equal to the first preset threshold and less than a fifth preset threshold, the second algorithm is used to enhance the video to be played based on the first parameter and / or the second parameter; Among them, the fifth preset threshold is greater than the first preset threshold.
6. The method according to claim 1, It is characterized in that The first preset threshold is 360P.
7. The method according to claim 1, It is characterized in that The step of performing enhancement processing on the to-be-played video by using a second algorithm based on the first parameter and / or the second parameter to generate an enhanced video includes: Based on the first parameter and / or the second parameter, the second algorithm is used to enhance the brightness channel data of the video to be played to generate the enhanced video.
8. The method according to claim 4, It is characterized in that Also includes: Obtaining the classification label of the video to be played; Determine whether the classification label belongs to a preset label, wherein the preset label includes a first label and a second label; If the classification label belongs to the first label, determine whether the value of the dynamic range of the video to be played is less than the second preset threshold, and the value of the dynamic range is obtained based on the proportion of the number of pixels in the first grayscale interval in the histogram of the video to be played.
9. The method according to claim 8, It is characterized in that The determining whether the value of the dynamic range of the video to be played is less than the second preset threshold comprises: Determine whether the proportion of the number of pixels in the first grayscale interval in the histogram of the video to be played is greater than a fourth preset threshold.
10. The method according to claim 8, It is characterized in that The step of enhancing the video to be played by using a contrast enhancement algorithm based on the value of the dynamic range includes: Obtaining a percentage value of the number of pixels in the first grayscale interval; Obtaining a first value and a second value based on a ratio of the number of pixels in the first grayscale interval; Based on the first value, the second value and the preset coordinate data, a mapping relationship is obtained, where the mapping relationship is used to indicate a correlation relationship between an input grayscale value and an output grayscale value; The enhancement processing is performed on the video to be played based on the mapping relationship.
11. The method according to claim 10, It is characterized in that The performing the enhancement processing on the to-be-played video based on the mapping relationship includes: The enhancement processing is performed on the brightness channel of the video to be played based on the mapping relationship.
12. The method according to claim 10, It is characterized in that The mapping relationship is a mapping curve, and the proportion of the number of pixels in the first grayscale interval is proportional to the curvature of the mapping curve.
13. The method according to claim 8, It is characterized in that Also includes: If the classification label belongs to the second label, it is determined whether the value of the high-frequency information of the video to be played is less than the third preset threshold.
14. The method according to claim 13, It is characterized in that The step of enhancing the video to be played by using an adaptive sharpness algorithm based on the value of the high-frequency information includes: Generate a frequency graph of the video to be played by performing Fourier transform processing on the brightness channel data of the video to be played; Determine, based on the frequency graph, a cumulative value of a high-frequency region in the frequency graph, where the cumulative value of the high-frequency region is a value obtained by traversing each pixel point in the high-frequency region; Obtaining a Laplace sharpening coefficient based on the cumulative value of the high-frequency area, a preset slope value, and a preset intercept value; Obtaining a first video based on the Laplace sharpening coefficient and the second-order gradient image of the video to be played; The video to be played is merged with the first video.
15. The method according to any one of claims 1 to 14, It is characterized in that Also includes: Determine whether the first parameter of each frame of data in the to-be-played video is less than the first preset threshold; or, Determine whether the first parameter of the preset frame data in the video to be played is less than the first preset threshold.
16. The method according to any one of claims 1 to 14, It is characterized in that Also includes: Determine whether the second parameter of each frame of data in the to-be-played video satisfies the first preset condition; or, Determine whether the second parameter of the preset frame data in the video to be played meets the first preset condition.
17. The method according to any one of claims 1 to 14, It is characterized in that Also includes: Displaying a second display interface, wherein the second display interface includes a first prompt box, wherein the first prompt box is used to prompt whether to perform the enhancement processing on the video to be played, and the first prompt box includes a first control, wherein the first control is used to indicate whether to perform the enhancement processing on the video to be played; detecting a first operation on the first control; In response to the first operation, it is determined whether the first parameter of the video to be played is less than the first preset threshold.
18. The method according to any one of claims 1 to 14, It is characterized in that In the case of saving the enhanced video, the method further includes: Displaying a second prompt box, where the second prompt box is used to prompt the storage method of the enhanced video; Among them, the storage method includes: a first storage method and a second storage method, the first storage method is a storage method for replacing the video to be played with the enhanced video, and the second storage method is a storage method for storing the enhanced video in a first storage area, and the first storage area is different from the storage area for storing the video to be played.
19. The method according to any one of claims 1 to 14, It is characterized in that Also includes: Acquire the video to be played in the electronic device; or, The video to be played sent by a first electronic device is received, where the first electronic device is a capture device for the video to be played.
20. An electronic device, It is characterized in that include: one or more processors and memory; The memory is coupled to the one or more processors, and the memory is used to store computer program codes, wherein the computer program codes include computer instructions, and the one or more processors call the computer instructions to enable the electronic device to perform the method as claimed in any one of claims 1 to 19.
21. A chip system, It is characterized in that The chip system is applied to an electronic device, and the chip system includes one or more processors, and the processor is used to call computer instructions so that the electronic device executes the method as described in any one of claims 1 to 19.
22. A computer-readable storage medium, It is characterized in that The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the processor is caused to perform the method according to any one of claims 1 to 19.
Citation Information
Patent Citations
Video data processing method, electronic equipment and readable storage medium
CN116055778A
Video image quality enhanced playing method and on-demand terminal
CN102811354A
A method and system for enhancing real-time video image quality of a mobile player
CN109345490A