Search

CN-122023208-A - Image processing method, electronic device, readable storage medium and program product

CN122023208ACN 122023208 ACN122023208 ACN 122023208ACN-122023208-A

Abstract

The embodiment of the application discloses an image processing method, electronic equipment, a readable storage medium and a program product. The electronic device may adjust a first parameter of a second image corresponding to the first local area in the first image according to information of the second image, where the first parameter includes one or more of sharpness, contrast, and dynamic range. The method can adjust the first parameter of the second image corresponding to the first local area in the first image to be in a proper range, such as moderate contrast, moderate definition and moderate dynamic range, thereby not only providing a visual effect for the comfort of human eyes, but also restoring a real and realistic viewing experience, and enabling the human eyes to perceive layering, light and shadow, details and the like of the image.

Inventors

  • MA ZHONGKE
  • PENG XIAOHANG
  • ZHANG YIYANG
  • LI BOHAN
  • XU CHANG
  • WANG ZIZHONG
  • AI JINQIN

Assignees

  • 华为技术有限公司

Dates

Publication Date
20260512
Application Date
20250610

Claims (20)

  1. 1. An electronic device, comprising: A memory for storing a computer program; The processor is configured to execute the computer program to cause the electronic device to implement: Determining a first local region in the first image; According to the information of a second image corresponding to the first local area in the first image, adjusting a first parameter of the second image, wherein the first parameter comprises one or more of definition, contrast and dynamic range, and the first parameter after adjustment is larger than the first parameter before adjustment; And displaying the second image according to the adjusted first parameter.
  2. 2. The electronic device of claim 1, wherein the processor is further configured to execute the computer program to cause the electronic device to implement: determining a second local region in the first image; and adjusting a second parameter of a third image corresponding to the second local area in the first image according to the information of the third image, wherein the second parameter comprises one or more of definition, contrast and dynamic range, and the adjusting value of the second parameter is different from the adjusting value of the first parameter.
  3. 3. The electronic device of claim 1 or 2, wherein the processor is further configured to execute the computer program to cause the electronic device to: Displaying the first image, receiving a first operation on the first image, and determining the first local area in the first image according to the area acted on by the first operation in the first image.
  4. 4. The electronic device of claim 1 or 2, wherein the processor is further configured to execute the computer program to cause the electronic device to: shooting to obtain the first image; the determining a first local region in a first image includes determining the first local region of the first image from a face region or a hand region in the first image.
  5. 5. The electronic device of any of claims 1-4, wherein the adjusting the first parameter of the second image comprises: the first parameter is adjusted by adjusting one or more of the following of the pixels in the second image, R-channel component, G-channel component, B-channel component, gray scale.
  6. 6. The electronic device of claim 5, wherein the processor is further configured to execute the computer program to cause the electronic device to implement: inputting the gray level of the pixel in the second image before adjustment into a first model to obtain a mapping relation between the gray level of the pixel in the second image before adjustment and the gray level of the pixel in the second image after adjustment, and determining the gray level of the pixel in the second image after adjustment according to the mapping relation and the gray level of the pixel in the second image before adjustment; Determining R channel components, G channel components and B channel components of the pixels in the second image after adjustment; The ratio of the R channel component of the pixel in the second image before and after adjustment, the ratio of the G channel component of the pixel in the second image before and after adjustment, and the ratio of the B channel component of the pixel in the second image before and after adjustment are equal to the ratio of the gray scale of the pixel in the second image before and after adjustment.
  7. 7. The electronic device of claim 5, wherein the processor is further configured to execute the computer program to cause the electronic device to at least one of: Inputting R channel components of pixels in the second image before adjustment into a first model to obtain a mapping relation between the R channel components of the pixels in the second image before adjustment and after adjustment, and determining R channel components of the pixels in the second image after adjustment according to the mapping relation between the R channel components of the pixels in the second image before adjustment and after adjustment; Inputting the G channel component of the pixel in the second image before adjustment into the first model to obtain a mapping relation between the G channel component of the pixel in the second image before adjustment and the G channel component after adjustment, and determining the G channel component of the pixel in the second image after adjustment according to the mapping relation between the G channel component before adjustment and the G channel component after adjustment; And inputting the B channel component of the pixel in the second image before adjustment into the first model to obtain a mapping relation between the B channel component of the pixel in the second image before adjustment and the B channel component after adjustment, and determining the B channel component of the pixel in the second image after adjustment according to the mapping relation between the B channel component before adjustment and the B channel component after adjustment.
  8. 8. The electronic device of claim 6 or 7, wherein the processor is specifically configured to execute the computer program to cause the electronic device to implement: Inputting the first image and the position of the first local area in the first image into a first model; Or inputting the second image corresponding to the first local area obtained by clipping from the first image into the first model; Or inputting the histogram of the second image corresponding to the first local area, which is obtained by clipping from the first image, into the first model.
  9. 9. The electronic device of any of claims 6-8, further comprising an NPU in which the first model operates, the processor being specifically configured to execute the computer program to cause the electronic device to implement: caching the first image and the position of the first local area in the first image; and running the first model in the NPU, acquiring the cached first image and the position of the first local area in the first image through the NPU, and inputting the first image and the position of the first local area into the first model.
  10. 10. The electronic device of claim 9, further comprising an image buffer, the processor being operable to execute the computer program to cause the electronic device to: the location of the first local area in the first image is cached in a first field of the image buffer or in a first field of a metadata storage field in the image buffer.
  11. 11. The electronic device according to any one of the claims 6-10, characterized in that, The first model is trained by the following process: Acquiring a plurality of training image pairs, wherein one training image pair comprises a first training image and a second training image, the content of an image corresponding to a first area in the first training image is the same as that of the second training image, a third parameter of the second training image is larger than a fourth parameter of the image corresponding to the first area, and the third parameter and the fourth parameter comprise one or more of definition, contrast and dynamic range; determining a reference mapping relation of each training image pair, wherein the reference mapping relation represents the corresponding relation between the information of the image corresponding to the first area and the information of the second training image in one training image pair; And training the plurality of training image pairs to obtain the first model, wherein in the training process, information of images corresponding to the first region in the training image pairs is used as input, and a reference mapping relation of the training image pairs is used as reference output.
  12. 12. The electronic device of claim 11, wherein the second training image is a hue-optimized and/or sharpness-optimized image.
  13. 13. The electronic device of any one of claims 1-12, wherein the processor is further configured to execute the computer program to cause the electronic device to: And determining that the first parameter of the second image corresponding to the first local area in the first image needs to be adjusted.
  14. 14. The electronic device of claim 13, wherein the processor is specifically configured to execute the computer program to cause the electronic device to implement: It is determined that the gray data in the histogram of the second image is centered at a first gray level.
  15. 15. The electronic device of any one of claims 1-14, wherein the processor is further configured to execute the computer program to cause the electronic device to: and receiving a second operation, and starting the first function according to the second operation.
  16. 16. The electronic device of any one of claims 1-15, wherein the processor is further configured to execute the computer program to cause the electronic device to: displaying a setting interface, wherein the second operation acts on the setting interface.
  17. 17. The electronic device of any of claims 1-16, wherein the first image is an image in a gallery application.
  18. 18. An image processing method, wherein the method is applied to an electronic device, the method comprising: Determining a first local region in the first image; According to the information of a second image corresponding to the first local area in the first image, adjusting a first parameter of the second image, wherein the first parameter comprises one or more of definition, contrast and dynamic range, and the first parameter after adjustment is larger than the first parameter before adjustment; And displaying the second image according to the adjusted first parameter.
  19. 19. The method of claim 18, wherein the method further comprises: determining a second local region in the first image; and adjusting a second parameter of a third image corresponding to the second local area in the first image according to the information of the third image, wherein the second parameter comprises one or more of definition, contrast and dynamic range, and the adjusting value of the second parameter is different from the adjusting value of the first parameter.
  20. 20. The method according to claim 18 or 19, characterized in that the method further comprises: Displaying the first image, receiving a first operation on the first image, and determining the first local area in the first image according to the area acted on by the first operation in the first image.

