WO2023000868A1 - Image processing method and apparatus, device, and storage medium - Google Patents

Image processing method and apparatus, device, and storage medium Download PDF

Info

Publication number
WO2023000868A1
WO2023000868A1 PCT/CN2022/098683 CN2022098683W WO2023000868A1 WO 2023000868 A1 WO2023000868 A1 WO 2023000868A1 CN 2022098683 W CN2022098683 W CN 2022098683W WO 2023000868 A1 WO2023000868 A1 WO 2023000868A1
Authority
WO
WIPO (PCT)
Prior art keywords
image
gamma curve
gamma
image area
visual feature
Prior art date
Application number
PCT/CN2022/098683
Other languages
French (fr)
Chinese (zh)
Inventor
吴义孝
胡木
Original Assignee
Oppo广东移动通信有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Oppo广东移动通信有限公司 filed Critical Oppo广东移动通信有限公司
Publication of WO2023000868A1 publication Critical patent/WO2023000868A1/en

Links

Images

Classifications

    • G06T5/94
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T7/00Image analysis
    • G06T7/10Segmentation; Edge detection
    • G06T7/11Region-based segmentation

Definitions

  • This application relates to image processing technology, but not limited to image processing methods, devices, equipment, and storage media.
  • gamma correction is usually performed on the image before display.
  • the so-called gamma correction is to edit the gamma curve of the image, and use the method of non-linear tone editing to the image to determine the dark part and light part of the image signal, and increase the ratio of the two, thereby improving the image quality.
  • the contrast effect In the field of computer graphics, it is customary to use the conversion relationship curve between the screen output voltage and the corresponding brightness, which is called the gamma curve. However, for some images, the gamma-corrected image quality is poor.
  • the image processing method, device, device, and storage medium provided in the embodiments of the present application can improve image quality and improve user's visual experience.
  • the image processing method, device, equipment, and storage medium provided in the embodiments of the present application are implemented as follows:
  • the image processing method provided in the embodiment of the present application includes: based on the first visual feature of the pixel unit of the image to be processed, segmenting the image to be processed to obtain multiple image regions; wherein the first visual feature includes the following At least one of: brightness, color temperature; determining a first gamma curve corresponding to a first image area; wherein, the first image area is one of the plurality of image areas; based at least in part on the first A gamma curve, performing gamma correction on the first image area.
  • the image processing chip provided in the embodiment of the present application includes a processor unit configured to execute the image processing method described in the embodiment of the present application.
  • the image processing device includes: a segmentation module configured to segment the image to be processed based on the first visual feature of the pixel unit of the image to be processed to obtain a plurality of image regions; wherein the first A visual feature includes at least one of the following: brightness, color temperature; a determination module configured to determine a first gamma curve corresponding to a first image area; wherein the first image area is one of the plurality of image areas 1.
  • a first correction module configured to perform gamma correction on the first image region based at least in part on the first gamma curve.
  • the electronic device provided by the embodiment of the present application includes a memory and a processor, the memory stores a computer program that can run on the processor, and the processor implements the method described in the embodiment of the present application when executing the program.
  • the computer-readable storage medium provided by the embodiment of the present application has a computer program stored thereon, and when the computer program is executed by a processor, the method described in the embodiment of the present application is implemented.
  • the image to be processed is segmented based on the first visual feature of the pixel unit of the image to be processed to obtain multiple image regions; then, the first gamma curve corresponding to the first image region is determined, at least partially Based on the first gamma curve, gamma correction is performed on the first image region; in this way, the corresponding gamma curve is used for correction for image regions with different visual characteristics, so that the quality of the image region can be improved in a targeted manner, and then Improve the user's visual experience.
  • FIG. 1 is a schematic diagram of an implementation flow of an image processing method provided by the present application
  • Figure 2 shows the gamma curves of the human eye in different environments
  • FIG. 3 is a schematic diagram of an implementation flow of another image processing method provided by the present application.
  • FIG. 4 is a schematic diagram of a transitional image area provided by the present application.
  • FIG. 5 is a schematic diagram of an implementation flow of another image processing method provided by the present application.
  • FIG. 6 is a schematic diagram of the relationship between brightness in nature and the corresponding brightness value perceived by human eyes
  • Figure 7 is a comparison of image display effects before and after gamma correction
  • FIG. 8 is a schematic diagram of an implementation flow of another image processing method provided by the present application.
  • FIG. 9 is a schematic diagram of the brightness of picture a before gamma correction
  • FIG. 10 is a schematic diagram of gamma curves corresponding to scene a1 and scene b1 of the present application.
  • Fig. 11 is a schematic diagram of the transitional image area of the picture and the gamma correction of the image area in the present application;
  • FIG. 12 is a schematic diagram of the weight relationship between the first weight function and the second weight function of the present application at the same pixel position;
  • FIG. 13 is a schematic diagram of the overall brightness of picture a after gamma correction in the present application.
  • FIG. 14 is a schematic structural diagram of an image processing device of the present application.
  • FIG. 15 is a schematic structural diagram of an electronic device provided by the present application.
  • first ⁇ second ⁇ third involved in this application does not represent a specific ordering of objects. It is understandable that “first ⁇ second ⁇ third” can be interchanged with specific sequence or sequence such that the application described herein can be practiced in sequences other than those illustrated or described herein.
  • An embodiment of the present application provides an image processing method, which is applied to an electronic device, and the electronic device may be various types of devices with information processing capabilities during implementation, for example, the electronic device may include a mobile phone, a tablet computer , laptop computer, projector, desktop computer, personal digital assistant, navigator, digital phone, video phone, television or sensory equipment, etc.
  • the functions realized by the method can be realized by calling the program codes by the processor in the electronic device, and of course the program codes can be stored in the computer storage medium. It can be seen that the electronic device at least includes a processor and a storage medium.
  • Figure 1 is a schematic diagram of the implementation flow of the image processing method provided by the embodiment of the present application. As shown in Figure 1, the method may include the following steps 101 to 103:
  • Step 101 Segment the image to be processed based on the first visual feature of the pixel unit of the image to be processed to obtain a plurality of image regions; wherein the first visual feature includes at least one of the following: brightness and color temperature.
  • the images to be processed may be various types of images.
  • the image to be processed is an image to be corrected by the image sensor; another example, the image to be processed is an image to be displayed on the image display terminal.
  • the image processing method described in the present application can be executed on the images generated in different stages.
  • the image to be processed may be segmented in the following manner: the pixel units in which the first visual feature falls within the same specific interval are divided into one image area, so as to obtain multiple image areas.
  • the pixel units whose brightness falls in the first brightness range can be divided into one image area, and the pixel units whose brightness falls in the second brightness range can be divided into another image area, and so on.
  • the first visual feature is color temperature
  • pixel units whose color temperature falls within the first color temperature range can be divided into one image area
  • pixel units whose color temperature falls within the second color temperature range can be divided into another image area, and so on.
  • the first visual feature is brightness and color temperature, divide the pixel units whose brightness falls into the third brightness range and whose color temperature falls into the third color temperature range into an image area, and divide the pixel units whose brightness falls into the fourth brightness range and whose color temperature falls into the third color temperature range
  • the pixel unit of the four color temperature intervals is divided into another image area, and so on.
  • a specific interval has at least one boundary, for example, a specific interval is [m, ⁇ ), it can be seen that it has only one boundary m; another example, a specific interval is [A, B], it can be seen that it has Two boundaries, namely A and B.
  • a pixel unit may include one pixel or multiple pixels.
  • the first visual feature of the pixel unit may be a representative feature of the visual feature of each pixel, and the representative feature may be an average value or a median value.
  • whether to segment the image to be processed may be unconditional, and in some embodiments, the segmentation may also be conditional. For example, if the overall second visual feature of the image to be processed satisfies the segmentation condition, execute steps 101 to 103; otherwise, if the second visual feature does not meet the segmentation condition, the image to be processed is not segmented, but determined The fourth gamma curve corresponding to the second visual feature, and performing gamma correction on the image to be processed according to the fourth gamma curve; in this way, under the premise of ensuring that each image conforms to the human eye's perception of brightness, Reduce unnecessary segmentation and other processing, thereby saving power consumption and computing resources.
  • the electronic device may determine the overall second visual feature of the image to be processed based on the first visual feature of the pixel units of the image to be processed.
  • the second visual feature may be a value used to characterize changes in the first visual feature of the pixel units of the image to be processed.
  • the second visual feature includes the variance and/or standard deviation of brightness of each pixel unit of the image to be processed, and/or the variance and/or standard deviation of color temperature of each pixel unit of the image to be processed.
  • the segmentation condition is that the variance and/or the standard deviation is greater than a corresponding threshold.
  • the second visual feature may also be used to characterize whether the image to be processed includes a light source, the number of light sources and/or the position of the light source, and the like.
  • the segmentation condition is: the image to be processed includes a light source, the number of light sources is greater than a corresponding threshold, and/or the position of the light source is at a specific position, etc.
  • the specific location is an edge area or a central area of the image to be processed.
  • the segmentation condition may also be: the variance and/or the standard deviation are greater than a corresponding threshold, and the image to be processed includes light sources, the number of light sources is greater than the corresponding threshold, and/or the position of the light source is at a specific position.
  • Step 102 determining a first gamma curve corresponding to a first image area; wherein, the first image area is one of the plurality of image areas.
  • the first gamma curve is obtained by calibration at the image sensor end, based on this, the first image region is calculated based on the first gamma curve at the image sensor end Perform gamma correction.
  • the image sensor side also calibrates other different gamma curves, and different gamma curves are applicable to different image areas.
  • different gamma curves have a mapping relationship with a third visual feature characterizing the scene.
  • the electronic device may determine the overall fourth visual feature of the first image area, and then determine a third visual feature that matches the fourth visual feature from different third visual features, and then obtain and determine the fourth visual feature.
  • the gamma curve corresponding to the three visual features (namely the first gamma curve); wherein, different third visual features correspond to different scenes, in other words, different scenes include different light sources and light intensities.
  • the electronic device may pre-acquire the images taken of the same scene under each candidate gamma curve, and then select a target image whose image quality meets the conditions from the captured images, and use the candidate gamma curve corresponding to the target image as the The final gamma curve for the scene.
  • the electronic device captures a scene under candidate gamma curve 1 to obtain image 1, captures the scene under candidate gamma curve 2 to obtain image 2, and captures the scene under candidate gamma curve 3 to obtain
  • the tester can select the image that is most in line with human perception from image 1 to image 3, and use the candidate gamma curve corresponding to the image as the final gamma curve of the scene; then, the electronic device calibrates the final gamma curve of the scene. gamma curve.
  • the final gamma curves of different scenes are selected through testing, and the mapping relationship between the third visual feature of each scene and the final gamma curves of the corresponding scenes is recorded.
  • the image to be processed is the image to be displayed on the image display terminal, it is similar to the solution of determining the corresponding first gamma curve in the above solution of the image to be corrected, and will not be repeated here.
  • the fourth visual feature represents the overall feature of the first image region, for example, the overall feature is an average brightness value, an average color temperature value, a median color temperature value, and/or a median brightness value.
  • the multiple gamma curves calibrated by the image sensor end and/or the image display end correspond to different visual feature intervals.
  • its mapping relationship is shown in Table 1: gamma curve 10 corresponding to brightness interval 10, gamma curve 20 corresponding to brightness interval 20, ..., gamma curve N0 corresponding to brightness interval N0; wherein, gamma curve 10, 20 , . . . , N0 are different, and the brightness interval 10 to the brightness interval N0 include different brightness.
  • the electronic device may determine the gamma curve corresponding to the interval from Table 1 according to the brightness interval in which the average brightness value or the median brightness value of the first image area falls, and use the curve as the first gamma curve corresponding to the first image area. For example, if the brightness mean value or brightness median value of the first image area falls into the brightness interval 20, then the gamma curve 20 is used as the first gamma curve.
  • the gamma curve 11 corresponding to the brightness interval 11 and the color temperature interval 11 the gamma curve 21 corresponding to the brightness interval 21 and the color temperature interval 21, ..., the gamma curve corresponding to the brightness interval N1 and the color temperature interval N1 N1; wherein, the gamma curves 11, 21, .
  • the electronic device may determine the corresponding first gamma curve according to the interval in which the average brightness value and the average color temperature value of the first image region fall. For example, if the average brightness falls into the brightness interval 11, and the average color temperature falls into the color temperature interval 11, the gamma curve 11 is taken as the first gamma curve; for another example, if the average brightness falls into the brightness interval 11, the average color temperature falls into If the color temperature range is 12, the gamma curve 11 or the gamma curve 21 can be used as the first gamma curve, or the fusion of the gamma curve 11 and the gamma curve 21 can be used as the first gamma curve.
  • Step 103 Perform gamma correction on the first image region based at least in part on the first gamma curve.
  • the image to be processed is segmented based on the first visual feature of the pixel unit of the image to be processed to obtain multiple image regions; then, the first gamma curve corresponding to the first image region is determined , performing gamma correction on the first image region based at least in part on the first gamma curve; in this way, for image regions with different visual characteristics, the corresponding gamma curve is used for correction, so that the gamma correction of the image region can be improved in a targeted manner. quality, thereby enhancing the user's visual experience.
  • gamma correction may be performed on the first image region based on the first gamma curve; gamma correction may also be performed on the first image region based on the third gamma curve and the first gamma curve; wherein, The third gamma curve is obtained by calibration at the image display end, and the first gamma curve is obtained by calibration at the image sensor end.
  • different third gamma curves correspond to different light characteristics
  • the electronic device may determine the corresponding third gamma curve according to the light characteristics of the current physical environment.
  • the corresponding gamma curves of human eyes are different.
  • the gamma value corresponding to the human eye will adapt to the overall brightness. Compress the dark places and brighten the dark places. Therefore, in the embodiment of the present application, when gamma correction is performed on the first image area, not only the influence of the visual characteristics of the first image area itself on the gamma curve of the human eye is considered, but also the current location of the electronic device is considered.
  • the influence of the light characteristics of the physical environment on the gamma curve of the human eye in this way, it helps to simulate the human eye's perception of light and shade in different light environments, thereby eliminating image mutations and making the first image area after gamma correction more accurate. Conforms to the human eye's perception of light and dark.
  • FIG. 3 is a schematic diagram of the implementation flow of another image processing method provided by the present application. As shown in FIG. 3 , the method may include the following steps 301 to 305:
  • Step 301 segment the image to be processed based on the first visual feature of the pixel unit of the image to be processed to obtain multiple image regions; wherein the first visual feature includes at least one of the following: brightness, color temperature;
  • Step 302 determining a first gamma curve corresponding to a first image area; wherein, the first image area is one of the plurality of image areas;
  • Step 303 performing gamma correction on the first image region based at least in part on the first gamma curve
  • Step 304 determining a second gamma curve corresponding to a second image area; wherein, the second image area is another image area adjacent to the first image area among the plurality of image areas;
  • Step 305 Perform gamma correction on the second image region based at least in part on the second gamma curve.
  • each image area of the image to be processed adopts the processing method for the first image area or the second image area described in the embodiment of the present application; in this way, when the electronic device performs gamma correction on the image to be processed , instead of using only one gamma curve to perform gamma correction on the entire image, the image is divided into multiple image regions, so as to select the gamma curve that matches the image region in a targeted manner, and based on this, the corresponding image region Perform gamma correction to improve the gamma correction effect of the image to be processed and improve image quality.
  • the method further includes: performing gamma correction on a transitional image region based at least in part on the first gamma curve and/or the second gamma curve, wherein the transitional image region includes A boundary line between the first image area and the second image area.
  • the boundary line between the first image area and the second image area can be determined first; An area enclosed by the second image area offset by a specific pixel distance is used as the transition image area.
  • 401 is the boundary line between the first image area 402 and the second image area 403, then, the boundary line 401 can be offset upward by the first pixel distance to obtain a boundary 404, and the boundary line 401 is shifted down by a second pixel distance, resulting in border 405 .
  • the area enclosed by the boundary 404 and the boundary 405 is the transition image area between the first image area 402 and the second image area.
  • the first pixel distance and the second pixel distance can be the same or different, and there is no limit to the size of the first pixel distance and the second pixel distance.
  • the first pixel distance and the second pixel distance are set specific pixel distances, and the value is a length of 3 to 5 pixel points.
  • the electronic device may perform gamma correction on the transitional image region in the following way: based on the first weight function and the second weight function, the first gamma curve and the second gamma curve The weighted sum is used as a fifth gamma curve; performing gamma correction on the transition image region based at least in part on the fifth gamma curve; thus, the brightness between different regions of the gamma-corrected image can be further improved continuity, the image effect looks more natural.
  • the first weight function is the coefficient of the first gamma curve
  • the second weight function is the coefficient of the second gamma curve
  • the value of the first weight function corresponding to the same pixel unit is the same as The sum of the values of the second weight function is 1; the value of the first weight function is negatively correlated with the distance from the first pixel unit to the first boundary of the first image area, wherein the first pixel A unit is a pixel unit belonging to a first image area in the transition image area, and the first boundary is located in the first image area.
  • light (x, y) represents the brightness of the pixel unit (x, y)
  • fun1 (light (x, y) ) represents the first gamma curve of the first image area
  • weight1 refers to the first weight function
  • the function The independent variable of is the pixel distance from the pixel unit of the transition image area to the first boundary
  • weight2 refers to the second weight function
  • the sum of the first weight function is 1
  • fun2(light (x,y) ) indicates the second image
  • the second gamma curve for the region
  • the electronic device may determine the gamma value of the pixel unit (x, y) in the transition image area according to the above formula (1), and perform gamma correction on the brightness of the pixel unit according to the gamma value.
  • FIG. 5 is a schematic diagram of the implementation flow of another image processing method provided by the present application. As shown in FIG. 5 , the method may include the following steps 501 to 505:
  • Step 501 segment the image to be processed based on the first visual feature of the pixel unit of the image to be processed to obtain multiple image regions; wherein the first visual feature includes at least one of the following: brightness, color temperature;
  • Step 502 determine the first gamma curve corresponding to the first image area; wherein, the first image area is one of the plurality of image areas, and the first gamma curve is calibrated at the image sensor end obtained;
  • Step 503 Perform gamma correction on the first image region based at least in part on the first gamma curve.
  • Step 504 determining a third gamma curve corresponding to the first image area; wherein, the third gamma curve is obtained by performing calibration on the image display terminal.
  • the electronic device may perform gamma correction on the first image area based on the first gamma curve at the image sensor end to obtain the corrected first image area; then, at the image display end based on the third A gamma curve, performing gamma correction on the corrected first image area to obtain a target image area.
  • the electronic device may firstly fuse the first gamma curve and the third gamma curve to obtain the fused gamma curve; then, based on the fused gamma curve, the first image region Perform gamma correction to obtain the target image area.
  • this application does not limit how the electronic device corrects the first image region based on the first gamma curve and the third gamma curve.
  • the electronic device may implement step 404 as follows: determine the light characteristics of the physical environment where the electronic device is located; and determine the corresponding third gamma curve according to the light characteristics.
  • the electronic device can calibrate different light characteristics on the image display end to correspond to the corresponding gamma curves, so that the electronic device can determine the corresponding gamma curve according to the light characteristics of the current physical environment before actually displaying the image to be processed.
  • the third gamma curve so that the display effect of the first image area corrected based on the third gamma curve is more in line with the current perception of light and shade by human eyes.
  • the light characteristics of the physical environment where the electronic device is located may be collected through a sensor on the electronic device. Further, in some embodiments, the light characteristics may include light intensity and/or color temperature.
  • Step 505 Perform gamma correction on the first image region according to the third gamma curve.
  • the two ends may or may not use the same image segmentation result.
  • the electronic device can re-segment the image to be displayed on the image display end.
  • the segmentation method is the same as the solution described above, and will not be repeated here.
  • the processing method for the transitional image area of the adjacent image area of the image to be displayed is the same as the above solution, and will not be repeated here.
  • FIG. 6 shows the brightness in nature and the corresponding brightness value felt by the human eye. It can be seen from the figure , the human eye is more sensitive to darker (closer to 0) brightness values, and less sensitive to brighter (closer to 1) brightness values. It can be understood that the human eye can better distinguish changes in darker brightness values, so the color is in When storing, the color value of the darker part should be preserved more.
  • the gamma curve is set according to the characteristics of the image sensor (sensor) and lens (lens), lighting environment, and even user preference.
  • the Gamma value When the Gamma value is large, the image will be very bright, but the contrast and saturation will decrease, as shown in Figure 7, it feels intuitively that there is a layer of fog covering the picture, and the noise in the dark will be amplified.
  • the Gamma value is small, the brightness will decrease, the overall contrast of the image will increase, the color will be more vivid, the noise in the dark place will be smaller, and the picture in the dark place will be darker, making it difficult to see clearly.
  • a gamma curve is used to perform gamma correction on the image to be processed during shooting by the mobile phone.
  • the gamma curves corresponding to the actual human eyes are not exactly the same in scenes with different brightness, especially in environments with obvious changes in light and dark and in environments where light and dark changes are not obvious.
  • the gamma corresponding to the human eye will adapt to the overall brightness. The higher the overall brightness, the steeper the gamma, compressing bright areas and brightening dark areas. That is to say, the human eye does not perceive the actual darker area as darker.
  • the gamma of the human eye will be automatically compressed, and the human eye will not feel that it is particularly bright.
  • the result will be that the brighter area will be brighter, or even appear white, while the darker area will be darker, or even appear black.
  • a gamma curve parameter that can adaptively adjust gamma curve parameters for different shooting scenes is provided, so as to simulate the human eye's perception of lightness and darkness in different environments as much as possible, and output the corresponding Image.
  • the overall process includes three parts:
  • gamma parameter calibration stage a set of gamma curves divided and calibrated according to the scene
  • This part calibrates the gamma curves in different scenes, that is, the gamma curves corresponding to different visual feature intervals.
  • the degree of brightness change of the captured image that is, an example of an image to be processed
  • determine whether the captured image needs to be segmented if necessary, perform regional segmentation on the captured image , to obtain image regions corresponding to different scenes, and then, based on the brightness of the image region, search for a corresponding gamma curve from the first part of the calibrated gamma curve set, and use the gamma curve to perform gamma correction on the corresponding image region.
  • interpolation is performed on the adjacent areas of the corresponding multiple image areas (ie transition image areas), so as to ensure the continuity of the adjacent image areas after gamma correction.
  • the third part the image display stage, corrects the gamma correction according to the display environment and finally displays it;
  • the gamma curve obtained in the second part needs to be adjusted according to the actual physical environment.
  • the gamma curve that is, the gamma correction parameter
  • a reference method for setting the shape of the gamma curve is to shoot 24 color cards in a light box environment, and make the brightness data Y of the 6 color blocks at the bottom of the color card as much as possible showing a linear proportional relationship.
  • the method of segmented linear interpolation is generally used, and SRAM can also be used to realize point-by-point mapping, so that the shape of the curve can be flexibly configured. After the first part is completed, the mapping relationship between multiple sets of gamma curves and scenes can be obtained.
  • scene recognition and scene segmentation in actual shooting, due to the complexity of the scene, the scene in the picture often contains not exactly the same environment when shooting, and the acquired image is down-sampled at the front end to obtain RGB condensed Outline, use the front-end segmentation module to segment different image areas, judge the environment of different image areas, and determine the gamma curve under the environment according to the judged environment.
  • the brightness of a certain picture a before gamma correction is shown in Figure 9, where x and y represent the pixel position respectively, and the z value represents the brightness of the pixel position.
  • the image is divided into two image areas, as shown in FIG. 4 , one image area 302 includes the scene a1, and the other image area 303 includes the scene b1.
  • the horizontal and vertical coordinates correspond to the positions of the pixels in the picture a
  • the curve represents the divided boundary line 301, which divides the whole picture into scene a1 and scene b1
  • the gamma curve corresponding to the pixel in scene a1 is The gamma curve a1
  • the gamma curve corresponding to the pixel in the scene b1 is the gamma curve b1.
  • the boundary line 301 is offset by a certain number of pixels on both sides.
  • the distance p is used to obtain the transition image area c, and the gamma curve corresponding to the pixels in the transition image area c adopts the weighted average of the former two, and sets the weight according to the distance of the offset.
  • scene a1 and scene b1 compare the values obtained in the first part to find the corresponding gamma curve.
  • x and y represent pixel positions respectively, and different gamma curves are used according to different scenes.
  • the curve of the transition image area is interpolated to ensure the continuity of the brightness change after mapping.
  • the method used here is linear interpolation, as shown in the following formula (2), the obtained gamma curve fun3 of the transition image area
  • the expression for (light (x,y) ) is:
  • light (x, y) represents the brightness of the pixel unit (x, y)
  • fun1(light (x, y) ) represents the target gamma curve of the image area
  • weight1 refers to the first weight function
  • the argument of the function is the pixel distance from the pixel unit of the transition image area to the boundary of the transition image area in the image area
  • weight2 refers to the second weight function
  • the sum of the first weight function is 1
  • fun2(light (x,y) ) means Target gamma curves of image regions adjacent to the image region.
  • FIG. 11 is a schematic diagram of the transitional image area of the above picture a and the gamma correction of the image area.
  • the area [0.0.5] represents the gamma correction result in the image area a1
  • [ 0.5,1.5] represents the gamma correction result in the transition image region
  • [1.5,2] represents the gamma correction result in the image region b1.
  • 0.5, 1.5, 2, etc. have no practical meaning, and are only examples, and do not limit the scope of the technical solution of the present application.
  • (x, y) represents the position of the pixel in the picture
  • light represents the brightness of the pixel at the x, y position
  • weight represents the weight, where the pixel width is p, when the pixel is on the upper boundary (that is, the transition image area is in The boundary of the image area of a1) weight1 is 1, weight2 is 0; when the pixel point is at the lower boundary (that is, the transition image area is at the boundary of the image area of b1), weight1 is 0, weight2 is 1, and other areas change as shown in Figure 12
  • the abscissa represents the proportion of the distance between the pixel point in the transition image area and the upper boundary (the maximum value is 1, and the distance from the upper boundary is 1*p, which is the lower boundary).
  • the corresponding gamma curves in different areas of the picture are saved and bound to the picture ID, and stored locally.
  • the light sensor of the mobile phone is used to obtain the light intensity and color temperature of the current external environment, combined with the currently displayed ambient brightness.
  • the data in the second part is subjected to corresponding light and dark calibration processing, and the corresponding image is output.
  • the gamma curve collection in the first part that the gamma curve corresponding to the currently displayed scene is fun2(), combined with the gamma curves in different areas of the shooting scene picture in the second part is fun(), Then the gamma curve used in the final display is: Weignt2*fun()+Weignt3*fun2().
  • the gamma curves corresponding to the human eye are not completely consistent in different environments, especially the corresponding gamma curves are not completely consistent under environments with obvious changes in brightness and darkness and in environments with insignificant changes in brightness and darkness.
  • different gamma curves are used according to the shooting scene and the display scene, and the gamma curve is adaptively adjusted for different shooting scenes, so as to simulate the human eye's perception of light and shade in different environments as much as possible, and the output corresponding image.
  • the front-end chip is used to divide different regions according to the color temperature and light intensity to select the gamma curve.
  • interpolation is performed in the transition image area of the adjacent image area to ensure the continuity of the brightness change.
  • the determination of the gamma curve during actual display is adjusted again according to the light intensity and color temperature of the current display environment, the corresponding gamma curve is obtained according to the current display scene, and the gamma curve corresponding to the existing shooting environment is carried out Weighted to get the final gamma curve.
  • the gamma curve sets generated by human eye calibration under different color temperature and light intensity scenes are pre-calibrated.
  • the original image is first divided into image regions according to the overall brightness difference of the picture in the front-end chip;
  • the principle of image segmentation is based on scene areas with obviously different color temperatures and light intensities in the overall picture.
  • threshold ladders multiple sets of thresholds
  • the color temperature or brightness difference of different areas falls within a certain threshold range to divide into different areas and perform segmentation.
  • the pre-calibrated gamma curve set use different gamma curves to perform gamma correction on these areas; then, in order to ensure that the gamma parameters between adjacent image areas in the image change with the pixel position
  • the continuity of the gamma parameter in the whole image is two-dimensional cubic polynomial interpolation; at the same time, the obtained information (including color temperature distribution, light intensity and gamma parameter distribution G1(x,y)) is saved in the image information.
  • the light sensor of the mobile phone When the picture is previewed and displayed, use the light sensor of the mobile phone to obtain the light intensity and color temperature value of the current external environment, compare it with the existing scene information during shooting, and perform gamut according to the similarity between the current environment and the shooting environment saved in the original picture Secondary adjustment of the horse curve; for example, find the corresponding overall gamma correction parameter G2 based on the environmental information obtained when the picture is currently displayed (because the current display scene is fixed, the gamma parameter is a fixed value), and the gamma generated by the old interpolation
  • the horse parameters G1(x, y) are summed and averaged to obtain the final parameters.
  • the present application provides an image processing device, which includes each module included and each unit included in each module, which can be realized by a processor; of course, it can also be realized by a specific logic circuit;
  • the processor may be a central processing unit (CPU), a microprocessor (MPU), a digital signal processor (DSP), a field programmable gate array (FPGA), or an image signal processing chip (ISP).
  • CPU central processing unit
  • MPU microprocessor
  • DSP digital signal processor
  • FPGA field programmable gate array
  • ISP image signal processing chip
  • FIG. 14 is a schematic structural diagram of the image processing device of the present application. As shown in FIG. 14, the image processing device 140 includes:
  • the segmentation module 141 is configured to segment the image to be processed based on the first visual feature of the pixel unit of the image to be processed to obtain a plurality of image regions; wherein the first visual feature includes at least one of the following: brightness, color temperature;
  • the determination module 142 is configured to determine a first gamma curve corresponding to a first image area; wherein the first image area is one of the plurality of image areas;
  • the first correction module 143 is configured to perform gamma correction on the first image region based at least in part on the first gamma curve.
  • the determining module 142 is further configured to: determine a second gamma curve corresponding to a second image area; wherein, the second image area is one of the plurality of image areas that is similar to the first image Another image region adjacent to the region; the first gamma curve is different from the second gamma curve; the first correction module 143 is also configured to: based on the second gamma curve, correct the second gamma curve Image areas are gamma corrected.
  • the first correction module 143 is further configured to perform gamma correction on the transitional image region based at least in part on the first gamma curve and/or the second gamma curve, wherein the The transition image area includes a boundary between the first image area and the second image area.
  • the determination module 142 is further configured to: determine the boundary line between the first image area and the second image area; The area enclosed by the area and the second image area offset by a specific pixel distance is used as the transition image area.
  • the first correction module 143 is configured to: based on the first weight function and the second weight function, use the weighted sum of the first gamma curve and the second gamma curve as the fifth gamma curve; performing gamma correction on the transition image region based at least in part on the fifth gamma curve; wherein the first weight function is a coefficient of the first gamma curve, and the second weight function is the coefficient of the second gamma curve, the sum of the value of the first weight function corresponding to the same pixel unit and the value of the second weight function is 1; the value of the first weight function and the value of the first pixel
  • the distance between the unit and the first boundary of the first image area is negatively correlated, wherein the first pixel unit is a pixel unit belonging to the first image area in the transition image area, and the first boundary is located in the first image area.
  • the image processing device 140 further includes a second correction module; wherein, the determination module 142 is further configured to: determine a third gamma curve corresponding to the first image region; wherein, the third gamma curve The horse curve is obtained by calibration at the image display end, and the first gamma curve is obtained by calibration at the image sensor end; the second correction module is also configured to, according to the third gamma curve, correct the Perform gamma correction on the first image area.
  • the determining module 142 is configured to: determine light characteristics of the physical environment; and determine a corresponding third gamma curve according to the light characteristics.
  • the segmentation module 141 is configured to: segment the pixel units in which the first visual feature falls into the same specific interval into one image area, so as to obtain multiple image areas.
  • the determining module 142 is further configured to: determine an overall second visual feature of the image to be processed based on the first visual feature of the pixel units of the image to be processed; if the second visual feature Satisfy the segmentation condition, trigger the segmentation module 141 to segment the image to be processed; if the second visual feature does not meet the segmentation condition, determine the fourth gamma curve corresponding to the second visual feature; and trigger the first correction module 143 according to The fourth gamma curve performs gamma correction on the image to be processed.
  • the second visual feature includes at least one of the following: the change of the first visual feature of the pixel unit of the image to be processed; whether the image to be processed includes a light source; the number of the light source ; the position of the light source.
  • the segmentation condition includes at least one of the following: the parameter characterizing the change is greater than a corresponding threshold; the image to be processed includes a light source; the number of the light source is greater than a corresponding threshold; the position of the light source at a specific location.
  • the determination module 142 is further configured to: acquire the mapping relationship between different gamma curves and the third visual feature representing the scene; determine the overall fourth visual feature of the first image region; from the Determining a third visual feature that matches the fourth visual feature from the third visual features that characterize the scene; determining a gamma curve corresponding to the matched third visual feature as the first gamma curve .
  • each functional unit in each embodiment of the present application may be integrated into one processing unit, or physically exist separately, or two or more units may be integrated into one unit.
  • the above-mentioned integrated units can be implemented in the form of hardware or in the form of software functional units. It can also be implemented in the form of a combination of software and hardware.
  • the above-mentioned method is implemented in the form of a software function module and sold or used as an independent product, it can also be stored in a computer-readable storage medium.
  • the computer software product is stored in a storage medium and includes several instructions to make the electronic device Execute all or part of the methods described in the various embodiments of the present application.
  • the aforementioned storage medium includes: various media that can store program codes such as U disk, mobile hard disk, read-only memory (Read Only Memory, ROM), magnetic disk or optical disk.
  • the present application is not limited to any specific combination of hardware and software.
  • the present application provides an image processing chip, including a processor unit configured to: execute the image processing method as described above.
  • FIG. 15 is a schematic diagram of the hardware entity of the electronic device of the present application.
  • a computer program running on the processor 152, and the processor 152 implements the steps in the methods provided in the above-mentioned embodiments when executing the program.
  • the memory 151 is configured to store instructions and applications executable by the processor 152, and may also cache data to be processed or processed by each module in the processor 152 and the electronic device 150 (for example, image data, audio data, etc. , voice communication data and video communication data), can be realized by flash memory (FLASH) or random access memory (Random Access Memory, RAM).
  • FLASH FLASH
  • RAM Random Access Memory
  • the present application provides a computer-readable storage medium on which a computer program is stored, and when the computer program is executed by a processor, the steps in the method provided in the above-mentioned embodiments are implemented.
  • the present application provides a computer program product containing instructions, which, when run on a computer, causes the computer to execute the steps in the methods provided by the above method embodiments.
  • the disclosed devices and methods may be implemented in other ways.
  • the above-described embodiments are only illustrative.
  • the division of the modules is only a logical function division.
  • the mutual coupling, or direct coupling, or communication connection between the various components shown or discussed may be through some interfaces, and the indirect coupling or communication connection of devices or modules may be in electrical, mechanical or other forms of.
  • modules described above as separate components may or may not be physically separated, and the components displayed as modules may or may not be physical modules; they may be located in one place or distributed to multiple network units; Part or all of the modules can be selected according to actual needs to achieve the purpose of the solution of this embodiment.
  • each functional module in each embodiment of the present application can be integrated into one processing unit, or each module can be used as a single unit, or two or more modules can be integrated into one unit; the above-mentioned integration
  • the modules can be implemented in the form of hardware, or in the form of hardware plus software functional units.
  • the above-mentioned integrated units of the present application are realized in the form of software function modules and sold or used as independent products, they can also be stored in a computer-readable storage medium.
  • the computer software product is stored in a storage medium and includes several instructions to make the electronic device Execute all or part of the methods described in the various embodiments of the present application.
  • the aforementioned storage medium includes various media capable of storing program codes such as removable storage devices, ROMs, magnetic disks or optical disks.

