Image Processing Method, Apparatus, Electronic Device, and Computer-Readable Medium
By acquiring the grayscale value and standard deviation of the image, determining the brightness level and using the corresponding neural network model for color enhancement, the problems of high hardware requirements and slow operation speed caused by large calculations in the prior art are solved, and efficient image processing is achieved.
Patent Information
- Application Number
- CN202010910263.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2020-09-02
- Publication Date
- 2025-07-25
- Estimated Expiration
- 2040-09-02
AI Technical Summary
The prior art uses color enhancement to images, especially when processing a large number of image frames in video, and has a large amount of calculation, resulting in high hardware requirements and slow operation speed, which cannot meet the needs of video application scenarios.
By obtaining the grayscale value, grayscale mean and grayscale standard deviation of the target image, the target brightness level is determined, and the corresponding neural network model is used for color enhancement processing, including the neural network model of the first brightness level, the second brightness level and the third brightness level, respectively, for images of different brightness levels.
On the premise of ensuring the quality of color enhancement, the computational complexity is reduced, the computational efficiency is improved, the image is too dark or overexposed, and rapid image processing is achieved.
Smart Images

Figure CN113409199B_ABST
Abstract
Description
Technical Field
[0001] The present disclosure relates to the field of image processing technologies, and in particular, to an image processing method, apparatus, electronic device, and computer-readable medium. Background Art
[0002] Currently, in the solution of intelligently enhancing the color of an image, complex operations on the image are often required, such as an image color enhancement solution based on a confrontation network. However, when the current complex solution is applied to a video with a large number of image frames, since the number of image frames is very large, it will lead to an increase in the amount of calculation. This problem will place higher requirements on hardware devices and will reduce the running speed, and cannot meet the image processing requirements of current video application scenarios.
[0003] Therefore, a new image processing method, apparatus, electronic device, and computer-readable medium are needed.
[0004] It should be noted that the information disclosed in the above background art section is only used to enhance the understanding of the background of the present disclosure, and thus may include information that does not constitute the prior art known to those of ordinary skill in the art. Summary of the Invention
[0005] Embodiments of the present disclosure provide an image processing method, apparatus, electronic device, and computer-readable medium, thereby at least to a certain extent avoiding the problem of low operation efficiency caused by a relatively complex algorithm used to ensure the quality of color enhancement in related technologies.
[0006] Other features and advantages of the present disclosure will become apparent through the following detailed description, or will be learned in part through the practice of the present disclosure.
[0007] An image processing method is proposed in an embodiment of the present disclosure, including: obtaining a target image; obtaining the gray values of each pixel point in the target image; obtaining the target gray value, gray mean value, and gray standard deviation with the largest number of pixel points in the target image according to the gray values of each pixel point in the target image; determining the target brightness level of the target image according to the target gray value, the gray mean value, and the gray standard deviation; and performing color enhancement processing on the target image according to the target brightness level.
[0008] An embodiment of the present disclosure provides an image processing apparatus, including: an image acquisition module configured to acquire a target image; a pixel grayscale module configured to obtain the grayscale values of each pixel point in the target image; a grayscale statistics module configured to obtain, according to the grayscale values of each pixel point in the target image, a target grayscale value with the largest number of pixel points in the target image, a grayscale mean value, and a grayscale standard deviation; a brightness level module configured to determine a target brightness level of the target image according to the target grayscale value, the grayscale mean value, and the grayscale standard deviation; and a color enhancement module configured to perform color enhancement processing on the target image according to the target brightness level.
[0009] In some exemplary embodiments of the present disclosure, the brightness level module includes a first brightness level unit 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, the grayscale mean value is less than a first mean threshold, and the grayscale standard deviation is less than a first standard deviation threshold.
[0010] In some exemplary embodiments of the present disclosure, the brightness level module further includes a second brightness level unit configured to determine that the target brightness level of the target image is the second brightness level if the target grayscale value is greater than or equal to a second grayscale threshold, the grayscale mean value is greater than a second mean threshold, and the grayscale standard deviation is less than a first standard deviation threshold; wherein, the second grayscale threshold is greater than the first grayscale threshold, and the second mean threshold is greater than the first mean threshold.
[0011] In some exemplary embodiments of the present disclosure, the brightness level module further includes a third brightness level unit configured to determine that the target 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, the grayscale mean value is greater than or equal to the first mean threshold, or the grayscale standard deviation is greater than or equal to the first standard deviation threshold; or, determine that the target brightness level of the target image is the third brightness level if the target grayscale value is greater than or equal to the second grayscale threshold, the grayscale mean value is less than or equal to the second mean threshold, or the grayscale standard deviation is greater than or equal to the first standard deviation threshold; or, determine that the target brightness level of the target image is the third brightness level if the target grayscale value is greater than the first grayscale threshold and less than the second grayscale threshold.
[0012] 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. Among them, 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 is the first brightness level, where the first neural network model is trained using 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 is the second brightness level, where the second neural network model is trained using 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 is the third brightness level, where the third neural network model is trained using a third image training set including the third brightness level.
[0013] 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. Among them, 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.
[0014] 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. Among them, the fourth enhancement unit is configured to perform color enhancement processing on the video frames in the target video if the target brightness level of the target image in the target video includes a first brightness level and a third brightness level, where 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. The fifth enhancement unit is configured to perform color enhancement processing on the video frames in the target video if the target brightness level of the target image in the target video is a second brightness level and a third brightness level, where 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. The sixth enhancement unit is configured to perform color enhancement processing on the video frames in the target video if the target brightness level of the target image in the target video is a first brightness level and a second brightness level, where 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 perform color enhancement processing on the video frames in the target video if the target brightness level of the target image in the target video is a first brightness level, a second brightness level, and a third brightness level, where the seventh neural network model is obtained by training using a seventh image training set including the first brightness level, the second brightness level, and the third brightness level.
[0015] In some exemplary embodiments of the present disclosure, the target video unit includes a shot detection subunit and a target video subunit. Among them, the shot detection subunit is configured to detect and obtain the shot mutation identification bit in the to-be-processed video. The target video subunit is configured to segment the to-be-processed video according to the shot mutation identification bit to obtain at least one of the target videos.
[0016] In some exemplary embodiments of the present disclosure, the target image unit is configured to sample the video frames of the target video at a preset sampling frequency to obtain at least one of the target images.
[0017] 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. Among them, the histogram unit is configured to perform grayscale statistics on the grayscale values of each pixel point in the target image to obtain a grayscale histogram of the target image. The first statistics unit is configured to determine, according to the peak value of the grayscale histogram, the grayscale value with the largest number of pixel points in the target image as the target grayscale value of the target image. The second statistics unit is configured to determine the grayscale mean and the grayscale standard deviation of the target image according to the grayscale values of each pixel point in the target image and the width value and height value of the target image.
[0018] An embodiment of the present disclosure provides an electronic device, including: at least one processor; a storage device for storing at least one program, which, when executed by the at least one processor, causes the at least one processor to implement the image processing method as described in the above embodiment.
[0019] An embodiment of the present disclosure provides a computer-readable medium, on which a computer program is stored, and when the program is executed by a processor, it implements the image processing method as described in the above embodiment.
[0020] According to one aspect of the present application, there is provided a computer program product or a computer program, which includes computer instructions stored in a computer-readable storage medium. The processor of the 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 image processing method or the method provided in various optional implementations of the image processing method.
[0021] In the technical solution provided by some embodiments of the present disclosure, the target grayscale value, the grayscale mean, and the grayscale standard deviation obtained according to the grayscale values of each pixel point in the target image can comprehensively characterize the brightness degree of the target image from different dimensions, so that the obtained target brightness level has a high accuracy rate. Furthermore, when performing color enhancement processing on the target image according to the target brightness degree, it is possible to adjust the brightness of the target image in a targeted manner, avoiding the appearance of overly dark or overexposed images. At the same time, only calculating the target grayscale value, the grayscale mean, and the grayscale standard deviation can greatly reduce the operation complexity and improve the operation efficiency on the premise of ensuring the color enhancement quality.
[0022] It should be understood that the above general description and the following detailed description are only exemplary and explanatory, and cannot limit the present disclosure. BRIEF DESCRIPTION OF THE DRAWINGS
[0023] The accompanying drawings herein are incorporated into and constitute a part of this specification, showing embodiments consistent with the present disclosure, and are used together with the specification to explain the principles of the present disclosure. Obviously, the accompanying drawings in the following description are only some embodiments of the present disclosure, and those of ordinary skill in the art can obtain other drawings based on these drawings without creative efforts. In the accompanying drawings:
[0024] Figure 1 A schematic diagram showing an exemplary system architecture of an image processing method or apparatus to which embodiments of the present disclosure can be applied;
[0025] Figure 2 A flowchart schematically showing an image processing method according to an embodiment of the present disclosure;
[0026] Figure 3 is based on Figure 2 A flowchart of step S240 in an exemplary embodiment;
[0027] Figure 4 is based on Figure 2 A flowchart of step S250 in an exemplary embodiment;
[0028] Figure 5 is based on Figure 2 A flowchart of step S210 in an exemplary embodiment;
[0029] Figure 6 is based on Figure 2 A flowchart of step S250 in an exemplary embodiment;
[0030] Figure 7 is based on Figure 5 A flowchart of step S520 in an exemplary embodiment;
[0031] Figure 8 is based on Figure 2 A flowchart of step S230 in an exemplary embodiment;
[0032] Figure 9 A flowchart schematically showing an image processing method according to an embodiment of the present disclosure;
[0033] Figure 10 A schematic diagram showing the architecture of a machine learning model according to an exemplary embodiment of the present disclosure;
[0034] Figure 11 A schematic diagram showing the architecture of a machine learning model according to an exemplary embodiment of the present disclosure;
[0035] Figure 12A block diagram of an image processing apparatus according to an embodiment of the present disclosure is schematically shown;
[0036] Figure 13 A schematic structural diagram of an electronic device suitable for implementing the embodiments of the present disclosure is shown. Detailed implementation manners
[0037] Example embodiments will now be described more fully with reference to the accompanying drawings. However, the example embodiments can be implemented in various 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 complete and comprehensive, and will fully convey the concept of the example embodiments to those skilled in the art.
[0038] In addition, the described features, structures, or characteristics can be combined in any suitable manner in one or more embodiments. In the following description, numerous specific details are provided to give a thorough understanding of the embodiments of the present disclosure. However, those skilled in the art will realize that the technical solutions of the present disclosure can be practiced without one or more of the specific details, or can be implemented using other methods, components, devices, steps, etc. In other cases, well-known methods, devices, implementations, or operations are not shown or described in detail to avoid obscuring aspects of the present disclosure.
[0039] The block diagrams shown in the 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 implemented in at least one hardware module or integrated circuit, or implemented in different networks and / or processor devices and / or microcontroller devices.
[0040] The flowcharts shown in the drawings are only illustrative and do not necessarily include all the content and operations / steps, nor do they necessarily have to 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 the actual situation.
[0041] Cloud technology refers to a hosting technology that unifies a series of resources such as hardware, software, and networks within a wide area network or a local area network to achieve data computing, storage, processing, and sharing.
[0042] 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.
[0043] 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.
[0044] 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.
[0045] 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.
[0046] like Figure 1 As shown, the system architecture 100 may include one or more of terminal devices 101, 102, 103, a network 104, and a server 105. The network 104 is used to provide a medium for communication links between the terminal devices 101, 102, 103 and the server 105. The network 104 may include various connection types, such as wired, wireless communication links, or optical fiber cables, etc.
[0047] 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.
[0048] Users can use terminal devices 101, 102, and 103 to interact with server 105 via network 104 to receive or send messages, etc. Terminal devices 101, 102, and 103 can be various electronic devices with a display screen and supporting web browsing, including but not limited to smartphones, tablets, portable computers, desktop computers, wearable devices, virtual reality devices, smart homes, smart cameras, and so on.
[0049] Server 105 can be a server that provides various services, an independent physical server, a server cluster or distributed system composed of multiple physical 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, and big data and artificial intelligence platforms. The terminal can be a smartphone, tablet, laptop, desktop computer, smart speaker, smart watch, etc., but is not limited thereto. The terminal and the server can be directly or indirectly connected through wired or wireless communication methods, and this application does not make any restrictions here. For example, terminal device 103 (which can also be terminal device 101 or 102) uploads a target image to server 105. Server 105 can obtain the target image; obtain the gray values of each pixel point in the target image; obtain the target gray value, gray mean, and gray standard deviation with the largest number of pixel points in the target image according to the gray values of each pixel point in the target image; determine the target brightness level of the target image according to the target gray value, the gray mean, and the gray standard deviation; perform color enhancement processing on the target image according to the target brightness level. And feedback the color enhancement processing result to terminal device 103. Furthermore, terminal device 103 can display the target image after color enhancement processing on the screen or further perform other processing on the target image after color enhancement processing, so as to be able to achieve a fast processing process of the image while ensuring the color enhancement quality.
[0050] For another example, the server 105 can obtain the video to be processed, obtain the target video based on the video to be processed, determine the target image from the target video, obtain the gray values of each pixel point in the target image, obtain the target gray value, gray mean value, and gray standard deviation with the largest number of pixel points in the target image according to the gray values of each pixel point in the target image, determine the target brightness level of the target image according to the target gray value, the gray mean value, and the gray standard deviation, and perform color enhancement processing on the target image according to the target brightness level. Then, the color enhancement processing result is fed back to the terminal device 101 (which can also be the terminal device 102 or 103). Thus, the user can view the video to be processed after color enhancement based on the content displayed on the terminal device 101, improving the user's viewing experience.
[0051] Figure 2 Schematically shows a flowchart of an image processing method according to an embodiment of the present disclosure. The method provided by the embodiments of the present disclosure can be processed by any electronic device with computing and processing capabilities, such as the server 105 and / or the terminal devices 102 and 103 in the above Figure 1 embodiments. In the following embodiments, the server 105 is taken as an example of the execution subject for illustration, but the present disclosure is not limited thereto.
[0052] As Figure 2 shown, the image processing method provided by the embodiments of the present disclosure may include the following steps.
[0053] In step S210, obtain a target image.
[0054] In the embodiments of the present disclosure, the target image can be obtained, for example, by sampling video frames in a video.
[0055] In step S220, obtain the gray values of each pixel point in the target image.
[0056] In the embodiments of the present disclosure, the gray value is a measure of the gray level presented by a certain pixel in a black-and-white image. In a grayscale image, it is usually displayed as a gray scale from the darkest black to the brightest white. Divide the range between white and black into several levels according to a logarithmic relationship, which is called the "gray level". The range is generally from 0 to 255, with white being 255 and black being 0.
[0057] In step S230, according to the gray values of each pixel point in the target image, obtain the target gray value, gray mean value, and gray standard deviation with the largest number of pixel points in the target image.
[0058] In the embodiments of the present disclosure, the target gray value with the largest number of pixel points in the target image refers to the gray value with the largest number of pixel points among the pixel point numbers corresponding to the gray values obtained by counting the gray values of each pixel point in the target image. The gray mean value is obtained by performing a mean operation on the gray values of each pixel point in the target image. The gray mean value can be calculated, for example, according to the following formula:
[0059]
[0060] where ave is the gray mean value, Gray(i, j) is the gray value of the pixel point with coordinates (i, j) in the target image, width is the width value of the target image, and height is the height value of the target image. 0 < j < width, 0 < j < height.
[0061] The gray standard deviation is obtained by performing a standard deviation operation on the gray values of each pixel point in the target image. The gray standard deviation can be calculated, for example, according to the following formula:
[0062]
[0063] where std is the gray standard deviation.
[0064] In step S240, the target brightness level of the target image is determined according to the target gray value, the gray mean value, and the gray standard deviation.
[0065] In the embodiments of the present disclosure, the target gray value, the gray mean value, and the gray standard deviation can be analyzed and processed, and the target brightness level is determined according to the analysis and processing results.
[0066] Among them, the target gray value, the gray mean value, and the gray standard deviation can be processed according to the mapping table of the preset numerical range and the brightness level, and the matched brightness level is determined as the target brightness level.
[0067] In step S250, color enhancement processing is performed on the target image according to the target brightness level.
[0068] In the embodiments of the present disclosure, the specific color enhancement scheme of the target image can be determined according to the target brightness level, and color enhancement processing is performed on the target image according to the specific color enhancement scheme. For example, different color enhancement processing schemes can be set according to different target brightness levels.
[0069] In an exemplary embodiment, color enhancement processing can be performed on the target image according to the trained machine learning model, and the processing result of the color enhancement of the target image is determined according to the output result of the machine learning model. The machine learning model can be, for example but not limited to, a convolutional neural network, but the present disclosure does not make special limitations on this.
[0070] The image processing method provided by the embodiments of the present disclosure can comprehensively characterize the brightness degree of the target image from different dimensions based on the target gray value, gray mean value, and gray standard deviation obtained from the gray values of each pixel point in the target image, so that the obtained target brightness level has high accuracy. Furthermore, when performing color enhancement processing on the target image according to the target brightness degree, the brightness of the target image can be adjusted directionally, avoiding the appearance of overly dark or overexposed images. At the same time, only calculating the target gray value, gray mean value, and gray standard deviation can greatly reduce the computational complexity and improve the computational efficiency on the premise of ensuring the color enhancement quality.
[0071] Figure 3 is based on Figure 2 The flowchart of step S240 in an exemplary embodiment.
[0072] As Figure 3 shown, step S240 in the above Figure 2 embodiment may further include the following steps.
[0073] In step S310, if the target gray value is less than or equal to the first gray threshold, the gray mean value is less than the first mean threshold, and the gray standard deviation is less than the first standard deviation threshold, then determine that the target brightness level of the target image is the first brightness level.
[0074] In the embodiments of the present disclosure, the first gray threshold, the first mean threshold, and the first standard deviation threshold can be obtained based on experience. In an exemplary embodiment, the value of the first gray threshold can be, for example, 50, the first mean threshold can be, for example, 60, and the first standard deviation threshold can be, for example, 40. However, the present disclosure does not make special limitations on this. The first brightness level can be a level with lower brightness. Among them, when the target gray value, gray mean value, and gray standard deviation meet the judgment conditions in step S310, it can be considered that the overall brightness of the target image is very small. The gray 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 value, and the larger the standard deviation, the more extensive the pixel value distribution. Therefore, the smaller the gray standard deviation, the less the brightness area of the target image appears. Therefore, when the conditions of S310 are met, it is determined that the brightness of the target image is low and is the first brightness level.
[0075] In an exemplary embodiment, step S240 in the above Figure 2 embodiment may further include the following steps.
[0076] In step S320, if the target gray value is greater than or equal to the second gray threshold, the gray mean value is greater than the second mean threshold, and the gray standard deviation is less than the first standard deviation threshold, then determine that the target brightness level of the target image is the second brightness level; where the second gray threshold is greater than the first gray threshold and the second mean threshold is greater than the first mean threshold.
[0077] In the embodiments of the present disclosure, the second gray threshold and the second mean threshold can be obtained based on experience. In an exemplary embodiment, the second gray threshold can be, for example, 200, and the second mean threshold can be, for example, 180, but the present disclosure does not make special limitations thereto. The second brightness level can be a level with too bright brightness. Wherein, when the target gray value, the gray mean, and the gray standard deviation meet the judgment conditions in step S320, it can be considered that the overall brightness of the target image is too bright, that is, an overexposed image.
[0078] In an exemplary embodiment, step S240 in the above Figure 2 embodiment may further include the following steps.
[0079] In step S330, if the target gray value is less than or equal to the first gray threshold, the gray mean is greater than or equal to the first mean threshold, or the gray standard deviation is greater than or equal to the first standard deviation threshold, then determine that the target brightness level of the target image is the third brightness level; or,
[0080] In step S340, if the target gray value is greater than or equal to the second gray threshold, the gray mean is less than or equal to the second mean threshold, or the gray standard deviation is greater than or equal to the first standard deviation threshold, then determine that the target brightness level of the target image is the third brightness level; or,
[0081] In step S350, if the target gray value is greater than the first gray threshold and less than the second gray threshold, then determine that the target brightness level of the target image is the third brightness level.
[0082] In the embodiments of the present disclosure, the third brightness level can be a brightness level with medium brightness. The set of conditions included in this exemplary embodiment is the complement of the set of conditions included in steps S310 - S320. That is, when the conditions in step S310 or S320 are not met, it can be considered that the overall brightness of the target image is at a medium level.
[0083] In this embodiment, by accurately analyzing and judging the three dimensions of the target gray value, the gray mean, and the gray standard deviation, the target brightness level of the target image can be accurately analyzed and obtained according to the specific values of the target gray value, the gray mean, and the gray standard deviation.
[0084] Figure 4 is based on Figure 2 The flowchart of step S250 in an exemplary embodiment.
[0085] As Figure 4 shown, the above Figure 2Step S250 in the embodiment may further include the following steps. In this embodiment, color enhancement processing may be performed on the target image according to the trained machine learning model, and the processing result of the color enhancement of the target image may be determined according to the output result of the machine learning model. Among them, the machine learning model may include a first neural network model, a second neural network model, and a third neural network model. Figure 10 Schematically shows an architecture diagram of a machine learning model according to an exemplary embodiment of the present disclosure. As Figure 10 shown, the machine learning model may include a first neural network model 1010, a second neural network model 1020, a third neural network model 1030, and a switching module 1040. Among them, the network structure adopted by the first neural network model 1010 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 structures adopted by the second neural network model 1020 and the third neural network model 1030 may be the same as those of the first network model 1010 or other image generation models may be selected. The network structures of the first neural network model 1010 and the second neural network model 1020, the third neural network model 1030 may be different or the same. The main difference between the three network models is that even when the network structures are the same, different image types are distinguished according to different scenes as the training set of the network, and then network models for different scenes can be obtained through training. The switching module 1040 may select the corresponding set neural network model for processing according to the target brightness level. For example, the switching module 1040 is provided with a judgment unit that executes the processes of the above steps S220 to S240 and / or steps S310 to S350. In addition, the switching module 1040 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 may be implemented, for example, through the framework of an artificial intelligence cloud service.
[0086] In step S410, if the target brightness level is the first brightness level, the first neural network model 1010 is used to perform color enhancement processing on the target image, where the first neural network model 1010 is trained using a first image training set including the first brightness level.
[0087] In the embodiment of the present disclosure, for example, the first neural network model 1010 may be selected by the switching module 1040 to perform color enhancement processing on the target image.
[0088] In an exemplary embodiment, if the target brightness level is the first brightness level, the brightness and contrast can also be specially adjusted by adjusting the lightness channel (L channel) in the color mode (LAB channel) to restore more details, and then the chroma is adjusted to achieve color enhancement processing of the target image.
[0089] In step S420, if the target brightness level is the second brightness level, the second neural network model 1020 is used to perform color enhancement processing on the target image, where the second neural network model 1020 is trained using a second image training set including the second brightness level.
[0090] In the embodiments of the present disclosure, for example, the second neural network model 1020 can be selected according to the switching module 1040 to perform color enhancement processing on the target image.
[0091] In an exemplary embodiment, if the target brightness level is the second brightness level, the brightness and contrast can also be specially adjusted by adjusting the lightness channel (L channel) in the color mode (LAB channel) to restore more details, and then the chroma is adjusted to achieve color enhancement processing of the target image.
[0092] In step S430, if the target brightness level is the third brightness level, the third neural network model 1030 is used to perform color enhancement processing on the target image, where the third neural network model 1030 is trained using a third image training set including the third brightness level.
[0093] In the embodiments of the present disclosure, for example, the third neural network model 1030 can be selected according to the switching module 1040 to perform color enhancement processing on the target image.
[0094] In an exemplary embodiment, when the target brightness level is the third brightness level, color enhancement processing of the target image can also be achieved by enhancing brightness, contrast, and saturation.
[0095] In this embodiment, different color enhancement methods are used to process target images with different brightness levels, which can adaptively and effectively adjust the brightness of the target image.
[0096] Figure 5 is based on Figure 2 The flowchart of step S210 in an exemplary embodiment.
[0097] As Figure 5 shown, step S210 in the above Figure 2 embodiment may further include the following steps.
[0098] In step S510, the video to be processed is acquired.
[0099] In step S520, a target video is obtained according to the video to be processed.
[0100] In the embodiments of the present disclosure, for example, by detecting scene cuts and segmenting the video to be processed according to the detection results of the scene cuts, a target video can be obtained. For example, the difference image between each video frame in the video to be processed and the previous frame can be obtained, and the mean value of the difference image obtained from the previous frame difference image and this frame can be calculated. Whether this frame is a cut frame is determined by comparing the magnitude and change of the frame difference mean value. And the video to be processed is cut according to the cut frames to obtain the target video.
[0101] In step S530, a target image is determined from the target video.
[0102] In the embodiments of the present disclosure, each frame in the target video can be determined as the target image.
[0103] In an exemplary embodiment, the video frames of the target video can be sampled according to a preset sampling frequency to obtain at least one target image.
[0104] Figure 6 is based on Figure 2 The flowchart of step S250 in an exemplary embodiment.
[0105] As Figure 6 shown, step S250 in the above Figure 2 embodiments may further include the following steps. In this embodiment, the machine learning model may further include a fourth neural network model, a fifth neural network model, a sixth neural network model, and a seventh neural network model. Figure 11 Schematically shows the architecture diagram of the machine learning model according to an exemplary embodiment of the present disclosure. As Figure 11As shown in the figure, the machine learning model may include a fourth neural network model 1110, a fifth neural network model 1120, a sixth neural network model 1130, a seventh neural network model 1140, and a switching module 1150. Among them, the network structure adopted by the fourth neural network model 1110 may be an image generation network, such as a super-resolution model, an image style conversion network, etc. The network structures of the fourth neural network model 1110, the fifth neural network model 1120, the sixth neural network model 1130, and the seventh neural network model 1140 may be different or the same. The main difference among the four network models is that even when the network structures are the same, different image types are distinguished according to different scenarios as the training set of the network, and then network models for different scenarios can be obtained through training. The switching module 1150 can select the corresponding set neural network model for processing according to the target brightness level. For example, the switching module 1150 is provided with a judgment unit that executes the processes of the above steps S220 - S240 and / or steps S310 - S350 and / or S510 - S530. In addition, the switching module 1150 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.
[0106] In step S610, if the target brightness levels of the target images in the target video include the first brightness level and the third brightness level, the fourth neural network model 1110 is used to perform color enhancement processing on the target images in the target video, where the fourth neural network model 1110 is trained using a fourth image training set including the first brightness level and the third brightness level.
[0107] In an embodiment of the present disclosure, for example, the fourth neural network model 1110 may be selected by the switching module 1150 to perform color enhancement processing on the target images.
[0108] In an embodiment of the present disclosure, since the target video includes multiple brightness levels: the first brightness level and the third brightness level, by processing the target images in the target video with an artificial intelligence model capable of handling two brightness levels, the target images with different brightness levels can be adaptively processed, so that each video frame in the target video obtained after color enhancement processing has good color brightness. This avoids the occurrence of over-bright or over-exposed video frames in the target video.
[0109] In step S620, if the target brightness levels of the target images in the target video are the second brightness level and the third brightness level, the fifth neural network model 1120 is used to perform color enhancement processing on the target images in the target video, where the fifth neural network model 1120 is trained using a fourth image training set including the second brightness level and the third brightness level.
[0110] In an embodiment of the present disclosure, for example, the fifth neural network model 1120 may be selected according to the switching module 1150 to perform color enhancement processing on the target image.
[0111] In step S630, 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 1130 is used to perform color enhancement processing on the target image in the target video, where the sixth neural network model is trained using a sixth image training set including the first brightness level and the second brightness level.
[0112] In an embodiment of the present disclosure, for example, the sixth neural network model 1130 may be selected according to the switching module 1150 to perform color enhancement processing on the target image.
[0113] In step S640, 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 1140 is used to perform color enhancement processing on the target image in the target video, where the seventh neural network model 1140 is trained using a seventh image training set including the first brightness level, the second brightness level, and the third brightness level.
[0114] In an embodiment of the present disclosure, for example, the seventh neural network model 1140 may be selected according to the switching module 1150 to perform color enhancement processing on the target image.
[0115] 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 video frames of the target video with different brightness levels, which can adaptively and effectively adjust the brightness of the target image.
[0116] Figure 7 is based on Figure 5 The flowchart of step S520 in an exemplary embodiment.
[0117] As Figure 7 shown, step S520 in the above Figure 5 embodiment may further include the following steps.
[0118] In step S710, a shot mutation identification bit in the video to be processed is detected and obtained.
[0119] In the embodiments of the present disclosure, the frame difference image of adjacent frames in the video to be processed can be calculated, and a judgment can be made based on the magnitude of the mean value of the frame difference image, and the shot mutation flag bit can be determined according to the judgment result. In an exemplary embodiment, before calculating the frame difference image, the video image can be first segmented into frames, and then each three-channel color image can be converted into a single-channel grayscale image; the obtained grayscale image can be downsampled to solve the problem of excessive computational complexity of the algorithm for high-pixel images and improve the algorithm efficiency. The image can be preprocessed using a filtering algorithm (such as the Gabor filtering algorithm, Gabor filtering algorithm), and this method can effectively extract the content of the image and solve the problem of interference caused by sudden changes in light intensity.
[0120] In step S720, the video to be processed is segmented according to the shot mutation flag bit to obtain at least one target video.
[0121] In this embodiment, by detecting the shot mutation flag bit and cutting the video to be processed according to the shot mutation flag bit, the video to be processed can be divided according to scene changes to obtain the target video. When performing color enhancement in units of the target video, the video frames with similar scenes can be color-enhanced aggregately, and the applicability of the selected color enhancement method during color enhancement processing can be improved.
[0122] Figure 8 is based on Figure 2 The flowchart of step S230 in an exemplary embodiment.
[0123] As Figure 8 shown, step S230 in the above Figure 2 embodiment may further include the following steps.
[0124] In step S810, the gray values of each pixel point in the target image are statistically analyzed to obtain the gray histogram of the target image.
[0125] In the embodiments of the present disclosure, the gray histogram is a function of the gray level distribution and is a statistic of the gray level distribution in the image. The gray histogram counts all the pixels in the digital image according to the magnitude of the gray value and calculates their occurrence frequencies. The gray histogram is a function of the gray level, which represents the number of pixels with a certain gray level in the image and reflects the occurrence frequency of a certain gray level in the image.
[0126] In step S820, the gray value with the largest number of pixel points in the target image is determined according to the peak value of the gray histogram as the target gray value of the target image.
[0127] In the embodiments of the present disclosure, the number of pixels with the most occurrences can be determined according to the peak value in the gray histogram, and the gray value corresponding to this peak value can be determined as the target gray value.
[0128] In step S830, the grayscale mean value and the grayscale standard deviation of the target image are determined based on the grayscale values of each pixel point in the target image and the width value and height value of the target image.
[0129] In the embodiments of the present disclosure, the grayscale mean value and the grayscale standard deviation can be obtained, for example, through formulas (1) and (2), which will not be elaborated here.
[0130] Figure 9 The flowchart of the image processing method according to an embodiment of the present disclosure is schematically shown.
[0131] As Figure 9 shown, the image processing method provided in this embodiment includes the following steps.
[0132] In step S905, the video to be processed is acquired.
[0133] In step S910, the shot mutation identification bit in the video to be processed is detected and obtained.
[0134] In step S915, the video to be processed is segmented according to the shot mutation identification bit to obtain at least one target video.
[0135] In step S920, the video frames of the target video are sampled at a preset sampling frequency to obtain at least one target image.
[0136] In step S925, the grayscale values of each pixel point in the target image are obtained.
[0137] In step S930, according to the grayscale values of each pixel point in the target image, the target grayscale value, the grayscale mean value, and the grayscale standard deviation with the largest number of pixel points in the target image are obtained.
[0138] In steps S935 to S955, the target brightness level of the target image is determined according to the target grayscale value, the grayscale mean value, and the grayscale standard deviation. Specifically:
[0139] In step S935, if the target grayscale value is greater than 50 and less than 200, it is confirmed that the target brightness level of the target image is the third brightness level.
[0140] In step S940, if the target grayscale value is greater than 0 and less than or equal to 50, the grayscale mean value is less than 60, and the grayscale standard deviation is less than 40, it is confirmed that the target brightness level of the target image is the first brightness level.
[0141] In step S945, if the target grayscale value is greater than 0 and less than or equal to 50, the grayscale mean value is greater than or equal to 60, or the grayscale standard deviation is greater than or equal to 40, it is confirmed that the target brightness level of the target image is the third brightness level.
[0142] In step S950, if the target gray value is greater than or equal to 200 and less than or equal to 255, and the gray mean value is greater than 180 and the gray standard deviation is less than 40, then it is confirmed that the target brightness level of the target image is the second brightness level.
[0143] In step S955, if the target gray value is greater than or equal to 200 and less than or equal to 255, the gray mean value is less than or equal to 180, or the gray standard deviation is greater than or equal to 40, then it is confirmed that the target brightness level of the target image is the third brightness level.
[0144] In steps S960 - S990, color enhancement processing is performed on the video frames in the target video 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:
[0145] In step S960, if the target brightness level of the target image in the target video is the first brightness level, then the first neural network model is used to perform color enhancement processing on the video frames in the target video.
[0146] In step S965, if the target brightness level of the target image in the target video is the second brightness level, then the second neural network model is used to perform color enhancement processing on the video frames in the target video.
[0147] In step S970, if the target brightness level of the target image in the target video is the third brightness level, then the third neural network model is used to perform color enhancement processing on the video frames in the target video.
[0148] In step S975, if the target brightness level of the target image in the target video is the first brightness level and the third brightness level, then the fourth neural network model is used to perform color enhancement processing on the video frames in the target video.
[0149] In step S980, if the target brightness level of the target image in the target video is the second brightness level and the third brightness level, then the fifth neural network model is used to perform color enhancement processing on the video frames in the target video.
[0150] In step S985, if the target brightness level of the target image in the target video is the first brightness level and the second brightness level, then the sixth neural network model is used to perform color enhancement processing on the video frames in the target video.
[0151] In step S990, 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, then the seventh neural network model is used to perform color enhancement processing on the video frames in the target video.
[0152] In this embodiment, by detecting the shot mutation flag bit of the video to be processed and cutting the video to be processed according to the shot mutation flag bit, the video to be processed can be divided according to scene changes to obtain the target video. When subsequently performing color enhancement on the target video according to the target brightness level of each target image in the target video, color enhancement can be performed aggregately on video frames with similar scenes, improving the applicability of the selected color enhancement method during color enhancement processing. At the same time, when determining the target brightness level of each target image, it is possible to consider three dimensions: the target gray value, the gray standard deviation, and the gray mean of the target image, so that the obtained target brightness level has a high accuracy rate. Only calculating the target gray value, the gray mean, and the gray standard deviation can greatly reduce the computational complexity and improve the computational efficiency while ensuring the color enhancement quality.
[0153] The following introduces the device embodiments 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 device embodiments of the present disclosure, please refer to the embodiments of the above-mentioned image processing method of the present disclosure.
[0154] Figure 12 The block diagram of an image processing device according to an embodiment of the present disclosure is schematically shown.
[0155] Referring to Figure 12 As shown, an image processing device 1200 according to an embodiment of the present disclosure may include: an image acquisition module 1210, a pixel gray module 1220, a gray statistics module 1230, a brightness level module 1240, and a color enhancement module 1250.
[0156] The image acquisition module 1210 may be configured to acquire a target image.
[0157] The pixel gray module 1220 may be configured to obtain the gray values of each pixel point in the target image.
[0158] The gray statistics module 1230 may be configured to obtain the target gray value, the gray mean, and the gray standard deviation with the largest number of pixel points in the target image according to the gray values of each pixel point in the target image.
[0159] The brightness level module 1240 may be configured to determine the target brightness level of the target image according to the target gray value, the gray mean, and the gray standard deviation.
[0160] The color enhancement module 1250 may be configured to perform color enhancement processing on the target image according to the target brightness level.
[0161] The image processing device provided by the embodiments of the present disclosure can comprehensively characterize the brightness level of the target image from different dimensions based on the target gray value, gray mean value, and gray standard deviation obtained from the gray values of each pixel point in the target image, so that the obtained target brightness level has a high accuracy rate. Furthermore, when performing color enhancement processing on the target image according to the target brightness level, it can adjust the brightness of the target image in a targeted manner, avoiding the appearance of overly dark or overexposed images. At the same time, only calculating the target gray value, gray mean value, and gray standard deviation can greatly reduce the computational complexity and improve the computational efficiency on the premise of ensuring the color enhancement quality.
[0162] In an exemplary embodiment, the brightness level module 1240 may include 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 gray value is less than or equal to the first gray threshold, the gray mean value is less than the first mean threshold, and the gray standard deviation is less than the first standard deviation threshold.
[0163] In an exemplary embodiment, the brightness level module 1240 may further include a second brightness level unit, which is configured to determine that the target brightness level of the target image is the second brightness level if the target gray value is greater than or equal to the second gray threshold, the gray mean value is greater than the second mean threshold, and the gray standard deviation is less than the first standard deviation threshold; wherein, the second gray threshold is greater than the first gray threshold, and the second mean threshold is greater than the first mean threshold.
[0164] In an exemplary embodiment, the brightness level module 1240 may further include a third brightness level unit, which is configured to determine that the target brightness level of the target image is the third brightness level if the target gray value is less than or equal to the first gray threshold, the gray mean value is greater than or equal to the first mean threshold, or the gray standard deviation is greater than or equal to the first standard deviation threshold; or, if the target gray value is greater than or equal to the second gray threshold, the gray mean value is less than or equal to the second mean threshold, or the gray standard deviation is greater than or equal to the first standard deviation threshold, then determine that the target brightness level of the target image is the third brightness level; or, if the target gray value is greater than the first gray threshold and less than the second gray threshold, then determine that the target brightness level of the target image is the third brightness level.
[0165] In an exemplary embodiment, the color enhancement module 1250 may include a first enhancement unit, a second enhancement unit, and a third enhancement unit. Among them, 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 is a first brightness level, where the first neural network model is trained using 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 is a second brightness level, where the second neural network model is trained using 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 is a third brightness level, where the third neural network model is trained using a third image training set including the third brightness level.
[0166] In an exemplary embodiment, the image acquisition module 1210 may include a video acquisition unit, a target video unit, and a target image unit. Among them, 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.
[0167] In an exemplary embodiment, the color enhancement module 1250 may include a fourth enhancement unit, a fifth enhancement unit, a sixth enhancement unit, and a seventh enhancement unit. Among them, the fourth enhancement unit may be configured to perform color enhancement processing on the video frames in the target video using a fourth neural network model if the target brightness level of the target image in the target video includes the first brightness level and the third brightness level, where the fourth neural network model is trained using 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 video frames in the target video using a fifth neural network model if the target brightness level of the target image in the target video is the second brightness level and the third brightness level, where the fifth neural network model is trained using 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 video frames in the target video using a sixth neural network model if the target brightness level of the target image in the target video is the first brightness level and the second brightness level, where the sixth neural network model is trained using a sixth image training set including the first brightness level and the second brightness level. The seventh enhancement unit may be configured to perform color enhancement processing on the video frames in the target video using a seventh neural network model 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, where the seventh neural network model is trained using a seventh image training set including the first brightness level, the second brightness level, and the third brightness level.
[0168] In an exemplary embodiment, the target video unit may include a shot detection subunit and a target video subunit. Among them, the shot detection subunit may be configured to detect and obtain the shot mutation flag 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 flag bit to obtain at least one target video.
[0169] 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.
[0170] In an exemplary embodiment, the gray-scale statistics module 1230 may include a histogram unit, a first statistics unit, and a second statistics unit. Among them, the histogram unit may be configured to perform gray-scale statistics on the gray-scale values of each pixel point in the target image to obtain the gray-scale histogram of the target image. The first statistics unit may be configured to determine, according to the peak value of the gray-scale histogram, the gray-scale value with the largest number of pixel points in the target image as the target gray-scale value of the target image. The second statistics unit may be configured to determine the gray-scale mean and gray-scale standard deviation of the target image according to the gray-scale values of each pixel point in the target image and the width value and height value of the target image.
[0171] Figure 13 The structural schematic diagram of the electronic device suitable for implementing the embodiments of the present disclosure is shown. It should be noted that, Figure 13 The shown electronic device 1300 is only an example and should not impose any limitation on the functions and usage scope of the embodiments of the present disclosure.
[0172] As Figure 13 shown, the electronic device 1300 includes a central processing unit (CPU) 1301, which can perform various appropriate actions and processes according to the program stored in the read-only memory (ROM) 1302 or the program loaded from the storage section 1308 into the random access memory (RAM) 1303. In the RAM 1303, various programs and data required for system operation are also stored. The CPU 1301, ROM 1302, and RAM 1303 are connected to each other through a bus 1304. The input / output (I / O) interface 1305 is also connected to the bus 1304.
[0173] The following components are connected to the I / O interface 1305: an input section 1306 including a keyboard, a mouse, etc.; an output section 1307 including a cathode ray tube (CRT), a liquid crystal display (LCD), etc. and a speaker, etc.; a storage section 1308 including a hard disk, etc.; and a communication section 1309 including a network interface card such as a LAN card, a modem, etc. The communication section 1309 performs communication processing via a network such as the Internet. A drive 1310 is also connected to the I / O interface 1305 as needed. A removable medium 1311, such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, etc., is mounted on the drive 1310 as needed so that a computer program read therefrom is installed into the storage section 1308 as needed.
[0174] Specifically, according to an embodiment of the present disclosure, the processes described below with reference to the flowcharts can be implemented as computer software programs. For example, an embodiment of the present disclosure includes a computer program product that includes a computer program carried on a computer-readable medium, and the computer program includes program codes for performing the methods shown in the flowcharts. In such an embodiment, the computer program can be downloaded and installed from a network via the communication section 1309, and / or installed from the removable medium 1313. When the computer program is executed by a central processing unit (CPU) 1301, various functions defined in the system of the present application are executed.
[0175] It should be noted that the computer-readable medium shown in this disclosure can be a computer-readable signal medium, a computer-readable storage medium, or any combination of the two. A computer-readable storage medium can be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination of the above. More specific examples of a computer-readable storage medium can include, but are not limited to: an electrical connection having 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 this disclosure, a computer-readable storage medium can be any tangible medium that contains or stores a program that can be used by or in conjunction with an instruction execution system, apparatus, or device. In this disclosure, a computer-readable signal medium can include a data signal propagated in a baseband or as part of a carrier wave, which carries computer-readable program code. Such a propagated data signal can take various forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the above. A computer-readable signal medium can also be any computer-readable medium other than a computer-readable storage medium, which can 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 a computer-readable medium can be transmitted using any appropriate medium, including but not limited to: wireless, wire, optical fiber, RF, etc., or any suitable combination of the above.
[0176] The flowcharts and block diagrams in the accompanying drawings illustrate the possible architectures, functions, and operations of systems, methods, and computer program products according to various embodiments of this disclosure. In this regard, each block in a flowchart or block diagram can represent a module, a program segment, or a part of code that contains at least one executable instruction for implementing a specified logical function. It should also be noted that in some alternative implementations, the functions marked in a block can occur in a different order than that marked in the accompanying drawings. For example, two consecutive blocks shown can actually be executed substantially in parallel, and they can sometimes be executed in the reverse order, depending on the functions involved. It should also be noted that each block in a block diagram or flowchart, and the combination of blocks in a block diagram or flowchart, can be implemented by a dedicated hardware-based system for performing the specified functions or operations, or can be implemented by a combination of dedicated hardware and computer instructions.
[0177] The modules and / or units and / or subunits involved in the embodiments described in this disclosure may be implemented in software or in hardware, and the described modules and / or units and / or subunits may also be provided in a processor. Among them, the names of these modules and / or units and / or subunits do not, in some cases, constitute a limitation on the modules and / or units and / or subunits themselves.
[0178] As another aspect, this application also provides a computer-readable medium, which may be included in the electronic device described in the above embodiments; or may exist alone without being assembled into the electronic device. The above computer-readable medium carries one or more programs, and when the one or more programs are executed by an electronic device, the electronic device is caused to implement the methods described in the following embodiments. For example, the electronic device may implement each step as shown in Figure 2 or Figure 3 or Figure 4 or Figure 5 or Figure 6 or Figure 7 or Figure 8 or Figure 9 the respective steps shown.
[0179] It should be noted that although several modules or units or subunits of the devices for action execution are mentioned in the above detailed description, such a division is not mandatory. In fact, according to the embodiments of the present disclosure, the features and functions of the two or more modules or units or subunits described above may be embodied in one module or unit or subunit. Conversely, the features and functions of one module or unit described above may be further divided and embodied by multiple modules or units or subunits.
[0180] Through the description of the above embodiments, those skilled in the art can easily understand that the example embodiments described herein can be implemented by software or by a combination of software and necessary hardware. Therefore, the technical solutions according to the embodiments 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 may be a CD-ROM, a USB flash drive, a mobile hard disk, etc.) or on a network, including several instructions to cause a computing device (which may be a personal computer, a server, a touch terminal, or a network device, etc.) to execute the methods according to the embodiments of the present disclosure.
[0181] Other embodiments of the present disclosure will be readily apparent to those skilled in the art upon consideration of the specification and practice of 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 known or customary technical means in the art not disclosed herein. The specification and examples are only to be considered as exemplary, and the true scope and spirit of the present disclosure are pointed out by the following claims.
[0182] It should be understood that the present disclosure is not limited to the exact structures described above and shown in the drawings, and various modifications and changes can be made without departing from its scope. The scope of the present disclosure is only limited by the appended claims.
Claims
1. An image processing method, characterized in that, including: Obtain a target image; Obtain the gray values of each pixel point in the target image; According to the gray values of each pixel point in the target image, obtain the target gray value, gray mean value, and gray standard deviation with the largest number of pixel points in the target image; Determine the target brightness level of the target image according to the target gray value, the gray mean value, and the gray standard deviation, where the target brightness level includes a first brightness level, a second brightness level, and a third brightness level; Perform color enhancement processing on the target image according to the target brightness level, including: If the target brightness level of the target image in the target video includes the first brightness level and the third brightness level, use a fourth neural network model to perform color enhancement processing on the video frames in the target video, where the fourth neural network model is trained using a fourth image training set including the first brightness level and the third brightness level; If the target brightness level of the target image in the target video is the second brightness level and the third brightness level, use a fifth neural network model to perform color enhancement processing on the video frames in the target video, where the fifth neural network model is trained using a fourth image training set including the second brightness level and the third brightness level; If the target brightness level of the target image in the target video is the first brightness level and the second brightness level, use a sixth neural network model to perform color enhancement processing on the video frames in the target video, where the sixth neural network model is trained using a sixth image training set including the first brightness level and the second brightness level; 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, use a seventh neural network model to perform color enhancement processing on the video frames in the target video, where the seventh neural network model is trained using a seventh image training set including the first brightness level, the second brightness level, and the third brightness level.
2. The method according to claim 1, characterized in that, Determining the target brightness level of the target image according to the target gray value, the gray mean value, and the gray standard deviation includes: If the target gray value is less than or equal to a first gray threshold, and the gray mean value is less than a first mean threshold, and the gray standard deviation is less than a first standard deviation threshold, determine that the target brightness level of the target image is the first brightness level.
3. The method according to claim 2, determining the target brightness level of the target image according to the target gray value, the gray mean value, and the gray standard deviation further includes: If the target gray value is greater than or equal to a second gray threshold, and the gray mean value is greater than a second mean threshold, and the gray standard deviation is less than a first standard deviation threshold, determine that the target brightness level of the target image is the second brightness level; wherein, the second gray threshold is greater than the first gray threshold, and the second mean threshold is greater than the first mean threshold.
4. The method according to claim 3, characterized in that, Determining the target brightness level of the target image according to the target gray value, the gray mean value, and the gray standard deviation further includes: If the target gray value is less than or equal to the first gray threshold, the gray mean value is greater than or equal to the first mean threshold, or the gray standard deviation is greater than or equal to the first standard deviation threshold, then determine that the target brightness level of the target image is the third brightness level; or, If the target gray value is greater than or equal to the second gray threshold, the gray mean value is less than or equal to the second mean threshold, or the gray standard deviation is greater than or equal to the first standard deviation threshold, then determine that the target brightness level of the target image is the third brightness level; or, If the target gray value is greater than the first gray threshold and less than the second gray threshold, then determine that the target brightness level of the target image is the third brightness level.
5. The method according to claim 4, wherein Performing color enhancement processing on the target image according to the target brightness level includes: If the target brightness level is the first brightness level, perform color enhancement processing on the target image by using a first neural network model, where the first neural network model is trained by using a first image training set including the first brightness level; If the target brightness level is the second brightness level, perform color enhancement processing on the target image by using a second neural network model, where the second neural network model is trained by using a second image training set including the second brightness level; If the target brightness level is the third brightness level, perform color enhancement processing on the target image by using a third neural network model, where the third neural network model is trained by using a third image training set including the third brightness level.
6. The method according to claim 4, wherein Obtaining a target image includes: Obtaining a video to be processed; Obtaining a target video according to the video to be processed; Determining the target image 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 a shot mutation flag bit in the video to be processed; Segmenting the video to be processed according to the shot mutation flag bit to obtain at least one target video.
8. The method according to claim 6, wherein Determining the target image from the target video includes: Sampling video frames of the target video at a preset sampling frequency to obtain at least one target image.
9. The method according to claim 1, wherein Obtaining the target gray value, gray mean value, and gray standard deviation with the largest number of pixel points in the target image according to the gray values of each pixel point in the target image includes: Performing gray statistics on the gray values of each pixel point in the target image to obtain a gray histogram of the target image; Determining the gray value with the largest number of pixel points in the target image according to the peak value of the gray histogram as the target gray value of the target image; Determining the gray mean value and the gray standard deviation of the target image according to the gray values of each pixel point in the target image and the width value and height value of the target image.
10. An image processing apparatus, characterized in that, Includes: An image acquisition module configured to acquire a target image; A pixel gray module configured to obtain the gray values of each pixel point in the target image; A grayscale statistics module, configured to obtain a target grayscale value, a grayscale mean value, and a grayscale standard deviation with the largest number of pixel points in the target image according to the grayscale values of each pixel point in the target image; A brightness level module, configured to determine a target brightness level of the target image according to the target grayscale value, the grayscale mean value, and the grayscale standard deviation, where the target brightness level includes a first brightness level, a second brightness level, and a third brightness level; A color enhancement module, configured to perform color enhancement processing on the target image according to the target brightness level; Among them, the color enhancement module includes: A fourth enhancement unit, configured to perform color enhancement processing on the video frames in the target video by using a fourth neural network model if the target brightness level of the target image in the target video includes the first brightness level and the third brightness level, where the fourth neural network model is trained by 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 video frames in the target video by using a fifth neural network model if the target brightness level of the target image in the target video is the second brightness level and the third brightness level, where the fifth neural network model is trained by 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 video frames in the target video by using a sixth neural network model if the target brightness level of the target image in the target video is the first brightness level and the second brightness level, where the sixth neural network model is trained by using a sixth image training set including the first brightness level and the second brightness level; A seventh enhancement unit, configured to perform color enhancement processing on the video frames in the target video by using a seventh neural network model 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, where the seventh neural network model is trained by using a seventh image training set including the first brightness level, the second brightness level, and the third brightness level.
11. An electronic device, characterized in that, Including: 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-9.
12. A computer-readable medium having a computer program stored thereon, characterized in that, When the program is executed by the processor, it implements the method according to any one of claims 1-9.
13. A computer program product, which includes computer instructions, and when the computer instructions are executed, it implements the method according to any one of claims 1-9.
Citation Information
Patent Citations
Backlight testing method, backlight testing system, picture taking device and terminal
CN105049743A
Image enhancement method and an image enhancement device
CN109801240A