Description

Image processing method, electronic device, readable storage medium and program product Technical Field The present application relates to the field of image processing technologies, and in particular, to an image processing method, an electronic device, a readable storage medium, and a program product. Background When an electronic device displays an image, a user often has the need to zoom in on a local area of the image and view the local area. Disclosure of Invention The embodiment of the application discloses an image processing method, electronic equipment, a readable storage medium and a program product, wherein a first parameter of a second image corresponding to a first local area in a first image can be adjusted to be in a proper range, such as moderate contrast, moderate definition and moderate dynamic range, so that a visual effect comfortable to eyes can be provided, a real and in-situ viewing experience can be restored, and the human eyes can sense layering, light and shadow, details and the like of the image. In a first aspect, an electronic device is provided, including a memory configured to store a computer program, and a processor configured to execute the computer program to cause the electronic device to determine a first local area in a first image, adjust a first parameter of a second image according to information of the second image corresponding to the first local area in the first image, the first parameter including one or more of sharpness, contrast, and dynamic range, the adjusted first parameter being greater than a first parameter before adjustment, and display the second image according to the adjusted first parameter. The electronic device of the first aspect may adjust the first parameter of the second image according to information of the second image corresponding to the first local area in the first image, and in particular, improve the first parameter of the second image corresponding to the first local area in the first image. The adjusted first parameter of the second image is in a proper range, such as moderate contrast, moderate definition and moderate dynamic range, so that not only can the visual effect of comfort of human eyes be provided, but also the viewing experience of reality and presence can be restored, and the human eyes can sense layering, light and shadow, details and the like of the image. With reference to the first aspect, in some embodiments, the processor is further configured to execute the computer program to cause the electronic device to determine a second local area in the first image, and adjust a second parameter of the third image according to information of the third image corresponding to the second local area in the first image, where the second parameter includes one or more of sharpness, contrast, dynamic range, and an adjustment value of the second parameter is different from an adjustment value of the first parameter. According to the embodiment, when the local areas determined by the electronic device are different, the electronic device can adjust the first parameters of the images corresponding to the different local areas in the first image, and the adjustment values of the images corresponding to the different local areas can be different, so that the adaptive adjustment of the images corresponding to the local areas is realized. The images corresponding to different local areas in the first image may be images of different positions and different resolutions in the first image. With reference to the first aspect or any implementation of the first aspect, in some implementations, the processor is further configured to execute the computer program to cause the electronic device to display a first image, receive a first operation on the first image, and determine a first local area in the first image according to an area acted on by the first operation in the first image. According to the embodiment, the electronic device determines the first local area in the first image according to the received first operation, the electronic device can keep synchronous with the user operation, the image quality of the second image in the first image is optimized according to the user intention in real time, and the effect that the user pays attention to which local area in the first image, and the image quality of the image corresponding to the local area is optimized is achieved. In connection with the above embodiment, the first operation may be, for example, a zoom-in operation, an operation of moving the entire image, an operation of clicking a certain position in the entire image, or the like. The zoom-in operation may include various kinds, such as an operation in which two fingers of a user are spread on a display screen, an operation in which a certain position in the entire image is double-clicked, an operation acting on a zoom-in control, an operation in which a mouse wheel is scrolled upward, and the like, to which the embodiment