Abstract

An image processing method and apparatus, a device, and a storage medium. The method comprises: segmenting an image to be processed on the basis of a first visual feature of a pixel unit of an image to be processed so as to obtain multiple image areas, the first visual feature comprising at least one of brightness and color temperature; determining a first gamma curve corresponding to the first image area, the first image area being one of the multiple image areas; and performing gamma correction on the first image area at least partly on the basis of the first gamma curve.

Description

图像处理方法及装置、设备、存储介质Image processing method and device, equipment, storage medium
相关申请的交叉引用Cross References to Related Applications
本申请基于申请号为202110836393.X、申请日为2021年07月23日的中国专利申请提出,并要求该中国专利申请的优先权,该中国专利申请的全部内容在此以全文引入的方式引入本申请。This application is based on a Chinese patent application with application number 202110836393.X and a filing date of July 23, 2021, and claims the priority of this Chinese patent application. The entire content of this Chinese patent application is hereby incorporated in its entirety this application.
技术领域technical field
本申请涉及图像处理技术,涉及但不限于图像处理方法及装置、设备、存储介质。This application relates to image processing technology, but not limited to image processing methods, devices, equipment, and storage media.
背景技术Background technique
亮度对于图像而言,是影响图像的显示效果的重要因素。为了提高图像最终的显示效果,通常在显示之前对图像进行伽马校正。所谓伽玛校正就是对图像的伽玛曲线进行编辑,以对图像进行非线性色调编辑的方法,确定出图像信号中的深色部分和浅色部分,并使两者比例增大,从而提高图像的对比度的效果。计算机绘图领域惯以此屏幕输出电压与对应亮度的转换关系曲线,称为伽玛曲线。然而,对于某些图像,伽马校正后的图像质量却较差。For an image, brightness is an important factor affecting the display effect of the image. In order to improve the final display effect of the image, gamma correction is usually performed on the image before display. The so-called gamma correction is to edit the gamma curve of the image, and use the method of non-linear tone editing to the image to determine the dark part and light part of the image signal, and increase the ratio of the two, thereby improving the image quality. The contrast effect. In the field of computer graphics, it is customary to use the conversion relationship curve between the screen output voltage and the corresponding brightness, which is called the gamma curve. However, for some images, the gamma-corrected image quality is poor.
发明内容Contents of the invention
有鉴于此,本申请实施例提供的图像处理方法及装置、设备、存储介质,能够提高图像质量,改善用户的视觉体验。本申请实施例提供的图像处理方法及装置、设备、存储介质是这样实现的:In view of this, the image processing method, device, device, and storage medium provided in the embodiments of the present application can improve image quality and improve user's visual experience. The image processing method, device, equipment, and storage medium provided in the embodiments of the present application are implemented as follows:
本申请实施例提供的图像处理方法,包括:基于待处理图像的像素单元的第一视觉特征,对所述待处理图像进行分割,得到多个图像区域;其中,所述第一视觉特征包括以下至少之一:亮度、色温;确定与第一图像区域对应的第一伽马曲线;其中,所述第一图像区域是所述多个图像区域的其中之一;至少部分地基于所述第一伽马曲线,对所述第一图像区域进行伽马校正。The image processing method provided in the embodiment of the present application includes: based on the first visual feature of the pixel unit of the image to be processed, segmenting the image to be processed to obtain multiple image regions; wherein the first visual feature includes the following At least one of: brightness, color temperature; determining a first gamma curve corresponding to a first image area; wherein, the first image area is one of the plurality of image areas; based at least in part on the first A gamma curve, performing gamma correction on the first image area.
本申请实施例提供的图像处理芯片,包括处理器单元,所述处理器单元配置成:执行本申请实施例所述的图像处理方法。The image processing chip provided in the embodiment of the present application includes a processor unit configured to execute the image processing method described in the embodiment of the present application.
本申请实施例提供的图像处理装置,包括:分割模块,配置成基于待处理图像的像素单元的第一视觉特征,对所述待处理图像进行分割,得到多个图像区域;其中,所述第一视觉 特征包括以下至少之一:亮度、色温;确定模块,配置成确定与第一图像区域对应的第一伽马曲线;其中,所述第一图像区域是所述多个图像区域的其中之一;第一校正模块,配置成至少部分地基于所述第一伽马曲线,对所述第一图像区域进行伽马校正。The image processing device provided in the embodiment of the present application includes: a segmentation module configured to segment the image to be processed based on the first visual feature of the pixel unit of the image to be processed to obtain a plurality of image regions; wherein the first A visual feature includes at least one of the following: brightness, color temperature; a determination module configured to determine a first gamma curve corresponding to a first image area; wherein the first image area is one of the plurality of image areas 1. A first correction module configured to perform gamma correction on the first image region based at least in part on the first gamma curve.
本申请实施例提供的电子设备,包括存储器和处理器,所述存储器存储有可在处理器上运行的计算机程序,所述处理器执行所述程序时实现本申请实施例所述的方法。The electronic device provided by the embodiment of the present application includes a memory and a processor, the memory stores a computer program that can run on the processor, and the processor implements the method described in the embodiment of the present application when executing the program.
本申请实施例提供的计算机可读存储介质,其上存储有计算机程序,该计算机程序被处理器执行时实现本申请实施例所述的方法。The computer-readable storage medium provided by the embodiment of the present application has a computer program stored thereon, and when the computer program is executed by a processor, the method described in the embodiment of the present application is implemented.
在本申请实施例中,基于待处理图像的像素单元的第一视觉特征对待处理图像进行区域分割,得到多个图像区域;然后,再确定第一图像区域对应的第一伽马曲线,至少部分地基于第一伽马曲线,对第一图像区域进行伽马校正;如此,针对不同视觉特征的图像区域采用相对应的伽马曲线进行校正,从而能够有针对性地改善图像区域的质量,进而提升用户的视觉体验。In the embodiment of the present application, the image to be processed is segmented based on the first visual feature of the pixel unit of the image to be processed to obtain multiple image regions; then, the first gamma curve corresponding to the first image region is determined, at least partially Based on the first gamma curve, gamma correction is performed on the first image region; in this way, the corresponding gamma curve is used for correction for image regions with different visual characteristics, so that the quality of the image region can be improved in a targeted manner, and then Improve the user's visual experience.
附图说明Description of drawings
此处的附图被并入说明书中并构成本说明书的一部分,这些附图示出了符合本申请的实施例,并与说明书一起用于说明本申请的技术方案。The accompanying drawings here are incorporated into the specification and constitute a part of the specification. These drawings show embodiments consistent with the application, and are used together with the description to describe the technical solution of the application.
图1为本申请提供的一种图像处理方法的实现流程示意图;FIG. 1 is a schematic diagram of an implementation flow of an image processing method provided by the present application;
图2为人眼在不同环境下的伽马曲线;Figure 2 shows the gamma curves of the human eye in different environments;
图3为本申请提供的另一图像处理方法的实现流程示意图;FIG. 3 is a schematic diagram of an implementation flow of another image processing method provided by the present application;
图4为本申请提供的一种过渡图像区域的示意图;FIG. 4 is a schematic diagram of a transitional image area provided by the present application;
图5为本申请提供的又一图像处理方法的实现流程示意图;FIG. 5 is a schematic diagram of an implementation flow of another image processing method provided by the present application;
图6为自然界中的亮度以及对应的人眼所感受的亮度值的关系示意图;6 is a schematic diagram of the relationship between brightness in nature and the corresponding brightness value perceived by human eyes;
图7为伽马校正前后的图像显示效果对比图;Figure 7 is a comparison of image display effects before and after gamma correction;
图8为本申请提供的又一种图像处理方法的实现流程示意图;FIG. 8 is a schematic diagram of an implementation flow of another image processing method provided by the present application;
图9为图片a在伽马校正前的亮度示意图;FIG. 9 is a schematic diagram of the brightness of picture a before gamma correction;
图10为本申请场景a1和场景b1分别对应的伽马曲线示意图;FIG. 10 is a schematic diagram of gamma curves corresponding to scene a1 and scene b1 of the present application;
图11为本申请对图片的过渡图像区域以及图像区域的伽马校正后的示意图;Fig. 11 is a schematic diagram of the transitional image area of the picture and the gamma correction of the image area in the present application;
图12为本申请第一权重函数与第二权重函数在同一像素位置的权重关系示意图;12 is a schematic diagram of the weight relationship between the first weight function and the second weight function of the present application at the same pixel position;
图13为本申请对图片a进行伽马校正后的整体亮度示意图;FIG. 13 is a schematic diagram of the overall brightness of picture a after gamma correction in the present application;
图14为本申请图像处理装置的结构示意图;FIG. 14 is a schematic structural diagram of an image processing device of the present application;
图15为本申请提供的电子设备的结构示意图。FIG. 15 is a schematic structural diagram of an electronic device provided by the present application.
具体实施方式detailed description
为使本申请的目的、技术方案和优点更加清楚,下面将结合本申请中的附图,对本申请的具体技术方案做进一步详细描述。以下实施例用于说明本申请,但不用来限制本申请的范围。In order to make the purpose, technical solutions and advantages of the present application clearer, the specific technical solutions of the present application will be further described in detail below in conjunction with the drawings in the present application. The following examples are used to illustrate the present application, but not to limit the scope of the present application.
除非另有定义,本文所使用的所有的技术和科学术语与属于本申请的技术领域的技术人员通常理解的含义相同。本文中所使用的术语只是为了描述本申请的目的,不是旨在限制本申请。Unless otherwise defined, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the technical field to which this application belongs. The terminology used herein is for the purpose of describing the application only and is not intended to limit the application.
在以下的描述中,涉及到“一些实施例”,其描述了所有可能实施例的子集,但是可以理解,“一些实施例”可以是所有可能实施例的相同子集或不同子集,并且可以在不冲突的情况下相互结合。In the following description, references to "some embodiments" describe a subset of all possible embodiments, but it is understood that "some embodiments" may be the same subset or a different subset of all possible embodiments, and Can be combined with each other without conflict.
需要指出,本申请所涉及的术语“第一\第二\第三”不代表针对对象的特定排序,可以理解地,“第一\第二\第三”在允许的情况下可以互换特定的顺序或先后次序,以使这里描述的本申请能够以除了在这里图示或描述的以外的顺序实施。It should be pointed out that the term "first\second\third" involved in this application does not represent a specific ordering of objects. It is understandable that "first\second\third" can be interchanged with specific sequence or sequence such that the application described herein can be practiced in sequences other than those illustrated or described herein.
本申请实施例提供一种图像处理方法,该方法应用于电子设备,该电子设备在实施的过程中可以为各种类型的具有信息处理能力的设备,例如所述电子设备可以包括手机、平板电脑、笔记本电脑、投影仪、台式机、个人数字助理、导航仪、数字电话、视频电话、电视机或传感设备等。该方法所实现的功能可以通过电子设备中的处理器调用程序代码来实现,当然程序代码可以保存在计算机存储介质中,可见,该电子设备至少包括处理器和存储介质。An embodiment of the present application provides an image processing method, which is applied to an electronic device, and the electronic device may be various types of devices with information processing capabilities during implementation, for example, the electronic device may include a mobile phone, a tablet computer , laptop computer, projector, desktop computer, personal digital assistant, navigator, digital phone, video phone, television or sensory equipment, etc. The functions realized by the method can be realized by calling the program codes by the processor in the electronic device, and of course the program codes can be stored in the computer storage medium. It can be seen that the electronic device at least includes a processor and a storage medium.
图1为本申请实施例提供的图像处理方法的实现流程示意图,如图1所示,该方法可以包括以下步骤101至步骤103:Figure 1 is a schematic diagram of the implementation flow of the image processing method provided by the embodiment of the present application. As shown in Figure 1, the method may include the following steps 101 to 103:
步骤101,基于待处理图像的像素单元的第一视觉特征,对所述待处理图像进行分割,得到多个图像区域;其中,所述第一视觉特征包括以下至少之一:亮度、色温。Step 101: Segment the image to be processed based on the first visual feature of the pixel unit of the image to be processed to obtain a plurality of image regions; wherein the first visual feature includes at least one of the following: brightness and color temperature.
在本申请实施例中,待处理图像可以是各种类型的图像。例如,待处理图像为图像传感器的待校正图像;又如,待处理图像为图像显示端的待显示图像。总之,在本申请实施例中,可以对各个不同阶段产生的图像执行本申请所述的图像处理方法。In this embodiment of the present application, the images to be processed may be various types of images. For example, the image to be processed is an image to be corrected by the image sensor; another example, the image to be processed is an image to be displayed on the image display terminal. In a word, in the embodiment of the present application, the image processing method described in the present application can be executed on the images generated in different stages.
在一些实施例中,可以这样对待处理图像进行分割:将所述第一视觉特征落入同一特定区间的像素单元,分割为一个图像区域,从而得到多个图像区域。In some embodiments, the image to be processed may be segmented in the following manner: the pixel units in which the first visual feature falls within the same specific interval are divided into one image area, so as to obtain multiple image areas.
例如,第一视觉特征为亮度,可以将亮度落入第一亮度区间的像素单元分割为一个图像区域,将亮度落入第二亮度区间的像素单元分割为另一个图像区域,诸如此类的。又如,第一视觉特征为色温,可以将色温落入第一色温区间的像素单元分割为一个图像区域,将色温落入第二色温区间的像素单元分割为另一个图像区域,诸如此类的。再如,第一视觉特征为 亮度和色温,将亮度落入第三亮度区间且色温落入第三色温区间的像素单元分割为一个图像区域,将亮度落入第四亮度区间且色温落入第四色温区间的像素单元分割为另一个图像区域,诸如此类的。需要说明的是,特定区间至少有一个边界,例如,某一特定区间为[m,∞),可见其仅有一个边界m;又如,某一特定区间为[A,B],可见其有两个边界,即A和B。For example, if the first visual feature is brightness, the pixel units whose brightness falls in the first brightness range can be divided into one image area, and the pixel units whose brightness falls in the second brightness range can be divided into another image area, and so on. For another example, if the first visual feature is color temperature, pixel units whose color temperature falls within the first color temperature range can be divided into one image area, and pixel units whose color temperature falls within the second color temperature range can be divided into another image area, and so on. For another example, the first visual feature is brightness and color temperature, divide the pixel units whose brightness falls into the third brightness range and whose color temperature falls into the third color temperature range into an image area, and divide the pixel units whose brightness falls into the fourth brightness range and whose color temperature falls into the third color temperature range The pixel unit of the four color temperature intervals is divided into another image area, and so on. It should be noted that a specific interval has at least one boundary, for example, a specific interval is [m,∞), it can be seen that it has only one boundary m; another example, a specific interval is [A, B], it can be seen that it has Two boundaries, namely A and B.
还需要说明的是,像素单元可以包括一个像素点,也可以包括多个像素点。包括多个像素点时,像素单元的第一视觉特征可以是其中的每个像素点的视觉特征的代表特征,代表特征可以是均值或中值等。It should also be noted that a pixel unit may include one pixel or multiple pixels. When multiple pixels are included, the first visual feature of the pixel unit may be a representative feature of the visual feature of each pixel, and the representative feature may be an average value or a median value.
在本申请实施例中,是否要对待处理图像进行分割,可以是无条件的,在一些实施例中,分割也可以是有条件的。例如,如果待处理图像的整体的第二视觉特征满足分割条件,则执行步骤101至步骤103;否则,如果所述第二视觉特征不满足分割条件,则不对待处理图像进行分割,而是确定与所述第二视觉特征对应的第四伽马曲线,以及根据第四伽马曲线对待处理图像进行伽马校正;如此,可以在确保每一图像符合人眼对明暗程度的感知的前提下,减少不必要的分割等处理过程,从而节约功耗和计算资源。In the embodiment of the present application, whether to segment the image to be processed may be unconditional, and in some embodiments, the segmentation may also be conditional. For example, if the overall second visual feature of the image to be processed satisfies the segmentation condition, execute steps 101 to 103; otherwise, if the second visual feature does not meet the segmentation condition, the image to be processed is not segmented, but determined The fourth gamma curve corresponding to the second visual feature, and performing gamma correction on the image to be processed according to the fourth gamma curve; in this way, under the premise of ensuring that each image conforms to the human eye's perception of brightness, Reduce unnecessary segmentation and other processing, thereby saving power consumption and computing resources.
其中,电子设备可以基于所述待处理图像的像素单元的第一视觉特征,确定所述待处理图像的整体的第二视觉特征。Wherein, the electronic device may determine the overall second visual feature of the image to be processed based on the first visual feature of the pixel units of the image to be processed.
在一些实施例中,第二视觉特征可以为用于表征待处理图像的像素单元的第一视觉特征的变化情况的值。例如,第二视觉特征包括待处理图像的各个像素单元的亮度的方差和/或标准差,和/或,待处理图像的各个像素单元的色温的方差和/或标准差等。相应地,分割条件为所述方差和/或所述标准差大于对应阈值。In some embodiments, the second visual feature may be a value used to characterize changes in the first visual feature of the pixel units of the image to be processed. For example, the second visual feature includes the variance and/or standard deviation of brightness of each pixel unit of the image to be processed, and/or the variance and/or standard deviation of color temperature of each pixel unit of the image to be processed. Correspondingly, the segmentation condition is that the variance and/or the standard deviation is greater than a corresponding threshold.
在另一些实施例中,第二视觉特征也可以用于表征待处理图像中是否包括光源、光源数目和/或光源的位置等。相应地,分割条件为:待处理图像中包括光源、光源数目大于对应阈值和/或光源的位置在特定位置等。例如,特定位置为待处理图像的边缘区域或中心区域等。In some other embodiments, the second visual feature may also be used to characterize whether the image to be processed includes a light source, the number of light sources and/or the position of the light source, and the like. Correspondingly, the segmentation condition is: the image to be processed includes a light source, the number of light sources is greater than a corresponding threshold, and/or the position of the light source is at a specific position, etc. For example, the specific location is an edge area or a central area of the image to be processed.
在又一些实施例中,分割条件也可以是:所述方差和/或所述标准差大于对应阈值,以及待处理图像中包括光源、光源数目大于对应阈值和/或光源的位置在特定位置。In some other embodiments, the segmentation condition may also be: the variance and/or the standard deviation are greater than a corresponding threshold, and the image to be processed includes light sources, the number of light sources is greater than the corresponding threshold, and/or the position of the light source is at a specific position.
步骤102,确定与第一图像区域对应的第一伽马曲线;其中,所述第一图像区域是所述多个图像区域的其中之一。 Step 102, determining a first gamma curve corresponding to a first image area; wherein, the first image area is one of the plurality of image areas.
在待处理图像为图像传感器端的待校正图像的情况下,第一伽马曲线是通过在图像传感器端进行标定而得到的,基于此,在图像传感器端基于第一伽马曲线对第一图像区域进行伽马校正。除此之外,图像传感器端还标定了其他不同的伽马曲线,不同的伽马曲线适用的图像区域不同。在一些实施例中,不同的伽马曲线与表征场景的第三视觉特征具有映射关系。电子设备可以确定第一图像区域的整体的第四视觉特征,然后从各个不同的第三视觉特征中 确定出与所述第四视觉特征相匹配的第三视觉特征,进而获取与确定出的第三视觉特征对应的伽马曲线(即第一伽马曲线);其中,不同的第三视觉特征对应的场景是不同的,换言之,不同的场景包括的光源和光线强度是不同的。电子设备可以预先获取分别在各个候选伽马曲线下对同一场景拍摄得到的图像,然后从拍摄得到的各个图像中选取图像质量满足条件的目标图像,将该目标图像对应的候选伽马曲线作为该场景的最终伽马曲线。In the case that the image to be processed is the image to be corrected at the image sensor end, the first gamma curve is obtained by calibration at the image sensor end, based on this, the first image region is calculated based on the first gamma curve at the image sensor end Perform gamma correction. In addition, the image sensor side also calibrates other different gamma curves, and different gamma curves are applicable to different image areas. In some embodiments, different gamma curves have a mapping relationship with a third visual feature characterizing the scene. The electronic device may determine the overall fourth visual feature of the first image area, and then determine a third visual feature that matches the fourth visual feature from different third visual features, and then obtain and determine the fourth visual feature. The gamma curve corresponding to the three visual features (namely the first gamma curve); wherein, different third visual features correspond to different scenes, in other words, different scenes include different light sources and light intensities. The electronic device may pre-acquire the images taken of the same scene under each candidate gamma curve, and then select a target image whose image quality meets the conditions from the captured images, and use the candidate gamma curve corresponding to the target image as the The final gamma curve for the scene.
例如,电子设备在候选伽马曲线1下对某一场景进行拍摄得到图像1,在候选伽马曲线2下对该场景进行拍摄得到图像2,在候选伽马曲线3下对该场景进行拍摄得到图像3,测试人员可以从图像1至图像3中选出最符合人眼感知的图像,将该图像对应的候选伽马曲线作为该场景的最终伽马曲线;然后,电子设备标定该场景的最终伽马曲线。如此,通过测试选取出各个不同场景的最终伽马曲线,并记录各个场景的第三视觉特征与各自对应场景的最终伽马曲线的映射关系。For example, the electronic device captures a scene under candidate gamma curve 1 to obtain image 1, captures the scene under candidate gamma curve 2 to obtain image 2, and captures the scene under candidate gamma curve 3 to obtain In image 3, the tester can select the image that is most in line with human perception from image 1 to image 3, and use the candidate gamma curve corresponding to the image as the final gamma curve of the scene; then, the electronic device calibrates the final gamma curve of the scene. gamma curve. In this way, the final gamma curves of different scenes are selected through testing, and the mapping relationship between the third visual feature of each scene and the final gamma curves of the corresponding scenes is recorded.
对于待处理图像为图像显示端的待显示图像的情况,与上述待校正图像的方案中确定对应的第一伽马曲线的方案类似,在此不再赘述。For the case where the image to be processed is the image to be displayed on the image display terminal, it is similar to the solution of determining the corresponding first gamma curve in the above solution of the image to be corrected, and will not be repeated here.
在本申请实施例中,第四视觉特征表征的是第一图像区域的整体特征,例如,该整体特征为亮度均值、色温均值、色温中值和/或亮度中值等。In the embodiment of the present application, the fourth visual feature represents the overall feature of the first image region, for example, the overall feature is an average brightness value, an average color temperature value, a median color temperature value, and/or a median brightness value.
在一些实施例中,图像传感器端和/或图像显示端标定的多个伽马曲线对应的视觉特征区间不同。例如,其映射关系如表1所示:亮度区间10对应的伽马曲线10、亮度区间20对应的伽马曲线20、…、亮度区间N0对应的伽马曲线N0;其中,伽马曲线10、20、…、N0不同,亮度区间10至亮度区间N0包括不同的亮度。In some embodiments, the multiple gamma curves calibrated by the image sensor end and/or the image display end correspond to different visual feature intervals. For example, its mapping relationship is shown in Table 1: gamma curve 10 corresponding to brightness interval 10, gamma curve 20 corresponding to brightness interval 20, ..., gamma curve N0 corresponding to brightness interval N0; wherein, gamma curve 10, 20 , . . . , N0 are different, and the brightness interval 10 to the brightness interval N0 include different brightness.
表1Table 1
亮度区间10 Brightness range 10 伽马曲线10 Gamma Curve 10
亮度区间20 Brightness range 20 伽马曲线20 Gamma Curve 20
亮度区间N0Brightness interval N0 伽马曲线N0Gamma curve N0
电子设备可以根据第一图像区域的亮度均值或亮度中值落入的亮度区间,从表1中确定该区间对应的伽马曲线,将该曲线作为第一图像区域对应的第一伽马曲线。例如,第一图像区域的亮度均值或亮度中值落入亮度区间20,则将伽马曲线20作为第一伽马曲线。The electronic device may determine the gamma curve corresponding to the interval from Table 1 according to the brightness interval in which the average brightness value or the median brightness value of the first image area falls, and use the curve as the first gamma curve corresponding to the first image area. For example, if the brightness mean value or brightness median value of the first image area falls into the brightness interval 20, then the gamma curve 20 is used as the first gamma curve.
又如,表2所示:亮度区间11和色温区间11对应的伽马曲线11、亮度区间21和色温区间21对应的伽马曲线21、…、亮度区间N1和色温区间N1对应的伽马曲线N1;其中,伽马曲线11、21、…、N1不同,亮度区间11至亮度区间N1包括不同的亮度,色温区间11 至色温区间N1包括不同的色温。As another example, as shown in Table 2: the gamma curve 11 corresponding to the brightness interval 11 and the color temperature interval 11, the gamma curve 21 corresponding to the brightness interval 21 and the color temperature interval 21, ..., the gamma curve corresponding to the brightness interval N1 and the color temperature interval N1 N1; wherein, the gamma curves 11, 21, .
表2Table 2
Figure PCTCN2022098683-appb-000001
Figure PCTCN2022098683-appb-000001
电子设备可以根据第一图像区域的亮度均值和色温均值落入的区间,确定对应的第一伽马曲线。例如,该亮度均值落入亮度区间11,该色温均值落入色温区间11,则将伽马曲线11作为第一伽马曲线;又如,该亮度均值落入亮度区间11,该色温均值落入色温区间12,则可以将伽马曲线11或者伽马曲线21作为第一伽马曲线,或者将伽马曲线11和伽马曲线21融合之后作为第一伽马曲线。The electronic device may determine the corresponding first gamma curve according to the interval in which the average brightness value and the average color temperature value of the first image region fall. For example, if the average brightness falls into the brightness interval 11, and the average color temperature falls into the color temperature interval 11, the gamma curve 11 is taken as the first gamma curve; for another example, if the average brightness falls into the brightness interval 11, the average color temperature falls into If the color temperature range is 12, the gamma curve 11 or the gamma curve 21 can be used as the first gamma curve, or the fusion of the gamma curve 11 and the gamma curve 21 can be used as the first gamma curve.
步骤103,至少部分地基于所述第一伽马曲线,对所述第一图像区域进行伽马校正。Step 103: Perform gamma correction on the first image region based at least in part on the first gamma curve.
可以理解地,对于一幅待处理图像,尤其是一幅明暗变化明显的图像,如果使用同一伽马曲线对其进行校正,结果可能会使较亮的区域更亮,甚至呈现一片白色,而较暗的区域更暗,甚至呈现一片黑色。It is understandable that for an image to be processed, especially an image with obvious changes in light and dark, if the same gamma curve is used to correct it, the result may make the brighter area brighter, or even appear white, while the darker Dark areas are even darker, and even appear black.
有鉴于此,在本申请实施例中,基于待处理图像的像素单元的第一视觉特征对待处理图像进行分割,得到多个图像区域;然后,再确定第一图像区域对应的第一伽马曲线,至少部分地基于第一伽马曲线,对第一图像区域进行伽马校正;如此,针对不同视觉特征的图像区域采用相对应的伽马曲线进行校正,从而能够有针对性地改善图像区域的质量,进而提升用户的视觉体验。In view of this, in the embodiment of the present application, the image to be processed is segmented based on the first visual feature of the pixel unit of the image to be processed to obtain multiple image regions; then, the first gamma curve corresponding to the first image region is determined , performing gamma correction on the first image region based at least in part on the first gamma curve; in this way, for image regions with different visual characteristics, the corresponding gamma curve is used for correction, so that the gamma correction of the image region can be improved in a targeted manner. quality, thereby enhancing the user's visual experience.
在一些实施例中,可以基于第一伽马曲线对第一图像区域进行伽马校正;也可以基于第三伽马曲线和第一伽马曲线,对第一图像区域进行伽马校正;其中,第三伽马曲线是通过在图像显示端进行标定而得到的,第一伽马曲线是在图像传感器端进行标定而得到的。In some embodiments, gamma correction may be performed on the first image region based on the first gamma curve; gamma correction may also be performed on the first image region based on the third gamma curve and the first gamma curve; wherein, The third gamma curve is obtained by calibration at the image display end, and the first gamma curve is obtained by calibration at the image sensor end.
在一些实施例中,不同的第三伽马曲线对应的光线特征不同,电子设备可以根据当前所处物理环境的光线特征,确定对应的第三伽马曲线。In some embodiments, different third gamma curves correspond to different light characteristics, and the electronic device may determine the corresponding third gamma curve according to the light characteristics of the current physical environment.
可以理解地,不同的光线强度下,人眼对应的伽马曲线是不同的。如图2所示,在明暗对比特别明显的场景中,人眼对应的伽马值会随着整体亮度进行适应,整体亮度越高,伽马 曲线越来越陡峭,人眼的感知会将亮的地方压缩,将暗的地方提亮。因此,在本申请实施例中,在对第一图像区域进行伽马校正时,不仅考虑了第一图像区域本身的视觉特征对人眼的伽马曲线的影响,还结合了电子设备当前所处物理环境的光线特征对人眼的伽马曲线的影响;如此,有助于模拟人眼在不同光线环境下对明暗程度的感知,从而消除图像突变,使得伽马校正后的第一图像区域更符合人眼对明暗程度的感知。Understandably, under different light intensities, the corresponding gamma curves of human eyes are different. As shown in Figure 2, in a scene where the contrast between light and dark is particularly obvious, the gamma value corresponding to the human eye will adapt to the overall brightness. Compress the dark places and brighten the dark places. Therefore, in the embodiment of the present application, when gamma correction is performed on the first image area, not only the influence of the visual characteristics of the first image area itself on the gamma curve of the human eye is considered, but also the current location of the electronic device is considered. The influence of the light characteristics of the physical environment on the gamma curve of the human eye; in this way, it helps to simulate the human eye's perception of light and shade in different light environments, thereby eliminating image mutations and making the first image area after gamma correction more accurate. Conforms to the human eye's perception of light and dark.
本申请再提供一种图像处理方法,图3为本申请提供的另一图像处理方法的实现流程示意图,如图3所示,该方法可以包括以下步骤301至步骤305:The present application further provides an image processing method. FIG. 3 is a schematic diagram of the implementation flow of another image processing method provided by the present application. As shown in FIG. 3 , the method may include the following steps 301 to 305:
步骤301,基于待处理图像的像素单元的第一视觉特征对所述待处理图像进行分割,以得到多个图像区域;其中,所述第一视觉特征包括以下至少之一:亮度、色温; Step 301, segment the image to be processed based on the first visual feature of the pixel unit of the image to be processed to obtain multiple image regions; wherein the first visual feature includes at least one of the following: brightness, color temperature;
步骤302,确定与第一图像区域对应的第一伽马曲线;其中,所述第一图像区域是所述多个图像区域的其中之一; Step 302, determining a first gamma curve corresponding to a first image area; wherein, the first image area is one of the plurality of image areas;
步骤303,至少部分地基于所述第一伽马曲线,对所述第一图像区域进行伽马校正; Step 303, performing gamma correction on the first image region based at least in part on the first gamma curve;
步骤304,确定与第二图像区域对应的第二伽马曲线;其中,所述第二图像区域是所述多个图像区域中与所述第一图像区域相邻的另一图像区域; Step 304, determining a second gamma curve corresponding to a second image area; wherein, the second image area is another image area adjacent to the first image area among the plurality of image areas;
步骤305,至少部分地基于所述第二伽马曲线,对所述第二图像区域进行伽马校正。Step 305: Perform gamma correction on the second image region based at least in part on the second gamma curve.
需要说明的是,对待处理图像的每一图像区域均采用本申请实施例所述的对第一图像区域或第二图像区域的处理方法;如此,使得电子设备在对待处理图像进行伽马校正时,不是仅使用一个伽马曲线对整张图像进行伽马校正,而是将图像分割为多个图像区域,从而有针对性地选择与图像区域相匹配的伽马曲线,基于此对相应图像区域进行伽马校正,进而提升待处理图像的伽马校正效果,改善图像质量。It should be noted that each image area of the image to be processed adopts the processing method for the first image area or the second image area described in the embodiment of the present application; in this way, when the electronic device performs gamma correction on the image to be processed , instead of using only one gamma curve to perform gamma correction on the entire image, the image is divided into multiple image regions, so as to select the gamma curve that matches the image region in a targeted manner, and based on this, the corresponding image region Perform gamma correction to improve the gamma correction effect of the image to be processed and improve image quality.
在一些实施例中,所述方法还包括:至少部分地基于所述第一伽马曲线和/或所述第二伽马曲线对过渡图像区域进行伽马校正,其中,所述过渡图像区域包括所述第一图像区域与所述第二图像区域之间的分界线。In some embodiments, the method further includes: performing gamma correction on a transitional image region based at least in part on the first gamma curve and/or the second gamma curve, wherein the transitional image region includes A boundary line between the first image area and the second image area.
对于过渡图像区域的确定方法,在一些实施例中,可以先确定第一图像区域与第二图像区域之间的分界线;将所述分界线、以及所述分界线分别向第一图像区域和第二图像区域偏移特定像素距离后所围成的区域作为所述过渡图像区域。For the determination method of the transitional image area, in some embodiments, the boundary line between the first image area and the second image area can be determined first; An area enclosed by the second image area offset by a specific pixel distance is used as the transition image area.
例如,图4所示,401为第一图像区域402与第二图像区域403的分界线,那么,可以将该分界线401向上偏移第一像素距离,得到边界404,以及,将该分界线401向下偏移第二像素距离,得到边界405。由边界404和边界405围成的区域即为第一图像区域402和第二图像区域的过渡图像区域。For example, as shown in FIG. 4, 401 is the boundary line between the first image area 402 and the second image area 403, then, the boundary line 401 can be offset upward by the first pixel distance to obtain a boundary 404, and the boundary line 401 is shifted down by a second pixel distance, resulting in border 405 . The area enclosed by the boundary 404 and the boundary 405 is the transition image area between the first image area 402 and the second image area.
在本申请实施例中,对于第一像素距离和第二像素距离可以相同,也可以不同,对于第一像素距离和第二像素距离的大小不做限定,总之以消除分界线附近的图像突变为宜。例如,第一像素距离和第二像素距离为设置的特定像素距离,该值为3至5个像素点的长度。In the embodiment of the present application, the first pixel distance and the second pixel distance can be the same or different, and there is no limit to the size of the first pixel distance and the second pixel distance. In a word, to eliminate the image mutation near the dividing line, should. For example, the first pixel distance and the second pixel distance are set specific pixel distances, and the value is a length of 3 to 5 pixel points.
进一步地,在一些实施例中,电子设备可以这样对过渡图像区域进行伽马校正:基于第一权重函数和第二权重函数,将所述第一伽马曲线与所述第二伽马曲线的加权和作为第五伽马曲线;至少部分地基于所述第五伽马曲线,对所述过渡图像区域进行伽马校正;如此,可以进一步提高伽马校正后的图像的不同区域之间的亮度的连续性,图像效果看起来更自然。Further, in some embodiments, the electronic device may perform gamma correction on the transitional image region in the following way: based on the first weight function and the second weight function, the first gamma curve and the second gamma curve The weighted sum is used as a fifth gamma curve; performing gamma correction on the transition image region based at least in part on the fifth gamma curve; thus, the brightness between different regions of the gamma-corrected image can be further improved continuity, the image effect looks more natural.
其中,所述第一权重函数为所述第一伽马曲线的系数,所述第二权重函数为所述第二伽马曲线的系数,同一像素单元对应的所述第一权重函数的值与所述第二权重函数的值的和为1;所述第一权重函数的值与第一像素单元至所述第一图像区域的第一边界的距离呈负相关,其中,所述第一像素单元为所述过渡图像区域中属于第一图像区域的像素单元,所述第一边界位于所述第一图像区域。Wherein, the first weight function is the coefficient of the first gamma curve, the second weight function is the coefficient of the second gamma curve, and the value of the first weight function corresponding to the same pixel unit is the same as The sum of the values of the second weight function is 1; the value of the first weight function is negatively correlated with the distance from the first pixel unit to the first boundary of the first image area, wherein the first pixel A unit is a pixel unit belonging to a first image area in the transition image area, and the first boundary is located in the first image area.
举例来说,如下公式(1)所示的过渡图像区域的伽马曲线fun3(light (x,y))的表达式: For example, the expression of the gamma curve fun3(light (x, y) ) of the transition image region shown in the following formula (1):
fun3(light (x,y))=weight1*fun1(light (x,y))+weight2*fun2(light (x,y))   公式(1); fun3(light (x,y) )=weight1*fun1(light (x,y) )+weight2*fun2(light (x,y) ) formula (1);
其中,light (x,y)表示像素单元(x,y)的亮度,fun1(light (x,y))表示第一图像区域的第一伽马曲线,weight1是指第一权重函数,该函数的自变量为过渡图像区域的像素单元到第一边界的像素距离;weight2是指第二权重函数,与第一权重函数的加和为1;fun2(light (x,y))表示第二图像区域的第二伽马曲线。 Among them, light (x, y) represents the brightness of the pixel unit (x, y), fun1 (light (x, y) ) represents the first gamma curve of the first image area, weight1 refers to the first weight function, the function The independent variable of is the pixel distance from the pixel unit of the transition image area to the first boundary; weight2 refers to the second weight function, and the sum of the first weight function is 1; fun2(light (x,y) ) indicates the second image The second gamma curve for the region.
在一些实施例中,电子设备可以根据上述公式(1)确定过渡图像区域的像素单元(x,y)的伽马值,根据该伽马值对该像素单元的亮度进行伽马校正。In some embodiments, the electronic device may determine the gamma value of the pixel unit (x, y) in the transition image area according to the above formula (1), and perform gamma correction on the brightness of the pixel unit according to the gamma value.
本申请再提供一种图像处理方法,图5为本申请提供的又一图像处理方法的实现流程示意图,如图5所示,该方法可以包括以下步骤501至步骤505:The present application further provides an image processing method. FIG. 5 is a schematic diagram of the implementation flow of another image processing method provided by the present application. As shown in FIG. 5 , the method may include the following steps 501 to 505:
步骤501,基于待处理图像的像素单元的第一视觉特征对所述待处理图像进行分割,以得到多个图像区域;其中,所述第一视觉特征包括以下至少之一:亮度、色温; Step 501, segment the image to be processed based on the first visual feature of the pixel unit of the image to be processed to obtain multiple image regions; wherein the first visual feature includes at least one of the following: brightness, color temperature;
步骤502,确定与第一图像区域对应的第一伽马曲线;其中,所述第一图像区域是所述多个图像区域的其中之一,第一伽马曲线是通过在图像传感器端进行标定而得到的; Step 502, determine the first gamma curve corresponding to the first image area; wherein, the first image area is one of the plurality of image areas, and the first gamma curve is calibrated at the image sensor end obtained;
步骤503,至少部分地基于所述第一伽马曲线,对所述第一图像区域进行伽马校正。Step 503: Perform gamma correction on the first image region based at least in part on the first gamma curve.
步骤504,确定与所述第一图像区域对应的第三伽马曲线;其中,所述第三伽马曲线是通过在图像显示端进行标定而得到的。 Step 504, determining a third gamma curve corresponding to the first image area; wherein, the third gamma curve is obtained by performing calibration on the image display terminal.
在一些实施例中,电子设备可以在图像传感器端先基于第一伽马曲线,对第一图像区域进行伽马校正,得到校正后的第一图像区域;然后,再在图像显示端基于第三伽马曲线,对校正后的第一图像区域进行伽马校正,得到目标图像区域。In some embodiments, the electronic device may perform gamma correction on the first image area based on the first gamma curve at the image sensor end to obtain the corrected first image area; then, at the image display end based on the third A gamma curve, performing gamma correction on the corrected first image area to obtain a target image area.
在另一些实施例中,电子设备也可以先将第一伽马曲线和第三伽马曲线进行融合,得到融合后的伽马曲线;然后,基于融合后的伽马曲线,对第一图像区域进行伽马校正,从而得到目标图像区域。总之,对于电子设备如何基于第一伽马曲线和第三伽马曲线对第一图像区域进行校正,本申请对此不做限制。In some other embodiments, the electronic device may firstly fuse the first gamma curve and the third gamma curve to obtain the fused gamma curve; then, based on the fused gamma curve, the first image region Perform gamma correction to obtain the target image area. In a word, this application does not limit how the electronic device corrects the first image region based on the first gamma curve and the third gamma curve.
进一步地,在一些实施例中,电子设备可以这样实现步骤404:确定电子设备所处的物理环境的光线特征;根据所述光线特征,确定对应的第三伽马曲线。Further, in some embodiments, the electronic device may implement step 404 as follows: determine the light characteristics of the physical environment where the electronic device is located; and determine the corresponding third gamma curve according to the light characteristics.
如前文所述,不同的光线强度下,人眼对应的伽马曲线是不同的。因此,在一些实施例中,电子设备可以在图像显示端标定不同的光线特征对应相应的伽马曲线,从而电子设备在实际显示待处理图像之前,可以根据当前所处物理环境的光线特征确定对应的第三伽马曲线,从而使得基于第三伽马曲线校正后的第一图像区域的显示效果更符合人眼当前对明暗程度的感知。As mentioned above, under different light intensities, the gamma curves corresponding to the human eye are different. Therefore, in some embodiments, the electronic device can calibrate different light characteristics on the image display end to correspond to the corresponding gamma curves, so that the electronic device can determine the corresponding gamma curve according to the light characteristics of the current physical environment before actually displaying the image to be processed. The third gamma curve, so that the display effect of the first image area corrected based on the third gamma curve is more in line with the current perception of light and shade by human eyes.
在一些实施例中,可以通过电子设备上的传感器采集所处物理环境的光线特征。进一步地,在一些实施例中,光线特征可以包括光线强度和/或色温。In some embodiments, the light characteristics of the physical environment where the electronic device is located may be collected through a sensor on the electronic device. Further, in some embodiments, the light characteristics may include light intensity and/or color temperature.
步骤505,根据所述第三伽马曲线,对所述第一图像区域进行伽马校正。Step 505: Perform gamma correction on the first image region according to the third gamma curve.
需要说明的是,在图像传感器端和图像显示端均对待处理图像进行伽马校正的实施例中,两端可以使用也可以不使用相同的图像分割结果。不使用的情况下,电子设备可以在图像显示端,对待显示图像重新进行分割,分割方法与前文描述的方案相同,在此不再赘述。确定待显示图像的图像区域对应的第六伽马曲线,对该图像区域进行伽马校正;其中,第六伽马曲线是在图像显示端通过标定而得到的。对于待显示图像的相邻图像区域的过渡图像区域的处理方法与上述方案相同,对此不再赘述。It should be noted that, in the embodiment where both the image sensor end and the image display end perform gamma correction on the image to be processed, the two ends may or may not use the same image segmentation result. When not in use, the electronic device can re-segment the image to be displayed on the image display end. The segmentation method is the same as the solution described above, and will not be repeated here. Determine the sixth gamma curve corresponding to the image area of the image to be displayed, and perform gamma correction on the image area; wherein, the sixth gamma curve is obtained through calibration at the image display end. The processing method for the transitional image area of the adjacent image area of the image to be displayed is the same as the above solution, and will not be repeated here.
伽马校正用于解决CRT显示器的非线性输出问题,同时还可以帮助“改善”输出的图像质量,图6是自然界中的亮度以及对应的人眼所感受的亮度值,从图中可以看出,人眼对于较暗(接近0)的亮度值比较敏感,对于较亮(接近1)的亮度值则不太敏感,可以理解为人眼更能辨别较暗的亮度值发生的变化,因此颜色在存储时,应该更多的保存较暗部分的颜色值。Gamma correction is used to solve the nonlinear output problem of CRT monitors, and can also help to "improve" the output image quality. Figure 6 shows the brightness in nature and the corresponding brightness value felt by the human eye. It can be seen from the figure , the human eye is more sensitive to darker (closer to 0) brightness values, and less sensitive to brighter (closer to 1) brightness values. It can be understood that the human eye can better distinguish changes in darker brightness values, so the color is in When storing, the color value of the darker part should be preserved more.
在一些实施例中,伽马(Gamma)曲线是根据图像传感器(sensor)和镜头(lens)的特性、光照环境、甚至用户喜好来设定的。Gamma数值较大时,图像会很亮,但是对比度 和饱和度会下降,如图7所示,直观上感觉像有一层雾遮住了画面,同时暗处的噪声(Noise)会被放大。Gamma数值较小时,亮度会降低,图像整体对比度增加,色彩更鲜艳,暗处的Noise较小,同时会让暗处的画面更暗而导致看不清。In some embodiments, the gamma curve is set according to the characteristics of the image sensor (sensor) and lens (lens), lighting environment, and even user preference. When the Gamma value is large, the image will be very bright, but the contrast and saturation will decrease, as shown in Figure 7, it feels intuitively that there is a layer of fog covering the picture, and the noise in the dark will be amplified. When the Gamma value is small, the brightness will decrease, the overall contrast of the image will increase, the color will be more vivid, the noise in the dark place will be smaller, and the picture in the dark place will be darker, making it difficult to see clearly.
下面将说明本申请在一个实际的应用场景中的示例性应用。An exemplary application of the present application in a practical application scenario will be described below.
在一些实施例中,手机进行拍摄过程中使用一种伽马曲线对待处理图像进行伽马校正。这样虽然能够提升待处理图像的质量,但是实际人眼所对应的伽马曲线在不同亮度的场景下并非完全一致,尤其是在明暗变化明显的环境下和在明暗变化不明显的环境下。例如,对于明暗变化明显的环境下,人眼对应的伽马会随着整体亮度进行适应,整体亮度越高,伽马就越陡峭,将亮的区域压缩,将暗的区域提亮。也就是说,人眼对于实际较暗的区域并非感觉较暗,对于较亮的区域,人眼的伽马会自动压缩,人眼感受不会觉得特别亮。而对于这类明暗变化明显的环境,如果使用同一伽马曲线进行校正,结果会是较亮的区域更亮,甚至呈现一片白色,而较暗的区域更暗,甚至呈现一片黑色。In some embodiments, a gamma curve is used to perform gamma correction on the image to be processed during shooting by the mobile phone. Although this can improve the quality of the image to be processed, the gamma curves corresponding to the actual human eyes are not exactly the same in scenes with different brightness, especially in environments with obvious changes in light and dark and in environments where light and dark changes are not obvious. For example, in an environment with obvious changes in light and shade, the gamma corresponding to the human eye will adapt to the overall brightness. The higher the overall brightness, the steeper the gamma, compressing bright areas and brightening dark areas. That is to say, the human eye does not perceive the actual darker area as darker. For the brighter area, the gamma of the human eye will be automatically compressed, and the human eye will not feel that it is particularly bright. For such an environment with obvious changes in light and shade, if the same gamma curve is used for correction, the result will be that the brighter area will be brighter, or even appear white, while the darker area will be darker, or even appear black.
因此,进一步地,在一些实施例中,提供一种针对拍摄的不同场景,能够自适应的调整伽马曲线参数,从而尽可能地模拟人眼在不同环境下的对明暗程度的感知,输出相应的图像。Therefore, further, in some embodiments, a gamma curve parameter that can adaptively adjust gamma curve parameters for different shooting scenes is provided, so as to simulate the human eye's perception of lightness and darkness in different environments as much as possible, and output the corresponding Image.
如图8所示,整体的流程包括三部分:As shown in Figure 8, the overall process includes three parts:
第一部分:伽马参数标定阶段:依照场景划分并标定的伽马曲线集合;The first part: gamma parameter calibration stage: a set of gamma curves divided and calibrated according to the scene;
这部分通过标定不同的场景下的伽马曲线,即不同视觉特征区间对应的伽马曲线。This part calibrates the gamma curves in different scenes, that is, the gamma curves corresponding to different visual feature intervals.
第二部分,图像拍摄和生成阶段:计算图像相对应的伽马校正表;The second part, the image capture and generation stage: calculate the gamma correction table corresponding to the image;
这部分,首先确定拍摄图像(即待处理图像的一种示例)的亮度变化程度,基于该亮度变化程度,确定是否需要对该拍摄图像进行区域分割;如果需要,则对该拍摄图像进行区域分割,得到对应不同场景的图像区域,进而,基于图像区域的亮度从第一部分标定的伽马曲线集合中查找对应的伽马曲线,利用该伽马曲线对对应的图像区域进行伽马校正。并针对同一幅图像中出现多个场景的情况,对相应的多个图像区域的邻接区域(即过渡图像区域)进行插值,从而保证伽马校正后相邻图像区域的连续性。In this part, first determine the degree of brightness change of the captured image (that is, an example of an image to be processed), and based on the degree of brightness change, determine whether the captured image needs to be segmented; if necessary, perform regional segmentation on the captured image , to obtain image regions corresponding to different scenes, and then, based on the brightness of the image region, search for a corresponding gamma curve from the first part of the calibrated gamma curve set, and use the gamma curve to perform gamma correction on the corresponding image region. And for the situation that multiple scenes appear in the same image, interpolation is performed on the adjacent areas of the corresponding multiple image areas (ie transition image areas), so as to ensure the continuity of the adjacent image areas after gamma correction.
第三部分,图像显示阶段,依照显示环境对伽马校正进行修正并最终显示;The third part, the image display stage, corrects the gamma correction according to the display environment and finally displays it;
由于实际画面的显示效果不仅和拍摄图像本身的亮暗程度相关,也和显示设备所处的物理环境相关,因此,需要依照实际物理环境对第二部分得到的伽马曲线进行调整。Since the display effect of the actual picture is not only related to the brightness and darkness of the captured image itself, but also related to the physical environment where the display device is located, therefore, the gamma curve obtained in the second part needs to be adjusted according to the actual physical environment.
下面对各个步骤进行相应的说明:The following describes each step accordingly:
对于第一部分,可以预先进行测试,选取不同场景,标定不同场景下的伽马曲线,此类场景包括不同的光源和光线强度,并且选取在这个场景下拍摄获取的不同伽马曲线下的图像以及与被测人员感知最一致的图像,从而选取出不同场景下的最符合人眼感受的伽马曲线 (也即伽马校正参数)。(Gamma曲线的形状并没有统一的标准,人为影响因素很大。设置gamma曲线形状的一个参考方法是在灯箱环境下拍摄24色卡,让色卡最下方的6个色块的亮度数据Y尽量呈现出线性等比例关系。)For the first part, you can test in advance, select different scenes, calibrate the gamma curves in different scenes, such scenes include different light sources and light intensities, and select images under different gamma curves captured in this scene and The image that is most consistent with the perception of the person being tested is used to select the gamma curve (that is, the gamma correction parameter) that is most in line with the perception of the human eye in different scenes. (There is no uniform standard for the shape of the gamma curve, and there are many human-influenced factors. A reference method for setting the shape of the gamma curve is to shoot 24 color cards in a light box environment, and make the brightness data Y of the 6 color blocks at the bottom of the color card as much as possible showing a linear proportional relationship.)
在实际的ISP设计中,一般是用分段线性插值的方式,也可以用SRAM实现逐点映射,这样曲线的形状可以灵活配置。在第一部分完成后,可以获得多组伽马曲线和场景的映射关系。In the actual ISP design, the method of segmented linear interpolation is generally used, and SRAM can also be used to realize point-by-point mapping, so that the shape of the curve can be flexibly configured. After the first part is completed, the mapping relationship between multiple sets of gamma curves and scenes can be obtained.
对于第二部分,场景识别和场景分割:在实际拍摄时,由于场景的复杂性,往往拍摄时画面中的场景往往包含的环境并非完全一致,在前端对获取的图像进行下采样获取RGB的缩略图,利用前端分割模块分割出不同的图像区域,对不同的图像区域进行环境判断,依照判断后的环境确定该环境下的伽马曲线。For the second part, scene recognition and scene segmentation: in actual shooting, due to the complexity of the scene, the scene in the picture often contains not exactly the same environment when shooting, and the acquired image is down-sampled at the front end to obtain RGB condensed Outline, use the front-end segmentation module to segment different image areas, judge the environment of different image areas, and determine the gamma curve under the environment according to the judged environment.
接着,在区域边缘对伽马曲线进行相应的修正,保证在分割区域之间伽马曲线的变化较为均匀,从而保证其画面明暗不至于出现跳变。Then, corresponding corrections are made to the gamma curve at the edge of the region to ensure that the change of the gamma curve between the divided regions is relatively uniform, so as to ensure that the brightness and darkness of the picture will not jump.
举例说明整体的方案流程,某图片a在进行伽马校正前的亮度如图9所示,其中x,y分别表示像素位置,z数值表示像素位置的亮度。场景分割后,图像被分割为两个图像区域,如图4所示,其中一个图像区域302包括场景a1,另一图像区域303包括场景b1。As an example to illustrate the overall solution process, the brightness of a certain picture a before gamma correction is shown in Figure 9, where x and y represent the pixel position respectively, and the z value represents the brightness of the pixel position. After the scene is segmented, the image is divided into two image areas, as shown in FIG. 4 , one image area 302 includes the scene a1, and the other image area 303 includes the scene b1.
其中,横纵坐标对应的是图片a中像素点的位置,曲线代表分割后的交界线301,将整幅图划分为场景a1和场景b1,处于场景a1中的像素点对应的伽马曲线为伽马曲线a1,处于场景b1中的像素点对应的伽马曲线为伽马曲线b1。Among them, the horizontal and vertical coordinates correspond to the positions of the pixels in the picture a, and the curve represents the divided boundary line 301, which divides the whole picture into scene a1 and scene b1, and the gamma curve corresponding to the pixel in scene a1 is The gamma curve a1, the gamma curve corresponding to the pixel in the scene b1 is the gamma curve b1.
由于不同场景之间,伽马校正差异会在交界线附近产生突变,通过在交界线处设置过渡图像区域,进行插值,从而保证亮度变化的连续性,将交界线301向上下两边偏移一定像素距离p,得到过渡图像区域c,过渡图像区域c中的像素点对应的伽马曲线采用前两者的加权平均,并依照偏移的远近设置权重。Due to the difference in gamma correction between different scenes, a sudden change will occur near the boundary line. By setting a transitional image area at the boundary line and performing interpolation, the continuity of brightness changes is ensured, and the boundary line 301 is offset by a certain number of pixels on both sides. The distance p is used to obtain the transition image area c, and the gamma curve corresponding to the pixels in the transition image area c adopts the weighted average of the former two, and sets the weight according to the distance of the offset.
依照场景a1和场景b1,对照第一部分得到的数值,查找相应的伽马曲线例如,图10所示,得到的伽马曲线gamma=2.1和gamma=2.4,这里仅仅是举例而已,实际情况并非如此。其中,x和y分别表示像素位置,依照场景的不同采用不同的伽马曲线。为了保证连续性,对过渡图像区域的曲线进行插值,保证映射后亮度变化的连续性,此处采用的方式为线性插值,如下公式(2)所示,得到的过渡图像区域的伽马曲线fun3(light (x,y))的表达式为: According to scene a1 and scene b1, compare the values obtained in the first part to find the corresponding gamma curve. For example, as shown in Figure 10, the obtained gamma curves gamma=2.1 and gamma=2.4 are just examples here, and the actual situation is not the case . Among them, x and y represent pixel positions respectively, and different gamma curves are used according to different scenes. In order to ensure the continuity, the curve of the transition image area is interpolated to ensure the continuity of the brightness change after mapping. The method used here is linear interpolation, as shown in the following formula (2), the obtained gamma curve fun3 of the transition image area The expression for (light (x,y) ) is:
fun3(light (x,y))=weight1*fun1(light (x,y))+weight2*fun2(light (x,y))   公式(2); fun3(light (x,y) )=weight1*fun1(light (x,y) )+weight2*fun2(light (x,y) ) formula (2);
其中,light (x,y)表示像素单元(x,y)的亮度,fun1(light (x,y))表示图像区域的目标伽马曲线,weight1是指第一权重函数,该函数的自变量为过渡图像区域的像素单元到在图像区域的过 渡图像区域的边界的像素距离;weight2是指第二权重函数,与第一权重函数的加和为1;fun2(light (x,y))表示所述图像区域的相邻图像区域的目标伽马曲线。 Among them, light (x, y) represents the brightness of the pixel unit (x, y), fun1(light (x, y) ) represents the target gamma curve of the image area, weight1 refers to the first weight function, and the argument of the function is the pixel distance from the pixel unit of the transition image area to the boundary of the transition image area in the image area; weight2 refers to the second weight function, and the sum of the first weight function is 1; fun2(light (x,y) ) means Target gamma curves of image regions adjacent to the image region.
举例来说,图11为对上述图片a的过渡图像区域以及图像区域的伽马校正后的示意图,如图11所示,区域[0.0.5]代表图像区域a1内的伽马校正结果,[0.5,1.5]代表过渡图像区域的伽马校正结果,[1.5,2]代表图像区域b1内的伽马校正结果。需要说明的是,这里的0.5、1.5、2等无实际意义,只作为示例,不对本申请的技术方案的范围造成限制。For example, FIG. 11 is a schematic diagram of the transitional image area of the above picture a and the gamma correction of the image area. As shown in FIG. 11, the area [0.0.5] represents the gamma correction result in the image area a1, [ 0.5,1.5] represents the gamma correction result in the transition image region, and [1.5,2] represents the gamma correction result in the image region b1. It should be noted that 0.5, 1.5, 2, etc. here have no practical meaning, and are only examples, and do not limit the scope of the technical solution of the present application.
在进行伽马校正时,如下公式(3)所示,不同位置的像素数值的伽马校正依照其划分的区域不同,采用不同的伽马曲线:When gamma correction is performed, as shown in the following formula (3), the gamma correction of pixel values at different positions is different according to the area divided by it, and different gamma curves are used:
Figure PCTCN2022098683-appb-000002
Figure PCTCN2022098683-appb-000002
其中,(x,y)代表像素点在图片中的位置,light代表处于x,y位置上像素的亮度,weight代表权重,其中像素宽度为p,当像素点处于上边界(即过渡图像区域在a1的图像区域的边界)时weight1为1,weight2为0;当像素点处于下边界(即过渡图像区域在b1的图像区域的边界),weight1为0,weight2为1,其他区域变化如图12所示,横坐标代表过渡图像区域内像素点距离上边界的距离占比(最大数值到1,距离上边界为1*p,即为下边界)。Among them, (x, y) represents the position of the pixel in the picture, light represents the brightness of the pixel at the x, y position, weight represents the weight, where the pixel width is p, when the pixel is on the upper boundary (that is, the transition image area is in The boundary of the image area of a1) weight1 is 1, weight2 is 0; when the pixel point is at the lower boundary (that is, the transition image area is at the boundary of the image area of b1), weight1 is 0, weight2 is 1, and other areas change as shown in Figure 12 As shown, the abscissa represents the proportion of the distance between the pixel point in the transition image area and the upper boundary (the maximum value is 1, and the distance from the upper boundary is 1*p, which is the lower boundary).
对图片a进行相应的伽马校正后,图片a的整体亮度如图13所示。After corresponding gamma correction is performed on picture a, the overall brightness of picture a is shown in FIG. 13 .
在针对图片不同区域中对应的伽马曲线保存下来和图片ID相互绑定,保存在本地,在实际显示时,利用手机光传感器获取当前外部环境的光线强度和色温,结合对当前显示的环境亮度的感知,结合第一部分中的伽马曲线,对第二部分中的数据,进行相应的明暗校准处理,输出相应的图像。The corresponding gamma curves in different areas of the picture are saved and bound to the picture ID, and stored locally. When actually displayed, the light sensor of the mobile phone is used to obtain the light intensity and color temperature of the current external environment, combined with the currently displayed ambient brightness. Combined with the gamma curve in the first part, the data in the second part is subjected to corresponding light and dark calibration processing, and the corresponding image is output.
举例来说,从第一部分中的伽马曲线集合中可以查到,当前显示场景对应的伽马曲线为fun2(),结合第二部分中拍摄场景画面不同区域的伽马曲线为fun(),那么最终显示时使用的伽马曲线为:Weignt2*fun()+Weignt3*fun2()。For example, it can be found from the gamma curve collection in the first part that the gamma curve corresponding to the currently displayed scene is fun2(), combined with the gamma curves in different areas of the shooting scene picture in the second part is fun(), Then the gamma curve used in the final display is: Weignt2*fun()+Weignt3*fun2().
其中,Weignt2和Weignt3都是常量,采用两个函数的加权平均,Weignt2+Weignt3=1,Weignt3代表修正幅度,可以依照经验数值确定,从而获取最终显示的图像亮度。Among them, Weignt2 and Weignt3 are both constants, using the weighted average of the two functions, Weignt2+Weignt3=1, Weignt3 represents the correction range, which can be determined according to empirical values, so as to obtain the brightness of the final displayed image.
可以理解地,人眼所对应的伽马曲线在不同的环境下并非完全一致,尤其是在明暗变化明显的环境以下和在明暗变化不明显的环境下其对应的伽马曲线并非完全一致。在本申请中,依照拍摄场景和显示场景使用不同的伽马曲线,针对拍摄的不同场景,自适应的调整伽马曲线,从而尽可能模拟人眼在不同环境下的对明暗程度的感知,输出相应的图像。It is understandable that the gamma curves corresponding to the human eye are not completely consistent in different environments, especially the corresponding gamma curves are not completely consistent under environments with obvious changes in brightness and darkness and in environments with insignificant changes in brightness and darkness. In this application, different gamma curves are used according to the shooting scene and the display scene, and the gamma curve is adaptively adjusted for different shooting scenes, so as to simulate the human eye's perception of light and shade in different environments as much as possible, and the output corresponding image.
在本申请中,对照同一图像中的不同场景使用多套不同的伽马曲线,针对同一场景下多 个光源色温的情况,利用前端芯片依照色温和光线强度不同分割不同区域进行伽马曲线选取,并在相邻图像区域的过渡图像区域进行插值以保证亮度变化的连续性。In this application, multiple sets of different gamma curves are used in comparison with different scenes in the same image. For the color temperature of multiple light sources in the same scene, the front-end chip is used to divide different regions according to the color temperature and light intensity to select the gamma curve. And interpolation is performed in the transition image area of the adjacent image area to ensure the continuity of the brightness change.
在本申请中,实际显示时伽马曲线的确定依照当前显示环境的光线强度和色温进行再次调整,依照当前显示场景获取对应的伽马曲线,以及和既有拍摄环境下对应的伽马曲线进行加权,获取最终的伽马曲线。In this application, the determination of the gamma curve during actual display is adjusted again according to the light intensity and color temperature of the current display environment, the corresponding gamma curve is obtained according to the current display scene, and the gamma curve corresponding to the existing shooting environment is carried out Weighted to get the final gamma curve.
在一些实施例中,预先标定不同的色温和光线强度场景下人眼标定产生的伽马曲线集合,在拍摄图片时,先在前端芯片中对原始图像依照画面的整体明暗差异进行图像区域分割;图像分割的原则为基于整体画面中明显不同色温以及光线强度的场景区域,通过设置阈值阶梯(多组阈值)依照不同的区域色温或者亮度差异落在某个阈值区间划分为不同区域并进行分割,对这些区域依照预先标定的伽马曲线集合,采用不同的伽马曲线有针对性地对这些区域进行伽马校正;接着,为保证图像中相邻图像区域之间的伽马参数随像素位置变化的连续性,对整个图像中伽马参数进行二维三次多项式插值;同时将获取的该信息(包括色温分布、光线强度以及伽马参数的分布G1(x,y))保存到图片信息中。In some embodiments, the gamma curve sets generated by human eye calibration under different color temperature and light intensity scenes are pre-calibrated. When taking pictures, the original image is first divided into image regions according to the overall brightness difference of the picture in the front-end chip; The principle of image segmentation is based on scene areas with obviously different color temperatures and light intensities in the overall picture. By setting threshold ladders (multiple sets of thresholds), the color temperature or brightness difference of different areas falls within a certain threshold range to divide into different areas and perform segmentation. For these areas, according to the pre-calibrated gamma curve set, use different gamma curves to perform gamma correction on these areas; then, in order to ensure that the gamma parameters between adjacent image areas in the image change with the pixel position The continuity of the gamma parameter in the whole image is two-dimensional cubic polynomial interpolation; at the same time, the obtained information (including color temperature distribution, light intensity and gamma parameter distribution G1(x,y)) is saved in the image information.
在图片进行预览显示时,利用手机光传感器获取当前外部环境的光线强度和色温数值,和既有的拍摄时的场景信息进行对比,依照当前环境和原有图片中保存拍摄环境的相似程度进行伽马曲线的二次调整;例如,基于当前显示图片时获取的环境信息查找对应的整体伽马校正参数G2(由于当前显示场景固定,伽马参数为定值),和旧有的插值产生的伽马参数G1(x,y)进行求和平均获取最终参数。When the picture is previewed and displayed, use the light sensor of the mobile phone to obtain the light intensity and color temperature value of the current external environment, compare it with the existing scene information during shooting, and perform gamut according to the similarity between the current environment and the shooting environment saved in the original picture Secondary adjustment of the horse curve; for example, find the corresponding overall gamma correction parameter G2 based on the environmental information obtained when the picture is currently displayed (because the current display scene is fixed, the gamma parameter is a fixed value), and the gamma generated by the old interpolation The horse parameters G1(x, y) are summed and averaged to obtain the final parameters.
基于前述的实施例,本申请提供一种图像处理装置,该装置包括所包括的各模块、以及各模块所包括的各单元,可以通过处理器来实现;当然也可通过具体的逻辑电路实现;在实施的过程中,处理器可以为中央处理器(CPU)、微处理器(MPU)、数字信号处理器(DSP)、现场可编程门阵列(FPGA)或图像信号处理芯片(ISP)等。Based on the foregoing embodiments, the present application provides an image processing device, which includes each module included and each unit included in each module, which can be realized by a processor; of course, it can also be realized by a specific logic circuit; During implementation, the processor may be a central processing unit (CPU), a microprocessor (MPU), a digital signal processor (DSP), a field programmable gate array (FPGA), or an image signal processing chip (ISP).
图14为本申请图像处理装置的结构示意图,如图14所示,图像处理装置140包括:FIG. 14 is a schematic structural diagram of the image processing device of the present application. As shown in FIG. 14, the image processing device 140 includes:
分割模块141,配置成基于待处理图像的像素单元的第一视觉特征,对所述待处理图像进行分割,得到多个图像区域;其中,所述第一视觉特征包括以下至少之一:亮度、色温;The segmentation module 141 is configured to segment the image to be processed based on the first visual feature of the pixel unit of the image to be processed to obtain a plurality of image regions; wherein the first visual feature includes at least one of the following: brightness, color temperature;
确定模块142,配置成确定与第一图像区域对应的第一伽马曲线;其中,所述第一图像区域是所述多个图像区域的其中之一;The determination module 142 is configured to determine a first gamma curve corresponding to a first image area; wherein the first image area is one of the plurality of image areas;
第一校正模块143,配置成至少部分地基于所述第一伽马曲线,对所述第一图像区域进行伽马校正。The first correction module 143 is configured to perform gamma correction on the first image region based at least in part on the first gamma curve.
在一些实施例中,确定模块142,还配置成:确定与第二图像区域对应的第二伽马曲线; 其中,所述第二图像区域是所述多个图像区域中与所述第一图像区域相邻的另一图像区域;所述第一伽马曲线与所述第二伽马曲线不同;第一校正模块143,还配置成:基于所述第二伽马曲线,对所述第二图像区域进行伽马校正。In some embodiments, the determining module 142 is further configured to: determine a second gamma curve corresponding to a second image area; wherein, the second image area is one of the plurality of image areas that is similar to the first image Another image region adjacent to the region; the first gamma curve is different from the second gamma curve; the first correction module 143 is also configured to: based on the second gamma curve, correct the second gamma curve Image areas are gamma corrected.
在一些实施例中,第一校正模块143,还配置成:至少部分地基于所述第一伽马曲线和/或所述第二伽马曲线对过渡图像区域进行伽马校正,其中,所述过渡图像区域包括所述第一图像区域与所述第二图像区域之间的分界线。In some embodiments, the first correction module 143 is further configured to perform gamma correction on the transitional image region based at least in part on the first gamma curve and/or the second gamma curve, wherein the The transition image area includes a boundary between the first image area and the second image area.
在一些实施例中,确定模块142,还配置成:确定所述第一图像区域与所述第二图像区域之间的分界线;将所述分界线、以及所述分界线分别向第一图像区域和第二图像区域偏移特定像素距离后所围成的区域作为所述过渡图像区域。In some embodiments, the determination module 142 is further configured to: determine the boundary line between the first image area and the second image area; The area enclosed by the area and the second image area offset by a specific pixel distance is used as the transition image area.
在一些实施例中,第一校正模块143,配置成:基于第一权重函数和第二权重函数,将所述第一伽马曲线与所述第二伽马曲线的加权和作为第五伽马曲线;至少部分地基于所述第五伽马曲线,对所述过渡图像区域进行伽马校正;其中,所述第一权重函数为所述第一伽马曲线的系数,所述第二权重函数为所述第二伽马曲线的系数,同一像素单元对应的所述第一权重函数的值与所述第二权重函数的值的和为1;所述第一权重函数的值与第一像素单元至所述第一图像区域的第一边界的距离呈负相关,其中,所述第一像素单元为所述过渡图像区域中属于第一图像区域的像素单元,所述第一边界位于所述第一图像区域。In some embodiments, the first correction module 143 is configured to: based on the first weight function and the second weight function, use the weighted sum of the first gamma curve and the second gamma curve as the fifth gamma curve; performing gamma correction on the transition image region based at least in part on the fifth gamma curve; wherein the first weight function is a coefficient of the first gamma curve, and the second weight function is the coefficient of the second gamma curve, the sum of the value of the first weight function corresponding to the same pixel unit and the value of the second weight function is 1; the value of the first weight function and the value of the first pixel The distance between the unit and the first boundary of the first image area is negatively correlated, wherein the first pixel unit is a pixel unit belonging to the first image area in the transition image area, and the first boundary is located in the first image area.
在一些实施例中,图像处理装置140还包括第二校正模块;其中,确定模块142,还配置成:确定与所述第一图像区域对应的第三伽马曲线;其中,所述第三伽马曲线是通过在图像显示端进行标定而得到,所述第一伽马曲线是通过在图像传感器端进行标定而得到;第二校正模块,还配置成根据所述第三伽马曲线,对所述第一图像区域进行伽马校正。In some embodiments, the image processing device 140 further includes a second correction module; wherein, the determination module 142 is further configured to: determine a third gamma curve corresponding to the first image region; wherein, the third gamma curve The horse curve is obtained by calibration at the image display end, and the first gamma curve is obtained by calibration at the image sensor end; the second correction module is also configured to, according to the third gamma curve, correct the Perform gamma correction on the first image area.
在一些实施例中,确定模块142,配置成:确定物理环境的光线特征;根据所述光线特征,确定对应的第三伽马曲线。In some embodiments, the determining module 142 is configured to: determine light characteristics of the physical environment; and determine a corresponding third gamma curve according to the light characteristics.
在一些实施例中,分割模块141,配置成:将所述第一视觉特征落入同一特定区间的像素单元,分割为一个图像区域,从而得到多个图像区域。In some embodiments, the segmentation module 141 is configured to: segment the pixel units in which the first visual feature falls into the same specific interval into one image area, so as to obtain multiple image areas.
在一些实施例中,确定模块142,还配置成:基于所述待处理图像的像素单元的第一视觉特征,确定所述待处理图像的整体的第二视觉特征;如果所述第二视觉特征满足分割条件,触发分割模块141对待处理图像进行分割;如果所述第二视觉特征不满足分割条件,确定与所述第二视觉特征对应的第四伽马曲线;以及触发第一校正模块143根据第四伽马曲线,对待处理图像进行伽马校正。In some embodiments, the determining module 142 is further configured to: determine an overall second visual feature of the image to be processed based on the first visual feature of the pixel units of the image to be processed; if the second visual feature Satisfy the segmentation condition, trigger the segmentation module 141 to segment the image to be processed; if the second visual feature does not meet the segmentation condition, determine the fourth gamma curve corresponding to the second visual feature; and trigger the first correction module 143 according to The fourth gamma curve performs gamma correction on the image to be processed.
在一些实施例中,所述第二视觉特征包括以下至少之一:所述待处理图像的像素单元的第一视觉特征的变化情况;所述待处理图像中是否包括光源;所述光源的数目;所述光源的 位置。In some embodiments, the second visual feature includes at least one of the following: the change of the first visual feature of the pixel unit of the image to be processed; whether the image to be processed includes a light source; the number of the light source ; the position of the light source.
在一些实施例中,所述分割条件包括以下至少之一:表征所述变化情况的参数大于对应阈值;所述待处理图像中包括光源;所述光源的数目大于对应阈值;所述光源的位置在特定位置。In some embodiments, the segmentation condition includes at least one of the following: the parameter characterizing the change is greater than a corresponding threshold; the image to be processed includes a light source; the number of the light source is greater than a corresponding threshold; the position of the light source at a specific location.
在一些实施例中,确定模块142,还配置成:获取不同的伽马曲线与表征场景的第三视觉特征的映射关系;确定所述第一图像区域的整体的第四视觉特征;从所述表征场景的第三视觉特征中确定出与所述第四视觉特征相匹配的第三视觉特征;将与所述相匹配的第三视觉特征对应的伽马曲线确定为所述第一伽马曲线。In some embodiments, the determination module 142 is further configured to: acquire the mapping relationship between different gamma curves and the third visual feature representing the scene; determine the overall fourth visual feature of the first image region; from the Determining a third visual feature that matches the fourth visual feature from the third visual features that characterize the scene; determining a gamma curve corresponding to the matched third visual feature as the first gamma curve .
以上装置实施例的描述,与上述方法实施例的描述是类似的,具有同方法实施例相似的有益效果。对于本申请装置实施例中未披露的技术细节,请参照本申请方法实施例的描述而理解。The description of the above device embodiment is similar to the description of the above method embodiment, and has similar beneficial effects as the method embodiment. For technical details not disclosed in the device embodiments of the present application, please refer to the description of the method embodiments of the present application for understanding.
需要说明的是,本申请中的装置对模块的划分是示意性的,仅仅为一种逻辑功能划分,实际实现时可以有另外的划分方式。另外,在本申请各个实施例中的各功能单元可以集成在一个处理单元中,也可以是单独物理存在,也可以两个或两个以上单元集成在一个单元中。上述集成的单元既可以采用硬件的形式实现,也可以采用软件功能单元的形式实现。也可以采用软件和硬件结合的形式实现。It should be noted that the division of modules by the device in the present application is schematic, and is only a logical function division, and there may be other division methods in actual implementation. In addition, each functional unit in each embodiment of the present application may be integrated into one processing unit, or physically exist separately, or two or more units may be integrated into one unit. The above-mentioned integrated units can be implemented in the form of hardware or in the form of software functional units. It can also be implemented in the form of a combination of software and hardware.
需要说明的是,本申请中,如果以软件功能模块的形式实现上述的方法,并作为独立的产品销售或使用时,也可以存储在一个计算机可读取存储介质中。基于这样的理解,本申请的技术方案本质上或者说对相关技术做出贡献的部分可以以软件产品的形式体现出来,该计算机软件产品存储在一个存储介质中,包括若干指令用以使得电子设备执行本申请各个实施例所述方法的全部或部分。而前述的存储介质包括:U盘、移动硬盘、只读存储器(Read Only Memory,ROM)、磁碟或者光盘等各种可以存储程序代码的介质。这样,本申请不限制于任何特定的硬件和软件结合。It should be noted that, in this application, if the above-mentioned method is implemented in the form of a software function module and sold or used as an independent product, it can also be stored in a computer-readable storage medium. Based on this understanding, the essence of the technical solution of this application or the part that contributes to the related technology can be embodied in the form of a software product. The computer software product is stored in a storage medium and includes several instructions to make the electronic device Execute all or part of the methods described in the various embodiments of the present application. The aforementioned storage medium includes: various media that can store program codes such as U disk, mobile hard disk, read-only memory (Read Only Memory, ROM), magnetic disk or optical disk. As such, the present application is not limited to any specific combination of hardware and software.
本申请提供一种图像处理芯片,包括处理器单元,所述处理器单元配置成:执行如前文所述的图像处理方法。The present application provides an image processing chip, including a processor unit configured to: execute the image processing method as described above.
本申请提供一种电子设备,图15为本申请的电子设备的硬件实体示意图,如图15所示,所述电子设备150包括存储器151和处理器152,所述存储器151存储有可在处理器152上运行的计算机程序,所述处理器152执行所述程序时实现上述实施例中提供的方法中的步骤。The present application provides an electronic device. FIG. 15 is a schematic diagram of the hardware entity of the electronic device of the present application. As shown in FIG. A computer program running on the processor 152, and the processor 152 implements the steps in the methods provided in the above-mentioned embodiments when executing the program.
需要说明的是,存储器151配置为存储由处理器152可执行的指令和应用,还可以缓存在处理器152以及电子设备150中各模块待处理或已经处理的数据(例如,图像数据、音频数据、语音通信数据和视频通信数据),可以通过闪存(FLASH)或随机访问存储器(Random  Access Memory,RAM)实现。It should be noted that the memory 151 is configured to store instructions and applications executable by the processor 152, and may also cache data to be processed or processed by each module in the processor 152 and the electronic device 150 (for example, image data, audio data, etc. , voice communication data and video communication data), can be realized by flash memory (FLASH) or random access memory (Random Access Memory, RAM).
本申请提供一种计算机可读存储介质,其上存储有计算机程序,该计算机程序被处理器执行时实现上述实施例中提供的方法中的步骤。The present application provides a computer-readable storage medium on which a computer program is stored, and when the computer program is executed by a processor, the steps in the method provided in the above-mentioned embodiments are implemented.
本申请提供了一种包含指令的计算机程序产品,当其在计算机上运行时,使得计算机执行上述方法实施例提供的方法中的步骤。The present application provides a computer program product containing instructions, which, when run on a computer, causes the computer to execute the steps in the methods provided by the above method embodiments.
这里需要指出的是:以上存储介质和设备实施例的描述,与上述方法实施例的描述是类似的,具有同方法实施例相似的有益效果。对于本申请存储介质、存储介质和设备实施例中未披露的技术细节,请参照本申请方法实施例的描述而理解。It should be pointed out here that: the descriptions of the above storage medium and device embodiments are similar to the descriptions of the above method embodiments, and have similar beneficial effects to those of the method embodiments. For technical details not disclosed in the storage medium, storage medium, and device embodiments of the present application, please refer to the description of the method embodiment of the present application for understanding.
应理解,说明书通篇中提到的“一个实施例”或“一实施例”或“一些实施例”意味着与实施例有关的特定特征、结构或特性包括在本申请的至少一个实施例中。因此,在整个说明书各处出现的“在一个实施例中”或“在一实施例中”或“在一些实施例中”未必一定指相同的实施例。此外,这些特定的特征、结构或特性可以任意适合的方式结合在一个或多个实施例中。应理解,在本申请的各种实施例中,上述各过程的序号的大小并不意味着执行顺序的先后,各过程的执行顺序应以其功能和内在逻辑确定,而不应对本申请的实施过程构成任何限定。上述本申请序号仅仅为了描述,不代表实施例的优劣。上文对各个实施例的描述倾向于强调各个实施例之间的不同之处,其相同或相似之处可以互相参考,为了简洁,本文不再赘述。It should be understood that reference throughout this specification to "one embodiment" or "an embodiment" or "some embodiments" means that a particular feature, structure, or characteristic related to the embodiment is included in at least one embodiment of the present application . Thus, appearances of "in one embodiment" or "in an embodiment" or "in some embodiments" in various places throughout the specification are not necessarily referring to the same embodiments. Furthermore, the particular features, structures or characteristics may be combined in any suitable manner in one or more embodiments. It should be understood that, in various embodiments of the present application, the serial numbers of the above-mentioned processes do not mean the order of execution, and the order of execution of the processes should be determined by their functions and internal logic, and should not be used in the implementation of the present application. process constitutes any qualification. The serial numbers of the above application are for description only, and do not represent the advantages and disadvantages of the embodiments. The above descriptions of the various embodiments tend to emphasize the differences between the various embodiments, the same or similar points can be referred to each other, and for the sake of brevity, details are not repeated herein.
本文中术语“和/或”,仅仅是一种描述关联对象的关联关系,表示可以存在三种关系,例如对象A和/或对象B,可以表示:单独存在对象A,同时存在对象A和对象B,单独存在对象B这三种情况。The term "and/or" in this article is just an association relationship describing associated objects, which means that there can be three relationships, such as object A and/or object B, which can mean: object A exists alone, and object A and object exist at the same time B, there are three situations of object B alone.
需要说明的是,在本文中,术语“包括”、“包含”或者其任何其他变体意在涵盖非排他性的包含,从而使得包括一系列要素的过程、方法、物品或者装置不仅包括那些要素,而且还包括没有明确列出的其他要素,或者是还包括为这种过程、方法、物品或者设备所固有的要素。在没有更多限制的情况下,由语句“包括一个……”限定的要素,并不排除在包括该要素的过程、方法、物品或者设备中还存在另外的相同要素。It should be noted that, in this document, the term "comprising", "comprising" or any other variation thereof is intended to cover a non-exclusive inclusion such that a process, method, article or apparatus comprising a set of elements includes not only those elements, It also includes other elements not expressly listed, or elements inherent in the process, method, article, or apparatus. Without further limitations, an element defined by the phrase "comprising a ..." does not preclude the presence of additional identical elements in the process, method, article or apparatus comprising that element.
在本申请所提供的几个实施例中,应该理解到,所揭露的设备和方法,可以通过其它的方式实现。以上所描述的实施例仅仅是示意性的,例如,所述模块的划分,仅仅为一种逻辑功能划分,实际实现时可以有另外的划分方式,如:多个模块或组件可以结合,或可以集成到另一个系统,或一些特征可以忽略,或不执行。另外,所显示或讨论的各组成部分相互之间的耦合、或直接耦合、或通信连接可以是通过一些接口,设备或模块的间接耦合或通信连接,可以是电性的、机械的或其它形式的。In the several embodiments provided in this application, it should be understood that the disclosed devices and methods may be implemented in other ways. The above-described embodiments are only illustrative. For example, the division of the modules is only a logical function division. In actual implementation, there may be other division methods, such as: multiple modules or components can be combined, or can be Integrate into another system, or some features may be ignored, or not implemented. In addition, the mutual coupling, or direct coupling, or communication connection between the various components shown or discussed may be through some interfaces, and the indirect coupling or communication connection of devices or modules may be in electrical, mechanical or other forms of.
上述作为分离部件说明的模块可以是、或也可以不是物理上分开的,作为模块显示的部件可以是、或也可以不是物理模块;既可以位于一个地方,也可以分布到多个网络单元上;可以根据实际的需要选择其中的部分或全部模块来实现本实施例方案的目的。The modules described above as separate components may or may not be physically separated, and the components displayed as modules may or may not be physical modules; they may be located in one place or distributed to multiple network units; Part or all of the modules can be selected according to actual needs to achieve the purpose of the solution of this embodiment.
另外,在本申请各实施例中的各功能模块可以全部集成在一个处理单元中,也可以是各模块分别单独作为一个单元,也可以两个或两个以上模块集成在一个单元中;上述集成的模块既可以采用硬件的形式实现,也可以采用硬件加软件功能单元的形式实现。In addition, each functional module in each embodiment of the present application can be integrated into one processing unit, or each module can be used as a single unit, or two or more modules can be integrated into one unit; the above-mentioned integration The modules can be implemented in the form of hardware, or in the form of hardware plus software functional units.
本领域普通技术人员可以理解:实现上述方法实施例的全部或部分步骤可以通过程序指令相关的硬件来完成,前述的程序可以存储于计算机可读取存储介质中,该程序在执行时,执行包括上述方法实施例的步骤;而前述的存储介质包括:移动存储设备、只读存储器(Read Only Memory,ROM)、磁碟或者光盘等各种可以存储程序代码的介质。Those of ordinary skill in the art can understand that all or part of the steps to realize the above method embodiments can be completed by hardware related to program instructions, and the aforementioned programs can be stored in computer-readable storage media. When the program is executed, the execution includes The steps of the foregoing method embodiments; and the foregoing storage media include: removable storage devices, read-only memory (Read Only Memory, ROM), magnetic disks or optical disks and other media that can store program codes.
或者,本申请上述集成的单元如果以软件功能模块的形式实现并作为独立的产品销售或使用时,也可以存储在一个计算机可读取存储介质中。基于这样的理解,本申请的技术方案本质上或者说对相关技术做出贡献的部分可以以软件产品的形式体现出来,该计算机软件产品存储在一个存储介质中,包括若干指令用以使得电子设备执行本申请各个实施例所述方法的全部或部分。而前述的存储介质包括:移动存储设备、ROM、磁碟或者光盘等各种可以存储程序代码的介质。Alternatively, if the above-mentioned integrated units of the present application are realized in the form of software function modules and sold or used as independent products, they can also be stored in a computer-readable storage medium. Based on this understanding, the essence of the technical solution of this application or the part that contributes to the related technology can be embodied in the form of a software product. The computer software product is stored in a storage medium and includes several instructions to make the electronic device Execute all or part of the methods described in the various embodiments of the present application. The aforementioned storage medium includes various media capable of storing program codes such as removable storage devices, ROMs, magnetic disks or optical disks.
本申请所提供的几个方法实施例中所揭露的方法,在不冲突的情况下可以任意组合,得到新的方法实施例。The methods disclosed in several method embodiments provided in this application can be combined arbitrarily to obtain new method embodiments under the condition of no conflict.
本申请所提供的几个产品实施例中所揭露的特征,在不冲突的情况下可以任意组合,得到新的产品实施例。The features disclosed in several product embodiments provided in this application can be combined arbitrarily without conflict to obtain new product embodiments.
本申请所提供的几个方法或设备实施例中所揭露的特征,在不冲突的情况下可以任意组合,得到新的方法实施例或设备实施例。The features disclosed in several method or device embodiments provided in this application can be combined arbitrarily without conflict to obtain new method embodiments or device embodiments.
以上所述,仅为本申请的实施方式,但本申请的保护范围并不局限于此,任何熟悉本技术领域的技术人员在本申请揭露的技术范围内,可轻易想到变化或替换,都应涵盖在本申请的保护范围之内。因此,本申请的保护范围应以所述权利要求的保护范围为准。The above is only the embodiment of the present application, but the scope of protection of the present application is not limited thereto. Anyone familiar with the technical field can easily think of changes or substitutions within the technical scope disclosed in the present application, and should covered within the scope of protection of this application. Therefore, the protection scope of the present application should be determined by the protection scope of the claims.

