Image processing method, device, electronic device and computer readable medium
The brightness level is determined through face detection and gray value analysis, and the neural network model is used for adaptive color enhancement, which solves the problem of poor color enhancement of face video images in the existing technology and improves the brightness adjustment accuracy and detection success. Rate.
Patent Information
- Application Number
- CN202010911742.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2020-09-02
- Publication Date
- 2024-09-06
- Estimated Expiration
- 2040-09-06
AI Technical Summary
When the existing technology processes video images containing human faces, the color enhancement effect is poor, resulting in brightness defects on the faces of the characters and affecting the detection or recognition success rate.
Obtain the grayscale value and grayscale mean value of the target face area through face detection, determine the target brightness level, perform color enhancement processing based on the brightness level, and use a neural network model for adaptive color enhancement.
It improves the accuracy of brightness adjustment in the face area, avoids over-darkness or over-exposure, improves color enhancement quality and detection success rate, while reducing computational complexity and improving computational efficiency.
Smart Images

Figure CN112069977B
Abstract
Description
Technical Field
[0001] The present disclosure relates to the field of image processing technology, and in particular to an image processing method, device, electronic device and computer-readable medium. Background Art
[0002] At present, the brightness of the captured video is often improper due to improper device parameter settings or changes in ambient light, resulting in dark or overexposed video images, which seriously affects the video viewing experience. In the later application of the video, such as detection or recognition, the loss of details due to improper brightness of the image will greatly reduce the success rate of detection or recognition. In the current intelligent color enhancement schemes for video images, the overall brightness of the image is usually focused on, and the color of the video image is enhanced according to the recognition results of the entire image. However, when faced with video images containing faces, the color enhancement results of the above methods are often unsatisfactory, and the brightness defects of the face cannot be improved.
[0003] Therefore, a new image processing method, device, electronic device and computer-readable medium are needed.
[0004] It should be noted that the information disclosed in the above background technology section is only used to enhance the understanding of the background of the present disclosure, and therefore may include information that does not constitute the prior art known to ordinary technicians in the field. Summary of the invention
[0005] The embodiments of the present disclosure provide an image processing method, device, electronic device and computer-readable medium, thereby improving the color enhancement quality of images including human faces in color enhancement processing at least to a certain extent.
[0006] Other features and advantages of the present disclosure will become apparent from the following detailed description, or may be learned in part by the practice of the present disclosure.
[0007] The disclosed embodiment proposes an image processing method, including: acquiring a target image; performing face detection on the target image to obtain a target face area; obtaining the grayscale value of each pixel in the target face area; obtaining a target grayscale value and a grayscale mean of the maximum number of pixels in the target face area based on the grayscale value of each pixel in the target face area; determining a target brightness level of the target face area based on the target grayscale value and the grayscale mean; and performing color enhancement processing on the target image based on the target brightness level.
[0008] The disclosed embodiment proposes an image processing device, including: an image acquisition module, configured to acquire a target image; a face detection module, configured to perform face detection on the target image to obtain a target face area; a grayscale acquisition module, configured to obtain the grayscale value of each pixel in the target face area; a grayscale statistics module, configured to obtain a target grayscale value and a grayscale mean of the maximum number of pixels in the target face area according to the grayscale value of each pixel in the target face area; a brightness level module, configured to determine a target brightness level of the target face area according to the target grayscale value and the grayscale mean of the target face area; and a color enhancement module, configured to perform color enhancement processing on the target image according to the target brightness level of the target face area.
[0009] In some exemplary embodiments of the present disclosure, the image processing device further includes a second grayscale acquisition module, a second grayscale statistics module, a second brightness level module, and a second color enhancement module. The second acquisition module is configured to obtain the grayscale value of each pixel in the target image if the target face area is not detected in the target image; the second grayscale statistics module is configured to obtain the target grayscale value, grayscale mean, and grayscale standard deviation of the largest number of pixels in the target image based on the grayscale value of each pixel in the target image; the second brightness level module is configured to determine the target brightness level of the target image based on the target grayscale value, grayscale mean, and grayscale standard deviation of the target image; and the second color enhancement module is configured to perform color enhancement processing on the target image based on the target brightness level of the target image.
[0010] In some exemplary embodiments of the present disclosure, the brightness level module includes a first brightness level unit, which is configured to determine that the target brightness level of the target image is the first brightness level if the target grayscale value is less than or equal to a first grayscale threshold and the grayscale mean is less than the first mean threshold; if the target grayscale value is greater than or equal to a second grayscale threshold and the grayscale mean is less than the first mean threshold, determine that the target brightness level of the target image is the first brightness level; wherein the second grayscale threshold is greater than the first grayscale threshold.
[0011] In some exemplary embodiments of the present disclosure, the brightness level module also includes a second brightness level unit, which is configured to determine that the target brightness level of the target image is a second brightness level if the target grayscale value is less than or equal to the first grayscale threshold and the grayscale mean is greater than the second mean threshold; wherein the second mean threshold is greater than the first mean threshold; if the target grayscale value is greater than or equal to the second grayscale threshold and the grayscale mean is greater than the second mean threshold, then the target brightness level of the target image is determined to be the second brightness level.
[0012] In some exemplary embodiments of the present disclosure, the brightness level module also includes a third brightness level unit, which is configured to determine that the brightness level of the target image is a third brightness level if the target grayscale value is less than or equal to the first grayscale threshold, and the grayscale mean is greater than or equal to the first mean threshold and less than or equal to the second mean threshold; or, if the target grayscale value is greater than or equal to the second grayscale threshold, and the grayscale mean is greater than or equal to the first mean threshold and less than or equal to the second mean threshold, then the brightness level of the target image is determined to be a third brightness level; or, if the target grayscale value is greater than the first grayscale threshold and less than the second grayscale threshold, then the brightness level of the target image is determined to be the third brightness level.
[0013] In some exemplary embodiments of the present disclosure, the color enhancement module includes: a first enhancement unit, a second enhancement unit, and a third enhancement unit. The first enhancement unit is configured to perform color enhancement processing on the target image using a first neural network model if the target brightness level of the target face area is a first brightness level, wherein the first neural network model is obtained by training with a first image training set including the first brightness level. The second enhancement unit is configured to perform color enhancement processing on the target image using a second neural network model if the target brightness level of the target face area is a second brightness level, wherein the second neural network model is obtained by training with a second image training set including the second brightness level. The third enhancement unit is configured to perform color enhancement processing on the target image using a third neural network model if the target brightness level of the target face area is a third brightness level, wherein the third neural network model is obtained by training with a third image training set including the third brightness level.
[0014] In some exemplary embodiments of the present disclosure, the image acquisition module includes a video acquisition unit, a target video unit and a target image unit. The video acquisition unit is configured to acquire a video to be processed. The target video unit is configured to obtain a target video according to the video to be processed. The target image unit is configured to determine the target image from the target video.
[0015] In some exemplary embodiments of the present disclosure, the color enhancement module includes a fourth enhancement unit, a fifth enhancement unit, a sixth enhancement unit, and a seventh enhancement unit. The fourth enhancement unit is configured to perform color enhancement processing on the target image in the target video using a fourth neural network model if the target brightness level of the target face area in the target video is a first brightness level and a third brightness level, wherein the fourth neural network model is obtained by training with a fourth image training set including a first brightness level and a third brightness level. The fifth enhancement unit is configured to perform color enhancement processing on the target image in the target video using a fifth neural network model if the target brightness level of the target face area in the target video is a second brightness level and a third brightness level, wherein the fifth neural network model is obtained by training with a fourth image training set including a second brightness level and a third brightness level. The sixth enhancement unit is configured to perform color enhancement processing on the target image in the target video using a sixth neural network model if the target brightness level of the target face area in the target video is a first brightness level and a second brightness level, wherein the sixth neural network model is obtained by training with a sixth image training set including a first brightness level and a second brightness level. The seventh enhancement unit is configured to perform color enhancement processing on the target image in the target video using a seventh neural network model if the target brightness level of the target face area in the target video is a first brightness level, a second brightness level, and a third brightness level, wherein the seventh neural network model is obtained by training using a seventh image training set including a first brightness level, a second brightness level, and a third brightness level.
[0016] In some exemplary embodiments of the present disclosure, the target video unit includes a shot detection subunit and a target video subunit. The shot detection subunit is configured to detect and obtain a shot mutation identification bit in the video to be processed. The target video subunit is configured to segment the video to be processed according to the shot mutation identification bit to obtain at least one target video.
[0017] In some exemplary embodiments of the present disclosure, the target image unit is configured to sample video frames of the target video at a preset sampling frequency to obtain at least one target image.
[0018] In some exemplary embodiments of the present disclosure, the grayscale statistics module includes a histogram unit, a first statistics unit, and a second statistics unit. The histogram unit is configured to perform grayscale statistics on the grayscale values of each pixel in the target image to obtain a grayscale histogram of the target image. The first statistics unit is configured to determine the grayscale value with the largest number of pixels in the target image according to the peak value of the grayscale histogram as the target grayscale value of the target image. The second statistics unit is configured to determine the grayscale mean of the target image according to the grayscale values of each pixel in the target image and the width and height values of the target image.
[0019] An embodiment of the present disclosure proposes an electronic device, comprising: at least one processor; and a storage device for storing at least one program, wherein when the at least one program is executed by the at least one processor, the at least one processor implements the image processing method as described in the above embodiment.
[0020] The embodiments of the present disclosure provide a computer-readable medium on which a computer program is stored. When the program is executed by a processor, the image processing method described in the above embodiments is implemented.
[0021] According to one aspect of the present application, a computer program product or a computer program is provided, the computer program product or the computer program comprising computer instructions, the computer instructions being stored in a computer-readable storage medium. A processor of a computer device reads the computer instructions from the computer-readable storage medium, and the processor executes the computer instructions, so that the computer device executes the above-mentioned image processing method or the method provided in various optional implementations of the image processing method.
[0022] In the technical solutions provided by some embodiments of the present disclosure, face detection is performed on a target image to obtain a target face area. The target grayscale value and grayscale mean are obtained based on the grayscale value of each pixel in the target face area, which can comprehensively characterize the brightness of the target face area from different dimensions, so that the obtained target brightness level can accurately reflect the brightness and darkness of the face of the person in the target image. This ensures that when the target image is color enhanced according to the target brightness of the target face area, the brightness of the target face area can be accurately adjusted to avoid the target face area from being too dark or overexposed. At the same time, only the target grayscale value and grayscale mean are calculated, which can greatly reduce the computational complexity and improve the computational efficiency while ensuring the quality of color enhancement.
[0023] It is to be understood that the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the present disclosure. BRIEF DESCRIPTION OF THE DRAWINGS
[0024] The drawings herein are incorporated into the specification and constitute a part of the specification, showing embodiments consistent with the present disclosure, and together with the specification, are used to explain the principles of the present disclosure. Obviously, the drawings described below are only some embodiments of the present disclosure, and for ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work. In the drawings:
[0025] Figure 1 A schematic diagram showing an exemplary system architecture to which the image processing method or device according to an embodiment of the present disclosure can be applied;
[0026] Figure 2 A flowchart of an image processing method according to an embodiment of the present disclosure is schematically shown;
[0027] Figure 3 is based on Figure 2 A flowchart of step S230 in an exemplary embodiment;
[0028] Figure 4 is based on Figure 2 A flowchart of step S250 in an exemplary embodiment;
[0029] Figure 5 is based on Figure 2 A flowchart of step S260 in an exemplary embodiment;
[0030] Figure 6 is based on Figure 2 A flowchart of step S210 in an exemplary embodiment;
[0031] Figure 7 is based on Figure 2 A flowchart of step S260 in an exemplary embodiment;
[0032] Figure 8 is based on Figure 6 A flowchart of step S620 in an exemplary embodiment;
[0033] Fig. 9 is based on Figure 2 A flowchart of step S240 in an exemplary embodiment;
[0034] Fig.10 A flowchart of an image processing method according to an embodiment of the present disclosure is schematically shown;
[0035] Fig.11 The following schematically shows an architecture diagram of a machine learning model according to an embodiment of the present disclosure;
[0036] Fig.12The following schematically shows an architecture diagram of a machine learning model according to an embodiment of the present disclosure;
[0037] Fig.13 A block diagram schematically shows an image processing device according to an embodiment of the present disclosure;
[0038] Fig.14 A schematic diagram of the structure of an electronic device suitable for implementing the embodiments of the present disclosure is shown. DETAILED DESCRIPTION
[0039] Example embodiments will now be described more fully with reference to the accompanying drawings. However, example embodiments can be implemented in a variety of forms and should not be construed as limited to the examples set forth herein; rather, these embodiments are provided so that this disclosure will be more comprehensive and complete and will fully convey the concept of the example embodiments to those skilled in the art.
[0040] In addition, the described features, structures or characteristics may be combined in one or more embodiments in any suitable manner. In the following description, many specific details are provided to provide a full understanding of the embodiments of the present disclosure. However, those skilled in the art will appreciate that the technical solutions of the present disclosure may be practiced without one or more of the specific details, or other methods, components, devices, steps, etc. may be adopted. In other cases, known methods, devices, implementations or operations are not shown or described in detail to avoid blurring the various aspects of the present disclosure.
[0041] The block diagrams shown in the accompanying drawings are only functional entities and do not necessarily correspond to physically independent entities. That is, these functional entities can be implemented in software form, or in at least one hardware module or integrated circuit, or in different networks and / or processor devices and / or microcontroller devices.
[0042] The flowcharts shown in the accompanying drawings are only exemplary and do not necessarily include all the contents and operations / steps, nor must they be executed in the order described. For example, some operations / steps can be decomposed, and some operations / steps can be combined or partially combined, so the actual execution order may change according to actual conditions.
[0043] Cloud technology refers to a hosting technology that unifies hardware, software, network and other resources within a wide area network or local area network to achieve data computing, storage, processing and sharing.
[0044] Cloud technology is a general term for network technology, information technology, integration technology, management platform technology, application technology, etc. based on the cloud computing business model. It can form a resource pool, which is used on demand and flexible and convenient. Cloud computing technology will become an important support. The background services of the technical network system require a large amount of computing and storage resources, such as video websites, picture websites and more portal websites. With the rapid development and application of the Internet industry, in the future, each item may have its own identification mark, which needs to be transmitted to the background system for logical processing. Data of different levels will be processed separately. All kinds of industry data need strong system backing support, which can only be achieved through cloud computing.
[0045] Artificial intelligence cloud service is generally referred to as AIaaS (AI as a Service). This is the service mode of a mainstream artificial intelligence platform. Specifically, the AIaaS platform will split several common AI services and provide independent or packaged services in the cloud. This service model is similar to opening an AI theme mall: all developers can access and use one or more artificial intelligence services provided by the platform through API interfaces. Some senior developers can also use the AI framework and AI infrastructure provided by the platform to deploy and operate their own cloud artificial intelligence services.
[0046] With the development of the Internet, real-time data streams, and the diversification of connected devices, as well as the demand for search services, social networks, mobile commerce, and open collaboration, cloud computing has developed rapidly. Different from the previous parallel distributed computing, the emergence of cloud computing will promote revolutionary changes in the entire Internet model and enterprise management model from a conceptual perspective.
[0047] Figure 1 A schematic diagram showing an exemplary system architecture to which the image processing method or apparatus according to an embodiment of the present disclosure can be applied is shown.
[0048] like Figure 1 As shown, the system architecture may include terminal devices 101, 103 and a server 102. The terminal devices 101, 103 may communicate with the server 105 via a communication link provided by a network. The network may include various connection types, such as wired, wireless communication links or optical fiber cables.
[0049] It should be understood that Figure 1 The number of terminal devices, networks and servers in the embodiment is only for illustration. According to the implementation requirements, there may be any number of terminal devices, networks and servers. For example, the server 105 may be a server cluster composed of multiple servers.
[0050] The user can use the terminal devices 101 and 103 to interact with the server 102 to receive or send messages, etc. The terminal devices 101 and 103 can be various electronic devices with display screens and supporting web browsing, including but not limited to smart phones, tablet computers, portable computers, desktop computers, wearable devices, virtual reality devices, smart cameras, smart homes, etc.
[0051] Server 102 can be an independent server, a server cluster or a distributed system composed of multiple servers, or a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, CDN (Content Delivery Network), as well as big data and artificial intelligence platforms.
[0052] In the disclosed embodiment, various clients such as a video client and a digital image processing client may be installed on the terminal devices 101 and 103. For example, a user may upload a video or image to the server 102 through the video client installed on the terminal device 101, and the server 102 may be a server of a video playback platform corresponding to the video client. After receiving the image sent by the terminal device 101, the server 102 may obtain the target image; perform face detection on the target image to obtain the target face area; obtain the grayscale value of each pixel in the target face area; obtain the target grayscale value and grayscale mean of the maximum number of pixels in the target face area according to the grayscale value of each pixel in the target face area; determine the target brightness level of the target face area according to the target grayscale value and grayscale mean of the target face area; perform color enhancement processing on the target image according to the target brightness level of the target face area. The processing result is fed back to the terminal device 101, and then the terminal device 101 may display the target image after color enhancement processing through the screen or further perform other processing on the target image after color enhancement processing, so as to achieve a fast processing process of the image while ensuring the quality of color enhancement.
[0053] For another example, the server 102 can obtain a video to be processed; obtain a target video based on the video to be processed; determine a target image from the target video; perform face detection on the target image to obtain a target face area; obtain the grayscale value of each pixel in the target face area; obtain the target grayscale value and grayscale mean with the largest number of pixels in the target face area based on the grayscale value of each pixel in the target face area; determine the target brightness level of the target face area based on the target grayscale value and grayscale mean of the target face area; perform color enhancement processing on the target image based on the target brightness level of the target face area, and feed back the processing result to the terminal device 101, so that the user can browse the video to be processed after color enhancement processing based on the content displayed on the terminal device 101, thereby improving the user's viewing experience.
[0054] Figure 2 The flowchart of the image processing method according to an embodiment of the present disclosure is schematically shown. The method provided by the embodiment of the present disclosure can be processed by any electronic device with computing processing capabilities, such as the above Figure 1 The server 102 and / or terminal devices 101 and 103 in the embodiment are described by taking the server 102 as the execution subject in the following embodiment, but the present disclosure is not limited to this.
[0055] like Figure 2 As shown, the image processing method provided by the embodiment of the present disclosure may include the following steps.
[0056] In step S210, a target image is acquired.
[0057] In the disclosed embodiment, the target image may be obtained, for example, based on video frame sampling in a video.
[0058] In step S220, face detection is performed on the target image to obtain a target face area.
[0059] In the disclosed embodiments, the target image may be subjected to face detection by, for example but not limited to, an adaptive reinforcement learning algorithm (AdaBoost algorithm) to obtain a target face region. The adaptive reinforcement learning algorithm is a type of ensemble learning, and its main idea is that a weak classifier is equivalent to a strong classifier. The calculation method of the adaptive reinforcement learning algorithm is mainly to minimize the error of a strong classifier composed of several weak classifiers by continuously iterating two sets of weights. Among them, the target face region may include at least one. Each target face region may be an image block containing face pixels in the target image.
[0060] In step S230, the grayscale value of each pixel in the target face area is obtained.
[0061] In the disclosed embodiment, the gray value is a measure of the gray degree of a certain pixel in the image in a black and white image. In a grayscale image, it is usually displayed as a grayscale from the darkest black to the brightest white. The relationship between white and black is divided into several levels according to a logarithmic relationship, which is called "grayscale level". The range is generally from 0 to 255, with white being 255 and black being 0.
[0062] In step S240, the target grayscale value and grayscale mean value of the pixel with the largest number in the target face area are obtained according to the grayscale value of each pixel in the target face area.
[0063] In the disclosed embodiment, the target grayscale value with the largest number of pixels in the target face area refers to the grayscale value with the largest number of pixels among the numbers of pixels of each grayscale value obtained after counting the grayscale values of each pixel in the target face area. The grayscale mean is obtained by performing a mean operation on the grayscale values of each pixel in the target face area. The grayscale mean can be calculated, for example, according to the following formula:
[0064]
[0065] Among them, ave is the grayscale mean, k is the number of target face areas, Gray k (i, j) is the grayscale value of the pixel with coordinates (i, j) in the kth target face area, width k is the width of the kth target face area, height k is the height value of the kth target face area. 0<i<width k , 0<j<height k .
[0066] In step S250, a target brightness level of the target face area is determined according to the target grayscale value and the grayscale mean of the target face area.
[0067] In the disclosed embodiment, the target grayscale value and the grayscale mean may be analyzed and processed, and the target brightness level may be determined according to the analysis and processing results.
[0068] The target grayscale value and the grayscale mean may be processed according to a mapping table of preset value ranges and brightness levels, and the matched brightness level may be determined as the target brightness level.
[0069] In step S260, color enhancement processing is performed on the target image according to the target brightness level of the target face area.
[0070] In the disclosed embodiment, a specific scheme for color enhancement of a target image can be determined according to the target brightness level, and the target image can be color enhanced according to the specific scheme. For example, different color enhancement schemes can be set according to different target brightness levels.
[0071] In an exemplary embodiment, the target image may be subjected to color enhancement processing according to the trained machine learning model, and the color enhancement processing result of the target image may be determined according to the output result of the machine learning model. The machine learning model may be, for example, but not limited to, a convolutional neural network, but the present disclosure does not specifically limit this.
[0072] The image processing method provided by the embodiment of the present disclosure performs face detection on the target image to obtain the target face area. The target grayscale value and grayscale mean are obtained according to the grayscale value of each pixel in the target face area, which can comprehensively characterize the brightness of the target face area from different dimensions, so that the obtained target brightness level can accurately reflect the brightness and darkness of the face of the person in the target image. This ensures that when the target image is color enhanced according to the target brightness of the target face area, the brightness of the target face area can be accurately adjusted to avoid the target face area from being too dark or overexposed. At the same time, only the target grayscale value and grayscale mean are calculated, which can greatly reduce the computational complexity and improve the computational efficiency while ensuring the quality of color enhancement.
[0073] Figure 3 The flowchart of an image processing method according to an embodiment of the present disclosure is schematically shown.
[0074] like Figure 3 As shown, the image processing method provided by the embodiment of the present disclosure may include the following steps.
[0075] In step S310, if the target face area is not detected in the target image, the grayscale value of each pixel in the target image is obtained.
[0076] In step S320, according to the grayscale value of each pixel in the target image, the target grayscale value, grayscale mean value and grayscale standard deviation of the pixel with the largest number in the target image are obtained.
[0077] In the disclosed embodiment, the target grayscale value with the largest number of pixels in the target image refers to the grayscale value with the largest number of pixels among the numbers of pixels of each grayscale value obtained after counting the grayscale values of each pixel in the target image. The grayscale mean is obtained by performing a mean operation on the grayscale values of each pixel in the target image. The grayscale mean of the target image can be calculated, for example, according to the following formula:
[0078]
[0079] Where ave is the grayscale mean, Gray(i, j) is the grayscale value of the pixel with coordinates (i, j) of the target image, width is the width of the target image, and height is the height of the target image. 0<i<width, 0<j<height.
[0080] The grayscale standard deviation is obtained by performing a standard deviation operation on the grayscale values of each pixel in the target image. The grayscale standard deviation can be calculated, for example, according to the following formula:
[0081]
[0082] Among them, std is the grayscale standard deviation.
[0083] In step S330, a target brightness level of the target image is determined according to the target grayscale value, grayscale mean and grayscale standard deviation of the target image.
[0084] In an exemplary embodiment, step S330 may further include the following steps S331 - S335 .
[0085] In step S331 , if the target grayscale value is greater than the first grayscale threshold and less than the second grayscale threshold, it is determined that the target brightness level of the target image is the third brightness level.
[0086] In step S332, if the target grayscale value is greater than 0 and less than or equal to the first grayscale threshold, the grayscale mean is less than the third mean threshold, and the grayscale standard deviation is less than the first standard deviation threshold, then the target brightness level of the target image is confirmed to be the first brightness level.
[0087] The third mean value threshold may be, for example but not limited to, 60.
[0088] In step S333, if the target grayscale value is greater than 0 and less than or equal to the first grayscale threshold, the grayscale mean is greater than or equal to the third mean threshold, or the grayscale standard deviation is greater than or equal to the first standard deviation threshold, then the target brightness level of the target image is confirmed to be the third brightness level.
[0089] In step S334, if the target grayscale value is greater than or equal to the second grayscale threshold and less than or equal to 255, and the grayscale mean is greater than the second grayscale threshold, and the grayscale standard deviation is less than the first standard deviation threshold, then the target brightness level of the target image is confirmed to be the second brightness level.
[0090] In step S335, if the target grayscale value is greater than or equal to the second grayscale threshold and less than or equal to 255, the grayscale mean is less than or equal to the fourth mean threshold, or the grayscale standard deviation is greater than or equal to the first standard deviation threshold, then the target brightness level of the target image is confirmed to be the third brightness level.
[0091] The fourth mean value threshold may be, for example but not limited to, 180.
[0092] In step S340, color enhancement processing is performed on the target image according to the target brightness level of the target image.
[0093] In this embodiment, the brightness discrimination parameters of the target image when there is no face in the video screen are provided: the target gray value, gray mean and gray standard deviation of the target image with the largest number of pixels. The execution framework of the image processing method disclosed in the present invention is improved, and the scope of application of the image processing method disclosed in the present invention is improved.
[0094] Figure 4 is based on Figure 2 FIG. 1 is a flow chart of step S250 in an exemplary embodiment.
[0095] like Figure 4 As shown above Figure 2 Step S250 in the embodiment may further include the following steps.
[0096] In step S410, if the target grayscale value is less than or equal to the first grayscale threshold, and the grayscale mean is less than the first mean threshold, the target brightness level of the target image is determined to be the first brightness level.
[0097] In step S420, if the target grayscale value is greater than or equal to the second grayscale threshold and the grayscale mean is less than the first mean threshold, the target brightness level of the target image is determined to be the first brightness level; wherein the second grayscale threshold is greater than the first grayscale threshold.
[0098] In the embodiment of the present disclosure, the first grayscale threshold, the second grayscale threshold and the first mean threshold can be obtained based on experience. In an exemplary embodiment, the value of the first grayscale threshold can be, for example, 70, the second grayscale threshold can be, for example, 180, and the first mean threshold can be, for example, 30. However, the present disclosure does not make any special limitation on this. The first brightness level can be a level with relatively low brightness. Among them, when the target grayscale value and the grayscale mean meet the judgment conditions in step S410 or step S420, it can be considered that the overall brightness of the target face area is very small. The grayscale standard deviation reflects the size of the image color distribution. The smaller the standard deviation, the closer the pixel value distribution size of the target image is to the mean. The larger the standard deviation, the wider the pixel value distribution. Therefore, the smaller the grayscale standard deviation, the less brightness area appears in the target face area. Therefore, when the above-mentioned conditions of S410 or S420 are met, it is judged that the brightness of the target face area is relatively low, which is the first brightness level.
[0099] In an exemplary embodiment, the above Figure 2 Step S250 in the embodiment may further include the following steps.
[0100] In step S430, if the target grayscale value is less than or equal to the first grayscale threshold and the grayscale mean is greater than the second mean threshold, the target brightness level of the target image is determined to be the second brightness level; wherein the second mean threshold is greater than the first mean threshold.
[0101] In step S440, if the target grayscale value is greater than or equal to the second grayscale threshold, and the grayscale mean is greater than the second mean threshold, the target brightness level of the target image is determined to be the second brightness level.
[0102] In the embodiment of the present disclosure, the second mean threshold value can be obtained based on experience. In an exemplary embodiment, the second mean threshold value can be, for example, 200, but the present disclosure does not specifically limit this. The second brightness level can be a level of excessive brightness. When the target grayscale value and the grayscale mean value meet the judgment conditions in step S430 or S440, it can be considered that the overall brightness of the target face area is too bright, that is, the image is overexposed.
[0103] In an exemplary embodiment, the above Figure 2 Step S250 in the embodiment may further include the following steps.
[0104] In step S450, if the target grayscale value is less than or equal to the first grayscale threshold, and the grayscale mean is greater than or equal to the first mean threshold and less than or equal to the second mean threshold, the brightness level of the target image is determined to be the third brightness level.
[0105] In step S460, if the target grayscale value is greater than or equal to the second grayscale threshold, and the grayscale mean is greater than or equal to the first mean threshold and less than or equal to the second mean threshold, the target image brightness level is determined to be the third brightness level.
[0106] In step S470, if the target grayscale value is greater than the first grayscale threshold and less than the second grayscale threshold, the brightness level of the target image is determined to be the third brightness level.
[0107] In the embodiment of the present disclosure, the third brightness level may be a brightness level of medium brightness. The condition set included in this exemplary embodiment is the complement of the condition set included in steps S410-S440. That is, when any of the conditions in steps S410 to S440 are not met, it can be considered that the overall brightness of the target face area is at a medium level.
[0108] In this embodiment, by accurately analyzing and judging the two dimensions of the target grayscale value and the grayscale mean, the target brightness level of the target face area can be accurately analyzed and obtained according to the specific numerical values of the target grayscale value and the grayscale mean.
[0109] Figure 5 is based on Figure 2A flowchart of step S260 in an exemplary embodiment.
[0110] like Figure 5 As shown above Figure 2 Step S260 in the embodiment may further include the following steps: In this embodiment, the target image may be subjected to color enhancement processing according to the trained machine learning model, and the color enhancement processing result of the target image may be determined according to the output result of the machine learning model. Fig.11 The following schematically shows an architecture diagram of a machine learning model according to an embodiment of the present disclosure. Fig.11 As shown, the machine learning model may include a first neural network model 1110, a second neural network model 1120, a third neural network model 1130 and a switching module 1140. Among them, the network structure used by the first neural network model 1110 may be an image generation network, such as a super resolution model (Super Resolution Convolutional Neural Network, SRCNN), an image style conversion network (Cycle Generative Adversarial Networks, cycleGAN), etc. The network structure used by the second neural network model 1120 and the third neural network model 1130 may be the same as the first network model 1110 or other image generation models may be selected. The network structure of the first neural network model 1110 and the second neural network model 1120 and the third neural network model 1130 may be different or consistent. The main difference between the three network models is that even if the network structure is consistent, different image types are distinguished according to different scenes as the training set of the network, and network models of different scenes can be obtained through training. The switching module 1140 can select the corresponding set of neural network models for processing according to the target brightness level. For example, the switching module 1140 is provided with a judgment unit, which executes the above-mentioned process of steps S220 to S240 and / or steps S410 to S470. In addition, the switching module 1140 may further include a selection unit to select different neural network models according to the judgment result of the judgment unit. The machine learning model in this embodiment can be implemented, for example, through the framework of an artificial intelligence cloud service.
[0111] In step S510, if the target brightness level of the target face area is a first brightness level, the target image is color enhanced using the first neural network model 1110, wherein the first neural network model 1110 is trained using a first image training set including a first brightness level.
[0112] In the disclosed embodiment, the first neural network model 1110 may be selected, for example, according to the switching module 1140 to perform color enhancement processing on the target image.
[0113] In an exemplary embodiment, if the target brightness level of the target face area is the first brightness level, the brightness and contrast can be specially adjusted by adjusting the lightness channel (L channel) in the color mode (LAB channel) to restore more details, and then the chromaticity can be adjusted to achieve color enhancement processing of the target image.
[0114] In step S520, if the target brightness level of the target face area is the second brightness level, the target image is color enhanced using the second neural network model 1120, wherein the second neural network model 1120 is trained using a second image training set including the second brightness level.
[0115] In the disclosed embodiment, the second neural network model 1120 may be selected, for example, according to the switching module 1140 to perform color enhancement processing on the target image.
[0116] In an exemplary embodiment, if the target brightness level of the target facial area is the second brightness level, the brightness and contrast can be specially adjusted by adjusting the lightness channel (L channel) in the color mode (LAB channel) to restore more details, and then the chromaticity can be adjusted to achieve color enhancement processing of the target image.
[0117] In step S530, if the target brightness level of the target face area is the third brightness level, the target image is color enhanced using the third neural network model 1130, wherein the third neural network model 1130 is obtained by training using a third image training set including a third brightness level.
[0118] In the disclosed embodiment, the third neural network model 1130 may be selected, for example, according to the switching module 1140 to perform color enhancement processing on the target image.
[0119] In an exemplary embodiment, when the target brightness level of the target face area is the third brightness level, the color enhancement processing of the target image can also be achieved by enhancing the brightness, contrast and saturation.
[0120] In this embodiment, different color enhancement methods are used to process target images with different brightness levels. When facing a target image including a face, the brightness of the target face area in the target image can be adaptively and effectively adjusted to avoid an image that is too dark or overexposed in the face area. When facing a target image that does not include a face, the brightness of the target image can also be adaptively and effectively adjusted.
[0121] Figure 6is based on Figure 2 FIG. 1 is a flow chart of step S210 in an exemplary embodiment.
[0122] like Figure 6 As shown above Figure 2 Step S210 in the embodiment may further include the following steps.
[0123] In step S610, a video to be processed is obtained.
[0124] In step S620, a target video is obtained according to the video to be processed.
[0125] In the disclosed embodiment, for example, by detecting scene cuts, the video to be processed can be segmented according to the detection result of the scene cuts to obtain the target video. For example, a frame difference image of each video frame in the video to be processed and the previous frame can be obtained, and the mean of the frame difference image of the previous frame and the frame difference image obtained by the frame can be calculated, and by comparing the size and change of the frame difference mean, it can be determined whether the frame is a cut frame. The video to be processed is segmented according to the cut frames to obtain the target video.
[0126] In step S630, a target image is determined from the target video.
[0127] In an exemplary embodiment, the video frames of the target video may be sampled according to a preset sampling frequency to obtain at least one target image.
[0128] Figure 7 is based on Figure 2 A flowchart of step S260 in an exemplary embodiment.
[0129] like Figure 7 As shown above Figure 2 Step S260 in the embodiment may further include the following steps: In this embodiment, the target image may be subjected to color enhancement processing according to the trained machine learning model, and the color enhancement processing result of the target image may be determined according to the output result of the machine learning model. Fig.12 The following schematically shows an architecture diagram of a machine learning model according to an embodiment of the present disclosure. Fig.12As shown, the machine learning model may include a fourth neural network model 1210, a fifth neural network model 1220, a sixth neural network model 1230, a seventh neural network model 1240 and a switching module 1250. Among them, the network structure adopted by the fourth neural network model 1210 may be an image generation network, such as a super resolution model (Super Resolution Convolutional Neural Network, SRCNN), an image style conversion network (Cycle Generative Adversarial Networks, cycleGAN), etc. The network structure of the fourth neural network model 1210 and the fifth neural network model 1220, the sixth neural network model 1230 and the seventh neural network model 1240 may be different, or the same. The main difference between the four network models is that even if the network structure is consistent, different image types are distinguished according to different scenes as the network training set, and network models for different scenes can be obtained through training. The switching module 1250 can select the corresponding set of neural network models for processing according to the target brightness level. For example, the switching module 1250 is provided with a judgment unit, which executes the above-mentioned process of steps S220 to S240 and / or steps S410 to S470 and / or S610 to S630. In addition, the switching module 1250 may further include a selection unit to select different neural network models according to the judgment result of the judgment unit. The machine learning model in this embodiment can be implemented, for example, through the framework of artificial intelligence cloud service.
[0130] In step S710, if the target brightness level of the target face area in the target video is the first brightness level and the third brightness level, the target image in the target video is color enhanced using the fourth neural network model 1210, wherein the fourth neural network model 1210 is trained using a fourth image training set including the first brightness level and the third brightness level.
[0131] In the disclosed embodiment, since the target face areas of different target images in the target video include multiple brightness levels: the first brightness level and the third brightness level, the target image in the target video is processed by an artificial intelligence model that can process two brightness levels, and the target images of different brightness levels can be processed adaptively, so that each video frame in the target video obtained after the color enhancement processing has good color brightness. Avoid overly bright or overexposed video frames in the target video.
[0132] In the disclosed embodiment, the fourth neural network model 1210 may be selected, for example, according to the switching module 1250 to perform color enhancement processing on the target image.
[0133] In step S720, if the target brightness level of the target face area in the target video is the second brightness level and the third brightness level, the fifth neural network model 1220 is used to perform color enhancement processing on the target image in the target video, wherein the fifth neural network model 1220 is obtained by training using the fourth image training set including the second brightness level and the third brightness level.
[0134] In the disclosed embodiment, the fifth neural network model 1220 may be selected, for example, according to the switching module 1250 to perform color enhancement processing on the target image.
[0135] In step S730, if the target brightness level of the target face area in the target video is the first brightness level and the second brightness level, the sixth neural network model 1230 is used to perform color enhancement processing on the target image in the target video, wherein the sixth neural network model 1230 is trained using the sixth image training set including the first brightness level and the second brightness level.
[0136] In the disclosed embodiment, the sixth neural network model 1230 may be selected, for example, according to the switching module 1250 to perform color enhancement processing on the target image.
[0137] In step S740, if the target brightness level of the target face area in the target video is the first brightness level, the second brightness level, and the third brightness level, the target image in the target video is color enhanced using the seventh neural network model 1240, wherein the seventh neural network model 1240 is trained using the seventh image training set including the first brightness level, the second brightness level, and the third brightness level.
[0138] In the disclosed embodiment, the seventh neural network model 1240 may be selected, for example, according to the switching module 1250 to perform color enhancement processing on the target image.
[0139] In this embodiment, when batch processing video frames in a target video, the target brightness level of the target image in the target video is obtained, and different color enhancement methods are used to process the video frames of the target video with different brightness levels, so as to adaptively and effectively adjust the brightness of the target image.
[0140] Figure 8 is based on Figure 6 FIG. 1 is a flow chart of step S620 in an exemplary embodiment.
[0141] like Figure 8 As shown above Figure 6 Step S620 in the embodiment may further include the following steps.
[0142] In step S810, a shot mutation identification position in the video to be processed is detected and obtained.
[0143] In the disclosed embodiment, the frame difference images of adjacent frames in the video to be processed can be calculated, and a judgment can be made based on the size of the mean of the frame difference images, and the lens mutation identification position can be determined based on the judgment result. In an exemplary embodiment, before calculating the frame difference image, the video image can be first processed by frame division, and then each frame of the three-channel color image can be converted into a single-channel grayscale image; the obtained grayscale image is downsampled to solve the problem of excessive calculation of the algorithm for high-pixel images and improve the efficiency of the algorithm. The image is preprocessed using a filtering algorithm (such as a Gabor filtering algorithm). This method can effectively extract the content of the image and solve the problem of interference from sudden changes in light intensity.
[0144] In step S820, the video to be processed is segmented according to the shot mutation markers to obtain at least one target video.
[0145] In this embodiment, by detecting the shot mutation marker and cutting the video to be processed according to the shot mutation marker, the video to be processed can be divided according to the scene cut to obtain the target video, so that when color enhancement is performed on the target video as a unit, color enhancement can be performed on video frames with similar scenes in an aggregated manner, thereby improving the applicability of the color enhancement method selected during color enhancement processing.
[0146] Fig. 9 is based on Figure 2 FIG. 1 is a flow chart of step S240 in an exemplary embodiment.
[0147] like Fig. 9 As shown above Figure 2 Step S240 in the embodiment may further include the following steps.
[0148] In step S910, grayscale statistics are performed on the grayscale values of each pixel in the target face area to obtain a grayscale histogram of the target face area.
[0149] In the disclosed embodiment, the grayscale histogram is a function of grayscale distribution, which is a statistic of grayscale distribution in an image. The grayscale histogram is a function of grayscale, which indicates the number of pixels with a certain grayscale in an image, and reflects the frequency of occurrence of a certain grayscale in the image.
[0150] In step S920, the grayscale value with the largest number of pixels in the target face area is determined according to the peak value of the grayscale histogram, and is used as the target grayscale value of the target face area.
[0151] In the disclosed embodiment, the number of pixels with the largest number of occurrences may be determined based on the peak value in the grayscale histogram, and the grayscale value corresponding to the peak value may be determined as the target grayscale value.
[0152] In step S930, the grayscale mean value of the target face area is determined according to the grayscale value of each pixel in the target face area and the width value and the height value of the target face area.
[0153] In the embodiment of the present disclosure, the grayscale mean value can be obtained, for example, by formula (1), which will not be described in detail here.
[0154] Fig.10 The flowchart of an image processing method according to an embodiment of the present disclosure is schematically shown.
[0155] like Fig.10 As shown, the image processing method provided by this embodiment includes the following steps.
[0156] In step S1002, a video to be processed is obtained.
[0157] In step S1004, a shot mutation identification position in the video to be processed is detected and obtained.
[0158] In step S1006, the video to be processed is segmented according to the shot mutation markers to obtain at least one target video.
[0159] In step S1008, the video frames of the target video are sampled according to a preset sampling frequency to obtain at least one target image.
[0160] In step S1010, face detection is performed on the target image to obtain the target face region. If the detection fails, step S1028 is executed.
[0161] In step S1012, according to the grayscale value of each pixel in the target face area, the target grayscale value and the grayscale mean value of the pixel with the largest number in the target face area are obtained.
[0162] In steps S1014 to S1026, the target brightness level of the target face area is determined according to the target grayscale value and the grayscale mean value of the target face area. Specifically:
[0163] In step S1014, if the target grayscale value of the target face area is less than or equal to 70, and the grayscale mean value is less than 30, the target brightness level of the target image is determined to be the first brightness level.
[0164] In step S1016, if the target grayscale value of the target face area is greater than or equal to 200, and the grayscale mean value is less than 30, the target brightness level of the target image is determined to be the first brightness level.
[0165] In step S1018, if the target grayscale value of the target face area is less than or equal to 70, and the grayscale mean is greater than 200, the target brightness level of the target image is determined to be the second brightness level.
[0166] In step S1020, if the target grayscale value of the target face area is greater than or equal to 180, and the grayscale mean is greater than 200, the target brightness level of the target image is determined to be the second brightness level.
[0167] In step S1022, if the target grayscale value of the target face area is less than or equal to 70, and the grayscale mean is greater than or equal to 30 and less than or equal to 200, the brightness level of the target image is determined to be the third brightness level.
[0168] In step S1024, if the target grayscale value of the target face area is greater than or equal to 180, and the grayscale mean is greater than or equal to 30 and less than or equal to 200, the target image brightness level is determined to be the third brightness level.
[0169] In step S1026, if the target grayscale value of the target face area is greater than 70 and less than 180, the brightness level of the target image is determined to be the third brightness level.
[0170] In steps S1028 to S1040, the video frames in the target video are color enhanced according to the target brightness level of the target face area in the target video. The machine learning model in this embodiment can be implemented, for example, through the framework of artificial intelligence cloud services. Specifically:
[0171] In step S1028, if the target brightness level of the target face area in the target video is the first brightness level, the first neural network model is used to perform color enhancement processing on the video frames in the target video.
[0172] In step S1030, if the target brightness level of the target face area in the target video is the second brightness level, the second neural network model is used to perform color enhancement processing on the video frames in the target video.
[0173] In step S1032, if the target brightness level of the target face area in the target video is the third brightness level, the third neural network model is used to perform color enhancement processing on the video frames in the target video.
[0174] In step S1034, if the target brightness level of the target face area in the target video is the first brightness level and the third brightness level, the fourth neural network model is used to perform color enhancement processing on the video frames in the target video.
[0175] In step S1036, if the target brightness level of the target face area in the target video is the second brightness level and the third brightness level, the fifth neural network model is used to perform color enhancement processing on the video frames in the target video.
[0176] In step S1038, if the target brightness level of the target face area in the target video is the first brightness level and the second brightness level, the sixth neural network model is used to perform color enhancement processing on the video frames in the target video.
[0177] In step S1040, if the target brightness level of the target face area in the target video is the first brightness level, the second brightness level, and the third brightness level, the seventh neural network model is used to perform color enhancement processing on the video frames in the target video.
[0178] In step S1042, if face detection on the target image fails, the grayscale value of each pixel in the target image is obtained.
[0179] In step S1044, according to the grayscale value of each pixel in the target image, the target grayscale value, grayscale mean value and grayscale standard deviation of the pixel with the largest number in the target image are obtained.
[0180] In steps S1046 to S1054, the target brightness level of the target image is determined according to the target grayscale value, grayscale mean and grayscale standard deviation of the target image. Specifically:
[0181] In step S1046 , if the target grayscale value of the target image is greater than 70 and less than 180, it is determined that the target brightness level of the target image is the third brightness level.
[0182] In step S1048, if the target grayscale value of the target image is greater than 0 and less than or equal to 70, the grayscale mean is less than 60, and the grayscale standard deviation is less than 40, then the target brightness level of the target image is confirmed to be the first brightness level.
[0183] In step S1050, if the target grayscale value of the target image is greater than 0 and less than or equal to 70, the grayscale mean is greater than or equal to 60, or the grayscale standard deviation is greater than or equal to 40, then the target brightness level of the target image is confirmed to be the third brightness level.
[0184] In step S1052, if the target grayscale value of the target image is greater than or equal to 180 and less than or equal to 255, and the grayscale mean is greater than 180, and the grayscale standard deviation is less than 40, then the target brightness level of the target image is confirmed to be the second brightness level.
[0185] In step S1054, if the target grayscale value of the target image is greater than or equal to 2180 and less than or equal to 255, the grayscale mean is less than or equal to 180, or the grayscale standard deviation is greater than or equal to 40, then the target brightness level of the target image is confirmed to be the third brightness level.
[0186] In steps S1056 to S1068, the video frames in the target video are subjected to color enhancement processing according to the target brightness level of the target image in the target video. The machine learning model in this embodiment can be implemented, for example, through the framework of an artificial intelligence cloud service. Specifically:
[0187] In step S1056, if the target brightness level of the target image in the target video is the first brightness level, the first neural network model is used to perform color enhancement processing on the video frames in the target video.
[0188] In step S1058, if the target brightness level of the target image in the target video is the second brightness level, the second neural network model is used to perform color enhancement processing on the video frames in the target video.
[0189] In step S1060, if the target brightness level of the target image in the target video is the third brightness level, the third neural network model is used to perform color enhancement processing on the video frames in the target video.
[0190] In step S1062, if the target brightness level of the target image in the target video is the first brightness level and the third brightness level, the fourth neural network model is used to perform color enhancement processing on the video frames in the target video.
[0191] In step S1064, if the target brightness level of the target image in the target video is the second brightness level and the third brightness level, the fifth neural network model is used to perform color enhancement processing on the video frames in the target video.
[0192] In step S1066, if the target brightness level of the target image in the target video is the first brightness level and the second brightness level, the sixth neural network model is used to perform color enhancement processing on the video frames in the target video.
[0193] In step S1068, if the target brightness level of the target image in the target video is the first brightness level, the second brightness level, and the third brightness level, the seventh neural network model is used to perform color enhancement processing on the video frames in the target video.
[0194] In this embodiment, by detecting the shot mutation identification bits of the video to be processed and cutting the video to be processed according to the shot mutation identification bits, the video to be processed can be divided according to the scene shear to obtain the target video. When the target video is subsequently color enhanced according to the target brightness level of each target image in the target video, the video frames with similar scenes can be color enhanced in an aggregated manner, thereby improving the applicability of the color enhancement method selected during the color enhancement process. At the same time, when determining the target brightness level of each target image, different dimensions of analysis can be performed based on the target grayscale value and grayscale standard deviation of the target image, so that the obtained target brightness level has a high accuracy rate. Only the target grayscale value and grayscale mean are calculated, which can greatly reduce the computational complexity and improve the computational efficiency while ensuring the quality of color enhancement.
[0195] The following describes an apparatus embodiment of the present disclosure, which can be used to execute the above-mentioned image processing method of the present disclosure. For details not disclosed in the apparatus embodiment of the present disclosure, please refer to the above-mentioned image processing method embodiment of the present disclosure.
[0196] Fig.13 The block diagram schematically shows an image processing apparatus according to an embodiment of the present disclosure.
[0197] Reference Fig.13 As shown, according to an embodiment of the present disclosure, an image processing device 1300 may include: an image acquisition module 1310, a face detection module 1320, a grayscale acquisition module 1330, a grayscale statistics module 1340, a brightness level module 1350 and a color enhancement module 1360.
[0198] The image acquisition module 1310 may be configured to acquire a target image.
[0199] The face detection module 1320 may be configured to perform face detection on a target image to obtain a target face region.
[0200] The grayscale acquisition module 1330 may be configured to obtain the grayscale value of each pixel in the target face area.
[0201] The grayscale statistics module 1340 may be configured to obtain a target grayscale value and a grayscale mean value of the pixel with the largest number in the target face area according to the grayscale value of each pixel in the target face area.
[0202] The brightness level module 1350 may be configured to determine a target brightness level of the target face area according to a target grayscale value and a grayscale mean value of the target face area.
[0203] The color enhancement module 1360 may be configured to perform color enhancement processing on the target image according to the target brightness level of the target face region.
[0204] The image processing device provided by the embodiment of the present disclosure performs face detection on the target image to obtain the target face area. The target grayscale value and grayscale mean are obtained according to the grayscale value of each pixel in the target face area, which can comprehensively characterize the brightness of the target face area from different dimensions, so that the obtained target brightness level can accurately reflect the brightness and darkness of the face of the person in the target image. This ensures that when the target image is color enhanced according to the target brightness of the target face area, the brightness of the target face area can be accurately adjusted to avoid the target face area from being too dark or overexposed. At the same time, only the target grayscale value and grayscale mean are calculated, which can greatly reduce the computational complexity and improve the computational efficiency while ensuring the quality of color enhancement.
[0205] In an exemplary embodiment, the image processing device 1300 may further include a second grayscale acquisition module, a second grayscale statistics module, a second brightness level module, and a second color enhancement module. The second acquisition module is configured to obtain the grayscale value of each pixel in the target image if the target face area is not detected in the target image; the second grayscale statistics module is configured to obtain the target grayscale value, grayscale mean, and grayscale standard deviation of the largest number of pixels in the target image based on the grayscale value of each pixel in the target image; the second brightness level module is configured to determine the target brightness level of the target image based on the target grayscale value, grayscale mean, and grayscale standard deviation of the target image; and the second color enhancement module is configured to perform color enhancement processing on the target image based on the target brightness level of the target image.
[0206] In an exemplary embodiment, the brightness level module 1350 may include a first brightness level unit, which may be configured to determine that the target brightness level of the target image is the first brightness level if the target grayscale value is less than or equal to a first grayscale threshold and the grayscale mean is less than the first mean threshold; if the target grayscale value is greater than or equal to a second grayscale threshold and the grayscale mean is less than the first mean threshold, then determine that the target brightness level of the target image is the first brightness level; wherein the second grayscale threshold is greater than the first grayscale threshold.
[0207] In an exemplary embodiment, the brightness level module 1350 may also include a second brightness level unit, which may be configured to determine that the target brightness level of the target image is the second brightness level if the target grayscale value is less than or equal to the first grayscale threshold and the grayscale mean is greater than the second mean threshold; wherein the second mean threshold is greater than the first mean threshold; if the target grayscale value is greater than or equal to the second grayscale threshold and the grayscale mean is greater than the second mean threshold, then determine that the target brightness level of the target image is the second brightness level.
[0208] In an exemplary embodiment, the brightness level module 1350 may also include a third brightness level unit, which may be configured to determine that the brightness level of the target image is the third brightness level if the target grayscale value is less than or equal to the first grayscale threshold, and the grayscale mean is greater than or equal to the first mean threshold and less than or equal to the second mean threshold; or, if the target grayscale value is greater than or equal to the second grayscale threshold, and the grayscale mean is greater than or equal to the first mean threshold and less than or equal to the second mean threshold, then the brightness level of the target image is determined to be the third brightness level; or, if the target grayscale value is greater than the first grayscale threshold and less than the second grayscale threshold, then the brightness level of the target image is determined to be the third brightness level.
[0209] In an exemplary embodiment, the color enhancement module 1360 may include: a first enhancement unit, a second enhancement unit, and a third enhancement unit. The first enhancement unit may be configured to perform color enhancement processing on the target image using a first neural network model if the target brightness level of the target face area is a first brightness level, wherein the first neural network model is obtained by training with a first image training set including the first brightness level. The second enhancement unit may be configured to perform color enhancement processing on the target image using a second neural network model if the target brightness level of the target face area is a second brightness level, wherein the second neural network model is obtained by training with a second image training set including the second brightness level. The third enhancement unit may be configured to perform color enhancement processing on the target image using a third neural network model if the target brightness level of the target face area is a third brightness level, wherein the third neural network model is obtained by training with a third image training set including a third brightness level.
[0210] In an exemplary embodiment, the image acquisition module 1310 may include a video acquisition unit, a target video unit, and a target image unit. The video acquisition unit may be configured to acquire a video to be processed. The target video unit may be configured to obtain a target video according to the video to be processed. The target image unit may be configured to determine a target image from the target video.
[0211] In an exemplary embodiment, the color enhancement module 1360 may include a fourth enhancement unit, a fifth enhancement unit, a sixth enhancement unit, and a seventh enhancement unit. The fourth enhancement unit may be configured to perform color enhancement processing on the target image in the target video using a fourth neural network model if the target brightness level of the target face area in the target video is the first brightness level and the third brightness level, wherein the fourth neural network model is obtained by training with a fourth image training set including the first brightness level and the third brightness level. The fifth enhancement unit may be configured to perform color enhancement processing on the target image in the target video using a fifth neural network model if the target brightness level of the target face area in the target video is the second brightness level and the third brightness level, wherein the fifth neural network model is obtained by training with a fourth image training set including the second brightness level and the third brightness level. The sixth enhancement unit may be configured to perform color enhancement processing on the target image in the target video using a sixth neural network model if the target brightness level of the target face area in the target video is the first brightness level and the second brightness level, wherein the sixth neural network model is obtained by training with a sixth image training set including the first brightness level and the second brightness level. The seventh enhancement unit can be configured to perform color enhancement processing on the target image in the target video using the seventh neural network model if the target brightness level of the target face area in the target video is the first brightness level, the second brightness level, and the third brightness level, wherein the seventh neural network model is trained using the seventh image training set including the first brightness level, the second brightness level, and the third brightness level.
[0212] In an exemplary embodiment, the target video unit may include a shot detection subunit and a target video subunit. The shot detection subunit may be configured to detect and obtain a shot mutation identification bit in the video to be processed. The target video subunit may be configured to segment the video to be processed according to the shot mutation identification bit to obtain at least one target video.
[0213] In an exemplary embodiment, the target image unit may be configured to sample the video frames of the target video at a preset sampling frequency to obtain at least one target image.
[0214] In an exemplary embodiment, the grayscale statistics module may include a histogram unit, a first statistics unit, and a second statistics unit. The histogram unit may be configured to perform grayscale statistics on the grayscale values of each pixel in the target image to obtain a grayscale histogram of the target image. The first statistics unit may be configured to determine the grayscale value with the largest number of pixels in the target image according to the peak value of the grayscale histogram as the target grayscale value of the target image. The second statistics unit may be configured to determine the grayscale mean of the target image according to the grayscale values of each pixel in the target image and the width and height values of the target image.
[0215] Fig.14FIG. 1 shows a schematic diagram of the structure of an electronic device suitable for implementing the embodiment of the present disclosure. It should be noted that: Fig.14 The electronic device 1400 shown is only an example and should not bring any limitation to the functions and scope of use of the embodiments of the present disclosure.
[0216] like Fig.14 As shown, the electronic device 1400 includes a central processing unit (CPU) 1401, which can perform various appropriate actions and processes according to the program stored in the read-only memory (ROM) 1402 or the program loaded from the storage part 1408 to the random access memory (RAM) 1403. In the RAM 1403, various programs and data required for system operation are also stored. The CPU 1401, the ROM 1402, and the RAM 1403 are connected to each other through a bus 1404. An input / output (I / O) interface 1405 is also connected to the bus 1404.
[0217] The following components are connected to the I / O interface 1405: an input section 1406 including a keyboard, a mouse, etc.; an output section 1407 including a cathode ray tube (CRT), a liquid crystal display (LCD), etc., and a speaker, etc.; a storage section 1408 including a hard disk, etc.; and a communication section 1409 including a network interface card such as a LAN card, a modem, etc. The communication section 1409 performs communication processing via a network such as the Internet. A drive 1410 is also connected to the I / O interface 1405 as needed. A removable medium 1411, such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, etc., is installed on the drive 1410 as needed, so that a computer program read therefrom is installed into the storage section 1408 as needed.
[0218] In particular, according to an embodiment of the present disclosure, the process described below with reference to the flowchart can be implemented as a computer software program. For example, an embodiment of the present disclosure includes a computer program product, which includes a computer program carried on a computer-readable medium, and the computer program includes a program code for executing the method shown in the flowchart. In such an embodiment, the computer program can be downloaded and installed from a network through a communication part 1409, and / or installed from a removable medium 1411. When the computer program is executed by a central processing unit (CPU) 1401, various functions defined in the system of the present application are executed.
[0219] It should be noted that the computer-readable medium shown in the present disclosure may be a computer-readable signal medium or a computer-readable storage medium or any combination of the above two. The computer-readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or device, or any combination of the above. More specific examples of computer-readable storage media may include, but are not limited to: an electrical connection with at least one wire, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In the present disclosure, a computer-readable storage medium may be any tangible medium containing or storing a program that can be used by or in combination with an instruction execution system, device or device. In the present disclosure, a computer-readable signal medium may include a data signal propagated in a baseband or as part of a carrier wave, in which a computer-readable program code is carried. This propagated data signal may take a variety of forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the above. Computer-readable signal media may also be any computer-readable medium other than computer-readable storage media, which may send, propagate or transmit a program for use by or in conjunction with an instruction execution system, apparatus or device. The program code contained on the computer-readable medium may be transmitted using any appropriate medium, including but not limited to: wireless, wire, optical cable, RF, etc., or any suitable combination of the above.
[0220] The flow chart and block diagram in the accompanying drawings illustrate the possible architecture, function and operation of the system, method and computer program product according to various embodiments of the present disclosure. In this regard, each box in the flow chart or block diagram can represent a module, a program segment or a part of the code, and the above-mentioned module, program segment or a part of the code contains at least one executable instruction for realizing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the box can also occur in a different order from the order marked in the accompanying drawings. For example, two boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each box in the block diagram or flow chart, and the combination of the boxes in the block diagram or flow chart can be implemented with a dedicated hardware-based system that performs the specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.
[0221] The modules and / or units and / or sub-units involved in the embodiments described in the present disclosure may be implemented by software or hardware, and the modules and / or units and / or sub-units described may also be set in a processor. The names of these modules and / or units and / or sub-units do not, in some cases, constitute limitations on the modules and / or units and / or sub-units themselves.
[0222] As another aspect, the present application also provides a computer-readable medium, which may be included in the electronic device described in the above embodiment; or may exist independently without being installed in the electronic device. The above computer-readable medium carries one or more programs, and when the above one or more programs are executed by an electronic device, the electronic device implements the method described in the following embodiment. For example, the electronic device may implement the following method. Figure 2 or Figure 3 or Figure 4 or Figure 5 or Figure 6 or Figure 7 or Figure 8 or Fig. 9 or Fig.10 The steps shown.
[0223] It should be noted that, although several modules or units or subunits of the device for action execution are mentioned in the above detailed description, this division is not mandatory. In fact, according to the embodiments of the present disclosure, the features and functions of two or more modules or units or subunits described above can be embodied in one module or unit or subunit. On the contrary, the features and functions of one module or unit described above can be further divided into multiple modules or units or subunits to be embodied.
[0224] Through the description of the above implementation, it is easy for those skilled in the art to understand that the example implementation described here can be implemented by software, or by software combined with necessary hardware. Therefore, the technical solution according to the implementation of the present disclosure can be embodied in the form of a software product, which can be stored in a non-volatile storage medium (which can be a CD-ROM, a USB flash drive, a mobile hard disk, etc.) or on a network, including several instructions to enable a computing device (which can be a personal computer, a server, a touch terminal, or a network device, etc.) to execute the method according to the implementation of the present disclosure.
[0225] Those skilled in the art will readily appreciate other embodiments of the present disclosure after considering the specification and practicing the invention disclosed herein. This application is intended to cover any variations, uses, or adaptations of the present disclosure that follow the general principles of the present disclosure and include common knowledge or customary techniques in the art that are not disclosed in the present disclosure. The specification and examples are intended to be exemplary only, and the true scope and spirit of the present disclosure are indicated by the following claims.
[0226] It should be understood that the present disclosure is not limited to the exact structures that have been described above and shown in the drawings, and that various modifications and changes may be made without departing from the scope thereof. The scope of the present disclosure is limited only by the appended claims.
Claims
1. An image processing method, characterized in that: include: Get the target image; Performing face detection on the target image to obtain a target face area; Obtaining the grayscale value of each pixel in the target face area; According to the grayscale values of each pixel in the target face area, a target grayscale value and a grayscale mean value of the pixel with the largest number in the target face area are obtained; Determining a target brightness level of the target face area according to a target grayscale value and a grayscale mean of the target face area; The target image is subjected to color enhancement processing according to the target brightness level of the target face area, which comprises: the target brightness level of the target face area comprises multiple brightness levels, and the target image is subjected to color enhancement processing using a neural network model obtained by training with an image training set comprising corresponding multiple brightness levels.
2. The method according to claim 1, characterized in that Also includes: If the target face area is not detected in the target image, obtaining the grayscale value of each pixel in the target image; According to the grayscale value of each pixel in the target image, the target grayscale value, grayscale mean and grayscale standard deviation of the pixel with the largest number in the target image are obtained; Determining a target brightness level of the target image according to a target grayscale value, a grayscale mean, and a grayscale standard deviation of the target image; The target image is subjected to color enhancement processing according to the target brightness level of the target image.
3. The method according to claim 1, characterized in that Determining the target brightness level of the target face area according to the target grayscale value and the grayscale mean of the target face area includes: If the target grayscale value is less than or equal to the first grayscale threshold, and the grayscale mean is less than the first mean threshold, determining that the target brightness level of the target image is the first brightness level; If the target grayscale value is greater than or equal to the second grayscale threshold, and the grayscale mean is less than the first mean threshold, determining that the target brightness level of the target image is the first brightness level; Wherein, the second grayscale threshold is greater than the first grayscale threshold.
4. The method according to claim 3, characterized in that Determining the target brightness level of the target face area according to the target grayscale value and the grayscale mean value also includes: If the target grayscale value is less than or equal to the first grayscale threshold, and the grayscale mean is greater than a second mean threshold, determining that the target brightness level of the target image is a second brightness level; wherein the second mean threshold is greater than the first mean threshold; If the target grayscale value is greater than or equal to the second grayscale threshold, and the grayscale mean is greater than the second mean threshold, the target brightness level of the target image is determined to be the second brightness level.
5. The method according to claim 4, characterized in that Determining the target brightness level of the target face area according to the target grayscale value and the grayscale mean value also includes: If the target grayscale value is less than or equal to the first grayscale threshold, and the grayscale mean is greater than or equal to the first mean threshold and less than or equal to the second mean threshold, then the brightness level of the target image is determined to be a third brightness level; or, If the target grayscale value is greater than or equal to the second grayscale threshold, and the grayscale mean is greater than or equal to the first mean threshold and less than or equal to the second mean threshold, then the target image brightness level is determined to be the third brightness level; or, If the target grayscale value is greater than the first grayscale threshold and less than the second grayscale threshold, the brightness level of the target image is determined to be a third brightness level.
6. The method according to claim 5, characterized in that Acquiring the target image includes: Get the video to be processed; Obtaining a target video according to the video to be processed; The target image is determined from the target video.
7. The method according to claim 6, characterized in that Obtaining a target video according to the video to be processed includes: Detecting and obtaining shot mutation identification positions in the video to be processed; The video to be processed is segmented according to the shot mutation marker to obtain at least one target video.
8. The method according to claim 6, characterized in that Determining the target image from the target video includes: The video frames of the target video are sampled according to a preset sampling frequency to obtain at least one of the target images.
9. The method according to claim 6, characterized in that Performing color enhancement processing on the target image according to the target brightness level of the target face area includes: If the target brightness level of the target face area in the target video is the first brightness level and the third brightness level, color enhancement processing is performed on the target image in the target video using a fourth neural network model, wherein the fourth neural network model is obtained by training using a fourth image training set including the first brightness level and the third brightness level; If the target brightness level of the target face area in the target video is the second brightness level and the third brightness level, color enhancement processing is performed on the target image in the target video using a fifth neural network model, wherein the fifth neural network model is obtained by training using a fourth image training set including the second brightness level and the third brightness level; If the target brightness level of the target face area in the target video is the first brightness level and the second brightness level, color enhancement processing is performed on the target image in the target video using a sixth neural network model, wherein the sixth neural network model is obtained by training using a sixth image training set including the first brightness level and the second brightness level; If the target brightness level of the target face area in the target video is the first brightness level, the second brightness level and the third brightness level, the target image in the target video is color enhanced using the seventh neural network model, wherein the seventh neural network model is obtained by training using the seventh image training set including the first brightness level, the second brightness level and the third brightness level.
10. The method according to any one of claims 1 to 9, characterized in that: According to the grayscale values of each pixel in the target face area, obtaining the target grayscale value and grayscale mean of the pixel with the largest number in the target face area includes: Performing grayscale statistics on the grayscale value of each pixel in the target face area to obtain a grayscale histogram of the target face area; Determine the grayscale value with the largest number of pixels in the target face area according to the peak value of the grayscale histogram, as the target grayscale value of the target face area; The grayscale mean value of the target face area is determined according to the grayscale value of each pixel point in the target face area and the width value and the height value of the target face area.
11. An image processing device, characterized in that: include: An image acquisition module, configured to acquire a target image; A face detection module, configured to perform face detection on the target image to obtain a target face area; A grayscale acquisition module configured to obtain the grayscale value of each pixel in the target face area; A grayscale statistics module, configured to obtain a target grayscale value and a grayscale mean of the maximum number of pixels in the target face area according to the grayscale values of each pixel in the target face area; A brightness level module, configured to determine a target brightness level of the target face area according to a target grayscale value and a grayscale mean of the target face area; The color enhancement module is configured to perform color enhancement processing on the target image according to the target brightness level of the target face area, which includes: the target brightness level of the target face area includes multiple brightness levels, and the target image is subjected to color enhancement processing using a neural network model obtained by training an image training set including corresponding multiple brightness levels.
12. The device according to claim 11, characterized in that Also includes: A second grayscale acquisition module is configured to obtain the grayscale value of each pixel in the target image if the target face area is not detected in the target image; A second grayscale statistics module is configured to obtain a target grayscale value, a grayscale mean, and a grayscale standard deviation of a pixel with the largest number in the target image according to the grayscale value of each pixel in the target image; A second brightness level module is configured to determine a target brightness level of the target image according to a target grayscale value, a grayscale mean, and a grayscale standard deviation of the target image; The second color enhancement module is configured to perform color enhancement processing on the target image according to the target brightness level of the target image.
13. The device according to claim 11, characterized in that The brightness level module comprises: A first brightness level unit is configured to determine that the target brightness level of the target image is the first brightness level if the target grayscale value is less than or equal to a first grayscale threshold and the grayscale mean is less than the first mean threshold; if the target grayscale value is greater than or equal to a second grayscale threshold and the grayscale mean is less than the first mean threshold, determine that the target brightness level of the target image is the first brightness level; Wherein, the second grayscale threshold is greater than the first grayscale threshold.
14. The device according to claim 13, characterized in that The brightness level module also includes: The second brightness level unit is configured to determine that the target brightness level of the target image is the second brightness level if the target grayscale value is less than or equal to the first grayscale threshold and the grayscale mean is greater than the second mean threshold; wherein the second mean threshold is greater than the first mean threshold; if the target grayscale value is greater than or equal to the second grayscale threshold and the grayscale mean is greater than the second mean threshold, then determine that the target brightness level of the target image is the second brightness level.
15. The device according to claim 14, characterized in that The brightness level module also includes: The third brightness level unit is configured to determine that the brightness level of the target image is the third brightness level if the target grayscale value is less than or equal to the first grayscale threshold, and the grayscale mean is greater than or equal to the first mean threshold and less than or equal to the second mean threshold; or, if the target grayscale value is greater than or equal to the second grayscale threshold, and the grayscale mean is greater than or equal to the first mean threshold and less than or equal to the second mean threshold, then determine that the brightness level of the target image is the third brightness level; or, if the target grayscale value is greater than the first grayscale threshold and less than the second grayscale threshold, then determine that the brightness level of the target image is the third brightness level.
16. The device according to claim 15, characterized in that The image acquisition module comprises: A video acquisition unit, configured to acquire a video to be processed; A target video unit, configured to obtain a target video according to the video to be processed; The target image unit is configured to determine the target image from the target video.
17. The device according to claim 16, characterized in that The target video unit comprises: A shot detection subunit, configured to detect and obtain a shot mutation identification position in the video to be processed; The target video sub-unit is configured to segment the video to be processed according to the shot mutation marker to obtain at least one target video.
18. The device according to claim 16, characterized in that The target image unit is further configured to: sample the video frames of the target video according to a preset sampling frequency to obtain at least one of the target images.
19. The device according to claim 16, characterized in that The color enhancement module comprises: a fourth enhancement unit, configured to perform color enhancement processing on the target image in the target video using a fourth neural network model if the target brightness level of the target face area in the target video is the first brightness level and the third brightness level, wherein the fourth neural network model is obtained by training using a fourth image training set including the first brightness level and the third brightness level; a fifth enhancement unit, configured to perform color enhancement processing on the target image in the target video using a fifth neural network model if the target brightness level of the target face area in the target video is the second brightness level and the third brightness level, wherein the fifth neural network model is obtained by training using a fourth image training set including the second brightness level and the third brightness level; a sixth enhancement unit, configured to perform color enhancement processing on the target image in the target video using a sixth neural network model if the target brightness level of the target face area in the target video is a first brightness level and a second brightness level, wherein the sixth neural network model is obtained by training using a sixth image training set including the first brightness level and the second brightness level; The seventh enhancement unit is configured to use a seventh neural network model to perform color enhancement processing on the target image in the target video if the target brightness level of the target face area in the target video is a first brightness level, a second brightness level, and a third brightness level, wherein the seventh neural network model is obtained by training with a seventh image training set including a first brightness level, a second brightness level, and a third brightness level.
20. The device according to any one of claims 11 to 19, characterized in that: The grayscale statistics module includes: a histogram unit configured to perform grayscale statistics on the grayscale values of each pixel in the target face area to obtain a grayscale histogram of the target face area; A first statistical unit is configured to determine the grayscale value with the largest number of pixels in the target face area according to the peak value of the grayscale histogram as the target grayscale value of the target face area; The second statistical unit is configured to determine the grayscale mean of the target face area according to the grayscale value of each pixel in the target face area and the width value and the height value of the target face area.
21. An electronic device, characterized in that: include: at least one processor; A storage device for storing at least one program; When the at least one program is executed by the at least one processor, the at least one processor implements the method according to any one of claims 1 to 10.
22. A computer readable medium having a computer program stored thereon, characterized in that: When the program is executed by a processor, the method according to any one of claims 1 to 10 is implemented.
23. A computer program product, comprising computer instructions, and when a processor executes the computer instructions, the method according to any one of claims 1 to 10 is implemented.
