Image processing method, device, electronic device and storage medium
Through the area division and reflectivity adjustment of image depth information and brightness parameters, the problem of contrast and hierarchy optimization in image processing is solved, and targeted adjustment of contrast is achieved to ensure that the image is not distorted.
Patent Information
- Application Number
- CN202310852295.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-07-11
- Publication Date
- 2025-08-15
- Estimated Expiration
- 2043-07-11
AI Technical Summary
In the prior art, image processing methods cannot effectively optimize the sense of contrast and layering, while avoiding image distortion, especially when adjusting other areas leads to distortion when highlighting a certain object.
By acquiring the depth information and brightness parameters of the image, dividing the area, determining the reflectance of each area, and adjusting the contrast based on the reflectance to achieve targeted adjustment.
While optimizing the contrast and layering of the image, ensure that the image is not distorted and highlights key objects without damaging the details of other areas.
Smart Images

Figure CN116862801B_ABST
Abstract
Description
Technical Field
[0001] The present application belongs to the field of artificial intelligence technology, and specifically relates to an image processing method, device, electronic device and storage medium. Background Art
[0002] During the image shooting process, lighting and image processing issues often result in dull image colors and a lack of contrast and layering between different image areas.
[0003] In related technologies, images are usually optimized through filters or global adjustment methods, but the optimization effect is not ideal. For example, when a user wants to highlight an object in an image, after processing the image through filters or global adjustment methods, in addition to the image area of the object the user wants to highlight, other image areas will also be adjusted, which can easily cause distortion of other image areas. Summary of the Invention
[0004] The purpose of the embodiments of the present application is to provide an image processing method, device, electronic device and storage medium, which can determine the target contrast corresponding to two or more image regions, and then perform targeted adjustments to the contrast of the two or more image regions respectively, thereby optimizing the contrast and layering of the image while ensuring that the image is not distorted.
[0005] In a first aspect, an embodiment of the present application provides an image processing method, the method comprising:
[0006] Obtaining image depth information and brightness parameters of the first image;
[0007] Dividing the first image into regions according to the image depth information and the brightness parameter to obtain two or more image regions, and determining reflectivities of the two or more image regions to obtain reflectivities corresponding to the two or more image regions respectively;
[0008] determining target contrasts corresponding to the two or more image regions based on reflectivities corresponding to the two or more image regions;
[0009] The contrasts of two or more image regions in the first image are respectively adjusted to target contrasts corresponding to the image regions to obtain a second image.
[0010] In a second aspect, an embodiment of the present application provides an image processing device, the device comprising:
[0011] An acquisition module, configured to acquire image depth information and brightness parameters of the first image;
[0012] a processing module, configured to divide the first image into regions based on the image depth information and the brightness parameter to obtain two or more image regions, and determine the reflectivity of the two or more image regions to obtain the reflectivity corresponding to the two or more image regions respectively;
[0013] a determination module, configured to determine target contrasts corresponding to the two or more image regions based on reflectivities corresponding to the two or more image regions;
[0014] The adjustment module is used to adjust the contrast of two or more image areas in the first image to the target contrast corresponding to the image area, so as to obtain a second image.
[0015] In a third aspect, an embodiment of the present application provides an electronic device comprising a processor and a memory, wherein the memory stores programs or instructions that can be run on the processor, and when the programs or instructions are executed by the processor, the steps of the method described in the first aspect are implemented.
[0016] In a fourth aspect, an embodiment of the present application provides a readable storage medium, on which a program or instruction is stored. When the program or instruction is executed by a processor, the steps of the method described in the first aspect are implemented.
[0017] In a fifth aspect, an embodiment of the present application provides a chip, which includes a processor and a communication interface, the communication interface and the processor are coupled, and the processor is used to run programs or instructions to implement the method described in the first aspect.
[0018] In a sixth aspect, an embodiment of the present application provides a computer program product, which is stored in a storage medium and executed by at least one processor to implement the method described in the first aspect.
[0019] In an embodiment of the present application, the first image can be divided into regions based on the image depth information and brightness parameters of the first image to obtain two or more image regions, and the reflectivity of the two or more image regions can be determined to obtain the reflectivity corresponding to the two or more image regions respectively. Based on the reflectivity corresponding to the two or more image regions respectively, the target contrast corresponding to the two or more image regions can be determined, and then the contrast of the two or more image regions can be adjusted to the target contrast corresponding to the image region respectively, so as to obtain a second image. Since the embodiment of the present application can determine the target contrast corresponding to the two or more image regions respectively, and then make targeted adjustments to the contrast of the two or more image regions respectively, it is possible to optimize the contrast and layering of the image while ensuring that the image is not distorted. BRIEF DESCRIPTION OF THE DRAWINGS
[0020] Figure 1is a schematic diagram showing an original image according to an exemplary embodiment;
[0021] Figure 2 is a schematic diagram of an image after filter processing according to an exemplary embodiment;
[0022] Figure 3 is one of the flow charts of an image processing method according to an exemplary embodiment;
[0023] Figure 4 is a schematic diagram of an image after region division according to an exemplary embodiment;
[0024] Figure 5 is a schematic diagram showing a second image according to an exemplary embodiment;
[0025] Figure 6 is a schematic diagram showing a scenario of artificially correcting contrast according to an exemplary embodiment;
[0026] Figure 7 is one of the structural diagrams of an image processing model according to an exemplary embodiment;
[0027] Figure 8 This is a second structural diagram of an image processing model according to an exemplary embodiment;
[0028] Figure 9 is a schematic diagram showing a corresponding relationship between image areas and reflectivity according to an exemplary embodiment;
[0029] Figure 10 This is a second flowchart of an image processing method according to an exemplary embodiment;
[0030] Figure 11 is a structural block diagram of an image processing apparatus according to an exemplary embodiment;
[0031] Figure 12 is a structural block diagram of an electronic device according to an exemplary embodiment;
[0032] Figure 13 A schematic diagram of the hardware structure of an electronic device implementing an embodiment of the present application. DETAILED DESCRIPTION
[0033] The following will be combined with the accompanying drawings in the embodiments of the present application to clearly describe the technical solutions in the embodiments of the present application. Obviously, the embodiments described are part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field are within the scope of protection of this application.
[0034] The terms "first," "second," and the like in the specification and claims of this application are used to distinguish similar objects, and are not used to describe a specific order or precedence. It should be understood that the terms used in this manner are interchangeable where appropriate, so that the embodiments of this application can be implemented in an order other than that illustrated or described herein, and that the objects distinguished by "first," "second," and the like are generally of the same type, and do not limit the number of objects; for example, the first object can be one or more. In addition, the term "and / or" in the specification and claims represents at least one of the connected objects, and the character " / " generally indicates that the objects associated with each other are in an "or" relationship.
[0035] In related technologies, images are usually optimized by using filters or global adjustments, but the optimization effect is not ideal. For example, the original image can be Figure 1 As shown in the figure, the overall color of the picture is relatively consistent, and different image areas lack contrast and layering. When the user wants to highlight the horse in the image, the image is processed through a filter, and the result is as follows Figure 2 The image shown here is also adjusted because other areas besides the horse are also adjusted. Figure 2 Other areas in the image are distorted, such as some clouds in the original image. Figure 2 It can no longer be seen.
[0036] Therefore, how to optimize the contrast and layering of the image while ensuring that the image is not distorted becomes a technical problem that needs to be solved.
[0037] In response to the problems encountered in the related art, an embodiment of the present application provides an image processing method that can divide a first image into regions based on the image depth information and brightness parameters of the first image to obtain two or more image regions, and determine the reflectivity of the two or more image regions to obtain the reflectivity corresponding to the two or more image regions respectively. Based on the reflectivity corresponding to the two or more image regions respectively, the target contrast corresponding to the two or more image regions is determined, and then the contrast of the two or more image regions is adjusted to the target contrast corresponding to the image region respectively, so as to obtain a second image. Since the embodiment of the present application can determine the target contrast corresponding to the two or more image regions respectively, and then make targeted adjustments to the contrast of the two or more image regions respectively, it is possible to optimize the contrast and layering of the image while ensuring that the image is not distorted.
[0038] The image processing method, device, electronic device, and storage medium provided by the embodiments of the present application are described in detail below with reference to specific embodiments and their application scenarios in conjunction with the accompanying drawings.
[0039] The image processing method provided in this application can be applied to image processing scenarios. Figure 3-Figure 11 The image processing method provided in the embodiment of the present application is described in detail. It should be noted that the image processing method provided in the embodiment of the present application can be executed by an image processing device. In the embodiment of the present application, the image processing method provided in the embodiment of the present application is described by taking an image processing device executing the image processing method as an example.
[0040] Figure 3 The figure is a flowchart of an image processing method according to an exemplary embodiment.
[0041] like Figure 3 As shown, the image processing method may include the following steps:
[0042] Step 310: Obtain image depth information and brightness parameters of the first image.
[0043] Here, the first image may be an image to be processed, which may be obtained by taking a picture with a camera. The first image may be a red-green-blue (RGB) image. For example, the first image may be as follows: Figure 1 shown.
[0044] Image depth information can be obtained through specialized hardware or model prediction. Brightness parameters can be obtained from the camera, including exposure parameters and illuminance (lux).
[0045] Exposure parameters include the camera's aperture, shutter speed, and ISO (International Standards Organization) sensitivity. A larger aperture results in a brighter image; a longer shutter speed results in a brighter image; and a higher ISO results in a brighter image. Illumination can be a camera-estimated value that reflects the current ambient brightness. A larger value indicates a darker environment, while a smaller value indicates a brighter environment.
[0046] Step 320 : dividing the first image into regions according to the image depth information and the brightness parameter to obtain two or more image regions, and determining the reflectivity of the two or more image regions to obtain the reflectivity corresponding to the two or more image regions.
[0047] Here, the image depths of pixels in a single image region are similar.
[0048] Reflectivity can be the reflectivity of an object in an image, that is, the object's ability to reflect light. This is related to the object's inherent properties, such as its material and surface roughness. Different reflectivities of objects result in different image effects, so the reflectivity of an object can be determined based on its image. Different objects can have different reflectivities, so the reflectivity of image regions corresponding to different objects in an image can vary.
[0049] In an optional implementation, step 320 may include:
[0050] The first image is divided into regions using an image processing model, image depth information, and brightness parameters to obtain two or more image regions, and reflectivities of the two or more image regions are determined to obtain reflectivities corresponding to the two or more image regions.
[0051] Specifically, the first image, the image depth information and the brightness parameter of the first image are input into the image processing model, the first image is divided into regions to obtain two or more image regions, and the reflectivity of the two or more image regions is determined, and the reflectivity corresponding to the two or more image regions can be output.
[0052] Here, the image processing model can be built based on convolutional neural networks and transformers. Convolutional neural networks are deep learning network architectures that learn directly from data and are particularly well-suited for finding patterns in images to identify objects, classes, and categories. Transformers are neural network models used to process sequence data. Based on the self-attention mechanism, a typical transformer structure is constructed through multiple layers of stacked multi-head self-attention and feedforward neural networks.
[0053] The image processing model can be obtained by training an initial image processing model.
[0054] In an optional embodiment, before dividing the first image into regions and determining the reflectivity of different image regions using the image processing model, image depth information, and brightness parameters to obtain two or more image regions and the reflectivity corresponding to the two or more image regions, the method may further include:
[0055] Obtaining two or more training samples, where the training samples may include a sample image, a sample brightness parameter corresponding to the sample image, sample image depth information, and two or more sample image regions and their corresponding sample reflectivities;
[0056] For each of the two or more training samples, perform the following steps:
[0057] Using the initial image processing model, the sample image depth and the sample brightness parameters, the sample image is divided into regions to obtain two or more predicted image regions, and the predicted reflectivity of the two or more predicted image regions is determined to obtain the predicted reflectivity corresponding to the two or more predicted image regions respectively;
[0058] Determining a loss function value based on the two or more predicted image regions and their corresponding predicted reflectivities, and the two or more sample image regions and their corresponding sample reflectivities;
[0059] The model parameters of the initial image processing model are adjusted according to the loss function value, and the image processing model is obtained by training.
[0060] In an optional implementation, obtaining two or more training samples may specifically include:
[0061] Obtaining sample brightness parameters and sample image depth information corresponding to two or more sample images respectively;
[0062] For each of the two or more sample images, perform the following steps:
[0063] Segment the sample image using a segmentation model to obtain two or more sample image regions;
[0064] Using a reflectivity prediction model to predict sample reflectivities corresponding to two or more sample image regions in a sample image;
[0065] A training sample is constructed based on a sample image, a sample brightness parameter corresponding to the sample image, depth information of the sample image, two or more sample image regions and their corresponding sample reflectivities.
[0066] Here, the segmentation model can be a large segmentation model such as Segment Anything, which can be deployed to the cloud. The segmentation model can segment the sample image according to the layer.
[0067] For example, the sample image can be Figure 1 As shown, Figure 1 The image shown is input to Segment Anything, and Segment Anything is used to Figure 1 The image shown in FIG is segmented, and two or more sample image regions are output. The sample image regions obtained by segmentation can be as follows Figure 4 shown.
[0068] Of course, the sample image can also be segmented manually to obtain more than two sample image regions.
[0069] The reflectivity prediction model may be NIID-Net. The first image may be input into NIID-Net, and the NIID-Net is used to predict sample reflectivities corresponding to two or more sample image regions in the sample image, and output the sample reflectivities corresponding to the two or more sample image regions.
[0070] Of course, the sample reflectances corresponding to two or more sample image regions may also be manually labeled to make them meet specific standards.
[0071] In addition, the reflectivity of common objects can be pre-stored for manual labeling of sample reflectivity or correction of sample reflectivity output by the reflectivity prediction model.
[0072] For example, the reflectivity maps of different objects can be as follows Figure 5 As shown, objects of the same color have similar reflectivity. The darker the color, the lower the reflectivity, and the lighter the color, the higher the reflectivity.
[0073] Step 330 : determining target contrasts corresponding to the two or more image regions based on the reflectivities corresponding to the two or more image regions.
[0074] Here, the target contrast corresponding to each image region may be determined separately. Specifically, for each image region, the brightness information corresponding to the image region may be determined based on the reflectivity corresponding to the image region, and then the contrast corresponding to the image region may be determined based on the brightness information corresponding to the image region.
[0075] In an optional implementation, step 330 may include:
[0076] Obtaining first brightness corresponding to two or more pixel points in the image area;
[0077] Determining second brightnesses corresponding to two or more pixel points in the image area, respectively, based on a reflectivity of the image area and the two or more first brightnesses;
[0078] A target contrast ratio of the image region is determined based on the two or more second brightnesses.
[0079] Here, the first brightness corresponding to two or more pixel points in the image area can be obtained through the photosensitive element.
[0080] The camera can assume a global reflectivity of 18 degrees of gray by default. For each pixel, the brightness of the pixel is different due to the different light reflected by the object. The brightness of the pixel is positively correlated with the reflectivity of the object. However, the metering is based on the global 18-degree gray assumption. Therefore, the intensity of the incident light should be different for different object reflectivities. Therefore, the brightness needs to be increased or decreased based on the reflectivity.
[0081] Specifically, the second brightness corresponding to the two or more pixel points in the image area may be determined according to the first brightness corresponding to the two or more pixel points in the image area and the reflectivity corresponding to the image area.
[0082] For example, the calculation formula for the second brightness corresponding to each pixel in the image area may be as follows:
[0083]
[0084] Among them, Brightness1 is the second brightness corresponding to the pixel, Brightness0 is the first brightness corresponding to the pixel, and r is the reflectivity corresponding to the image area.
[0085] Then, the target contrast of the image area may be determined based on the maximum brightness and the minimum brightness among the two or more second brightnesses.
[0086] For example, the target contrast of the image area may be calculated as follows:
[0087]
[0088] Among them, C is the target contrast, Brightness max Brightness is the maximum brightness among two or more second brightnesses. min The minimum brightness among two or more second brightnesses.
[0089] In this way, through the above process, the second brightness corresponding to two or more pixel points in the image area can be accurately determined based on the first brightness corresponding to two or more pixel points in the image area and the reflectivity corresponding to the image area, and then the target contrast of the image area can be more accurately determined based on the second brightness corresponding to two or more pixel points.
[0090] In an optional implementation, determining the target contrast of the image area based on the two or more second brightnesses may include:
[0091] determining a first contrast of the image region based on the two or more second brightnesses;
[0092] The first contrast is smoothed according to the first image depth of the image region, the second image depth of an image region adjacent to the image region, and the second contrast to obtain a target contrast.
[0093] Here, the adjacent image region may include at least one image region adjacent to the image region.
[0094] Specifically, the first contrast of the image area may be determined based on the maximum brightness and the minimum brightness of the two or more second brightnesses, and then the first contrast may be smoothed to obtain the target contrast.
[0095] The greater the contrast difference between different image areas, The larger the value, the smaller the contrast difference. The smaller the value, the greater the difference in image depth between different image areas. The larger the value, the smaller the image depth difference. The smaller the value, the smoothing formula for the first contrast can be:
[0096]
[0097] Where i represents the image region and j represents the adjacent image region. i is the first contrast of image region i, C j is the second contrast of the adjacent image area, d i is the first image depth of the image area, d j is the second image depth of the adjacent image area, and C is the target contrast of the image area.
[0098] In this way, by smoothing the contrast of the image region through the above process, it is possible to avoid a large contrast difference between the image region and adjacent image regions, which would cause obvious discontinuities and abruptness, thereby making the image more natural.
[0099] In an optional embodiment, the smoothing of the first contrast according to the first image depth of the image region, the second image depth of an adjacent image region of the image region, and the second contrast to obtain the target contrast may include:
[0100] Determine the content label of the image area;
[0101] Get the third contrast corresponding to the content label;
[0102] determining a weight corresponding to the image area according to the third contrast;
[0103] performing a smoothing process on the first contrast according to the first image depth of the image region, the second image depth of an image region adjacent to the image region, and the second contrast to obtain a fourth contrast;
[0104] The fourth contrast is weighted based on the weight to obtain a target contrast.
[0105] Here, the content label may be used to represent the content of the image region. For example, the content label may be sky, grass, or horse.
[0106] The third contrast ratio can be determined based on a correction value previously input by the user. Before determining the content label for an image region, the user may have manually corrected the contrast of other historical image regions corresponding to that content label. The manually corrected contrast can be stored as the third contrast ratio corresponding to that content label. Specifically, the third contrast ratio can be the difference between the contrast after the manual correction and the contrast before the correction.
[0107] Specifically, the image region can be input into a classification model, which extracts semantic features from the image region and outputs a content label for the image region. The third contrast ratio corresponding to the content label can then be obtained, and the weight corresponding to the image region can be determined based on the third contrast ratio.
[0108] In addition, the fourth contrast may be calculated by using the above formula for smoothing the first contrast.
[0109] Then, the fourth contrast is weighted based on the weight to obtain the target contrast.
[0110] For example, the target contrast can be calculated by the following formula:
[0111]
[0112] Among them, C i is the first contrast of image region i, C j is the second contrast of the adjacent image area, d i is the first image depth of the image area, d j is the second image depth of the adjacent image region, C is the target contrast of the image region, avg(h) is the average value of two or more third contrasts corresponding to the content label of image region i, h i The third contrast corresponding to the content tag is determined based on the most recent user input.
[0113] In this way, based on the third contrast determined by the user's historical input, the smoothed contrast of the image region is automatically weighted to obtain the target contrast, so that the target contrast can better meet the user's needs.
[0114] In an optional embodiment, after smoothing the first contrast according to the first image depth of the image region, the second image depth of an adjacent image region of the image region, and the second contrast, the method may further include:
[0115] displaying the image region based on the smoothed first contrast;
[0116] receiving a first input of the user on the image area;
[0117] In response to the first input, the contrast corresponding to the image region is updated to a target contrast.
[0118] Here, after smoothing the first contrast, the image region may be displayed based on the smoothed first contrast. If the user is dissatisfied with the display effect of the image region, the contrast of the image region may be corrected through manual input. The first input may be an input for correcting the contrast of the image region, and the first input may correct the contrast corresponding to the image region from the smoothed first contrast to a target contrast.
[0119] For example, Figure 6 As shown, the user's electronic device displays an image area 601 based on the first contrast after smoothing. If the user is not satisfied with the display effect of the image area 601, the user long presses the image area 601, and the electronic device can display a contrast wheel 602. The user can increase or decrease the contrast of the image area 601 by inputting into the contrast wheel 602, thereby adjusting the contrast of the image area 601 from the first contrast after smoothing to the target contrast.
[0120] In this way, the contrast of the image area can be corrected according to the user input, so that the display effect of the image area is more in line with the user's personalized needs.
[0121] In an optional implementation, after updating the contrast corresponding to the image area to the target contrast in response to the first input, the method may further include:
[0122] For each first adjacent image region of the image region, perform the following steps respectively:
[0123] Acquire a third image depth and a fifth contrast of a first adjacent image region, and a fourth image depth and a sixth contrast of a second adjacent image region adjacent to the first adjacent image region;
[0124] The fifth contrast is smoothed according to the third image depth, the fourth image depth, and the sixth contrast to obtain a target contrast corresponding to the first adjacent image region.
[0125] Here, the first adjacent image region may be an image region adjacent to the image region with artificially corrected contrast, and the second adjacent image region may be an image region adjacent to the first adjacent image region. The second adjacent image region may not include the image region with artificially corrected contrast.
[0126] Specifically, after manually correcting the contrast of the image region, a first adjacent image region adjacent to the image region may be smoothed. The specific process of smoothing the first adjacent image region is the same as the specific process of smoothing the image region described above, and will not be repeated here.
[0127] In this way, after artificially correcting the contrast of an image area, a first adjacent image area adjacent to the image area can be smoothed to avoid large contrast differences between different image areas, which would result in obvious discontinuities and abruptness, thereby making the image more natural.
[0128] In an optional implementation, after receiving the first input of the user on the image area, the method may further include:
[0129] In response to the first input, a target contrast and a content label corresponding to the image region are stored.
[0130] Here, the target contrast may be determined based on the first input.
[0131] Specifically, the target contrast can be stored, and when subsequently performing image processing, the historical contrast corresponding to the content tag can be determined based on the difference between the target contrast and the fourth contrast. Alternatively, the difference between the target contrast and the fourth contrast can be directly stored as the historical contrast corresponding to the content tag.
[0132] In this way, storing the target contrast and content label corresponding to the image area can provide historical data for subsequent processing of image areas with the same content label, so that the historical data can be referenced when subsequently determining the contrast of the image area, making the determined contrast more in line with user needs.
[0133] Step 340 : Adjust the contrasts of two or more image regions in the first image to target contrasts corresponding to the image regions, to obtain a second image.
[0134] For example, the second image may be Figure 5 shown.
[0135] Thus, the first image can be divided into regions based on the image depth information and brightness parameters of the first image to obtain two or more image regions, and the reflectivity of the two or more image regions can be determined to obtain the reflectivity corresponding to the two or more image regions respectively. Based on the reflectivity corresponding to the two or more image regions respectively, the target contrast corresponding to the two or more image regions can be determined, and then the contrast of the two or more image regions can be adjusted to the target contrast corresponding to the image region respectively, so as to obtain the second image. Since the embodiment of the present application can determine the target contrast corresponding to the two or more image regions respectively, and then make targeted adjustments to the contrast of the two or more image regions respectively, it is possible to optimize the contrast and layering of the image while ensuring that the image is not distorted.
[0136] In an optional embodiment, the image processing model may include an image feature extraction model, a reflectivity feature extraction model, and a region division model. Based on this, step 320 may include:
[0137] Performing image feature extraction on the first image and the image depth information using an image feature extraction model to obtain a first feature;
[0138] Performing reflectance feature extraction on the first feature and the brightness parameter using a reflectance feature extraction model to obtain a second feature;
[0139] The first image is divided into regions using the region division model, the first feature, and the second feature to obtain two or more image regions and reflectivities corresponding to the two or more image regions.
[0140] Here, the first feature may be an image feature of the first image and image depth information, and the second feature may be a reflectivity determined based on the first feature and a brightness parameter.
[0141] Specifically, the first image and image depth information can be input into an image feature extraction model, and the image feature extraction model is used to extract image features from the first image and image depth information, and a first feature is output; the first feature and brightness parameter are input into a reflectance feature extraction model, and the reflectance feature extraction model is used to extract reflectance features from the first feature and brightness parameter, and a second feature is output; the first feature and the second feature are input into a region division model, and the region division model, the first feature and the second feature are used to divide the first image into regions, and obtain two or more image regions and the reflectivities corresponding to the two or more image regions respectively.
[0142] In this way, by dividing the first image into regions and determining the reflectivity through a machine learning model, more than two image regions and the reflectivities corresponding to the two or more image regions can be accurately and efficiently determined.
[0143] In an optional embodiment, the image feature extraction model may include a convolution module, a deconvolution module, and a third feature fusion module. Based on this, using the image feature extraction model to extract image features from the first image and image depth information to obtain the first feature may include:
[0144] Inputting the first image and the image depth information into a convolution module, performing image feature extraction on the first image and the image depth information using the convolution module, and outputting a sixth feature;
[0145] Input the sixth feature into the deconvolution module, use the deconvolution module to upsample the sixth feature, and output the seventh feature;
[0146] The seventh feature is input into the third feature fusion module, and the third feature fusion module is used to perform feature fusion on the seventh feature, and the first feature is output.
[0147] Among them, the convolution module may include a first convolution layer and a second convolution layer, and the first convolution layer and the second convolution layer may both be more than two convolution layers. The deconvolution module may include a first deconvolution layer and a second deconvolution layer, and the first deconvolution layer and the second deconvolution layer may both be more than two deconvolution layers. The third feature fusion module may include a fully connected layer.
[0148] For example, it can be Figure 7 As shown, the first image and image depth information are input to the first convolution layer, and the first convolution layer is used to extract shallow semantic features from the first image and image depth information, and a shallow feature coding vector 701 is output. The shallow feature coding vector 701 is input to the second convolution layer, and the second convolution layer is used to extract deep semantic features from the shallow feature coding vector 701, and a deep feature coding vector 702 is output, which is the sixth feature. The deep feature coding vector 702 is input to the first deconvolution layer, and the first deconvolution layer is used to extract deep semantic features from the shallow feature coding vector 701. The shallow layer feature coding vector 701 is upsampled to obtain an upsampled feature coding vector 703; the upsampled feature coding vector 703 and the shallow layer feature coding vector 701 are input into the second deconvolution layer, and the upsampled feature coding vector 703 and the shallow layer feature coding vector 701 are upsampled by the second deconvolution layer, and the feature coding vector 704, which is the seventh feature, is output. The feature coding vector 704 is input into the fully connected layer, and the feature coding vector 704 is spliced by the fully connected layer to obtain the first feature 705.
[0149] Here, through two or more convolutional layers, we can obtain the image feature encoding vectors extracted by different convolutional layers. Shallow semantics focus more on local features, while deep semantics focus more on global features. In an image, shallow layers represent local exposure or contours, while deep layers represent exposure and contours of larger areas. The shallow feature encoding vector and deep feature encoding vector are the encoding vectors output after the image passes through two or more convolutional layers in sequence. The more convolutional layers the image passes through, the deeper the encoding vector.
[0150] By using a fully connected layer to splice the shallow feature coding vector and the deep feature coding vector, a multi-dimensional image feature coding vector can be obtained. The fully connected layer can pre-learn the weight factors of the shallow feature coding vector and the deep feature coding vector on reflectivity and area division, that is, the relevant model parameters.
[0151] In an optional embodiment, the reflectivity feature extraction model may include a feature conversion module, a first feature fusion module, and a reflectivity feature extraction module. Based on this, the reflectivity feature extraction model is used to extract the reflectivity feature of the first feature and the brightness parameter to obtain the second feature, which may include:
[0152] Input the brightness parameter into the feature conversion module, use the feature conversion module to convert the brightness parameter into a feature with the same dimension as the first feature, and output a third feature;
[0153] Inputting the first feature and the third feature into a first feature fusion module, performing feature fusion on the first feature and the third feature using the first feature fusion module, and outputting a fourth feature;
[0154] The fourth feature is input into the reflectivity feature extraction module, and the reflectivity feature extraction module is used to perform reflectivity feature extraction on the fourth feature, and the second feature is obtained as an output.
[0155] The feature conversion module may include a fully connected layer. The first feature fusion module may be used to perform a dot product on the input features. The reflectivity feature extraction module may include at least one transformer.
[0156] For example, it can be Figure 7 As shown, the exposure parameters and lux are input into a learnable fully connected layer, which is used to convert the exposure parameters and lux into features with the same dimension as the first feature, and the third feature is output; the first feature 705 and the third feature are dot-multiplied to obtain the fourth feature; the fourth feature is input into a 3-layer transformer, and the reflectivity feature of the fourth feature is extracted using the 3-layer transformer, and the second feature 706 is output.
[0157] In addition, before the fourth feature is input into the transformer, the fourth feature can be sliced first, and the fourth feature can be evenly divided into several segments, for example, 9 segments or 16 segments. Figure 8 As shown, the two or more feature segments 810 corresponding to the fourth feature can be linearly projected (Linear Projection of Flattened Payches), and then the two or more feature segments after linear projection can be positionally embedded (Position Embedding, PE), and then input into the transformer, which can include a multi-head self-attention mechanism (Self-Multi-HeadAttention, Self-MHA) and a feedforward neural network (Feed Forward).
[0158] Here, the Transformer can pre-learn the impact of brightness parameters on the characteristics of different encoded feature vectors. Specifically, the Transformer's multi-head self-attention mechanism can pre-learn the impact of exposure parameters and environmental information such as lux on the reflectivity of different image regions.
[0159] In this way, by performing reflectivity feature extraction on the fusion features of image features and brightness parameters, the reflectivity features of the image can be extracted accurately and efficiently.
[0160] In an optional embodiment, the region division model may include a second feature fusion module and a region division module. Based on this, the region division model, the first feature, and the second feature are used to perform region division on the first image to obtain two or more image regions and reflectivities corresponding to the two or more image regions, respectively, which may include:
[0161] Inputting the first feature and the second feature into a second feature fusion module, performing feature fusion on the first feature and the second feature using the second feature fusion module, and outputting a fifth feature;
[0162] The fifth feature is input into a region division module, and the region division module is used to divide the fifth feature into regions, and outputs two or more image regions and reflectivities corresponding to the two or more image regions.
[0163] The second feature fusion module may include a Concat module and a fully connected layer, wherein the Concat module may be used to splice the input features by layer. The region division module may include a pooling layer.
[0164] For example, it can be Figure 7 As shown, the first feature 705 and the second feature 706 are input to the Concat module, and the Concat module is used to splice the first feature 705 and the second feature 706 by layer, and the splicing feature 707 is output; the splicing feature 707 is input to the fully connected layer, and the splicing feature 707 is fused by the fully connected layer, and the fifth feature 708 is output; the fifth feature 708 is input to the pooling layer, and the pooling layer is used to divide the fifth feature 708 into regions, and the mask image containing more than two image regions and the reflectivity corresponding to the two or more image regions is output. The mask image can be shown as follows Figure 9 shown.
[0165] In this way, by performing region division based on the fusion features of the image features and the reflectivity features, two or more image regions and their corresponding reflectivities can be accurately and efficiently determined.
[0166] In order to better describe the entire solution, based on the above embodiments, a specific example is given. Figure 10 As shown, the image processing method may include steps 1001-1007, which are explained in detail below.
[0167] Step 1001: Obtain image depth information and brightness parameters of a first image.
[0168] Step 1002 : dividing the first image into regions according to the image depth information and the brightness parameter to obtain two or more image regions, and determining the reflectivity of the two or more image regions to obtain the reflectivity corresponding to the two or more image regions.
[0169] Step 1003: Determine a first contrast corresponding to the image area based on the reflectivity corresponding to the image area.
[0170] Step 1004: smoothing the first contrast.
[0171] Step 1005 : In response to a first input of the user on the image region, the contrast corresponding to the image region is updated to a target contrast.
[0172] Step 1006 : Smoothing the contrast of the first adjacent image region of the image region to obtain a target contrast corresponding to the first adjacent image region.
[0173] Step 1007 : Adjust the contrasts of two or more image regions in the first image to target contrasts corresponding to the image regions, to obtain a second image.
[0174] The specific process of each step can be found in the above embodiment and will not be repeated here.
[0175] Thus, the first image can be divided into regions based on the image depth information and brightness parameters of the first image to obtain two or more image regions, and the reflectivity of the two or more image regions can be determined to obtain the reflectivity corresponding to the two or more image regions respectively. Based on the reflectivity corresponding to the two or more image regions respectively, the target contrast corresponding to the two or more image regions can be determined, and then the contrast of the two or more image regions can be adjusted to the target contrast corresponding to the image region respectively, so as to obtain the second image. Since the embodiment of the present application can determine the target contrast corresponding to the two or more image regions respectively, and then make targeted adjustments to the contrast of the two or more image regions respectively, it is possible to optimize the contrast and layering of the image while ensuring that the image is as undistorted as possible.
[0176] The image processing method provided in the embodiment of the present application can automatically optimize the layering and atmosphere of the image by obtaining exposure parameters and lux and other environmental information related to photography and image semantic information, and highlight some elements in the image, so that the picture has both aesthetics and retains the original environmental characteristics, thereby improving the user experience and desire to share.
[0177] Furthermore, the image processing methods provided by the embodiments of this application not only adjust image contrast by region, but also adjust image saturation, brightness, and other parameters by region, thereby achieving better image quality. During the adjustment of image saturation, brightness, and other parameters, smoothing and manual correction can also be performed to avoid overly abrupt differences between different image regions.
[0178] It should be noted that the application scenarios described in the above-mentioned embodiments of the present application are intended to more clearly illustrate the technical solutions of the embodiments of the present application, and do not constitute a limitation on the technical solutions provided by the embodiments of the present application. Ordinary technicians in this field can know that with the emergence of new application scenarios, the technical solutions provided by the embodiments of the present application are also applicable to similar technical problems.
[0179] The image processing method provided in the embodiment of the present application can be executed by an image processing device. In the embodiment of the present application, the image processing device provided in the embodiment of the present application is described by taking the image processing device executing the image processing method as an example.
[0180] Based on the same inventive concept, the present application also provides an image processing device. Figure 13 The image processing device provided in the embodiment of the present application is described in detail.
[0181] Figure 11 The figure is a structural block diagram of an image processing apparatus according to an exemplary embodiment.
[0182] like Figure 11 As shown, the image processing apparatus 1100 may include:
[0183] An acquisition module 1101 is configured to acquire image depth information and brightness parameters of a first image;
[0184] The processing module 1102 is configured to divide the first image into regions based on the image depth information and the brightness parameter to obtain two or more image regions, and determine the reflectivity of the two or more image regions to obtain the reflectivity corresponding to the two or more image regions.
[0185] A determination module 1103 is configured to determine target contrasts corresponding to the two or more image regions based on the reflectivities corresponding to the two or more image regions;
[0186] The adjustment module 1104 is configured to adjust the contrasts of two or more image regions in the first image to target contrasts corresponding to the image regions, thereby obtaining a second image.
[0187] The image processing apparatus 1100 is described in detail below.
[0188] In one embodiment, the processing module 1102 may include:
[0189] An image feature extraction submodule, configured to extract image features from the first image and image depth information using an image feature extraction model to obtain a first feature;
[0190] A reflectivity feature extraction submodule, configured to perform reflectivity feature extraction on the first feature and the brightness parameter using a reflectivity feature extraction model to obtain a second feature;
[0191] The region division submodule is used to divide the first image into regions using the region division model, the first feature and the second feature to obtain two or more image regions and the reflectivities corresponding to the two or more image regions.
[0192] In one embodiment, the reflectivity feature extraction model includes a feature conversion module, a first feature fusion module and a reflectivity feature extraction module;
[0193] The reflectivity feature extraction submodule may include:
[0194] a feature conversion unit, configured to input the brightness parameter into a feature conversion module, convert the brightness parameter into a feature with the same dimension as the first feature using the feature conversion module, and output a third feature;
[0195] A first feature fusion unit is used to input the first feature and the third feature into the first feature fusion module, perform feature fusion on the first feature and the third feature using the first feature fusion module, and output a fourth feature;
[0196] The feature extraction unit is used to input the fourth feature into the reflectivity feature extraction module, use the reflectivity feature extraction module to perform reflectivity feature extraction on the fourth feature, and output the second feature.
[0197] In one embodiment, the region partitioning model includes a second feature fusion module and a region partitioning module;
[0198] The region division submodule may include:
[0199] A second feature fusion unit is used to input the first feature and the second feature into the second feature fusion module, perform feature fusion on the first feature and the second feature using the second feature fusion module, and output a fifth feature;
[0200] The area division unit is used to input the fifth feature into the area division module, use the area division module to divide the fifth feature into areas, and output more than two image areas and the reflectivities corresponding to the two or more image areas.
[0201] In one embodiment, the determining module 1103 may include:
[0202] An acquisition submodule, configured to acquire first brightness corresponding to two or more pixel points in an image area;
[0203] a brightness determination submodule, configured to determine second brightnesses corresponding to two or more pixel points in the image area according to the reflectivity of the image area and the two or more first brightnesses;
[0204] The contrast determination submodule is configured to determine a target contrast of the image area based on the two or more second brightnesses.
[0205] In one embodiment, the contrast determination submodule may include:
[0206] a determining unit, configured to determine a first contrast of the image area based on the two or more second brightnesses;
[0207] The smoothing processing unit is configured to perform smoothing processing on the first contrast according to the first image depth of the image region, the second image depth of an adjacent image region of the image region, and the second contrast to obtain a target contrast.
[0208] In one embodiment, the smoothing processing unit may include:
[0209] determining a subunit for determining a content label of an image region;
[0210] A first acquiring subunit, configured to acquire a third contrast ratio corresponding to the content label;
[0211] a determining subunit, configured to determine a weight corresponding to the image region according to a third contrast ratio, wherein the third contrast ratio is determined based on a correction value historically input by a user;
[0212] a first smoothing processing subunit, configured to perform smoothing processing on the first contrast according to the first image depth of the image region, the second image depth of an adjacent image region of the image region, and the second contrast, to obtain a fourth contrast;
[0213] The weighted processing subunit is configured to perform weighted processing on the fourth contrast based on the weight to obtain a target contrast.
[0214] In one embodiment, the device may further include:
[0215] a display module configured to display the image region based on the smoothed first contrast after smoothing the first contrast according to the first image depth of the image region, the second image depth of an adjacent image region of the image region, and the second contrast;
[0216] A receiving module, configured to receive a first input of a user on an image area;
[0217] The updating module is configured to update the contrast corresponding to the image area to a target contrast in response to the first input.
[0218] Thus, the first image can be divided into regions based on the image depth information and brightness parameters of the first image to obtain two or more image regions, and the reflectivity of the two or more image regions can be determined to obtain the reflectivity corresponding to the two or more image regions respectively. Based on the reflectivity corresponding to the two or more image regions respectively, the target contrast corresponding to the two or more image regions can be determined, and then the contrast of the two or more image regions can be adjusted to the target contrast corresponding to the image region respectively, so as to obtain the second image. Since the embodiment of the present application can determine the target contrast corresponding to the two or more image regions respectively, and then make targeted adjustments to the contrast of the two or more image regions respectively, it is possible to optimize the contrast and layering of the image while ensuring that the image is as undistorted as possible.
[0219] The image processing device in the embodiment of the present application can be an electronic device or a component in the electronic device, such as an integrated circuit or a chip. The electronic device can be a terminal or a device other than a terminal. For example, the electronic device can be a mobile phone, a tablet computer, a laptop computer, a PDA, an in-vehicle electronic device, a mobile Internet device (MID), an augmented reality (AR) / virtual reality (VR) device, a robot, a wearable device, an ultra-mobile personal computer (UMPC), a netbook or a personal digital assistant (PDA), etc. It can also be a server, a network attached storage (NAS), a personal computer (PC), a television (TV), a teller machine or a self-service machine, etc., and the embodiment of the present application does not specifically limit it.
[0220] The image processing device in the embodiment of the present application may be a device having an operating system. The operating system may be an Android operating system, an iOS operating system, or other possible operating systems, which are not specifically limited in the embodiment of the present application.
[0221] The image processing device provided in the embodiment of the present application can achieve Figures 3 to 10 The various processes implemented in the method embodiment achieve the same technical effect and will not be described again here to avoid repetition.
[0222] Alternatively, as Figure 12 As shown, an embodiment of the present application also provides an electronic device 1200, including a processor 1201 and a memory 1202, wherein the memory 1202 stores a program or instruction that can be run on the processor 1201, and when the program or instruction is executed by the processor 1201, the various steps of the above-mentioned image processing method embodiment are implemented, and the same technical effect can be achieved. To avoid repetition, it will not be repeated here.
[0223] It should be noted that the electronic devices in the embodiments of the present application include the mobile electronic devices and non-mobile electronic devices mentioned above.
[0224] Figure 13 A schematic diagram of the hardware structure of an electronic device implementing an embodiment of the present application.
[0225] The electronic device 1300 includes but is not limited to components such as a radio frequency unit 1301 , a network module 1302 , an audio output unit 1303 , an input unit 1304 , a sensor 1305 , a display unit 1306 , a user input unit 1307 , an interface unit 1308 , a memory 1309 , and a processor 1310 .
[0226] Those skilled in the art will understand that the electronic device 1300 may also include a power source (such as a battery) to power each component, and the power source may be logically connected to the processor 1310 through a power management system, thereby implementing functions such as charging, discharging, and power consumption management through the power management system. Figure 13 The electronic device structure shown in the figure does not constitute a limitation on the electronic device. The electronic device may include more or fewer components than shown in the figure, or combine certain components, or arrange the components differently, which will not be repeated here.
[0227] The processor 1310 is configured to obtain image depth information and brightness parameters of the first image;
[0228] Dividing the first image into regions according to the image depth information and the brightness parameter to obtain two or more image regions, and determining reflectivities of the two or more image regions to obtain reflectivities corresponding to the two or more image regions respectively;
[0229] determining target contrasts corresponding to the two or more image regions based on reflectivities corresponding to the two or more image regions;
[0230] The contrasts of two or more image regions in the first image are respectively adjusted to target contrasts corresponding to the image regions to obtain a second image.
[0231] Thus, the first image can be divided into regions based on the image depth information and brightness parameters of the first image to obtain two or more image regions, and the reflectivity of the two or more image regions can be determined to obtain the reflectivity corresponding to the two or more image regions respectively. Based on the reflectivity corresponding to the two or more image regions respectively, the target contrast corresponding to the two or more image regions can be determined, and then the contrast of the two or more image regions can be adjusted to the target contrast corresponding to the image region respectively, so as to obtain the second image. Since the embodiment of the present application can determine the target contrast corresponding to the two or more image regions respectively, and then make targeted adjustments to the contrast of the two or more image regions respectively, it is possible to optimize the contrast and layering of the image while ensuring that the image is as undistorted as possible.
[0232] Optionally, the processor 1310 is further configured to perform image feature extraction on the first image and the image depth information using an image feature extraction model to obtain a first feature;
[0233] Performing reflectance feature extraction on the first feature and the brightness parameter using a reflectance feature extraction model to obtain a second feature;
[0234] The first image is divided into regions using the region division model, the first feature, and the second feature to obtain two or more image regions and reflectivities corresponding to the two or more image regions.
[0235] In this way, by dividing the first image into regions and determining the reflectivity through a machine learning model, more than two image regions and the reflectivities corresponding to the two or more image regions can be accurately and efficiently determined.
[0236] Optionally, the reflectivity feature extraction model includes a feature conversion module, a first feature fusion module and a reflectivity feature extraction module;
[0237] The processor 1310 is further configured to input the brightness parameter into a feature conversion module, use the feature conversion module to convert the brightness parameter into a feature having the same dimension as the first feature, and output a third feature;
[0238] Inputting the first feature and the third feature into a first feature fusion module, performing feature fusion on the first feature and the third feature using the first feature fusion module, and outputting a fourth feature;
[0239] The fourth feature is input into the reflectivity feature extraction module, and the reflectivity feature extraction module is used to perform reflectivity feature extraction on the fourth feature, and the second feature is obtained as an output.
[0240] In this way, by performing reflectivity feature extraction on the fusion features of image features and brightness parameters, the reflectivity features of the image can be extracted accurately and efficiently.
[0241] Optionally, the region division model includes a second feature fusion module and a region division module;
[0242] The processor 1310 is further configured to input the first feature and the second feature into a second feature fusion module, perform feature fusion on the first feature and the second feature using the second feature fusion module, and output a fifth feature;
[0243] The fifth feature is input into a region division module, and the region division module is used to divide the fifth feature into regions, and outputs two or more image regions and reflectivities corresponding to the two or more image regions.
[0244] In this way, by performing region division based on the fusion features of the image features and the reflectivity features, two or more image regions and their corresponding reflectivities can be accurately and efficiently determined.
[0245] Optionally, the processor 1310 is further configured to
[0246] Obtaining first brightness corresponding to two or more pixel points in the image area;
[0247] Determining second brightnesses corresponding to two or more pixel points in the image area, respectively, based on a reflectivity of the image area and the two or more first brightnesses;
[0248] A target contrast ratio of the image region is determined based on the two or more second brightnesses.
[0249] In this way, through the above process, the second brightness corresponding to two or more pixel points in the image area can be accurately determined based on the first brightness corresponding to two or more pixel points in the image area and the reflectivity corresponding to the image area, and then the target contrast of the image area can be more accurately determined based on the second brightness corresponding to two or more pixel points.
[0250] Optionally, the processor 1310 is further configured to determine a first contrast of the image area based on the two or more second brightnesses;
[0251] The first contrast is smoothed according to the first image depth of the image region, the second image depth of an image region adjacent to the image region, and the second contrast to obtain a target contrast.
[0252] In this way, by smoothing the contrast of the image region through the above process, it is possible to avoid a large contrast difference between the image region and adjacent image regions, which would cause obvious discontinuities and abruptness, thereby making the image more natural.
[0253] Optionally, the processor 1310 is further configured to determine a content tag of the image region;
[0254] Get the third contrast corresponding to the content label;
[0255] determining a weight corresponding to the image region according to a third contrast ratio, where the third contrast ratio is determined based on a correction value inputted by a user historically;
[0256] performing a smoothing process on the first contrast according to the first image depth of the image region, the second image depth of an image region adjacent to the image region, and the second contrast to obtain a fourth contrast;
[0257] The fourth contrast is weighted based on the weight to obtain a target contrast.
[0258] In this way, based on the third contrast determined by the user's historical input, the smoothed contrast of the image region is automatically weighted to obtain the target contrast, so that the target contrast can better meet the user's needs.
[0259] Optionally, the display unit 1306 is configured to display the image region based on the smoothed first contrast after smoothing the first contrast according to the first image depth of the image region, the second image depth of an adjacent image region of the image region, and the second contrast;
[0260] The processor 1310 is further configured to receive a first input from a user regarding an image area;
[0261] In response to the first input, the contrast corresponding to the image region is updated to a target contrast.
[0262] In this way, the contrast of the image area can be corrected according to the user input, so that the display effect of the image area is more in line with the user's personalized needs.
[0263] It should be understood that in an embodiment of the present application, the input unit 1304 may include a graphics processing unit (GPU) 13041 and a microphone 13042, and the graphics processor 13041 processes the image data of a static picture or video obtained by an image capture device (such as a camera) in a video capture mode or an image capture mode. The display unit 1306 may include a display panel 13061, and the display panel 13061 may be configured in the form of a liquid crystal display, an organic light emitting diode, etc. The user input unit 1307 includes a touch panel 13071 and at least one of the other input devices 13072. The touch panel 13071 is also called a touch screen. The touch panel 13071 may include two parts: a touch detection device and a touch controller. Other input devices 13072 may include, but are not limited to, a physical keyboard, function keys (such as volume control keys, switch keys, etc.), a trackball, a mouse, and an operating stick, which will not be repeated here.
[0264] The memory 1309 can be used to store software programs and various data. The memory 1309 may mainly include a first storage area for storing programs or instructions and a second storage area for storing data, wherein the first storage area may store an operating system, applications or instructions required for at least one function (such as a sound playback function, an image playback function, etc.). In addition, the memory 1309 may include a volatile memory or a non-volatile memory, or the memory 1309 may include both volatile and non-volatile memories. Among them, the non-volatile memory may be a read-only memory (ROM), a programmable read-only memory (PROM), an erasable programmable read-only memory (EPROM), an electrically erasable programmable read-only memory (EEPROM), or a flash memory. Volatile memory can be random access memory (RAM), static random access memory (SRAM), dynamic random access memory (DRAM), synchronous dynamic random access memory (SDRAM), double data rate synchronous dynamic random access memory (DDRSDRAM), enhanced synchronous dynamic random access memory (ESDRAM), synchronous link dynamic random access memory (SLDRAM), and direct RAM bus random access memory (DRRAM). The memory 1309 in the embodiment of the present application includes but is not limited to these and any other suitable types of memory.
[0265] Processor 1310 may include one or more processing units. Optionally, processor 1310 integrates an application processor and a modem processor. The application processor primarily handles operations related to the operating system, user interface, and application programs, while the modem processor primarily processes wireless communication signals, such as a baseband processor. It is understood that the modem processor may not be integrated into processor 1310.
[0266] An embodiment of the present application also provides a readable storage medium, on which a program or instruction is stored. When the program or instruction is executed by a processor, the various processes of the above-mentioned image processing method embodiment are implemented and the same technical effect can be achieved. To avoid repetition, it will not be repeated here.
[0267] The processor is the processor in the electronic device described in the above embodiment. The readable storage medium includes a computer-readable storage medium, such as a computer read-only memory, a random access memory, a magnetic disk, or an optical disk.
[0268] An embodiment of the present application further provides a chip, which includes a processor and a communication interface, wherein the communication interface is coupled to the processor, and the processor is used to run programs or instructions to implement the various processes of the above-mentioned image processing method embodiment and achieve the same technical effect. To avoid repetition, it will not be repeated here.
[0269] It should be understood that the chip mentioned in the embodiments of the present application can also be called a system-level chip, a system chip, a chip system or a system-on-chip chip, etc.
[0270] An embodiment of the present application provides a computer program product, which is stored in a storage medium. The program product is executed by at least one processor to implement the various processes of the above-mentioned image processing method embodiment and can achieve the same technical effect. To avoid repetition, it will not be repeated here.
[0271] It should be noted that, in this article, the terms "comprise", "include" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device comprising a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, an element defined by the statement "comprises a ..." does not exclude the presence of other identical elements in the process, method, article or device comprising the element. In addition, it should be noted that the scope of the methods and devices in the embodiments of the present application is not limited to performing functions in the order shown or discussed, and may also include performing functions in a substantially simultaneous manner or in the opposite order according to the functions involved. For example, the described method may be performed in an order different from that described, and various steps may also be added, omitted, or combined. In addition, the features described with reference to certain examples may be combined in other examples.
[0272] Through the description of the above implementation methods, those skilled in the art can clearly understand that the above-mentioned embodiment methods can be implemented by means of software plus the necessary general hardware platform, and of course can also be implemented by hardware, but in many cases the former is a better implementation method. Based on this understanding, the technical solution of the present application is essentially or the part that contributes to the prior art can be embodied in the form of a computer software product, which is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk), including a number of instructions for enabling a terminal (which can be a mobile phone, computer, server, or network device, etc.) to execute the methods described in each embodiment of the present application.
[0273] The embodiments of the present application are described above in conjunction with the accompanying drawings, but the present application is not limited to the above-mentioned specific implementation methods. The above-mentioned specific implementation methods are merely illustrative and not restrictive. Under the guidance of this application, ordinary technicians in this field can also make many forms without departing from the purpose of this application and the scope of protection of the claims, all of which are within the protection of this application.
Claims
1. An image processing method, characterized in that: The method comprises: Obtaining image depth information and brightness parameters of the first image; Dividing the first image into regions according to the image depth information and the brightness parameter to obtain two or more image regions, and determining reflectivities of the two or more image regions to obtain reflectivities corresponding to the two or more image regions respectively; determining target contrasts corresponding to the two or more image regions based on reflectivities corresponding to the two or more image regions; adjusting the contrasts of the two or more image regions in the first image to target contrasts corresponding to the image regions, respectively, to obtain a second image; The determining of target contrasts corresponding to the two or more image regions based on the reflectivities corresponding to the two or more image regions respectively includes: Obtaining first brightness corresponding to two or more pixel points in the image area; determining second brightnesses corresponding to two or more pixel points in the image area, respectively, based on the reflectivity of the image area and the two or more first brightnesses; A target contrast of the image area is determined based on the two or more second brightnesses.
2. The method according to claim 1, characterized in that The step of dividing the first image into regions based on the image depth information and the brightness parameter to obtain two or more image regions, and determining reflectivities of the two or more image regions to obtain reflectivities corresponding to the two or more image regions, respectively, includes: Performing image feature extraction on the first image and the image depth information using an image feature extraction model to obtain a first feature; Performing reflectance feature extraction on the first feature and the brightness parameter using a reflectance feature extraction model to obtain a second feature; The first image is divided into regions using a region division model, the first feature, and the second feature to obtain two or more image regions and reflectivities corresponding to the two or more image regions.
3. The method according to claim 2, characterized in that The reflectivity feature extraction model includes a feature conversion module, a first feature fusion module and a reflectivity feature extraction module; The step of performing reflectance feature extraction on the first feature and the brightness parameter using a reflectance feature extraction model to obtain a second feature includes: Inputting the brightness parameter into the feature conversion module, using the feature conversion module to convert the brightness parameter into a feature with the same dimension as the first feature, and outputting a third feature; Inputting the first feature and the third feature into the first feature fusion module, performing feature fusion on the first feature and the third feature using the first feature fusion module, and outputting a fourth feature; The fourth feature is input into the reflectivity feature extraction module, and the reflectivity feature extraction module is used to perform reflectivity feature extraction on the fourth feature, and output to obtain the second feature.
4. The method according to claim 2, characterized in that The region division model includes a second feature fusion module and a region division module; The method of dividing the first image into regions by using the region division model, the first feature, and the second feature to obtain two or more image regions and reflectivities corresponding to the two or more image regions, respectively, includes: Inputting the first feature and the second feature into the second feature fusion module, performing feature fusion on the first feature and the second feature using the second feature fusion module, and outputting a fifth feature; The fifth feature is input into the region division module, and the region division module is used to perform region division on the fifth feature, and outputs two or more image regions and reflectivities corresponding to the two or more image regions.
5. The method according to claim 1, wherein The determining the target contrast of the image area based on the two or more second brightnesses includes: determining a first contrast of the image area based on two or more of the second brightnesses; The target contrast is obtained by performing a smoothing process on the first contrast according to the first image depth of the image area, the second image depth of an image area adjacent to the image area, and the second contrast.
6. The method according to claim 5, characterized in that The step of performing smoothing on the first contrast according to the first image depth of the image area, the second image depth of an adjacent image area of the image area, and the second contrast to obtain the target contrast includes: determining a content label of the image region; Obtaining a third contrast ratio corresponding to the content label; determining a weight corresponding to the image region according to the third contrast, wherein the third contrast is determined based on a correction value inputted by a user in history; performing smoothing processing on the first contrast according to the first image depth of the image area, the second image depth of an image area adjacent to the image area, and the second contrast to obtain a fourth contrast; The fourth contrast is weighted based on the weight to obtain the target contrast.
7. The method according to claim 5, characterized in that After smoothing the first contrast according to the first image depth of the image area, the second image depth of an adjacent image area of the image area, and the second contrast, the method further includes: displaying the image region based on the smoothed first contrast; receiving a first input from a user regarding the image area; In response to the first input, the contrast corresponding to the image area is updated to the target contrast.
8. An image processing device, characterized in that: The device comprises: An acquisition module, configured to acquire image depth information and brightness parameters of the first image; a processing module, configured to divide the first image into regions according to the image depth information and the brightness parameter to obtain two or more image regions, and determine reflectivities of the two or more image regions to obtain reflectivities corresponding to the two or more image regions respectively; a determination module, configured to determine target contrasts corresponding to the two or more image regions based on reflectivities corresponding to the two or more image regions; an adjustment module, configured to adjust the contrasts of the two or more image regions in the first image to target contrasts corresponding to the image regions, to obtain a second image; The determination module includes: An acquisition submodule, configured to acquire first brightness corresponding to two or more pixel points in the image area; a brightness determination submodule, configured to determine second brightnesses corresponding to two or more pixel points in the image area according to the reflectivity of the image area and the two or more first brightnesses; The contrast determination submodule is configured to determine a target contrast of the image area based on two or more second brightnesses.
9. The device according to claim 8, characterized in that The processing module includes: An image feature extraction submodule, configured to extract image features from the first image and the image depth information using an image feature extraction model to obtain a first feature; a reflectivity feature extraction submodule, configured to perform reflectivity feature extraction on the first feature and the brightness parameter using a reflectivity feature extraction model to obtain a second feature; The region division submodule is used to divide the first image into regions using the region division model, the first feature and the second feature to obtain more than two image regions and reflectivities corresponding to the two or more image regions.
10. The device according to claim 9, characterized in that The reflectivity feature extraction model includes a feature conversion module, a first feature fusion module and a reflectivity feature extraction module; The reflectivity feature extraction submodule includes: a feature conversion unit, configured to input the brightness parameter into the feature conversion module, convert the brightness parameter into a feature with the same dimension as the first feature using the feature conversion module, and output a third feature; a first feature fusion unit, configured to input the first feature and the third feature into the first feature fusion module, perform feature fusion on the first feature and the third feature using the first feature fusion module, and output a fourth feature; The feature extraction unit is used to input the fourth feature into the reflectivity feature extraction module, use the reflectivity feature extraction module to perform reflectivity feature extraction on the fourth feature, and output the second feature.
11. The device according to claim 9, characterized in that The region division model includes a second feature fusion module and a region division module; The area division submodule includes: a second feature fusion unit, configured to input the first feature and the second feature into the second feature fusion module, perform feature fusion on the first feature and the second feature using the second feature fusion module, and output a fifth feature; The area division unit is used to input the fifth feature into the area division module, use the area division module to divide the fifth feature into areas, and output more than two image areas and the reflectivities corresponding to the two or more image areas.
12. The device according to claim 8, characterized in that The contrast determination submodule includes: a determining unit, configured to determine a first contrast of the image area based on two or more second brightnesses; A smoothing processing unit is configured to perform smoothing processing on the first contrast according to the first image depth of the image area, the second image depth of an image area adjacent to the image area, and the second contrast to obtain the target contrast.
13. The device according to claim 12, characterized in that The smoothing processing unit includes: a determination subunit, configured to determine a content label of the image area; A first acquiring subunit, configured to acquire a third contrast corresponding to the content tag; a determining subunit, configured to determine a weight corresponding to the image region according to the third contrast, wherein the third contrast is determined based on a correction value inputted by a user in history; a first smoothing processing subunit, configured to perform smoothing processing on the first contrast according to the first image depth of the image area, the second image depth of an image area adjacent to the image area, and the second contrast, to obtain a fourth contrast; The weighted processing subunit is configured to perform weighted processing on the fourth contrast based on the weight to obtain the target contrast.
14. The device according to claim 12, characterized in that The device further comprises: a display module configured to display the image area based on the smoothed first contrast after smoothing the first contrast according to the first image depth of the image area, the second image depth of an adjacent image area of the image area, and the second contrast; A receiving module, configured to receive a first input from a user regarding the image area; An updating module is configured to update the contrast corresponding to the image area to the target contrast in response to the first input.
15. An electronic device, characterized in that: The method comprises a processor and a memory, wherein the memory stores a program or instruction that can be run on the processor, and when the program or instruction is executed by the processor, the steps of the image processing method according to any one of claims 1 to 7 are implemented.
16. A readable storage medium, characterized in that The readable storage medium stores a program or instruction, and when the program or instruction is executed by a processor, the steps of the image processing method according to any one of claims 1 to 7 are implemented.
Citation Information
Patent Citations
Image processing method and device, electronic equipment and storage medium
CN112581395A
Image processing method and device
CN114363507A