Claims (20)

  1. 一种图像处理方法,包括:An image processing method, comprising:
    基于待处理图像的像素单元的第一视觉特征,对所述待处理图像进行分割,得到多个图像区域;其中,所述第一视觉特征包括以下至少之一:亮度、色温;Based on the first visual feature of the pixel unit of the image to be processed, the image to be processed is segmented to obtain a plurality of image regions; wherein the first visual feature includes at least one of the following: brightness, color temperature;
    确定与第一图像区域对应的第一伽马曲线;其中,所述第一图像区域是所述多个图像区域的其中之一;determining a first gamma curve corresponding to a first image area; wherein the first image area is one of the plurality of image areas;
    至少部分地基于所述第一伽马曲线,对所述第一图像区域进行伽马校正。The first image region is gamma corrected based at least in part on the first gamma curve.
  2. 根据权利要求1所述的方法,其中,所述方法还包括:The method according to claim 1, wherein the method further comprises:
    确定与第二图像区域对应的第二伽马曲线;其中,所述第二图像区域是所述多个图像区域中与所述第一图像区域相邻的另一图像区域;所述第一伽马曲线与所述第二伽马曲线不同;Determining a second gamma curve corresponding to a second image area; wherein, the second image area is another image area adjacent to the first image area among the plurality of image areas; the first gamma the horse curve is different from said second gamma curve;
    基于所述第二伽马曲线,对所述第二图像区域进行伽马校正。Perform gamma correction on the second image area based on the second gamma curve.
  3. 根据权利要求2所述的方法,其中,所述方法还包括:The method according to claim 2, wherein the method further comprises:
    至少部分地基于所述第一伽马曲线和/或所述第二伽马曲线对过渡图像区域进行伽马校正;其中,所述过渡图像区域包括所述第一图像区域与所述第二图像区域之间的分界线。performing gamma correction on the transitional image region based at least in part on the first gamma curve and/or the second gamma curve; wherein the transitional image region includes the first image region and the second image The dividing line between areas.
  4. 根据权利要求3所述的方法,其中,所述方法还包括:The method according to claim 3, wherein the method further comprises:
    确定所述第一图像区域与所述第二图像区域之间的分界线;determining a boundary between the first image area and the second image area;
    将所述分界线、以及所述分界线分别向第一图像区域和第二图像区域偏移特定像素距离后所围成的区域作为所述过渡图像区域。The boundary line and the area enclosed by the boundary line offset from the first image area and the second image area by a specific pixel distance are used as the transition image area.
  5. 根据权利要求3所述的方法,其中,所述至少部分地基于所述第一伽马曲线和/或所述第二伽马曲线对过渡图像区域进行伽马校正,包括:The method according to claim 3, wherein performing gamma correction on the transition image region based at least in part on the first gamma curve and/or the second gamma curve comprises:
    基于第一权重函数和第二权重函数,将所述第一伽马曲线与所述第二伽马曲线的加权和作为第五伽马曲线;Based on the first weight function and the second weight function, using the weighted sum of the first gamma curve and the second gamma curve as a fifth gamma curve;
    至少部分地基于所述第五伽马曲线,对所述过渡图像区域进行伽马校正;gamma correcting the transition image region based at least in part on the fifth gamma curve;
    其中,所述第一权重函数为所述第一伽马曲线的系数,所述第二权重函数为所述第二伽马曲线的系数,同一像素单元对应的所述第一权重函数的值与所述第二权重函数的值的和为1;所述第一权重函数的值与第一像素单元至所述第一图像区域的第一边界的距离呈负相关,其中,所述第一像素单元为所述过渡图像区域中属于第一图像区域的像素单元,所述第一边界位于所述第一图像区域。Wherein, the first weight function is the coefficient of the first gamma curve, the second weight function is the coefficient of the second gamma curve, and the value of the first weight function corresponding to the same pixel unit is the same as The sum of the values of the second weight function is 1; the value of the first weight function is negatively correlated with the distance from the first pixel unit to the first boundary of the first image area, wherein the first pixel A unit is a pixel unit belonging to a first image area in the transition image area, and the first boundary is located in the first image area.
  6. 根据权利要求1至5任一项所述的方法,其中,所述方法还包括:The method according to any one of claims 1 to 5, wherein the method further comprises:
    确定与所述第一图像区域对应的第三伽马曲线;其中,所述第三伽马曲线是通过在图像 显示端进行标定而得到,所述第一伽马曲线是通过在图像传感器端进行标定而得到;Determining a third gamma curve corresponding to the first image area; wherein, the third gamma curve is obtained by performing calibration on the image display end, and the first gamma curve is obtained by performing calibration on the image sensor end obtained by calibration;
    根据所述第三伽马曲线,对所述第一图像区域进行伽马校正。Perform gamma correction on the first image area according to the third gamma curve.
  7. 根据权利要求6所述的方法,其中,所述确定与所述第一图像区域对应的第三伽马曲线,包括:The method according to claim 6, wherein said determining a third gamma curve corresponding to said first image region comprises:
    确定物理环境的光线特征;Determine the light characteristics of the physical environment;
    根据所述光线特征,确定对应的第三伽马曲线。According to the light characteristics, a corresponding third gamma curve is determined.
  8. 根据权利要求1至5任一项所述的方法,其中,所述基于待处理图像的第一视觉特征对所述待处理图像进行分割,以得到多个图像区域,包括:The method according to any one of claims 1 to 5, wherein the segmentation of the image to be processed based on the first visual feature of the image to be processed to obtain a plurality of image regions includes:
    将所述第一视觉特征落入同一特定区间的像素单元分割为一个图像区域,从而得到多个图像区域。The pixel units in which the first visual feature falls into the same specific interval are divided into one image area, so as to obtain multiple image areas.
  9. 根据权利要求1至5任一项所述的方法,其中,所述方法还包括:The method according to any one of claims 1 to 5, wherein the method further comprises:
    基于所述待处理图像的像素单元的第一视觉特征,确定所述待处理图像的整体的第二视觉特征;determining an overall second visual feature of the image to be processed based on the first visual feature of the pixel unit of the image to be processed;
    如果所述第二视觉特征满足分割条件,执行所述对待处理图像进行分割的步骤。If the second visual feature satisfies the segmentation condition, execute the step of segmenting the image to be processed.
  10. 根据权利要求9所述的方法,其中,所述方法还包括:The method according to claim 9, wherein the method further comprises:
    如果所述第二视觉特征不满足所述分割条件,确定与所述第二视觉特征对应的第四伽马曲线;以及根据所述第四伽马曲线,对所述待处理图像进行伽马校正。If the second visual feature does not satisfy the segmentation condition, determine a fourth gamma curve corresponding to the second visual feature; and perform gamma correction on the image to be processed according to the fourth gamma curve .
  11. 根据权利要求10所述的方法,其中,所述第二视觉特征包括以下至少之一:The method of claim 10, wherein the second visual characteristic comprises at least one of the following:
    所述待处理图像的像素单元的第一视觉特征的变化情况;The change of the first visual feature of the pixel unit of the image to be processed;
    所述待处理图像中是否包括光源;Whether the image to be processed includes a light source;
    所述光源的数目;the number of said light sources;
    所述光源的位置。The location of the light source.
  12. 根据权利要求11所述的方法,其中,所述分割条件包括以下至少之一:The method according to claim 11, wherein the segmentation condition comprises at least one of the following:
    表征所述变化情况的参数大于对应阈值;The parameter characterizing the change is greater than the corresponding threshold;
    所述待处理图像中包括光源;The image to be processed includes a light source;
    所述光源的数目大于对应阈值;The number of the light sources is greater than a corresponding threshold;
    所述光源的位置在特定位置。The position of the light source is at a specific position.
  13. 根据权利要求1所述的方法,其中,所述确定与第一图像区域对应的第一伽马曲线,包括:The method according to claim 1, wherein said determining the first gamma curve corresponding to the first image region comprises:
    获取不同的伽马曲线与表征场景的第三视觉特征的映射关系;Obtain the mapping relationship between different gamma curves and the third visual feature representing the scene;
    确定所述第一图像区域的整体的第四视觉特征;determining an overall fourth visual characteristic of the first image region;
    从所述表征场景的第三视觉特征中确定出与所述第四视觉特征相匹配的第三视觉特征;determining a third visual feature matching the fourth visual feature from the third visual features representing the scene;
    将与所述相匹配的第三视觉特征对应的伽马曲线确定为所述第一伽马曲线。A gamma curve corresponding to the matched third visual feature is determined as the first gamma curve.
  14. 一种图像处理芯片,包括处理器单元,所述处理器单元配置成:An image processing chip, comprising a processor unit configured to:
    执行如权利要求1至13中任一项所述的图像处理方法。Executing the image processing method according to any one of claims 1 to 13.
  15. 一种图像处理装置,包括:An image processing device, comprising:
    分割模块,配置成基于待处理图像的像素单元的第一视觉特征,对所述待处理图像进行分割,得到多个图像区域;其中,所述第一视觉特征包括以下至少之一:亮度、色温;The segmentation module is configured to segment the image to be processed based on the first visual feature of the pixel unit of the image to be processed to obtain a plurality of image regions; wherein the first visual feature includes at least one of the following: brightness, color temperature ;
    确定模块,配置成确定与第一图像区域对应的第一伽马曲线;其中,所述第一图像区域是所述多个图像区域的其中之一;A determination module configured to determine a first gamma curve corresponding to a first image area; wherein the first image area is one of the plurality of image areas;
    第一校正模块,配置成至少部分地基于所述第一伽马曲线,对所述第一图像区域进行伽马校正。A first correction module configured to perform gamma correction on the first image region based at least in part on the first gamma curve.
  16. 根据权利要求15所述的装置,其中,所述确定模块,配置成:The device according to claim 15, wherein the determining module is configured to:
    获取不同的伽马曲线与表征场景的第三视觉特征的映射关系;Obtain the mapping relationship between different gamma curves and the third visual feature representing the scene;
    确定所述第一图像区域的整体的第四视觉特征;determining an overall fourth visual characteristic of the first image region;
    从所述表征场景的第三视觉特征中确定出与所述第四视觉特征相匹配的第三视觉特征;determining a third visual feature matching the fourth visual feature from the third visual features representing the scene;
    将与所述相匹配的第三视觉特征对应的伽马曲线确定为所述第一伽马曲线。A gamma curve corresponding to the matched third visual feature is determined as the first gamma curve.
  17. 根据权利要求15所述的装置,其中,还包括第二校正模块;The device according to claim 15, further comprising a second calibration module;
    所述确定模块,还配置成确定与所述第一图像区域对应的第三伽马曲线;其中,所述第三伽马曲线是通过在图像显示端进行标定而得到,所述第一伽马曲线是通过在图像传感器端进行标定而得到;The determining module is further configured to determine a third gamma curve corresponding to the first image area; wherein, the third gamma curve is obtained by calibration at the image display terminal, and the first gamma curve The curve is obtained by calibration at the image sensor end;
    所述第二校正模块,配置成根据所述第三伽马曲线,对所述第一图像区域进行伽马校正。The second correction module is configured to perform gamma correction on the first image area according to the third gamma curve.
  18. 根据权利要求15所述的装置,其中,The apparatus of claim 15, wherein,
    所述确定模块,还配置成确定与第二图像区域对应的第二伽马曲线;其中,所述第二图像区域是所述多个图像区域中与所述第一图像区域相邻的另一图像区域;所述第一伽马曲线与所述第二伽马曲线不同;The determination module is further configured to determine a second gamma curve corresponding to a second image area; wherein the second image area is another one of the plurality of image areas that is adjacent to the first image area an image area; the first gamma curve is different from the second gamma curve;
    所述第一校正模块,还配置成基于所述第二伽马曲线,对所述第二图像区域进行伽马校正。The first correction module is further configured to perform gamma correction on the second image region based on the second gamma curve.
  19. 一种电子设备,包括存储器和处理器,所述存储器存储有可在处理器上运行的计算机程序,所述处理器执行所述程序时实现权利要求1至13任一项所述的方法。An electronic device, comprising a memory and a processor, the memory stores a computer program that can run on the processor, and the processor implements the method according to any one of claims 1 to 13 when executing the program.
  20. 一种计算机可读存储介质,其上存储有计算机程序,该计算机程序被处理器执行时实现如权利要求1至13任一项所述的方法。A computer-readable storage medium, on which a computer program is stored, and when the computer program is executed by a processor, the method according to any one of claims 1 to 13 is implemented.
