Image processing method, device, terminal equipment and storage medium
By acquiring the image in the color-brightness separation color mode, determining each scene and brightness distribution, and generating a brightness mapping relationship based on the standard brightness distribution and weight value, adjusting the brightness component of each pixel in the image, solving the problem of excessive color in the existing technology Adjustment and distortion problems in bright areas are achieved, achieving efficient image processing effects.
Patent Information
- Application Number
- CN201811630233.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2018-12-28
- Publication Date
- 2024-09-10
- Estimated Expiration
- 2038-12-28
AI Technical Summary
Existing image brightening methods enhance the RGB value of each pixel, resulting in excessive color adjustment, distortion, blurring of brighter areas, and poor image processing effects.
By obtaining the image in the color-brightness separation color mode, determine each scene and brightness distribution in the image, generate a brightness mapping relationship according to the standard brightness distribution and weight value of each scene, adjust the brightness component of each pixel in the image, and generate the processed image.
The image processing effect is significantly improved, maintaining the authenticity of colors and the clarity of bright areas, meeting users' needs for high-definition images.
Smart Images

Figure CN109697738B
Abstract
Description
Technical Field
[0001] The embodiments of the present application relate to image processing technology, and in particular, to an image processing method, apparatus, terminal device and storage medium. Background Art
[0002] With the rapid development of terminal devices, devices such as smart phones and tablet computers are equipped with image acquisition functions, and users have increasingly higher requirements for the quality of images captured by these terminal devices.
[0003] At present, after collecting images, the images are generally brightened to make the darker areas in the obtained images brighter, to show the details that are difficult to distinguish with the naked eye, and to improve the clarity of the entire image. However, in the above-mentioned image brightening method, the RGB value of each pixel in the image is generally enhanced, which can easily lead to the following problems: the color in the image is over-adjusted and close to gray, and the color of the brighter area is distorted after enhancement and becomes blurred, resulting in poor image processing effect. Summary of the invention
[0004] The present application provides an image processing method, apparatus, terminal device and storage medium, which improve the image processing effect.
[0005] In a first aspect, an embodiment of the present application provides an image processing method, comprising:
[0006] Get an image in color-brightness separation color mode;
[0007] Determining each scene included in the image and image brightness distribution of the image;
[0008] Generate a brightness mapping relationship according to the standard brightness distribution corresponding to each scene, the weight value and the image brightness distribution;
[0009] The brightness component of each pixel in the image is adjusted according to the brightness mapping relationship to generate a first processed image.
[0010] In a second aspect, an embodiment of the present application further provides an image processing device, including:
[0011] An original image acquisition module is used to acquire an image in a color-brightness separation color mode;
[0012] An image parameter determination module, used to determine each scene included in the image and the image brightness distribution of the image;
[0013] A mapping relationship determination module, used to generate a brightness mapping relationship according to the standard brightness distribution corresponding to each scene, the weight value and the image brightness distribution;
[0014] The adjustment module is used to adjust the brightness component of each pixel in the image according to the brightness mapping relationship to generate a first processed image.
[0015] In a third aspect, an embodiment of the present application further provides a terminal device, comprising: a processor, a memory, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the computer program, the image processing method as described in the embodiment of the present application is implemented.
[0016] In a fourth aspect, an embodiment of the present application further provides a storage medium comprising terminal device executable instructions, wherein the terminal device executable instructions are used to execute the image processing method described in the embodiment of the present application when executed by a terminal device processor.
[0017] In this scheme, an image in a color-brightness separation color mode is obtained; the various scenes contained in the image and the image brightness distribution of the image are determined; a brightness mapping relationship is generated according to the standard brightness distribution and weight values corresponding to the various scenes and the image brightness distribution; and the brightness component of each pixel in the image is adjusted according to the brightness mapping relationship, thereby improving the image processing effect. BRIEF DESCRIPTION OF THE DRAWINGS
[0018] Other features, objects and advantages of the present application will become more apparent by reading the detailed description of non-limiting embodiments made with reference to the following drawings:
[0019] Figure 1 is a flow chart of an image processing method provided by an embodiment of the present application;
[0020] Figure 1a is a schematic diagram of a determined image brightness distribution diagram provided in an embodiment of the present application;
[0021] Figure 1b is a curve schematic diagram of a brightness mapping relationship provided in an embodiment of the present application;
[0022] Figure 2 is a flowchart of another image processing method provided by an embodiment of the present application;
[0023] Figure 3 is a flowchart of another image processing method provided by an embodiment of the present application;
[0024] Figure 4 is a flowchart of another image processing method provided by an embodiment of the present application;
[0025] Figure 5 is a flowchart of another image processing method provided by an embodiment of the present application;
[0026] Figure 6is a structural block diagram of an image processing device provided in an embodiment of the present application;
[0027] Figure 7 It is a structural diagram of a terminal device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0028] The present application will be further described in detail below in conjunction with the accompanying drawings and embodiments. It is to be understood that the specific embodiments described herein are used to explain the present application, rather than to limit the present application. It should also be noted that, for ease of description, only the parts related to the present application, rather than all structures, are shown in the accompanying drawings.
[0029] Figure 1 is a flowchart of an image processing method provided in an embodiment of the present application, which can be applied to a terminal device to process an image. The method can be executed by the terminal device provided in an embodiment of the present application. The image processing device of the terminal device can be implemented in software and / or hardware. Figure 1 As shown, the specific solution provided in this embodiment is as follows:
[0030] Step S101, obtaining an image in a color-brightness separation color mode.
[0031] Color is usually described by three relatively independent attributes. The three independent variables work together to form a spatial coordinate, which is the color mode. Color modes can be divided into primary color mode and color and brightness separation color mode. For example, primary color mode includes but is not limited to RGB color mode, and color and brightness separation color mode includes but is not limited to YUV color mode.
[0032] and Lab color mode. In the YUV color mode, the Y component represents brightness, the U component represents chromaticity, and the V component represents concentration, where the U component and the V component together represent the color of the image. In the Lab color mode, the L component represents brightness, and a and b together represent color. In the image of the color and brightness separation color mode, the brightness component and the color component can be extracted separately, and the image can be processed in any aspect of brightness and color. During the processing of the brightness component, it will not cause any impact on the color component of the image.
[0033] RGB color mode, YUV color mode and Lab color mode can be converted. Taking a mobile phone as an example, when an image is collected by an image acquisition device in the mobile phone, a method for generating an image in a YUV color mode includes: based on the raw data collected by the image sensor, converting the raw data into an image in an RGB color mode; generating an image in a YUV color mode according to the image in the RGB color mode. Among them, the image acquisition device can be a camera, which can include a charge-coupled device (CCD) image sensor or a complementary metal oxide semiconductor (CMOS) image sensor, converting the captured light source signal into RAW raw data of a digital signal based on the above CCD image sensor or CMOS image sensor, converting the RAW raw data into image data in an RGB color mode, and further converting the image data into image data in a YUV color mode. In the image acquisition device of the mobile phone, an image in JPG format can be formed by an image in a YUV color mode.
[0034] The colors in the image data of the RGB color mode formed by the conversion of the RAW original data are not the real colors of the image, and the image data of the RGB color mode formed here cannot be processed in any way. The colors formed in the image data of the YUV color mode are the real colors of the image, and the image data of the YUV color mode can be processed. In common image processing, RGB data is usually processed, and the raw data collected by the image sensor is converted into the following color mode during the processing: RAW original data - RGB color mode image - YUV color mode image - RGB color mode image, the RGB color mode image is processed to obtain the processed RGB color mode image, and the processed RGB color mode image is converted into the YUV color mode image, and the JPG format image can be output. Correspondingly, when processing images of other color modes, they all need to be converted from the YUV color mode image, and after the processed image is converted into the YUV color mode image, the JPG format image is obtained.
[0035] In one embodiment, the acquired image in the color brightness separation color mode may be an image in the YUV color mode or an image in the Lab color mode. When the image processing method of the present application is applied to a mobile phone, the acquired image in the color brightness separation color mode may be an image in the YUV color mode, which may be processed after the image acquisition device acquires the image in the YUV color mode, without the need for redundant image conversion, thereby reducing the image conversion process and improving image processing efficiency.
[0036] In this embodiment, the image in the color-brightness separation color mode can be an image captured by the camera according to a shooting instruction, or it can be image information collected by the camera before the shooting instruction is executed and presented on the screen of the electronic device for user preview.
[0037] Step S102: Determine each scene included in the image and the image brightness distribution of the image.
[0038] In one embodiment, the different scenes contained in the image are divided by image segmentation. Specifically, it can be implemented by threshold-based segmentation, region-based segmentation, edge-based segmentation, or segmentation based on specific theories. For example, if an image contains four scenes such as sunset, sea water, beach, and people, the image regions corresponding to the sunset, sea water, beach, and people are obtained by image segmentation. After the image segmentation is completed, the segmented image regions are respectively identified to determine the various scenes contained in the current image. Among them, image recognition refers to the use of a program to process, analyze, and understand an image to identify each image region. Specifically, it can be scene recognition of an image based on factors such as the objects contained in the image region and the light and dark ratio of the image. For example, image recognition can be performed on an image based on a deep learning model, and the deep learning model can be a convolutional neural network. A deep learning model with scene recognition function is pre-set in the terminal device. The deep learning model can be trained based on supervised learning. For example, a large number of images are collected and the real scene of each image is labeled as a training sample. The sample image is input into an untrained deep learning model to obtain an output scene. When the output scene of the deep learning model is inconsistent with the real scene, the network parameters such as weights and offset values in the deep learning model are reversely adjusted according to the difference between the output scene and the real scene. The above training process is executed repeatedly until the accuracy of the output scene of the deep learning model reaches the preset accuracy, and the training of the deep learning model is completed.
[0039] In one embodiment, in the process of determining the brightness distribution of an image, the brightness component of each pixel in the image is traversed. For example, in an image in a YUV color mode, the Y component of each pixel in the image is extracted, and the pixel points corresponding to each brightness component are counted. Optionally, the image data in the YUV color mode is stored in a planar format, that is, the three components of Y, U, and V are stored in different matrices respectively. When traversing the brightness components of each pixel in the image, the matrix used to store the Y component is read to obtain the brightness components of each pixel in the image, and then the image brightness distribution is obtained by statistics. For example, Figure 1a As shown, Figure 1aIt is a schematic diagram of the determined image brightness distribution diagram provided in an embodiment of the present application, wherein the horizontal axis is the brightness components of the image, ranging from 0 to 255, and the vertical axis is the number of pixels corresponding to each brightness component in the image.
[0040] Step S103: generating a brightness mapping relationship according to the standard brightness distribution corresponding to each scene, the weight value and the image brightness distribution.
[0041] Among them, different scenes correspond to a standard brightness distribution. The standard brightness distribution contains the standard ratio of the number of pixels corresponding to each brightness component of 0-255 to the number of pixels in the entire image. When the brightness distribution of the image area corresponding to the scene meets the corresponding standard brightness distribution, the display effect of the image can meet the user's demand for the image. When the brightness distribution of the image is different from the corresponding standard brightness distribution, the brightness components of the pixels in the image can be adjusted so that the brightness distribution of the adjusted image is consistent with the standard brightness distribution or within the allowable error range.
[0042] In one embodiment, after different scenes are identified, real-time calculations are performed to obtain corresponding standard brightness distributions, or standard brightness distributions corresponding to different scenes are pre-stored. Specifically, the process of determining the standard brightness distribution can be based on the test sample image effect (the test sample image is a picture corresponding to different scenes, such as sunset, sea water, beach, people and other scenes), and a set of standard brightness distributions is calibrated for each sample set. Different scenes also correspond to corresponding weight values. The larger the weight value, the higher the importance of the scene in the entire image, and the lower the weight value, the lower the importance of the scene in the entire image. The weight value can be set by the user or the system by default. For example, taking the four scenes of sunset, sea water, beach, and people as examples, the weight values can be respectively: 0.2, 0.3, 0.1 and 0.4.
[0043] In one embodiment, the method of generating a brightness mapping relationship according to the standard brightness distribution corresponding to each scene, the weight value and the image brightness distribution can be: for the brightness value of each pixel in the image brightness distribution, the brightness value of the pixel in the standard brightness distribution under each scene is searched to obtain a first contrast coefficient table, and the contrast coefficient values in the first contrast coefficient table are weighted according to the weight value to obtain a second contrast coefficient table. Among them, the contrast coefficient of any pixel is equal to the brightness value of the pixel in the standard brightness distribution divided by the brightness value of the corresponding pixel in the image brightness distribution. Specifically, for the brightness value of each pixel in the image, the brightness value of the pixel in the standard brightness distribution under different scenes is searched respectively, and the first contrast coefficient table is obtained by division operation, wherein the number of scenes is a positive integer greater than 1. After obtaining the contrast coefficient table corresponding to each pixel in the image, each contrast coefficient value in the contrast coefficient table can be multiplied by the corresponding weight value to obtain a second contrast coefficient table by weighting, and the contrast coefficient value in the second contrast coefficient table is a parameter that introduces different weight value factors for different scenes. The setting of the specific scenes and the corresponding weight values can refer to the above implementation, and will not be repeated here.
[0044] In one embodiment, the generating of brightness mapping relationship according to the standard brightness distribution, weight value and image brightness distribution corresponding to each scene includes: generating a combined brightness distribution according to the standard brightness distribution and weight value corresponding to each scene; generating a brightness mapping relationship according to the combined brightness distribution and the image brightness distribution. Wherein, the combined brightness distribution is a combination of standard brightness distributions corresponding to multiple different scenes, and is a brightness distribution corresponding to the image that needs to be finally realized. Specifically, it can be determined that the pixel point ratio corresponding to each brightness component in the standard brightness distribution corresponding to each scene is multiplied by the corresponding weight value and then summed to obtain the pixel point ratio of the brightness component in the combined brightness distribution, thereby obtaining a complete combined brightness distribution. Optionally, generating a brightness mapping relationship according to the combined brightness distribution and the image brightness distribution includes: searching for the brightness value of each pixel point in the image brightness distribution for the corresponding pixel point brightness value of the combined brightness distribution to obtain a contrast coefficient matrix. Wherein, the contrast coefficient matrix stores the contrast coefficient values corresponding to the image pixels. The determination method of the contrast coefficient value refers to the above example and will not be repeated here.
[0045] The brightness mapping relationship includes the correspondence between the original brightness component of the image and the mapped brightness component, which can be used to adjust the brightness component of the pixel point in the image to the mapped brightness component, and the brightness distribution of the adjusted image satisfies the combined brightness distribution. Figure 1b , Figure 1bis a curve diagram of a brightness mapping relationship provided in an embodiment of the present application. The brightness mapping relationship may be displayed in the form of a curve or a lookup table (LUT), which is not limited in this embodiment. Figure 1b This is just a curve showing an example of brightness mapping. Figure 1b In the figure, the curve corresponding to the horizontal axis is the original brightness component of the image, and the curve corresponding to the vertical axis is the adjusted brightness component.
[0046] Step S104: adjusting the brightness component of each pixel in the image according to the brightness mapping relationship to generate a first processed image.
[0047] In one embodiment, the brightness distribution of the image is adjusted according to the obtained combined brightness distribution, so as to achieve reasonable adaptive adjustment when the image contains multiple scenes at the same time. Exemplarily, each pixel in the image is traversed, the brightness component of each pixel is obtained, the mapped brightness component corresponding to the brightness component is determined based on the brightness mapping relationship, and the brightness component of each pixel is adjusted to the mapped brightness component to achieve brightness adjustment of the image and obtain a first processed image. In one embodiment, the color of each pixel in the image brightness distribution can be compensated according to the obtained contrast coefficient matrix to obtain the first processed image. Specifically, the brightness value of each pixel in the determined image brightness distribution can be multiplied by the corresponding contrast coefficient value stored in the contrast coefficient matrix to complete the compensation of the image and obtain the first processed image.
[0048] From the above content, it can be seen that for each scene contained in the image, a brightness mapping relationship is generated according to the standard brightness distribution, weight value and the image brightness distribution corresponding to each scene, and after the mapping relationship is established, the brightness component of the pixel points in the image is adjusted, which significantly improves the image processing effect and meets the user's demand for high-definition images.
[0049] Figure 2 This is a flowchart of another image processing method provided by an embodiment of the present application. Optionally, the brightness mapping relationship generated based on the combined brightness distribution and the image brightness distribution includes: determining the first pixel point ratio corresponding to each brightness component in the combined brightness distribution, determining the second pixel point ratio corresponding to each brightness component in the image brightness distribution, determining the brightness component to be adjusted and the corresponding target brightness component according to the first pixel point ratio and the second pixel point ratio, and establishing a mapping relationship between the brightness component to be adjusted and the target brightness component. Figure 2 As shown, the technical solution is as follows:
[0050] Step S201, obtaining an image in a color-brightness separation color mode.
[0051] Step S202: Determine each scene included in the image and the image brightness distribution of the image.
[0052] Step S203, determine the first pixel ratio corresponding to each brightness component in the combined brightness distribution, determine the second pixel ratio corresponding to each brightness component in the image brightness distribution, determine the brightness component to be adjusted and the corresponding target brightness component according to the first pixel ratio and the second pixel ratio, and establish a mapping relationship between the brightness component to be adjusted and the target brightness component.
[0053] In one embodiment, for any brightness component, when the first pixel ratio of the brightness component in the combined brightness distribution is different from the second pixel ratio of the corresponding brightness component in the image, the brightness component needs to be adjusted. Specifically, when the first pixel ratio of the first brightness component in the combined brightness distribution is greater than the second pixel ratio of the first brightness component in the image, it is necessary to map other brightness components to the first brightness component to increase the second pixel ratio of the first brightness component in the image, wherein the other brightness component is the brightness component to be adjusted, the first brightness component is the target brightness component, and a mapping relationship between the other brightness component and the target brightness component is established. Exemplarily, the other brightness component is the brightness component in the adjacent interval of the first brightness component, wherein the corresponding pixel ratio of the other brightness component to be adjusted can be the same as the difference between the first pixel ratio and the second pixel ratio, or the difference between the first pixel ratio and the second pixel ratio is within the allowable error range. Similarly, when the first pixel ratio of the second brightness component in the standard brightness distribution is greater than the second pixel ratio of the second brightness component in the image to be processed, it is necessary to map the second brightness component to other brightness components to reduce the second pixel ratio of the second brightness component in the image to be processed.
[0054] Optionally, each brightness component is analyzed and processed in sequence according to the numerical value of the brightness component, for example, it can be performed in the order of increasing brightness components from 0 to 255, or in the order of decreasing brightness components from 255 to 0. Exemplarily, taking the brightness component of 0 as an example, the generation method of the brightness mapping relationship is introduced. When the proportion of the first pixel point with a brightness component of 0 in the combined brightness distribution is greater than the proportion of the second pixel point with a brightness component of 0 in the image to be processed, the proportional difference between the first pixel point proportion and the second pixel proportion can be determined. If the pixel proportion of the brightness component in the interval of 1-5 is the same or similar to the above-mentioned proportional difference, the brightness component in the interval of 1-5 is determined as the brightness component that needs to be adjusted, and the brightness component of 0 is used as the target brightness component. A mapping relationship is established, that is, the brightness components of 1-5 are mapped to the brightness component of 0 in the brightness mapping relationship. And so on, a brightness mapping relationship is established.
[0055] It should be noted that, the range of the brightness component of the image acquired by the terminal device can be 0-255, or any sub-range of 0-255. For example, the range of the brightness component can be 30-200, that is, the number of pixels in the image whose brightness components are within the range of 0-30 and 200-255 is 0. By establishing a brightness mapping relationship, the range of the brightness component 30-200 can be mapped to the range of 0-255, thereby stretching the brightness component range of the acquired image, making the bright areas brighter and the dark areas darker, amplifying the colors, and improving the clarity of the image.
[0056] Step S204: adjusting the brightness component of each pixel in the image according to the brightness mapping relationship to generate a first processed image.
[0057] From the above, it can be seen that by combining the brightness distribution and the pixel ratio of the corresponding brightness component in the image brightness distribution of the image to be processed, the mapping relationship of the brightness component is determined to establish a brightness mapping relationship. After determining the brightness component of each pixel in the image, the mapped target brightness component can be quickly determined by querying the brightness mapping relationship. Compared with the method of performing function mapping on each pixel, the image processing efficiency is improved, the image processing time is reduced, and the user experience is better.
[0058] On the basis of the above technical solution, optionally, generating a brightness mapping relationship based on the combined brightness distribution and the image brightness distribution includes: determining the third pixel ratio corresponding to each brightness component interval in the combined brightness distribution, determining the fourth pixel ratio corresponding to each brightness component interval in the image brightness distribution, determining the brightness component to be adjusted and the corresponding target brightness component according to the third pixel ratio and the fourth pixel ratio, and establishing a mapping relationship between the brightness component to be adjusted and the target brightness component.
[0059] The brightness component range 0-255 is divided into multiple brightness component intervals, and the brightness component is analyzed and processed in units of brightness component intervals to establish a brightness mapping relationship. The principle of establishing the brightness mapping relationship is the same as the principle of establishing the brightness mapping relationship in the above embodiment, and will not be repeated here.
[0060] Exemplarily, taking the brightness component interval 0-10 as an example, the generation method of the brightness mapping relationship is introduced. When the ratio of the third pixel point with a brightness component interval of 0-10 in the standard brightness distribution is greater than the ratio of the fourth pixel point with a brightness component interval of 0-10 in the image to be processed, the ratio difference between the third pixel point ratio and the fourth pixel ratio can be determined. If the pixel ratio of the brightness component in the interval 10-15 is the same or similar to the above ratio difference, the brightness component in the interval 0-15 is determined as the brightness component to be adjusted, and the brightness component interval 0-10 is used as the target brightness component to establish a mapping relationship. Exemplarily, each brightness component in the brightness component interval 0-15 is multiplied by 2 / 3 to obtain the target brightness component, for example, a mapping relationship is established between brightness component 15 and target brightness component 10, a mapping relationship is established between brightness component 12 and target brightness component 8, and a mapping relationship is established between brightness component 9 and target brightness component 6... and so on. Correspondingly, the mapping relationship is determined in sequence for each brightness component interval in the brightness component range 0-255 to establish a brightness mapping relationship.
[0061] Among them, the larger the brightness component interval, the faster the brightness mapping relationship is established, and the worse the accuracy of the brightness mapping relationship; correspondingly, the smaller the brightness component interval, the slower the brightness mapping relationship is established, and the higher the accuracy of the brightness mapping relationship. The division of the brightness component interval can be determined by measuring the speed and accuracy of establishing the brightness mapping relationship.
[0062] Figure 3 is a flowchart of another image processing method provided by an embodiment of the present application. Optionally, the brightness mapping relationship generated based on the combined brightness distribution and the image brightness distribution includes: traversing the brightness components of each pixel in the image to determine the brightness component range of the image; intercepting the target brightness distribution corresponding to the brightness component range in the combined brightness distribution; generating a brightness mapping relationship based on the target brightness distribution and the brightness distribution of the image. Figure 3 As shown, the technical solution is as follows:
[0063] Step S301, obtaining an image in a color-brightness separation color mode.
[0064] Step S302: Determine each scene included in the image and the image brightness distribution of the image.
[0065] Step S303, traversing the brightness components of each pixel in the image, intercepting a target brightness distribution corresponding to the brightness component range in the combined brightness distribution, and generating a brightness mapping relationship according to the target brightness distribution and the brightness distribution of the image.
[0066] Among them, according to the traversal results of the brightness components of each pixel in the image, the maximum and minimum values of the brightness components in the image are determined. It can be further known that the range of the brightness component of the image is the range between the minimum and maximum values. For example, the maximum value of the brightness component is 200 and the minimum value is 50, then the range of the brightness component of the image is 50-200. If the brightness component range of the image acquired by the electronic device is a subset of the brightness range 0-255, the combined brightness distribution is intercepted according to the maximum and minimum values of the brightness component in the image, and the part between the maximum and minimum values in the standard brightness distribution is obtained as the target brightness distribution. For example, when the range of the brightness component of the image is 50-200, the part of the brightness component of 50-200 in the standard brightness distribution is intercepted as the target brightness distribution.
[0067] The principle of generating the brightness mapping relationship based on the target brightness distribution and the brightness distribution of the image is the same as that of generating the brightness mapping relationship based on the combined brightness distribution and the image brightness distribution in the above embodiment, which will not be repeated here. The brightness mapping relationship can be established by analyzing in units of brightness components or brightness component intervals.
[0068] Step S304: adjusting the brightness component of each pixel in the image according to the brightness mapping relationship to generate a first processed image.
[0069] As can be seen from the above, according to the traversal results of the brightness components of the pixels in the image, the range of the image brightness components is determined, the target brightness distribution corresponding to the range of the image brightness components is intercepted in the combined brightness distribution, and the brightness mapping relationship is generated according to the target brightness distribution and the brightness distribution of the image, and the brightness components of the image are adjusted to generate a processed image. Within the range of the image brightness components, the brightness of the image is adjusted to a standard state, and the image brightness is reasonably adjusted to improve the image quality.
[0070] Figure 4 This is a flowchart of another image processing method provided by an embodiment of the present application. Optionally, after adjusting the brightness component of each pixel in the image according to the brightness mapping relationship to generate a first processed image, it also includes: edge recognition of the first processed image; determining a filter kernel for filtering the image according to the edge recognition result; filtering the first processed image based on the filter kernel to obtain a low-frequency image and a high-frequency image corresponding to the first processed image; determining a first gain coefficient for the high-frequency image and a second gain coefficient for the low-frequency image; gain processing the high-frequency image by the first gain coefficient to obtain a first gain image, and gain processing the low-frequency image by the second gain coefficient to obtain a second gain image; fusing the first gain image and the second gain image to obtain a second processed image. Figure 4As shown, the technical solution is as follows:
[0071] Step S401: Acquire an image in a color-brightness separation color mode.
[0072] Step S402: Determine each scene included in the image and the image brightness distribution of the image.
[0073] Step S403: Generate a brightness mapping relationship according to the standard brightness distribution corresponding to each scene, the weight value and the image brightness distribution.
[0074] Step S404: adjusting the brightness component of each pixel in the image according to the brightness mapping relationship to generate a first processed image.
[0075] Step S405: perform edge recognition on the first processed image, determine a filter kernel for filtering the image according to the edge recognition result, and filter the first processed image based on the filter kernel to obtain a low-frequency image and a high-frequency image corresponding to the first processed image.
[0076] Among them, edge recognition of the image is used to extract the boundary between the object and the background in the image. It can be to first roughly detect the contour points in the image, and then connect the detected contour points through the linking rules, and also detect and connect the missed boundary points and remove the false boundaries. The purpose of edge recognition is to find information about the shape and reflectance or transmittance in the image. Exemplarily, the adjacent pixel values or brightness values of the pixels of the image can be detected row by row and column by column, and the pixels with drastic changes in pixel values or brightness values are determined as edge pixels, and the edge pixels are connected to form edges. Exemplarily, edge recognition of the image can also be based on but not limited to the Roberts edge operator, the Sobel edge detection operator or the Laplacan edge operator to calculate the image.
[0077] Among them, the edge recognition result can be the edge information in the output image, or a feature value representing the edge information is generated based on the recognized edge information. The filter kernel is the operator kernel of the filter that performs filtering processing on the image. The filtering effect is different for different filter kernel sizes. For example, a filter with a smaller filter kernel can retain small details in the image for filtering processing, and a filter with a larger filter kernel can retain large contours in the image for filtering processing. Exemplarily, the filter kernel can be, but is not limited to, 3×3, 5×5, 7×7, or 9×9, etc.
[0078] Among them, when shooting different shooting objects, the collected image content has great differences. By edge recognition of the image, the filter kernel suitable for the image is determined, so that the image content is retained during the filtering process to avoid the loss of detail information or contour information in the image. Among them, the edge coefficient of the image is a characteristic value used to characterize the edge information. For example, the larger the edge coefficient, the more edge information contained in the image, and the smaller the edge coefficient, the less edge information contained in the image. In order to retain the information in the image, the size of the filter kernel is positively correlated with the edge coefficient, that is, the larger the edge coefficient of the image, the larger the filter kernel applied to the image. For example, when the image includes a white desktop and black buttons and dot-shaped stains on the desktop, it can be seen that the image is relatively flat and contains less edge information. The edge coefficient obtained by edge recognition of the image is small. Correspondingly, the filter kernel applicable to the image is small, for example, it can be a 3×3 filter kernel; when the image includes multiple tables, chairs, cabinets and multiple objects such as tables, it can be seen that the image is relatively complex and contains more edge information. The edge coefficient obtained by edge recognition of the image is large. Correspondingly, the filter kernel applicable to the image is large, for example, it can be a 9×9 filter kernel.
[0079] Optionally, based on the edge recognition result of the image, the position of the edge information in the image is determined, the image is divided into regions, the regions with edge information are filtered using a larger filter kernel, the background region of the image is filtered using a smaller filter kernel, and the image is filtered based on a dynamic filter kernel, while retaining the contour information and detail information of the image to avoid the loss of image information.
[0080] The filter used for filtering the image is a low-pass filter, and accordingly, the image is low-pass filtered. Specifically, the image is low-pass filtered based on the low-pass filter to obtain a low-frequency image corresponding to the original image, and the low-frequency image is subtracted from the original image to obtain a high-frequency image corresponding to the original image. Specifically, the pixel difference value of the corresponding pixel points of the original image and the low-frequency image is calculated to obtain a high-frequency image corresponding to the original image.
[0081] Among them, the brightness component of the first processed image is low-pass filtered. For example, in the YUV color mode, only the Y component is filtered to obtain a high-frequency image and a low-frequency image related to the Y component. The subsequent enhancement processing is all about adjusting and transforming the Y component, which does not affect the ratio between UVs at all, ensuring that the color of the image is not distorted during the processing, and improving the contrast of the image without damaging the color.
[0082] Step S406: determine a first gain coefficient of the high-frequency image and a second gain coefficient of the low-frequency image, perform gain processing on the high-frequency image using the first gain coefficient to obtain a first gain image, and perform gain processing on the low-frequency image using the second gain coefficient to obtain a second gain image.
[0083] Among them, the high-frequency image contains the content information in the original image, and the high-frequency image is enhanced so that the contrast between the enhanced high-frequency image and the low-frequency image is improved, the dynamic range of the image is adjusted, the object in the image is highlighted, and the clarity of the image is improved. Exemplarily, the high-frequency image is enhanced by setting an enhancement coefficient of a pixel in the high-frequency image, multiplying the enhancement coefficient by the pixel value or brightness value of the pixel, and fusing the enhanced high-frequency image with the low-frequency image to obtain a processed image. Among them, the enhancement coefficient used for the enhancement processing of the high-frequency image can be a fixed value, that is, the enhancement coefficient of each pixel is the same. Or the enhancement coefficient used for the enhancement processing of the high-frequency image can also be calculated based on each pixel, and there are differences according to each pixel. Accordingly, when the high-frequency image is enhanced, the pixel value or brightness value of each pixel is multiplied by the corresponding enhancement coefficient to obtain a high-quality enhanced image.
[0084] Wherein, in the high-frequency image, based on a window of preset size, with the reference pixel point as the center, the local variance of the window area is calculated; the gain value of the reference pixel point is determined according to the local standard deviation corresponding to the local variance of the window area; and the first gain coefficient of the high-frequency image is determined according to the gain value of each reference pixel point. The reference pixel point is any pixel point (i, j) in the image, and its brightness component is x(i, j), where i and j are the horizontal and vertical coordinates of the reference pixel point in the image, respectively, and the window size is (2n+1)·(2n+1), where n is an integer greater than or equal to 0. The above window size is only an example. In other embodiments, the above window can be rectangular, that is, in the form of (2n+1)·(2m+1).
[0085] The local variance of the window area can be calculated by the following formula:
[0086]
[0087] in,
[0088] In the above formula, m x (i, j) is the local average value of the window area, x(k, l) is the brightness component of the pixel in the window, and k and l are integers greater than or equal to 0.
[0089] Among them, σ x(i, j) is the local standard deviation of the window area centered on the reference pixel. Optionally, the gain value of the reference pixel is inversely proportional to the local standard deviation. For example, the gain value of the reference pixel can be D / σ x (i, j), optionally, the gain value of the reference pixel is greater than 1 to enhance the brightness component of the pixel in the high-frequency image, where D is a constant.
[0090] The method for determining the second gain coefficient of the low-frequency image is the same as the method for determining the first gain coefficient of the high-frequency image, and will not be described in detail herein.
[0091] Step S407: Fusing the first gain image and the second gain image to obtain a second processed image.
[0092] As can be seen from the above, for the image captured by the camera, the image is sequentially subjected to color amplification processing and contrast enhancement processing, and both are for processing independent brightness components without involving color components, that is, without damaging the color, the color dynamic range and virtual mode are adjusted to improve the image brightness and the clarity of image details. At the same time, the high-frequency image and the low-frequency image obtained by filtering the brightness component of the first processed image of the color separation color mode are respectively calculated with a first gain coefficient and a second gain coefficient, the high-frequency image is enhanced according to the first gain coefficient, the low-frequency image is enhanced according to the second gain coefficient, the enhanced low-frequency image is fused with the enhanced high-frequency image to obtain a processed image, and the contrast in the high-frequency image and the low-pass image is enhanced to avoid the loss of details in the image processing process, and the image clarity is improved on the basis of undistorted image.
[0093] Figure 5 This is a flowchart of another image processing method provided by an embodiment of the present application. Optionally, the second gain image is obtained by performing gain processing on the low-frequency image through the second gain coefficient, including: identifying the flat area and the non-flat area in the low-frequency image according to the brightness information of each pixel in the low-frequency image; splitting the low-frequency image according to the flat area and the non-flat area; performing gain processing on the split non-flat area through the second gain coefficient and performing image fusion with the split flat area to obtain the second gain image. Figure 5 As shown, the technical solution is as follows:
[0094] Step S501: Acquire an image in a color-brightness separation color mode.
[0095] Step S502: Determine each scene included in the image and the image brightness distribution of the image.
[0096] Step S503: Generate a brightness mapping relationship according to the standard brightness distribution corresponding to each scene, the weight value and the image brightness distribution.
[0097] Step S504: adjusting the brightness component of each pixel in the image according to the brightness mapping relationship to generate a first processed image.
[0098] Step S505: perform edge recognition on the first processed image, determine a filter kernel for filtering the image according to the edge recognition result, and filter the first processed image based on the filter kernel to obtain a low-frequency image and a high-frequency image corresponding to the first processed image.
[0099] Step S506: determine a first gain coefficient of the high-frequency image and a second gain coefficient of the low-frequency image, and perform gain processing on the high-frequency image using the first gain coefficient to obtain a first gain image.
[0100] Step S507: identifying a flat area and a non-flat area in the low-frequency image according to the brightness information of each pixel in the low-frequency image, splitting the low-frequency image according to the flat area and the non-flat area, performing gain processing on the split non-flat area by using the second gain coefficient, and performing image fusion with the split flat area to obtain a second gain image.
[0101] Among them, according to the brightness information of each pixel point in the low-frequency image, identifying the flat area and the non-flat area in the low-frequency image includes: performing block processing on the low-frequency image to obtain multiple image areas, and determining the pixel difference values of the image areas; when the pixel difference value of the image area is less than or equal to a preset value, determining that the image area belongs to the flat area; when the pixel difference value of the image area is greater than the preset value, determining that the image area belongs to the non-flat area.
[0102] Wherein, for any image region, the pixel difference value in the image region may be calculated by the following formula:
[0103]
[0104] Where A is the pixel difference value of the image area, p is the total number of pixels in the image area, and g b (b=1,2,…p) is the brightness component of each pixel in the image area, is the local brightness mean of the image area, and both p and b are positive integers greater than 0.
[0105] The pixel difference value indicates the difference in brightness information of each pixel in the image area. For example, the larger the pixel difference value, the greater the difference in brightness information of each pixel in the image area. The smaller the pixel difference value, the higher the similarity of brightness information of each pixel in the image area. The image areas with pixel difference values less than or equal to the preset value are spliced to form a flat area, and the image areas with pixel difference values greater than the preset value are spliced to form a non-flat area. Optionally, the preset value used to determine the flat area and the non-flat area is used to determine the average local difference value of the low-frequency image Specifically, according to the number of image regions and the pixel difference value A of each image region, the average local difference value of the low-frequency image can be determined: Introducing the coefficient λ, the above preset value can be That is, when the pixel difference value of the image area When the pixel difference value of the image area is , the image area belongs to a non-flat area.
[0106] Exemplarily, for an image including black buttons and dot-shaped stains on a white desktop, the high-frequency image obtained by filtering may include the black buttons, and the low-frequency image may include the white desktop and the dot-shaped stains on the desktop. In the low-frequency image, the portion with the dot-shaped stains is a non-flat area, and the background area of the white desktop is a flat area. In the above embodiment, it can be seen that the gain value of the pixel point is inversely proportional to the local standard deviation. In the flat area, the local standard deviation is very small, resulting in a relatively large gain value of the pixel point, thereby causing noise amplification. The flat area and the non-flat area in the low-frequency image are identified and split, and only the non-flat area is enhanced, and the brightness component of the flat area is not adjusted, thereby avoiding the amplification of the noise in the flat area when the image is enhanced.
[0107] Step S508: Fusing the first gain image and the second gain image to obtain a second processed image.
[0108] From the above, it can be seen that the color of the image is virtually amplified to obtain a first processed image. Further, the first processed image is low-pass filtered, and the obtained high-frequency image is enhanced, and the non-flat area of the low-frequency image is enhanced to enhance the image details, maintain the flat area of the low-frequency image, control the noise, and avoid amplifying the noise while increasing the contrast of the image.
[0109] Figure 6 1 is a structural block diagram of an image processing device provided in an embodiment of the present application. The device is used to execute the image processing method provided in the above embodiment and has functional modules and beneficial effects corresponding to the execution method. Figure 6As shown, the device specifically includes: an original image acquisition module 101, an image parameter determination module 102, a mapping relationship determination module 103 and an adjustment module 104, wherein:
[0110] The original image acquisition module 101 is used to acquire an image in a color-brightness separation color mode;
[0111] An image parameter determination module 102, used to determine each scene included in the image and the image brightness distribution of the image;
[0112] A mapping relationship determination module 103, configured to generate a brightness mapping relationship according to the standard brightness distribution corresponding to each scene, the weight value and the image brightness distribution;
[0113] The adjustment module 104 is used to adjust the brightness component of each pixel in the image according to the brightness mapping relationship to generate a first processed image.
[0114] From the above content, it can be seen that for each scene contained in the image, a brightness mapping relationship is generated according to the standard brightness distribution, weight value and the image brightness distribution corresponding to each scene, and after the mapping relationship is established, the brightness component of the pixel points in the image is adjusted, which significantly improves the image processing effect and meets the user's demand for high-definition images.
[0115] In a possible embodiment, the image parameter determination module 102 is further configured to:
[0116] Before generating a brightness mapping relationship according to the standard brightness distribution corresponding to each scene, the weight value and the image brightness distribution, the corresponding standard brightness distribution is generated according to different image scenes, and the corresponding weight value is determined.
[0117] In a possible embodiment, the mapping relationship determination module 103 is specifically used to:
[0118] The generating of the brightness mapping relationship according to the standard brightness distribution corresponding to each scene, the weight value and the image brightness distribution includes: generating a combined brightness distribution according to the standard brightness distribution corresponding to each scene and the weight value; generating a brightness mapping relationship according to the combined brightness distribution and the image brightness distribution.
[0119] In a possible embodiment, the mapping relationship determination module 103 is specifically used to:
[0120] Determine a first pixel ratio corresponding to each brightness component in the combined brightness distribution, determine a second pixel ratio corresponding to each brightness component in the image brightness distribution, determine a brightness component to be adjusted and a corresponding target brightness component according to the first pixel ratio and the second pixel ratio, and establish a mapping relationship between the brightness component to be adjusted and the target brightness component; or,
[0121] Determine the third pixel ratio corresponding to each brightness component interval in the combined brightness distribution, determine the fourth pixel ratio corresponding to each brightness component interval in the image brightness distribution, determine the brightness component to be adjusted and the corresponding target brightness component according to the third pixel ratio and the fourth pixel ratio, and establish a mapping relationship between the brightness component to be adjusted and the target brightness component.
[0122] In a possible embodiment, the mapping relationship determination module 103 is specifically used to:
[0123] Traversing the brightness component of each pixel in the image to determine the brightness component range of the image;
[0124] intercepting a target brightness distribution corresponding to the brightness component range in the combined brightness distribution;
[0125] A brightness mapping relationship is generated according to the target brightness distribution and the brightness distribution of the image.
[0126] In a possible embodiment, the adjustment module 104 is further configured to:
[0127] After adjusting the brightness component of each pixel in the image according to the brightness mapping relationship to generate a first processed image, performing edge recognition on the first processed image;
[0128] Determining a filter kernel for filtering the image according to the edge recognition result;
[0129] Performing filtering processing on the first processed image based on the filtering kernel to obtain a low-frequency image and a high-frequency image corresponding to the first processed image;
[0130] determining a first gain coefficient of the high-frequency image and a second gain coefficient of the low-frequency image;
[0131] Performing gain processing on the high-frequency image by using the first gain coefficient to obtain a first gain image, and performing gain processing on the low-frequency image by using the second gain coefficient to obtain a second gain image;
[0132] The first gain image and the second gain image are fused to obtain a second processed image.
[0133] In a possible embodiment, performing gain processing on the low-frequency image by using the second gain coefficient to obtain the second gain image includes:
[0134] Identifying a flat area and a non-flat area in the low-frequency image according to brightness information of each pixel in the low-frequency image;
[0135] Splitting the low-frequency image according to the flat area and the non-flat area;
[0136] The split non-flat area is subjected to gain processing by using the second gain coefficient and image fusion is performed with the split flat area to obtain a second gain image.
[0137] In a possible embodiment, the original image acquisition module 101 is further used for:
[0138] Before acquiring the image in the color-brightness separation color mode, the original signal collected by the image sensor is converted into an image in the RGB color mode, and the image in the RGB color mode is converted into an image in the color-brightness separation color mode, wherein the color-brightness separation color mode includes at least one of the YUV color mode, the LAB color mode and the HSV color mode.
[0139] This embodiment provides a terminal device based on the above embodiments. Figure 7 is a schematic diagram of the structure of a terminal device provided in an embodiment of the present application, such as Figure 7 As shown, the terminal device 200 includes: a memory 201, a processor (Central Processing Unit, CPU) 202, a peripheral interface 203, an RF (Radio Frequency) circuit 205, an audio circuit 206, a speaker 211, a power management chip 208, an input / output (I / O) subsystem 209, a touch screen 212, a Wifi module 213, other input / control devices 210 and an external port 204, and these components communicate through one or more communication buses or signal lines 207.
[0140] It should be understood that the illustrated terminal device 200 is only an example of a terminal device, and the terminal device 200 may have more or fewer components than those shown in the figure, may combine two or more components, or may have different component configurations. The various components shown in the figure may be implemented in hardware, software, or a combination of hardware and software including one or more signal processing and / or application specific integrated circuits.
[0141] The following is a detailed description of the terminal device for image processing provided in this embodiment, taking a smart phone as an example of the terminal device.
[0142] Memory 201, which can be accessed by CPU 202, peripheral interface 203, etc., and which can include high-speed random access memory and non-volatile memory, such as one or more disk storage devices, flash memory devices, or other volatile solid-state storage devices.
[0143] The peripheral interface 203 can connect the input and output peripherals of the device to the CPU 202 and the memory 201 .
[0144] The I / O subsystem 209 can connect the input and output peripherals on the device, such as a touch screen 212 and other input / control devices 210, to the peripheral interface 203. The I / O subsystem 209 may include a display controller 2091 and one or more input controllers 2092 for controlling other input / control devices 210. Among them, the one or more input controllers 2092 receive electrical signals from other input / control devices 210 or send electrical signals to other input / control devices 210. Other input / control devices 210 may include physical buttons (press buttons, rocker buttons, etc.), dials, slide switches, joysticks, and click wheels. It is worth noting that the input controller 2092 can be connected to any of the following: a keyboard, an infrared port, a USB interface, and a pointing device such as a mouse.
[0145] The touch screen 212 is an input interface and an output interface between the user terminal and the user, and displays visual output to the user. The visual output may include graphics, text, icons, videos, etc.
[0146] The display controller 2091 in the I / O subsystem 209 receives an electrical signal from the touch screen 212 or sends an electrical signal to the touch screen 212. The touch screen 212 detects contact on the touch screen, and the display controller 2091 converts the detected contact into interaction with a user interface object displayed on the touch screen 212, that is, realizes human-computer interaction. The user interface object displayed on the touch screen 212 may be an icon for running a game, an icon for connecting to a corresponding network, etc. It is worth noting that the device may also include an optical mouse, which is a touch-sensitive surface that does not display a visual output, or an extension of a touch-sensitive surface formed by the touch screen.
[0147] RF circuit 205 is mainly used to establish communication between the mobile phone and the wireless network (i.e., the network side) to realize data reception and transmission between the mobile phone and the wireless network. For example, sending and receiving short messages, emails, etc. Specifically, RF circuit 205 receives and sends RF signals, which are also called electromagnetic signals. RF circuit 205 converts electrical signals into electromagnetic signals or converts electromagnetic signals into electrical signals, and communicates with the communication network and other devices through the electromagnetic signals. RF circuit 205 may include known circuits for performing these functions, including but not limited to antenna systems, RF transceivers, one or more amplifiers, tuners, one or more oscillators, digital signal processors, CODEC (COder-DECoder, codec) chipsets, Subscriber Identity Module (SIM), etc.
[0148] The audio circuit 206 is mainly used to receive audio data from the peripheral interface 203 , convert the audio data into an electrical signal, and send the electrical signal to the speaker 211 .
[0149] The speaker 211 is used to restore the voice signal received by the mobile phone from the wireless network through the RF circuit 205 to sound and play the sound to the user.
[0150] The power management chip 208 is used to provide power and manage the power for the CPU 202, the I / O subsystem, and the hardware connected to the peripheral interface.
[0151] The image processing device of the terminal device and the terminal device provided in the above embodiments can execute the image processing method of the terminal device provided in any embodiment of the present application, and have the corresponding functional modules and beneficial effects of executing the method. For technical details not described in detail in the above embodiments, please refer to the image processing method of the terminal device provided in any embodiment of the present application.
[0152] The embodiment of the present application further provides a storage medium containing terminal device executable instructions, wherein the terminal device executable instructions are used to perform an image processing method when executed by a terminal device processor, the method comprising:
[0153] Get an image in color-brightness separation color mode;
[0154] Determining each scene included in the image and image brightness distribution of the image;
[0155] Generate a brightness mapping relationship according to the standard brightness distribution corresponding to each scene, the weight value and the image brightness distribution;
[0156] The brightness component of each pixel in the image is adjusted according to the brightness mapping relationship to generate a first processed image.
[0157] In a possible embodiment, before generating the brightness mapping relationship according to the standard brightness distribution corresponding to each scene, the weight value and the image brightness distribution, the method further includes:
[0158] Generate corresponding standard brightness distribution according to different image scenes and determine corresponding weight values.
[0159] In a possible embodiment, generating a brightness mapping relationship according to the combined brightness distribution and the image brightness distribution includes:
[0160] Determine a first pixel ratio corresponding to each brightness component in the combined brightness distribution, determine a second pixel ratio corresponding to each brightness component in the image brightness distribution, determine a brightness component to be adjusted and a corresponding target brightness component according to the first pixel ratio and the second pixel ratio, and establish a mapping relationship between the brightness component to be adjusted and the target brightness component; or,
[0161] Determine the third pixel ratio corresponding to each brightness component interval in the combined brightness distribution, determine the fourth pixel ratio corresponding to each brightness component interval in the image brightness distribution, determine the brightness component to be adjusted and the corresponding target brightness component according to the third pixel ratio and the fourth pixel ratio, and establish a mapping relationship between the brightness component to be adjusted and the target brightness component.
[0162] In a possible embodiment, generating a brightness mapping relationship according to the combined brightness distribution and the image brightness distribution includes:
[0163] Traversing the brightness component of each pixel in the image to determine the brightness component range of the image;
[0164] intercepting a target brightness distribution corresponding to the brightness component range in the combined brightness distribution;
[0165] A brightness mapping relationship is generated according to the target brightness distribution and the brightness distribution of the image.
[0166] In a possible embodiment, after adjusting the brightness component of each pixel in the image according to the brightness mapping relationship to generate the first processed image, the method further includes:
[0167] performing edge recognition on the first processed image;
[0168] Determining a filter kernel for filtering the image according to the edge recognition result;
[0169] Performing filtering processing on the first processed image based on the filtering kernel to obtain a low-frequency image and a high-frequency image corresponding to the first processed image;
[0170] determining a first gain coefficient of the high-frequency image and a second gain coefficient of the low-frequency image;
[0171] Performing gain processing on the high-frequency image by using the first gain coefficient to obtain a first gain image, and performing gain processing on the low-frequency image by using the second gain coefficient to obtain a second gain image;
[0172] The first gain image and the second gain image are fused to obtain a second processed image.
[0173] In a possible embodiment, performing gain processing on the low-frequency image by using the second gain coefficient to obtain the second gain image includes:
[0174] Identifying a flat area and a non-flat area in the low-frequency image according to brightness information of each pixel in the low-frequency image;
[0175] Splitting the low-frequency image according to the flat area and the non-flat area;
[0176] The split non-flat area is subjected to gain processing by using the second gain coefficient and image fusion is performed with the split flat area to obtain a second gain image.
[0177] In a possible embodiment, before acquiring the image in the color-brightness separation color mode, the method further includes:
[0178] The original signal collected by the image sensor is converted into an image in RGB color mode, and the image in RGB color mode is converted into an image in color-brightness separation color mode, wherein the color-brightness separation color mode includes at least one of a YUV color mode, a LAB color mode and an HSV color mode.
[0179] Storage medium - any of various types of memory devices or storage devices. The term "storage medium" is intended to include: installation media, such as CD-ROM, floppy disk or tape device; computer system memory or random access memory, such as DRAM, DDR RAM, SRAM, EDO RAM, Rambus RAM, etc.; non-volatile memory, such as flash memory, magnetic media (such as hard disk or optical storage); registers or other similar types of memory elements, etc. Storage media may also include other types of memory or combinations thereof. In addition, the storage medium may be located in the first computer system in which the program is executed, or may be located in a different second computer system, which is connected to the first computer system via a network (such as the Internet). The second computer system can provide program instructions to the first computer for execution. The term "storage medium" may include two or more storage media that may reside in different locations (for example, in different computer systems connected by a network). The storage medium may store program instructions (for example, embodied as a computer program) that can be executed by one or more processors.
[0180] Of course, the storage medium containing computer executable instructions provided in the embodiment of the present application, whose computer executable instructions are not limited to the operations of the image processing method described above, can also execute related operations in the image processing method provided in any embodiment of the present application.
[0181] Note that the above are only preferred embodiments of the present application and the technical principles used. Those skilled in the art will understand that the present application is not limited to the specific embodiments described herein, and that various obvious changes, readjustments and substitutions can be made by those skilled in the art without departing from the scope of protection of the present application. Therefore, although the present application is described in more detail through the above embodiments, the present application is not limited to the above embodiments, and may include more other equivalent embodiments without departing from the concept of the present application, and the scope of the present application is determined by the scope of the appended claims.
Claims
1. Image processing methods, It is characterized in that include: Get an image in color-brightness separation color mode; Dividing different scenes contained in the image based on an image segmentation method, identifying each scene contained in the image, and determining each scene contained in the image and image brightness distribution of the image; Generate corresponding standard brightness distribution according to different image scenes, and determine corresponding weight values, wherein the weight values represent the importance of the image scenes in the image; Generate a brightness mapping relationship according to the standard brightness distribution corresponding to each scene, the weight value and the image brightness distribution; Adjusting the brightness component of each pixel in the image according to the brightness mapping relationship to generate a first processed image; Generating a brightness mapping relationship according to the standard brightness distribution corresponding to each scene, the weight value and the image brightness distribution includes: Determine the pixel ratio corresponding to each brightness component in the standard brightness distribution corresponding to each scene, multiply it by the corresponding weight value, and then sum it to obtain the pixel ratio of the brightness component in the combined brightness distribution to obtain the combined brightness distribution; A brightness mapping relationship is generated according to the combined brightness distribution and the image brightness distribution.
2. The method according to claim 1, It is characterized in that Generating a brightness mapping relationship according to the standard brightness distribution corresponding to each scene, the weight value and the image brightness distribution includes: The first contrast coefficient table is obtained by searching the pixel brightness values of the standard brightness distribution in each scene for the brightness value of each pixel in the image brightness distribution, and the contrast coefficient values in the first contrast coefficient table are weighted according to the weight value to obtain a second contrast coefficient table.
3. The method according to claim 1, It is characterized in that Generating a brightness mapping relationship according to the combined brightness distribution and the image brightness distribution comprises: For each pixel in the image brightness distribution, searching for the corresponding pixel brightness value of the combined brightness distribution to obtain a contrast coefficient matrix; Correspondingly, adjusting the brightness component of each pixel in the image according to the brightness mapping relationship to generate a first processed image includes: The color of each pixel in the image brightness distribution is compensated according to the contrast coefficient matrix to obtain a first processed image.
4. The method according to claim 1, It is characterized in that Generating a brightness mapping relationship according to the combined brightness distribution and the image brightness distribution comprises: Traversing the brightness component of each pixel in the image to determine the brightness component range of the image; intercepting a target brightness distribution corresponding to the brightness component range in the combined brightness distribution; A brightness mapping relationship is generated according to the target brightness distribution and the image brightness distribution.
5. The method according to any one of claims 1 to 4, It is characterized in that After adjusting the brightness component of each pixel in the image according to the brightness mapping relationship to generate a first processed image, the method further includes: performing edge recognition on the first processed image; Determining a filter kernel for filtering the image according to the edge recognition result; Performing filtering processing on the first processed image based on the filtering kernel to obtain a low-frequency image and a high-frequency image corresponding to the first processed image; determining a first gain coefficient of the high-frequency image and a second gain coefficient of the low-frequency image; Performing gain processing on the high-frequency image by using the first gain coefficient to obtain a first gain image, and performing gain processing on the low-frequency image by using the second gain coefficient to obtain a second gain image; The first gain image and the second gain image are fused to obtain a second processed image.
6. Image processing device, It is characterized in that include: An original image acquisition module, used to divide different scenes contained in the image based on an image segmentation method, identify each scene contained in the image, and acquire an image in a color-brightness separation color mode; An image parameter determination module, used to determine each scene included in the image and the image brightness distribution of the image; generate corresponding standard brightness distribution according to different image scenes, and determine corresponding weight values, wherein the weight value represents the importance of the image scene in the image; A mapping relationship determination module, used to generate a brightness mapping relationship according to the standard brightness distribution corresponding to each scene, the weight value and the image brightness distribution; An adjustment module, used for adjusting the brightness component of each pixel in the image according to the brightness mapping relationship to generate a first processed image; The mapping relationship determination module is specifically used for: The generating of the brightness mapping relationship according to the standard brightness distribution corresponding to each scene, the weight value and the image brightness distribution includes: determining the pixel point ratio corresponding to each brightness component in the standard brightness distribution corresponding to each scene, multiplying by the corresponding weight value and then summing up to obtain the pixel point ratio of the brightness component in the combined brightness distribution, and obtaining the combined brightness distribution; generating the brightness mapping relationship according to the combined brightness distribution and the image brightness distribution.
7. A terminal device, include: A processor, a memory, and a computer program stored in the memory and executable on the processor, wherein the processor implements the image processing method according to any one of claims 1 to 5 when executing the computer program.
8. A storage medium containing instructions executable by a terminal device, It is characterized in that The terminal device executable instructions are used to execute the image processing method according to any one of claims 1 to 5 when executed by a terminal device processor.