PCT/CN2022/098683 2021-07-23 2022-06-14 Image processing method and apparatus, device, and storage medium WO2023000868A1 (en)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN202110836393.XA CN115689903A (en) 2021-07-23 2021-07-23 Image processing method and device, equipment and storage medium
CN202110836393.X 2021-07-23

Publications (1)

Publication Number Publication Date
WO2023000868A1 true WO2023000868A1 (en) 2023-01-26

Family

ID=84979802

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2022/098683 WO2023000868A1 (en) 2021-07-23 2022-06-14 Image processing method and apparatus, device, and storage medium

Country Status (2)

Country Link
CN (1) CN115689903A (en)
WO (1) WO2023000868A1 (en)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116072059A (en) * 2023-02-27 2023-05-05 卡莱特云科技股份有限公司 Image display method and device, electronic equipment and storage medium

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20100026731A1 (en) * 2008-07-31 2010-02-04 Sony Corporation Image processing circuit and image display apparatus
US20150244915A1 (en) * 2014-02-21 2015-08-27 Taro Kikuchi Image processing apparatus, image capturing apparatus, image correction method, and storage medium
CN108337450A (en) * 2017-01-19 2018-07-27 卡西欧计算机株式会社 Image processing apparatus, image processing method and recording medium
CN110139020A (en) * 2018-02-09 2019-08-16 杭州海康威视数字技术股份有限公司 A kind of image processing method and its device
CN112714356A (en) * 2020-12-18 2021-04-27 北京百度网讯科技有限公司 Image brightness correction method, device, equipment and storage medium

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20100026731A1 (en) * 2008-07-31 2010-02-04 Sony Corporation Image processing circuit and image display apparatus
US20150244915A1 (en) * 2014-02-21 2015-08-27 Taro Kikuchi Image processing apparatus, image capturing apparatus, image correction method, and storage medium
CN108337450A (en) * 2017-01-19 2018-07-27 卡西欧计算机株式会社 Image processing apparatus, image processing method and recording medium
CN110139020A (en) * 2018-02-09 2019-08-16 杭州海康威视数字技术股份有限公司 A kind of image processing method and its device
CN112714356A (en) * 2020-12-18 2021-04-27 北京百度网讯科技有限公司 Image brightness correction method, device, equipment and storage medium

Also Published As

Publication number Publication date
CN115689903A (en) 2023-02-03

Similar Documents

Publication Publication Date Title
JP5772991B2 (en) Electronics
US10013739B2 (en) Image enhancement methods and systems using the same
US8538147B2 (en) Methods and appartuses for restoring color and enhancing electronic images
CN107274351B (en) Image processing apparatus, image processing system, and image processing method
JPWO2006059573A1 (en) Color adjustment apparatus and method
JP3959909B2 (en) White balance adjustment method and adjustment device
KR20070090224A (en) Method of electronic color image saturation processing
WO2021218603A1 (en) Image processing method and projection system
US20180232862A1 (en) Image processing device and image processing method
CN112351195B (en) Image processing method, device and electronic system
JP4595569B2 (en) Imaging device
WO2023000868A1 (en) Image processing method and apparatus, device, and storage medium
KR20190073516A (en) Image processing apparatus, digital camera, image processing program, and recording medium
US10970822B2 (en) Image processing method and electronic device thereof
WO2023284528A1 (en) Image enhancement method and apparatus, computer device, and storage medium
CN109982012B (en) Image processing method and device, storage medium and terminal
JP4359662B2 (en) Color image exposure compensation method
TWI438718B (en) Image processing method and system by using adaptive inverse hyperbolic curve
JP2012028937A (en) Video signal correction apparatus and video signal correction program
WO2022067761A1 (en) Image processing method and apparatus, capturing device, movable platform, and computer readable storage medium
JP2002369004A (en) Image processing unit, image output device, image processing method and storage medium
JP5050141B2 (en) Color image exposure evaluation method
WO2013114802A1 (en) Image processing device, image processing method therefor, computer program, and image processing system
JP2013115571A (en) Information processing apparatus
JP6403811B2 (en) Image processing apparatus and program

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 22845035

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE