Image processing method and device and readable storage medium

By determining mutual information in the RGB color space and converting it to the HSV color space, the degree of purple fringing is evaluated, which solves the problem of purple fringing phenomenon in digital imaging devices under backlight conditions and enables accurate evaluation of image quality and device photography capabilities.

CN121661156APending Publication Date: 2026-03-13HONOR DEVICE CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-08-27
Publication Date
2026-03-13

AI Technical Summary

Technical Problem

When shooting in backlight or with a wide aperture, the chromatic aberration of the lens of a digital imaging device causes the blue and red channels to fail to focus accurately, resulting in purple edges or color shifts in local areas of the image. Existing technologies make it difficult to accurately assess image quality and the photographic capabilities of electronic devices.

Method used

By acquiring the channel information of the first image in the RGB color space, determining the mutual information, converting the color space to the HSV color space, and using the offset coefficient to evaluate the degree and range of purple fringing, a data basis is provided for purple fringing calibration or correction.

Benefits of technology

Accurately and objectively assess the degree and extent of purple fringing in images, improve image quality, and accurately compare the photographic capabilities of different electronic devices.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121661156A_ABST
    Figure CN121661156A_ABST
Patent Text Reader

Abstract

The invention provides an image processing method and device and a readable storage medium, and is applied to the technical field of image processing, and the method comprises the steps: obtaining a first image, and determining first mutual information based on channel information (such as R, G and B channel information in an RGB color space) of the first image in a first color space; further, performing color space conversion processing on the first image to obtain a second image in a second color space (such as an HSV color space); a first value is determined based on a first offset coefficient corresponding to the first mutual information and the second image. Therefore, the purple edge degree and / or the purple edge range of the first image can be accurately and objectively evaluated by determining the first numerical value, and a data basis can be provided for subsequent purple edge calibration processing or purple edge correction processing.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of image processing technology, and more specifically, to a method, apparatus, and readable storage medium for image processing. Background Technology

[0002] With the development of digital imaging devices (such as mobile phone cameras, digital cameras, and surveillance cameras), users can use different digital imaging devices to capture images. When users use digital imaging devices to shoot under conditions such as backlighting and wide aperture, due to lens chromatic aberration (including lateral and longitudinal chromatic aberration), different wavelengths of light cannot converge at the same point after passing through the lens, resulting in the blue and red channels not being able to focus accurately. Therefore, local areas of the image captured by the digital imaging device, especially high-contrast edge areas, will show purple edges or purple color shift. Summary of the Invention

[0003] This application provides a method, apparatus, and readable storage medium for image processing, which can accurately and objectively evaluate the quality of images and the photographic capabilities of different electronic devices.

[0004] In a first aspect, this application provides a method for image processing, the method comprising:

[0005] Acquire the first image; the first image uses the first color space;

[0006] Based on the channel information of the first image in the first color space, a first mutual information is determined; the channel information includes first channel information, second channel information, and third channel information; the first mutual information is determined based on the second mutual information and the third mutual information, the second mutual information is determined based on the first channel information and the second channel information, and the third mutual information is determined based on the first channel information and the third channel information; the first mutual information corresponds to the first offset coefficient.

[0007] The first image is converted to a different color space to obtain a second image, which is the image corresponding to the first image in a different color space.

[0008] A first value is determined based on a first offset coefficient and a second image; the first value is used to represent the degree and / or range of purple fringing in the first image.

[0009] This embodiment of the application acquires a first image, which yields a color image using a first color space (e.g., RGB color space). Then, based on the channel information of the first image in the first color space (e.g., R, G, B channel information in RGB color space), a first mutual information, i.e., the maximum mutual information, can be determined. Furthermore, by performing color space conversion processing on the first image, a second image in a second color space (e.g., HSV color space) different from the first color space can be obtained. Further, based on a first offset coefficient corresponding to the first mutual information and the second image, a first numerical value is determined. Thus, by determining the first numerical value, the degree and / or range of purple fringing in the first image can be accurately and objectively evaluated, and an accurate data basis can be provided for subsequent purple fringing calibration or correction processing.

[0010] Furthermore, in evaluating the photographic capabilities of different types and / or models of electronic devices, embodiments of this application can employ the same photographing conditions to obtain multiple first images. For example, the same photographing conditions involve different electronic devices acquiring images under the same light source (e.g., a D65 light source) and / or the same field of view (e.g., a central field of view). By acquiring multiple first images under the same light source and / or the same field of view, interference from other external conditions on image quality evaluation can be avoided, resulting in more accurate image quality evaluation results.

[0011] In some possible implementations, the first mutual information is determined based on the channel information of the first image in the first color space, including:

[0012] Based on each of multiple offset coefficients, the first channel information is offset to obtain multiple fourth channel information; the multiple offset coefficients include the first offset coefficient; based on each of the multiple fourth channel information and the second channel information, multiple second mutual information is determined; the second mutual information is used to represent the dependency relationship between the first channel information and the second channel information under the corresponding offset coefficient; based on each of the multiple fourth channel information and the third channel information, multiple third mutual information is determined; the third mutual information is used to represent the dependency relationship between the first channel information and the third channel information under the corresponding offset coefficient; based on the multiple second mutual information and the multiple third mutual information, the first mutual information is determined; the first mutual information is the largest mutual information among the multiple second mutual information and the multiple third mutual information. Therefore, by determining the first mutual information, the first offset coefficient corresponding to the first mutual information can be obtained, thus providing a data basis for the subsequent calculation of the first value.

[0013] In some possible implementations, the multiple offset coefficients also include a second offset coefficient; the first channel information includes multiple first coordinates; the multiple first coordinates are used to represent the positions corresponding to multiple pixels in the first channel information;

[0014] The method further includes: determining a sampling window and first information based on the size of the first image; the sampling window is a local region in the first image; the first information includes at least one or more of the following: the size of the sampling window, the step size of the sampling window, the sampling range of the sampling window, and the center coordinates of the sampling window; offsetting each first coordinate in the sampling window based on a second offset coefficient, and traversing the first image based on the sampling window to obtain fourth channel information; the fourth channel information includes multiple second coordinates; the multiple second coordinates are used to represent the position after offsetting the multiple first coordinates;

[0015] Based on each of the fourth channel information and the second channel information in the multiple fourth channel information, multiple second mutual information is determined, including: based on multiple second coordinates and multiple third coordinates in the second channel information, multiple second mutual information is determined; the multiple third coordinates are used to represent the positions corresponding to multiple pixels in the second channel information;

[0016] Based on each of the fourth channel information and the third channel information, multiple third mutual information is determined, including: determining multiple third mutual information based on multiple second coordinates and multiple fourth coordinates in the third channel information; the multiple fourth coordinates are used to represent the positions corresponding to multiple pixels in the third channel information. Therefore, by setting a sampling window, the range of the local region operated by the algorithm can be defined, and by setting a sampling window, erroneous analysis or processing caused by insufficient pixels in the edge regions of the first image can be avoided. In addition, by traversing the first image based on the sampling window to obtain the fourth channel information, preparation can be made for determining multiple second mutual information and multiple third mutual information, thereby providing a data basis for determining the first mutual information, that is, the maximum mutual information among multiple second mutual information and multiple third mutual information.

[0017] In some possible implementations, the first color space is the RGB color space; the first channel information is the G channel information of the first image in the RGB color space; the second channel information is the R channel information of the first image in the RGB color space; and the third channel information is the B channel information of the first image in the RGB color space.

[0018] In some possible implementations, determining a first value based on a first offset coefficient and a second image includes: determining a first ratio based on the first offset coefficient and a preset offset range; determining a second ratio based on a first number of pixels and a second number of pixels; the first number of pixels being the number of pixels in the second image within a preset hue range; the preset hue range representing the purple range in a second color space; the second number of pixels being the number of pixels included in the second image; and calculating the first value based on the first ratio, the first weight, the second ratio, and the second weight. Therefore, by calculating the first value, the image quality of the first image, i.e., the degree and / or range of purple fringing, can be accurately and objectively evaluated, and a data basis can be provided for subsequent purple fringing calibration or correction processing of the first image using the first value.

[0019] In some possible implementations, before determining the second ratio based on the first and second pixel counts, the method further includes: determining a purple region in the second image based on a preset hue range; and determining the first pixel count based on the purple region in the second image. Therefore, determining the first pixel count prepares for subsequently determining the second ratio.

[0020] In some possible implementations, the second color space is any of the following color spaces: HSV color space, LAB color space, and YUV color space. Therefore, by converting the first image to a second image in any of the aforementioned second color spaces, it is possible to prepare for determining the purple region in the second image in the second color space.

[0021] In some possible implementations, after determining the first value, the method further includes: performing purple fringing calibration or correction processing on the first image based on the first value to obtain and display the processed image. Therefore, by using the first value to perform purple fringing calibration or correction processing on the first image to obtain and display the processed image, the purple fringing phenomenon in the first image can be eliminated, improving the user's visual experience.

[0022] In some possible implementations, acquiring the first image includes: acquiring the first image in response to a first user operation. Therefore, the first image provides a data basis for subsequently determining a first value, and also provides a data basis for performing purple fringing calibration or correction processing on the first image using the first value.

[0023] In a second aspect, this application provides an apparatus for image processing, including a processor; when the processor executes computer code or instructions in memory, the apparatus for image processing causes the image processing method in the first aspect and any possible design of the first aspect to perform the image processing method.

[0024] Thirdly, this application provides a chip system applied to an electronic device including a memory, a display screen, and a sensor; the chip system includes: one or more interface circuits and one or more processors; the interface circuits and processors are interconnected via lines; the interface circuits are used to receive signals from the memory and send signals to the processors, the signals including computer code or instructions stored in the memory; the processor invokes the computer code or instructions to cause the apparatus for image processing to perform the image processing method in the first aspect and any possible design of the first aspect.

[0025] The chip system may include one chip or multiple chips; when the chip system includes multiple chips, this application does not limit the type and number of chips.

[0026] Fourthly, this application provides a readable storage medium storing code or instructions, which a processor invokes to cause an apparatus for image processing to perform the image processing method of the first aspect and any possible design of the first aspect.

[0027] Fifthly, this application provides a computer program product that, when run on a computer, causes the computer to execute the image processing method in the first aspect and any possible design of the first aspect.

[0028] It is understood that the beneficial effects of the second to fifth aspects mentioned above can be found in the relevant descriptions in the first aspect mentioned above, and will not be repeated here. Attached Figure Description

[0029] Figure 1 This is a schematic diagram illustrating an application scenario of an image processing method provided in an embodiment of this application;

[0030] Figure 2 This is a schematic diagram of a scene for acquiring an image, provided as an embodiment of this application.

[0031] Figure 3 A schematic diagram of an embodiment of this application;

[0032] Figure 4 A schematic diagram of an embodiment of this application;

[0033] Figure 5 A schematic diagram of an embodiment of this application;

[0034] Figure 6 A flowchart illustrating a method for image processing provided in an embodiment of this application;

[0035] Figure 7A first image schematic diagram provided for an embodiment of this application;

[0036] Figure 8 A first image schematic diagram provided for an embodiment of this application;

[0037] Figure 9 This is a schematic diagram illustrating the result of a first mutual information provided in an embodiment of this application;

[0038] Figure 10 This is a schematic diagram illustrating the result of a first mutual information provided in an embodiment of this application;

[0039] Figure 11 A flowchart illustrating a method for image processing provided in an embodiment of this application;

[0040] Figure 12 A schematic diagram illustrating the results of a second mutual information and a third mutual information provided in an embodiment of this application;

[0041] Figure 13 This is a schematic diagram illustrating the effect of the purple area provided in one embodiment of this application;

[0042] Figure 14 A schematic diagram of the hardware structure of an image processing apparatus provided in an embodiment of this application;

[0043] Figure 15 This application provides a schematic diagram of the hardware system of a terminal device.

[0044] Figure 16 This is a schematic diagram of the software system of a terminal device provided in an embodiment of this application. Detailed Implementation

[0045] The technical solutions of the embodiments of this application will be described below with reference to the accompanying drawings. In the description of the embodiments of this application, unless otherwise stated, " / " means "or," for example, A / B can mean A or B; "and / or" in this text is merely a description of the relationship between related objects, indicating that three relationships can exist. For example, A and / or B can represent: A existing alone, A and B existing simultaneously, and B existing alone. Furthermore, in the description of the embodiments of this application, "multiple" refers to two or more than two.

[0046] Hereinafter, the terms "first," "second," and "third" are used for descriptive purposes only and should not be construed as indicating or implying relative importance or implicitly specifying the number of technical features indicated. Thus, a feature defined as "first," "second," or "third" may explicitly or implicitly include one or more of that feature.

[0047] The image processing method provided in this application can be applied to scenarios where it is necessary to accurately determine the degree and / or range of purple fringing in an image, and / or to perform subsequent analysis and processing based on the degree and / or range of purple fringing in the image.

[0048] In some embodiments, the method for generating image data provided in this application can be applied to scenarios such as comparing the photographic capabilities of different electronic devices, evaluating image quality, calibrating purple fringing in images, correcting purple fringing in images, or evaluating the results of color difference correction in images.

[0049] In some embodiments, the image processing method provided in this application can be applied to an image processing device having a microcontroller unit (MCU) or a single-chip microcomputer.

[0050] For example, the image processing apparatus in this application embodiment can be a server or other image processing apparatus. The server can be a standalone physical server, a server cluster consisting of multiple physical servers, or a distributed system. The server can also be a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud functions, cloud storage, network services, cloud communication, middleware services, domain name services, security services, and big data and artificial intelligence platforms. This application embodiment does not impose any restrictions on the specific type of server.

[0051] Optionally, when the image processing apparatus in this embodiment is a server, the server can establish a communication connection with other electronic devices (e.g., terminal devices). The server can obtain the image to be processed from other electronic devices, and after using the image processing method in this embodiment, it can output the processed image or transmit the processed image to other electronic devices.

[0052] In some embodiments, the image processing apparatus provided in this application can also be a terminal device. The terminal device can be a mobile phone, foldable screen, smart screen, tablet computer, wearable electronic device, in-vehicle electronic device, augmented reality (AR) device, virtual reality (VR) device, laptop computer, ultra-mobile personal computer (UMPC), netbook, personal digital assistant (PDA), home appliance, projector, or digital camera, etc. This application does not impose any limitations on the specific type of terminal device.

[0053] Optionally, when the image processing apparatus in this application embodiment is a terminal device, the terminal device can acquire the image to be processed, and after adopting the image processing method in this application embodiment, it can output the processed image.

[0054] In some embodiments, for scenarios involving comparing the photographic capabilities of different electronic devices, the image processing apparatus of this application embodiment can use the image processing method of this application embodiment to process images captured by different electronic devices (e.g., mobile phones and tablets; or, for example, mobile phone A and mobile phone B) to obtain a first value corresponding to each image. Furthermore, by comparing the first values ​​corresponding to different images, the image processing apparatus of this application embodiment can accurately evaluate and compare the photographic capabilities of different electronic devices.

[0055] In another embodiment, for the scenario of image purple fringing correction, the image processing apparatus of this application embodiment can employ the image processing method of this application embodiment to process the image acquired by the electronic device to obtain a first value corresponding to the image. Then, the image processing apparatus of this application embodiment can perform purple fringing correction processing on the image based on the first value corresponding to the image, thereby eliminating the purple fringing phenomenon in the image and improving image quality. Here, the electronic device used for acquiring the image can be the image processing apparatus itself, or it can be a different device than the image processing apparatus; there is no limitation on this.

[0056] It should be noted that the different electronic devices mentioned in the above scenarios refer to different types and / or models of electronic devices. For example, different electronic devices can be different models of mobile phones; or different electronic devices can be a mobile phone and a digital camera; or different electronic devices can be a mobile phone and a tablet computer. This application embodiment does not limit this.

[0057] It is understood that those skilled in the art can select different electronic devices based on specific application scenarios to compare the photographic capabilities of different electronic devices, and this application does not limit this.

[0058] For example, in a scenario comparing the photographic capabilities of different electronic devices, those skilled in the art can select different models of mobile phones to capture images, so that the image processing apparatus of this application can process the images captured by different models of mobile phones respectively, and further accurately determine a certain model of mobile phone with higher photographic capabilities, or in other words, better image quality, based on the processing results of the images captured by different models of mobile phones.

[0059] For example, in the scenario of image quality evaluation, those skilled in the art can choose to collect images using a mobile phone and a digital camera respectively, so that the device for image processing in this application embodiment can accurately determine whether the electronic device with higher image quality is a mobile phone or a digital camera based on the images collected by the mobile phone and the images collected by the digital camera.

[0060] The following is combined with Figures 1 to 5 This paper details an application scenario of an embodiment of this application.

[0061] Please see Figure 1 , Figure 1 The illustration shows an application scenario diagram of an image processing method provided by an embodiment of this application.

[0062] like Figure 1 As shown, the electronic device may include a mobile phone 10 and a tablet computer 20. The mobile phone 10 and the tablet computer 20 are two different types of electronic devices. The mobile phone 10 is communicatively connected to the server 30. The tablet computer 20 is communicatively connected to the server 30.

[0063] Optionally, in some embodiments, the mobile phone 10 is used to capture image 1 and transmit image 1 to the server 30. This allows the server 30 to perform corresponding processing on image 1.

[0064] When the user is using phone 10, phone 10 can display as follows: Figure 2 Interface 11 is shown in Figure (1) of the document. (See Figure 1) Figure 2 As shown in Figure (1), the mobile phone 10 has multiple applications installed. These applications may include a camera 101, contacts, phone, and photo album.

[0065] like Figure 2 As shown in Figure (1), the mobile phone 10 displays the interface of the camera 101 application in response to the user's trigger operation on the camera 101 in the interface 11 (e.g., single click, multiple clicks or long press).

[0066] like Figure 2 As shown in Figure (2), the interface 12 displayed by the mobile phone 10 is an internal interface of the camera 101. The interface 12 may include various shooting modes of the camera 101. The various shooting modes may include aperture mode, night mode, portrait mode, photo mode, video mode, and professional mode, etc.

[0067] like Figure 2 As shown in Figure (2), the interface 12 may also include a viewfinder 102, a control 103, and a control 104. In response to the user's triggering operation on different controls in the interface 12, the mobile phone 10 can perform different operations.

[0068] Optionally, the viewfinder 102 is used to display the image 1 to be captured (e.g., Figure 2 (2) The tree image shown in Figure 101 or the video to be recorded. For example, in the shooting mode of camera 101, the viewfinder 102 is used to display the tree image to be photographed.

[0069] Optionally, control 103 is used to display the captured image (e.g., Figure 2 (2) The image of the person shown in the figure) or the recorded video. In response to the user's trigger operation on the control 103, the mobile phone 10 can display the captured image or the recorded video.

[0070] Optionally, control 104 is used to trigger the start of shooting. For example... Figure 2 As shown in Figure (2), the mobile phone 10 can start capturing image 1 in response to the user's trigger operation on the control 104.

[0071] After the shoot, such as Figure 2 As shown in Figure (3), the interface displayed by the mobile phone 10 is interface 13. The control 103 in interface 13 displays the captured image 1 (for example, Figure 2 The image of the tree shown in Figure (3) is displayed in the viewfinder 102 of interface 13 (e.g., as shown in Figure 3). The image to be captured is displayed in the viewfinder 102 of interface 13 (e.g., as shown in Figure 3). Figure 2 (3) The checkerboard image shown in Figure (3).

[0072] It should be noted that the above-described implementation of image 1 obtained by mobile phone 10 is only illustrative and the embodiments of this application are not limited thereto. For example, in response to the user's voice command to take a picture, mobile phone 10 can automatically open camera 101, complete the photo-taking action, and obtain image 1.

[0073] Optionally, in some embodiments, purple fringing may be present in image 1. Purple fringing can also be referred to as chromatic aberration, purple edge, purple color shift, or purple fringing. It is an optical phenomenon caused during the imaging process by the combined effects of chromatic aberration (including axial and longitudinal chromatic aberration), optical diffraction, and image digitization within the mobile phone's camera.

[0074] During the imaging process, due to the inherent properties of the camera material in a mobile phone, the camera refracts light of different spectra (or different colors of light) to different degrees. This causes light of different spectra to bend to different degrees when passing through the camera, which in turn causes light of different spectra to fail to focus on the same point. This results in deviations in the imaging of different colors of light, causing the edges of objects in the image to appear in colors that do not belong to the objects themselves, i.e., purple fringing.

[0075] It should be noted that there are many reasons why purple fringing may appear in images, and this application does not limit the causes. For example, in high dynamic range (HDR) scenes, i.e., high-contrast environments, when a user takes a photo with a mobile phone, the different response speeds and sensitivities of different color channels in the image cause color distortion at the edges of objects, i.e., purple fringing. Another example is when a mobile phone uses a large aperture to shoot; because the aperture is large, more light passes through the camera, making the purple fringing more noticeable in the resulting image. Yet another example is that when the quality of the mobile phone's camera is low, purple fringing may appear in the captured image.

[0076] It should also be noted that in practical applications, purple fringing in images typically occurs in localized areas, especially high-contrast regions, i.e., areas with significant brightness contrast (e.g., the boundary between a bright sky and a dark object). Furthermore, the specific color of the purple fringing can vary depending on camera specifications, coating differences, and the actual shooting angle; this embodiment does not limit this. For example, the specific color of the purple fringing could be purple, magenta, magenta, or light blue stripes, etc.

[0077] For example, in the case where purple fringing exists in image 1, such as Figure 3 As shown, image 1 may include purple-bordered region 1, purple-bordered region 2, and purple-bordered region 3.

[0078] It should be noted that, in the embodiments of this application... Figure 2 Figure (2) in the middle and Figure 2 Image 1 shown in Figure (3) is an example image. Figure 3 This is the actual effect of image 1. Additionally, Figure 3 Purple-edged regions 1, 2, and 3 in Image 1 are shown as illustrative examples only and do not constitute a limitation on the purple-edged regions in Image 1. Figure 3 Image 1 shown may also include other unmarked purple areas besides purple-bordered areas 1, 2, and 3.

[0079] Optionally, in some embodiments, the tablet computer 20 is used to capture image 2 and transmit image 2 to the server 30. Image 2 differs from image 1 captured by the mobile phone 10 in image quality, i.e., the degree and / or range of purple fringing.

[0080] For example, in the case where purple fringing exists in image 2, such as Figure 4 As shown, image 2 may include purple-bordered region 4 and purple-bordered region 5.

[0081] It should be noted that the specific implementation method of the tablet computer 20 obtaining image 2 is similar to the implementation method of the mobile phone 10 obtaining image 1, and can be found in the relevant description of the mobile phone 10 obtaining image 1 above, which will not be repeated here. In addition, Figure 4 The purple-edged regions 4 and 5 in Image 2 shown are for illustrative purposes only and do not constitute a limitation on the purple-edged regions in Image 2.

[0082] It should also be noted that images 1 and 2 above are merely illustrative examples, such as... Figure 3 and Figure 4 As shown, both Images 1 and 2 include tree branches, sky, and buildings. The purple fringing in both Images 1 and 2 occurs at the boundary between the tree branches and the sky, and the color of the purple fringing in both Images 1 and 2 is purple. However, this embodiment is not limited to this. In practical applications, purple fringing can also occur when the subject is another object (e.g., ...). Figure 2 The image of the chessboard shown in Figure (3) is shown in the figure.

[0083] Considering that checkerboard images are typically used as test objects in scenarios comparing the photographic capabilities of different electronic devices, this embodiment can also use checkerboard images for image processing. After the electronic device (e.g., mobile phone 10 or tablet computer 20) captures the checkerboard image, purple fringing may also exist in the checkerboard image (e.g., ...). Figure 5 (As shown).

[0084] like Figure 5 As shown, the chessboard in Image 3 includes black and white squares. A purple fringing effect exists at the boundary between the black and white squares in Image 3, and the purple fringing effect in Image 3 appears as a light blue color (e.g., ...). Figure 5 The purple-edged area shown is 6).

[0085] Currently, server 30 is used to receive image 1 transmitted by mobile phone 10 and image 2 transmitted by tablet computer 20. After obtaining the images (image 1 and / or image 2), server 30 can determine the purple-edge region of the image based on the differences between the intensity values ​​of the blue channel and the intensity values ​​of the red component and the intensity values ​​of the green component, respectively. Thus, server 30 can obtain the purple-edge region of image 1 (e.g., image 1). Figure 3 Purple-edged regions 1, 2, and 3 (as shown) and / or the purple-edged regions of image 2 (e.g., purple-edged regions 1, 2, and 3, etc.) and / or the purple-edged regions of image 2 (e.g.) Figure 4 The purple-edged areas 4 and 5 are shown. Server 30 can obtain the following results through comparison: Figure 3 Image 1 shown is compared to... Figure 4 As shown in image 2, there are more purple-edged areas and the image quality is worse.

[0086] However, in the above implementation, server 30 can only determine the approximate range of the purple fringing in the image (e.g., image 1 and image 2). Figure 3 The purple-edged area 1 shown and as shown Figure 4 The purple fringing area shown in Figure 4 cannot accurately determine the degree of purple fringing in the image, nor can it objectively and accurately assess the image quality, nor can it accurately assess the photographic capabilities of different electronic devices (such as mobile phone 10 and tablet computer 20).

[0087] In view of this, the image processing method provided in this application can obtain a color image by acquiring a first image in a first color space (e.g., RGB color space). Then, based on the channel information of the first image in the first color space (e.g., R, G, B channel information in RGB color space), a first mutual information, i.e., the maximum mutual information, can be determined. Next, the first image is subjected to color space conversion processing to obtain a second image in a second color space (e.g., HSV color space), which is different from the first color space. Further, a first value is determined based on a first offset coefficient corresponding to the first mutual information and the second image. Thus, by determining the first value, the degree and / or range of purple fringing in the first image can be accurately and objectively evaluated, and an accurate data basis can be provided for subsequent purple fringing calibration or correction processing.

[0088] The following is combined with Figures 6 to 13 This application provides a detailed description of the specific implementation process of an image processing method provided in its embodiments.

[0089] Please see Figure 6 , Figure 6 A flowchart illustrating a method for image processing provided in an embodiment of this application is shown.

[0090] like Figure 6 As shown, the image processing method in this application embodiment specifically includes the following steps:

[0091] S101, Obtain the first image.

[0092] Optionally, in some embodiments, the first image uses a first color space. The first image is a color image. For example, as shown... Figure 7 As shown, the first image can be an electronic device 100 (e.g., Figure 1 The image shown is a chessboard pattern card captured by a mobile phone 10 or tablet computer 20. The resolution of the first image can be 4032 pixels * 3024 pixels.

[0093] It should be noted that, Figure 7 The first image shown is for illustrative purposes only, and the embodiments of this application are not limited thereto. For example, the first image may be as follows: Figure 3Image 1 is shown; for example, the first image can also be as follows: Figure 4 Image 2 is shown; for example, the first image can also be as follows: Figure 5 Image 3 is shown.

[0094] Optionally, in some embodiments, the image processing apparatus of this application embodiment can acquire a first image in response to a user's first operation. For example, when the image processing apparatus of this application embodiment is a terminal device, such as... Figure 2 As shown in Figure (2), in response to the user clicking the camera control 104 of the camera application 101 in the terminal device, the terminal device can obtain the first image.

[0095] It should be noted that the first operation can be either the user clicking the camera control 104 or the user selecting the first image to be processed. This application embodiment does not limit this.

[0096] Optionally, in some embodiments, the first image may include multiple images from different fields of view and / or different pitch angles. For example, as shown... Figure 8 As shown, the multiple first images may include image A, image B, and image C.

[0097] It should be noted that the field of view refers to the range of the scene that the camera of electronic device 100 can capture. The pitch angle depends on the shooting angle of the user using electronic device 100.

[0098] Optionally, in some embodiments, the electronic device 100 can acquire images under different fields of view and / or different pitch angles to obtain multiple first images, and transmit the multiple first images to the image processing apparatus of this application embodiment.

[0099] It should be noted that the image processing device in the embodiments of this application can be a server or a terminal device, and the embodiments of this application do not limit it in this way.

[0100] Since the degree and / or range of purple fringing in an image is related to the shooting angle of the electronic device 100, the degree and / or range of purple fringing in images acquired under different fields of view and / or different pitch angles may be different. Therefore, acquiring multiple first images under different fields of view and / or different pitch angles by the electronic device 100 can provide a diverse data foundation for the embodiments of this application, thereby enabling the embodiments of this application to accurately evaluate the photography level of the electronic device 100 based on multiple first images under different fields of view and / or different pitch angles.

[0101] Alternatively, in some embodiments, such as Figure 7As shown in the embodiment of this application, when the image processing device is a server 200, the server 200 is communicatively connected to the electronic device 100. The server 200 can acquire the first image transmitted by the electronic device 100 in real time.

[0102] For example, in the case where the image processing apparatus in this application embodiment is a server, such as Figure 7 As shown, the electronic device 100 can acquire images under a first field of view, a second field of view, and a third field of view, respectively, to obtain image A under the first field of view, image B under the second field of view, and image C under the third field of view, and transmit image A, image B, and image C to the server 200.

[0103] Optionally, the first field of view can be a central field of view, which refers to the central area of ​​the camera. The second field of view can be a horizontal field of view, which refers to the range of the scene that the camera can capture in the horizontal direction. The third field of view can be a diagonal field of view, which refers to the range of the scene that the camera can capture in the diagonal direction.

[0104] It should be noted that the aforementioned fields of view (including the first, second, and third fields of view) are merely illustrative examples of embodiments of this application. In practical applications, the electronic device 100 can acquire images from more or fewer fields of view, and this application is not limited thereto. For example, the electronic device 100 can also acquire images from the peripheral field of view, i.e., the area outside the central field of view where the camera is located. Furthermore, the electronic device 100 can also acquire images from different pitch angles as the first image, and this application does not limit this aspect.

[0105] Optionally, in another embodiment, the first image may be an image pre-stored in the memory of the image processing apparatus of this application embodiment or in another storage device communicatively connected to the image processing apparatus of this application embodiment.

[0106] It should be noted that the first image can be captured by the electronic device 100 under natural light (or sunlight), or it can be captured by the electronic device 100 under other light sources; this application embodiment does not limit this. For example, the first image can be captured by the electronic device 100 under a D65 light source. A D65 light source is a light source that simulates artificial sunlight. As another example, the first image can be captured by the electronic device 100 under a TL83 light source or a TL84 light source. A TL83 light source or a TL84 light source is a light source that simulates the lighting environment of a shop.

[0107] In summary, the embodiments of this application can obtain a first image. The image processing apparatus of the embodiments of this application, by acquiring the first image, can provide a data foundation for subsequent image processing.

[0108] S102, determine the first mutual information based on the channel information of the first image in the first color space.

[0109] Optionally, in some embodiments, the first color space can be the RGB color space (or, in other words, the RGB color gamut). The RGB color space is an additive color model based on the three primary colors: red (R), green (G), and blue (B). In the RGB color space, the color of any pixel in the first image is generated by superimposing light of the three primary colors in different proportions.

[0110] Optionally, in the RGB color space, the mathematical expression for the color of any pixel in the first image is as follows:

[0111] Color = (R, G, B);

[0112] Where R represents the intensity value of the red component, ranging from 0 to 255; G represents the intensity value of the green component, ranging from 0 to 255; and B represents the intensity value of the blue component, ranging from 0 to 255.

[0113] For example, in the RGB color space, when the color of any pixel in the first image is purple, Color = (128, 0, 128). Or, when the color of any pixel in the first image is reddish-purple, Color = (255, 0, 128).

[0114] It should be noted that the component represents the intensity of that color of light, with 0 indicating that the color of light has no brightness and 255 indicating that the color of light has maximum brightness. For example, when the intensity value R of the red component is 0, it means that the red light has no brightness.

[0115] Optionally, in some embodiments, the channel information may include first channel information, second channel information, and third channel information. The resolution of each of these three channels is the same as the resolution of the first image. For example, when the resolution of the first image is 4032 pixels * 3024 pixels, the resolution of the first channel is also 4032 pixels * 3024 pixels.

[0116] Optionally, if the first color space is RGB, the first channel information can be the G channel information of the first image in the RGB color space. In the RGB color space, the G channel information of the first image can include the intensity value of the green component corresponding to each pixel in the first image.

[0117] Optionally, if the first color space is RGB, the second channel information can be the R channel information of the first image in the RGB color space. In the RGB color space, the R channel information of the first image can include the intensity value of the red component corresponding to each pixel in the first image.

[0118] Optionally, if the first color space is RGB, the third channel information can be the B channel information of the first image in the RGB color space. In the RGB color space, the B channel information of the first image can include the intensity value of the blue component corresponding to each pixel in the first image.

[0119] It should be noted that, in another embodiment, under the RGB color space, the channel information of the first image may further include four channels: R channel information, Gr channel information, Gb channel information, and B channel information. Thus, by superimposing the pixel values ​​of each pixel in these four channels at different ratios, the pixel value corresponding to each pixel in the first image can be obtained.

[0120] Optionally, in another embodiment, the first color space may also be the CIELAB color space. The CIELAB color space is a color space based on three attributes: lightness (L), green-red axis (A), and blue-yellow axis (B). The lightness axis represents the brightness or darkness of a color. A lightness of 0 represents black, and a lightness of 100 represents white. The green-red axis represents the relative intensity of a color between red and green. Positive values ​​on the green-red axis indicate a reddish tint, and negative values ​​indicate a greenish tint. The blue-yellow axis represents the relative intensity of a color between yellow and blue. Positive values ​​on the blue-yellow axis indicate a yellowish tint, and negative values ​​indicate a bluish tint.

[0121] It should be noted that in imaging systems or digital image displays (such as web pages, TV screens, or mobile phone screens), the primary color space is usually the RGB color space.

[0122] Optionally, in some embodiments, the first mutual information is determined based on the second mutual information and the third mutual information. The second mutual information is determined based on the first channel information and the second channel information. For example, when the first color space is the RGB color space, the first channel information is the G channel information of the first image in the RGB color space, and the second channel information is the R channel information of the first image in the RGB color space, the second mutual information is determined based on the G channel information and the R channel information of the first image in the RGB color space.

[0123] Optionally, the third mutual information is determined based on the first channel information and the third channel information. For example, when the first color space is the RGB color space, the first channel information is the G channel information of the first image in the RGB color space, and the third channel information is the B channel information of the first image in the RGB color space, the third mutual information is determined based on the G channel information of the first image in the RGB color space and the B channel information of the first image in the RGB color space.

[0124] It's important to note that mutual information (MI) is a parameter that measures the mutual dependence, or interdependence, between two sets of events. Mutual information can be used to measure the dependency between two random variables. For example, a larger mutual information value indicates a stronger interdependence between the two random variables; a smaller mutual information value indicates a weaker interdependence. If the two random variables are independent, the mutual information is 0; if one of the random variables contains information about the other, the mutual information is positive.

[0125] For example, the mathematical expression for mutual information is as follows:

[0126]

[0127] Where I(X;Y) represents the mutual information between random variables X and Y, p(x) represents the probability that random variable X takes the value x, p(y) represents the probability that random variable Y takes the value y, and p(x,y) is used to represent the joint probability that random variable X takes the value x and random variable Y takes the value y; p(x) is the marginal probability distribution, which can be obtained by summing the joint probability distribution p(x,y) in one dimension (e.g., the y-axis direction); p(y) is also a marginal probability distribution, which can be obtained by summing the joint probability distribution p(x,y) in one dimension (e.g., the x-axis direction).

[0128] Optionally, in some embodiments, when determining the second mutual information based on the G channel information and R channel information of the first image in the RGB color space, the random variable X can be the coordinates of each pixel in the G channel information of the first image after offset processing (or deformation processing) (or, the random variable X can be the coordinates of the center pixel in the G channel information of the first image after offset processing), and the random variable Y can be the coordinates of each pixel in the R channel information of the first image (or, the random variable Y can be the coordinates of the center pixel in the B channel information of the first image).

[0129] Optionally, the first mutual information corresponds to the first offset coefficient. The first offset coefficient is the deformation coefficient that is closest to the actual purple edge, and the first offset coefficient is a value within a preset offset range. For example, the preset offset range can be 0-2, and the first offset coefficient can be 1.3.

[0130] It should be noted that the preset offset range can be obtained based on the experience of those skilled in the art, or it can be obtained through multiple experiments. In practical applications, those skilled in the art can modify the preset offset range based on experience, and this application embodiment does not limit this.

[0131] Optionally, in another embodiment, when there are multiple second mutual information and multiple third mutual information, the first mutual information is the maximum mutual information (MMI) among the multiple second mutual information and multiple third mutual information. For example, as shown... Figure 9 As shown, the first mutual information in the first image is 3.30155891, the first offset coefficient corresponding to the first mutual information is 1.3, and the first mutual information is the mutual information corresponding to the pixel with coordinates (2288, 1716) in the first image.

[0132] Optionally, the first offset coefficient corresponding to the maximum mutual information (i.e., the degree of deformation of the coordinates of each pixel in the G channel information of the first image) is the offset coefficient of the purple edge (or color difference) of the actual image.

[0133] It should be noted that each mutual information corresponds to a unique offset coefficient, and the offset coefficient corresponding to each mutual information (e.g., the second mutual information or the third mutual information) is a coefficient within a preset offset range.

[0134] Optionally, when the first color space is RGB, the purple fringing phenomenon in the first image is caused by the offset of the image's R and B channels relative to the image's G channel. In an imaging system, the G channel is usually able to focus accurately, but due to lens chromatic aberration, the R and B channels of the first image cannot be completely accurately focused, resulting in a purplish-red or light blue fringing around the edges of objects in the first image.

[0135] Optionally, after acquiring the first image, the image processing apparatus of this embodiment can extract the channel information of the first image in a first color space. After obtaining the channel information of the first image in the first color space, the image processing apparatus of this embodiment can determine the first mutual information based on the channel information of the first image in the first color space. By determining the first mutual information, this embodiment can provide a data basis for accurately determining the degree and / or range of purple fringing in the first image.

[0136] S103, perform color space conversion on the first image to obtain the second image.

[0137] It should be understood that S102 and S103 are not sequential in terms of timing or order. That is, the image processing apparatus in this embodiment can be executed in the order of S102 first and S103 second, or in the order of S102 second and S103 first, or S102 and S103 can be executed simultaneously (e.g., Figure 6 As shown in the embodiments, this application does not limit this.

[0138] Optionally, in some embodiments, the second image is the image corresponding to the first image in a second color space. The resolution of the second image is the same as the resolution of the first image. For example, when the resolution of the first image is 4032 pixels * 3024 pixels, the resolution of the second image is also 4032 pixels * 3024 pixels.

[0139] Optionally, in some embodiments, the second color space is different from the first color space. The second color space can be any of the following color spaces: HSV color space (or HSV color gamut), LAB color space (or LAB color gamut) and YUV color space (or YUV color gamut).

[0140] Alternatively, the HSV color space can also be called the hexagonal pyramid model, a color space model created based on the intuitive characteristics of color. HSV represents three color dimensions: hue (H), saturation (S), and value (V).

[0141] It's important to note that the hue component represents color information, specifically the type of color. For example, the hue component ranges from 0 (black) to 255 (white). The saturation component represents the purity of a color, i.e., how close the color is to a spectral color; the saturation component also ranges from 0 to 255. The lightness component represents the brightness or darkness of a color; for example, the lightness component also ranges from 0 to 255.

[0142] Optionally, in the HSV color space, the mathematical expression for the HSV value of any pixel in the second image is as follows:

[0143] HSV value = (H, S, V);

[0144] Wherein, the H component represents the hue value; the S component represents the saturation value; and the V component represents the brightness value. For example, in the HSV color space, the specific HSV values ​​for each color are shown in Table 1 below:

[0145] Table 1

[0146]

[0147] Table 1 shows that, for black, the minimum H value (Hmin) is 0, and the maximum H value (Hmax) is 180; the minimum S value (Smin) is 0, and the maximum S value (Smax) is 255; the minimum V value (Vmin) is 0, and the maximum V value (Vmax) is 46. For gray, the minimum H value (Hmin) is 0, and the maximum H value (Hmax) is 180; the minimum S value (Smin) is 0, and the maximum S value (Smax) is 43; the minimum V value (Vmin) is 46, and the maximum V value (Vmax) is 220. When the color is purple, the specific values ​​of HSV for purple are as follows: the minimum value of H, i.e., Hmin, is 125, and the maximum value of H, i.e., Hmax, is 155; the minimum value of S, i.e., Smin, is 43, and the maximum value of S, i.e., Smax, is 255; the minimum value of V, i.e. Vmin, is 46, and the maximum value of V, Vmax, is 255.

[0148] It should be noted that the above examples use the specific HSV values ​​of black, gray, and purple as examples. The specific HSV values ​​of other colors in Table 1 can be found in the descriptions of the three colors mentioned above, and will not be repeated here.

[0149] Furthermore, based on Table 1 above, for any pixel in the second image, when 0 ≤ H < 20, the pixel's color is red; when 30 ≤ H < 45, the pixel's color is yellow; when 45 ≤ H < 90, the pixel's color is green; when 90 ≤ H < 125, the pixel's color is cyan; when 125 ≤ H < 150, the pixel's color is blue; when 150 ≤ H < 175, the pixel's color is purple; when 175 ≤ H < 200, the pixel's color is pink; when 200 ≤ H < 220, the pixel's color is brick red; and when 220 ≤ H < 255, the pixel's color is magenta.

[0150] Optionally, in some embodiments, the image processing apparatus of this application can pre-set and store the HSV values ​​of a specific color or the range of HSV values ​​of a specific color, so as to quickly find the corresponding color region in the second image based on the HSV values ​​of the specific color or the range of HSV values ​​of the specific color.

[0151] For example, in the HSV color space, when the specific color is purple, the HSV value is (30, 50, 50). Alternatively, when the specific color is purple, the HSV value ranges from (30, 50, 50) to (155, 255, 255).

[0152] It should be noted that the hue of the HSV value for the specific color mentioned above is determined by the H component, and is independent of the S and V components. Therefore, when setting a specific color, the image processing apparatus in this application embodiment can adjust only the value of the H component, without adjusting the values ​​of the S and V components. Alternatively, in the HSV color space, users can also change the image color by adjusting the values ​​of the H, S, and V components; this application embodiment does not limit this approach.

[0153] Optionally, the LAB color space consists of a lightness (L) channel, a green-red axis (A) channel, and a blue-yellow axis (B) channel. The A channel represents the range from green to red; a positive value for the A channel represents red, and a negative value represents green. The B channel represents the range from blue to yellow; a positive value for the B channel represents yellow, and a negative value represents blue.

[0154] Optionally, the YUV color space is a color encoding system that divides color information into a luminance (Y) component, a chrominance (U) component, and a chrominance (V) component. The luminance (Y) component represents the brightness information of an image (e.g., the second image). The chrominance (U) component represents the intensity difference between blue and yellow. A positive chrominance (U) value indicates a higher proportion of blue in the image; a negative chrominance (U) value indicates a higher proportion of yellow. The chrominance (V) component represents the intensity difference between red and green. A positive chrominance (V) value indicates a higher proportion of red in the image; a negative chrominance (V) value indicates a higher proportion of green.

[0155] Optionally, in some embodiments, after executing S101, the image processing apparatus of this application embodiment can obtain a first image. After obtaining the first image, the image processing apparatus of this application embodiment can perform color space conversion processing on the first image to obtain a second image after color space conversion processing.

[0156] The embodiments of this application can obtain the second image through various possible implementations. The following describes one possible implementation of obtaining the second image according to the embodiments of this application.

[0157] Optionally, if the first image is an image in a first color space (e.g., RGB color space) and the second color space is an HSV color space, the image processing apparatus of this application embodiment can determine the normalized RGB value of each pixel in the first image based on the first image.

[0158] For example, the expression for determining the normalized RGB value of any pixel in the first image in this application embodiment is as follows:

[0159]

[0160] Where (R, G, B) represents the RGB value of a pixel in the first image; (R ′ G ′ B ′ ) represents the RGB value of the above pixels after normalization.

[0161] This application embodiment can convert the RGB values ​​of the first image from an integer range of 0-255 to a floating-point range of 0-1 by normalizing the RGB values ​​of the first image, thereby providing a data basis for subsequent color space conversion processing.

[0162] After normalizing the RGB values ​​of the first image, the image processing apparatus of this application embodiment can determine the maximum normalized RGB value in the first image. Exemplarily, the expression for determining the maximum normalized RGB value (i.e., V) in the first image in this application embodiment is as follows:

[0163] V = max(R) ′ G ′ B ′ ).

[0164] After normalizing the RGB values ​​of the first image, the image processing apparatus of this application embodiment can further determine the minimum normalized RGB value in the first image. Exemplarily, the expression for determining the minimum normalized RGB value (i.e., C) in the first image in this application embodiment is as follows:

[0165] C = min(R) ′ G ′ B ′ ).

[0166] After determining the normalized maximum RGB value (V) and the normalized minimum RGB value (C) in the first image, the image processing apparatus of this application embodiment can calculate the hue based on V and C. Exemplarily, the expression for calculating the hue in this application embodiment is as follows:

[0167] If V≠C, then the expression for calculating H is as follows:

[0168] V=R ′ ,

[0169] V=B ′ ,

[0170] V = B ′ ,

[0171] If V = C, then H is 0 or 255.

[0172] It should be noted that the value of hue H can be adjusted according to actual usage requirements to ensure that the value of H is within the range of 0-255. For example, when H < 0, H = H + 255.

[0173] After determining H, the image processing apparatus of this application embodiment can calculate the saturation S. For example, if V = 0, then the saturation S = 0. If V ≠ 0, the expression for calculating S by the image processing apparatus of this application embodiment is as follows:

[0174] S = (VC) / V.

[0175] Since the brightness V = max(R′, G′, B′), after determining H and S, the image processing apparatus of this embodiment can obtain the HSV value of any pixel in the second image. After converting each pixel in the first image to the HSV color space (i.e., determining the HSV value of each pixel in the first image), the image processing apparatus of this embodiment can obtain the second image.

[0176] It should be noted that the embodiments of this application use the conversion of a first image between RGB and HSV color spaces to obtain a second image as an example for illustration, but the embodiments of this application are not limited to this. For example, if the first image is an image in a first color space, where the first color space is RGB and the second color space is YUV, those skilled in the art can complete the conversion process based on the conversion relationship between RGB and YUV color spaces in related technologies to obtain a second image in the YUV color space.

[0177] In summary, the embodiments of this application can obtain a second image, which can provide a data basis for accurately determining the degree and / or range of purple fringing in the first image.

[0178] S104, determine the first value based on the first offset coefficient and the second image.

[0179] Optionally, in some embodiments, the first value is used to represent the degree and / or range of purple fringing in the first image. The first value is ≥0. For example, the first value can be 0.5476.

[0180] Optionally, in some embodiments, the degree of purple fringing refers to the severity of the purple fringing phenomenon in the image, or the degree of color distortion in the image. The purple fringing range refers to the size of the area affected by the purple fringing phenomenon in the image (e.g., whether the image has purple fringing in a specific area or whether the image has purple fringing throughout the entire area).

[0181] It should be noted that the above-mentioned first value is only an illustrative example, and the embodiments of this application are not limited thereto. The smaller the first value, the smaller the degree and / or range of purple fringing in the first image, and the better the image quality of the first image; the larger the first value, the larger the degree and / or range of purple fringing in the first image, and the worse the image quality of the first image.

[0182] like Figure 6As shown, after executing S102, this embodiment of the application can determine a first offset coefficient corresponding to the first mutual information based on the first mutual information. Then, after executing S103, this embodiment of the application can obtain a second image. Further, after obtaining the first offset coefficient and the second image, this embodiment of the application can determine a first value based on the first offset coefficient and the second image. By determining the first value, this embodiment of the application can accurately and objectively evaluate the image quality of the first image and accurately evaluate the electronic device 100 that acquired the first image (e.g., such as...). Figure 1 The mobile phone 10 shown has a high level of photography capabilities, and can provide an accurate data basis for subsequent purple edge calibration and correction processing of the first image, thereby improving the effect of purple edge correction processing of the first image.

[0183] Optionally, in some embodiments, after determining the first value, the embodiments of this application may further perform purple edge calibration processing or purple edge correction processing on the first image based on the first value to obtain the processed image.

[0184] Optionally, in some embodiments, chromatic aberration calibration is used to measure and record the chromatic aberration of the camera (i.e., purple fringing) to provide the necessary data and parameters for subsequent purple fringing correction, so as to more accurately correct the purple fringing of the first image during image processing.

[0185] Optionally, in some embodiments, the purple fringing correction process includes chromatic aberration correction and depurple removal. Chromatic aberration correction mainly targets purple fringing caused by camera chromatic aberration, while depurple removal is used to handle purple fringing caused by other reasons or purple fringing that was not fully corrected in the previous processing.

[0186] It should be noted that the embodiments of this application may employ a color difference algorithm (de-mosaic algorithm) to reduce color errors (e.g., purple fringing) caused by high-frequency aliasing. Alternatively, the purple fringing of the image (e.g., the first image) can be eliminated by replacing the camera of the electronic device 100 with a higher-quality camera, or by adjusting shooting parameters (e.g., aperture size). This improves image quality, ensures natural color transitions, and avoids unnatural color fringing (e.g., purple fringing) from affecting the user's visual experience.

[0187] Optionally, if a purple edge calibration or correction processing is performed on the first image based on the first value to obtain a processed image, the image processing apparatus of this application embodiment can also display the processed image to enhance the user's visual experience.

[0188] Optionally, in another embodiment, the processed image can be used as the first image, and the above steps S102 to S104 can be repeated to obtain a first value corresponding to the processed image. By comparing the first value of the first image with the first value corresponding to the processed image, the embodiments of this application can objectively and accurately assess how much the purple fringing degree and / or purple fringing range in the processed image has been reduced compared to the purple fringing degree and / or purple fringing range of the first image, thereby determining whether the purple fringing calibration processing or purple fringing correction processing of the first image is effective.

[0189] The image processing method of this application embodiment acquires a first image to obtain a color image using a first color space (e.g., RGB color space). Then, based on the channel information of the first image in the first color space (e.g., R, G, B channel information in RGB color space), a first mutual information, i.e., the maximum mutual information, can be determined. Furthermore, by performing color space conversion processing on the first image, a second image in a second color space (e.g., HSV color space) different from the first color space can be obtained. Further, based on a first offset coefficient corresponding to the first mutual information and the second image, a first numerical value is determined. Thus, by determining the first numerical value, the degree and / or range of purple fringing in the first image can be accurately and objectively evaluated, and an accurate data basis can be provided for subsequent purple fringing calibration or correction processing.

[0190] Furthermore, the image processing method in this application embodiment can take multiple first images by using the same shooting conditions when evaluating the photographic capabilities of different types and / or models of electronic devices. For example, the same shooting conditions involve different electronic devices acquiring images under the same light source (e.g., a D65 light source) and / or the same field of view (e.g., a central field of view). By acquiring multiple first images under the same light source and / or the same field of view, interference from other external conditions on image quality evaluation can be avoided, resulting in more accurate image quality evaluation results.

[0191] For example, such as Figure 10 As shown, the first mutual information in the first image is 3.67422281, the first offset coefficient corresponding to the first mutual information is 1.1, and the first mutual information is the mutual information corresponding to the pixel with coordinates (2288, 1356) in the first image. Figure 9 and Figure 10 The maximum mutual information corresponding to different first images acquired by different electronic devices 100 (e.g., mobile phone 10 and tablet computer 20). This application embodiment compares... Figure 9 and Figure 10 The different first offset coefficients obtained in the process (e.g., Figure 9 1.3 and shown Figure 10As shown in 1.1), it can accurately and objectively conclude that... Figure 9 The corresponding first image has a higher degree of purple fringing, meaning that the acquisition... Figure 9 The electronic device 100 (e.g., mobile phone 10) that produces the first image has a worse photographic quality.

[0192] Based on the description in S102, embodiments of this application can determine the first mutual information through various possible implementations. The following, in conjunction with... Figure 11 This application provides a detailed description of one possible implementation for determining the first mutual information in its embodiments.

[0193] Please see Figure 11 , Figure 11 A flowchart illustrating a method for image processing provided in an embodiment of this application is shown.

[0194] like Figure 11 As shown, the image processing method in this application embodiment specifically includes the following steps:

[0195] S201, based on the first image, acquire the first channel information, the second channel information and the third channel information respectively.

[0196] Optionally, the first channel information may also include the coordinates of each pixel in the first image. For example, the coordinates of a certain pixel in the first image may be... Figure 9 The (2288, 1716) shown is or is as follows Figure 10 As shown (2288,1356).

[0197] It should be noted that the second channel information may also include the coordinates of each pixel in the first image. The third channel information may also include the coordinates of each pixel in the first image. The coordinates of the same pixel are the same in different channels.

[0198] It should be noted that when the first color space is RGB color space, the information of the first channel, the second channel, and the third channel in S201 can be found in the relevant description in S102 when the first color space is RGB color space, and will not be repeated here.

[0199] After acquiring the first image, the image processing apparatus of this application embodiment can extract the channel information of the first image to obtain first channel information, second channel information, and third channel information. By extracting the three channel information of the first image respectively, this application embodiment can provide a data foundation for subsequently determining the first mutual information.

[0200] S202, based on each of the multiple offset coefficients, the first channel information is offset to obtain multiple fourth channel information.

[0201] Optionally, each offset coefficient is a value within a preset offset range, and each offset coefficient is different. Multiple offset coefficients include a first offset coefficient.

[0202] Optionally, the first channel information includes multiple first coordinates. Each of the multiple first coordinates is used to represent the position corresponding to each pixel in the first channel information of the first image. For example, when the first image uses the RGB color space and the first channel information is the G channel information of the first image, the multiple first coordinates are used to represent the positions corresponding to multiple pixels in the G channel information of the first image.

[0203] Optionally, any fourth channel information may also include the coordinates of each pixel in the first image after offset processing based on any one of multiple offset coefficients.

[0204] After obtaining the first channel information, second channel information, and third channel information, this embodiment of the application can perform offset processing on the first channel information based on each of multiple offset coefficients to obtain multiple fourth channel information. Specifically, this embodiment of the application can perform offset processing on the coordinates of each pixel in the first image based on each offset coefficient to obtain fourth channel information based on that offset coefficient. By obtaining multiple fourth channel information, this embodiment of the application can prepare for the subsequent determination of the first mutual information.

[0205] It should be noted that the above-described method of offsetting the first channel information using each of the multiple offset coefficients is merely an illustrative example, and the embodiments of this application are not limited thereto. In practical applications, the embodiments of this application may also select several offset coefficients from a set offset range based on a preset interval (or step size), and offset the first channel information based on the selected offset coefficients to obtain the corresponding fourth channel information. By selecting several offset coefficients to offset the first channel information separately, the embodiments of this application can reduce the computational load and speed up the determination of the first mutual information.

[0206] For example, such as Figure 12 As shown, several offset coefficients within a preset offset range can be selected at intervals of 0.2, such as 0.5, 0.7, 0.899999999999999, 1.099999999999999, and 1.299999999999999.

[0207] It should be noted that the interval between the above offset coefficients can be equal to or approximately equal to a preset interval (e.g., 0.2), and this embodiment of the application does not limit this.

[0208] S203, based on each of the fourth channel information and the second channel information in the multiple fourth channel information, determine multiple second mutual information.

[0209] Optionally, the second mutual information is used to represent the dependency between the first channel information and the second channel information of the first image under the corresponding offset coefficient. For example, when the first image uses the RGB color space, the first channel information of the first image is the G channel information of the first image in the RGB color space, and the second channel information is the R channel information of the first image in the RGB color space, the second mutual information is used to represent the dependency between the G channel information and the R channel information of the first image in the RGB color space under the corresponding offset coefficient.

[0210] After obtaining multiple fourth-channel information, embodiments of this application can determine multiple second mutual information based on the multiple fourth-channel information and the second-channel information. Specifically, embodiments of this application can determine the second mutual information of each pixel in the first image at each offset coefficient based on the fourth-channel information and the second-channel information at each offset coefficient. By obtaining multiple second mutual information, preparation can be made for the subsequent determination of the first mutual information.

[0211] For example, such as Figure 12 As shown, for the pixel with coordinates (2348, 1836) in the first image, the second mutual information is 1.1167903341911718 when the offset coefficient is 0.5, and the second mutual information is 1.4373375031192699 when the offset coefficient is 0.7.

[0212] It should be noted that, Figure 12 The coordinates, mutual information, and offset coefficients in the text are merely illustrative examples, intended only to clearly illustrate the technical solutions of the embodiments of this application, and are not limited thereto. In practical applications, the coordinates, mutual information, and offset coefficients of the first image may include, in addition to... Figure 12 The coordinates, mutual information, and offset coefficients shown are not included in the coordinates, mutual information, and offset coefficients (e.g., Figure 9 (The coordinates, mutual information, and offset coefficients are shown).

[0213] S204, based on each of the fourth channel information and the third channel information in the multiple fourth channel information, determine multiple third mutual information.

[0214] Optionally, the third mutual information is used to represent the dependency between the first channel information and the third channel information of the first image under the corresponding offset coefficient. For example, when the first image uses the RGB color space, the first channel information of the first image is the G channel information of the first image in the RGB color space, and the third channel information is the B channel information of the first image in the RGB color space, the third mutual information is used to represent the dependency between the G channel information and the B channel information of the first image in the RGB color space under the corresponding offset coefficient.

[0215] After obtaining multiple fourth-channel information, embodiments of this application can determine multiple third mutual information based on the multiple fourth-channel information and the third-channel information. Specifically, embodiments of this application can determine the third mutual information of each pixel in the first image at each offset coefficient based on the fourth-channel information and the third-channel information at that offset coefficient. By obtaining multiple third mutual information, embodiments of this application can prepare for the subsequent determination of the first mutual information.

[0216] For example, such as Figure 12 As shown, for the pixel with coordinates (2348, 1836) in the first image, the third mutual information is 1.7908397350135652 when the offset coefficient is 0.8999999999999999, and the third mutual information is 1.7335548440581976 when the offset coefficient is 1.0999999999999999.

[0217] S205, determine the first mutual information based on multiple second mutual information and multiple third mutual information.

[0218] After executing S203 and S204, multiple second mutual information and multiple third mutual information can be obtained. Therefore, embodiments of this application can determine the first mutual information, i.e., the maximum mutual information among the multiple second and third mutual information (e.g., ...). Figure 10 (As shown in 3.67422281). By determining the first mutual information, it is possible to further determine the first offset coefficient corresponding to the first mutual information (e.g., with). Figure 10 The 3.67422281 shown corresponds to 1.1), which can provide a data basis for subsequently determining the first value, thereby enabling the embodiments of this application to accurately evaluate the image quality of the first image, that is, the degree and / or range of purple fringing of the first image.

[0219] Considering that directly processing the first image might lead to erroneous analysis or processing due to insufficient pixels in the edge regions of the first image, this embodiment of the application can discretize the first image before determining the first mutual information. Specifically, a sampling window is set, and each pixel within the sampling window is analyzed and processed. By setting a sampling window, this embodiment of the application can define the range of the local region for algorithm operation, and by setting a sampling window, erroneous analysis or processing due to insufficient pixels in the edge regions of the first image can be avoided.

[0220] Optionally, the multiple offset coefficients may also include a second offset coefficient. The second offset coefficient may be the same as or different from the first offset coefficient.

[0221] The following section uses the example of the second offset coefficient to describe in detail the specific implementation process of determining the first mutual information in the embodiments of this application.

[0222] Optionally, in some embodiments, when the offset coefficient is the second offset coefficient, the embodiments of this application may determine the sampling window and the first information based on the size of the first image.

[0223] Optionally, the sampling window is a local region in the first image. The sampling window is used to extract pixel values ​​within the corresponding region from the first image, and to perform pixel-level analysis or processing on that region. By limiting the size of the sampling window, the necessary computational load can be reduced, thereby improving processing speed.

[0224] Optionally, the first information includes at least one or more of the following: the size of the sampling window, the step size of the sampling window, the sampling range of the sampling window, and the center coordinates of the sampling window.

[0225] For example, when the size of the first image is 4032 pixels * 3024 pixels, the size of the sampling window can be 50 pixels * 50 pixels, the step size of the sampling window is 50 pixels, and the sampling range of the sampling window is the first image. In the image processing apparatus of this application embodiment, the larger the size of the sampling window and the smaller the step size of the sampling window, the higher the accuracy and precision of the calculation.

[0226] It should be noted that the above-mentioned first information is only an illustrative example. In practical applications, those skilled in the art can set the first information according to actual sampling needs, and the embodiments of this application do not limit this.

[0227] After determining the sampling window and the first information, the embodiments of this application can perform offset processing on each first coordinate in the sampling window based on the second offset coefficient, and traverse the first image based on the sampling window to obtain the fourth channel information.

[0228] Optionally, the fourth channel information includes multiple second coordinates. These second coordinates represent the position after offsetting multiple first coordinates.

[0229] Optionally, embodiments of this application can traverse the first image by moving the sampling window to process each part of the first image. Specifically, embodiments of this application can move the sampling window according to the center coordinates and step size of the sampling window.

[0230] It should be noted that the center coordinates of the sampling window can be determined by the size of the sampling window. For example, when the size of the sampling window is 50*50, the center coordinates of the sampling window are (25,25).

[0231] It should also be noted that the embodiment of this application traversing the first image by moving the sampling window is only an example and is not limited to this. For example, the embodiment of this application can also divide the first image directly into multiple sampling windows based on the size of the first image and determine the mutual information of each pixel in each sampling window.

[0232] After obtaining the fourth channel information, embodiments of this application can determine multiple second mutual information based on multiple second coordinates in the fourth channel information and multiple third coordinates in the second channel information.

[0233] Optionally, multiple third coordinates are used to represent the positions of multiple pixels in the second channel information of the first image. For example, when the first image uses the RGB color space and the second channel information is the R channel information of the first image, multiple third coordinates are used to represent the positions of multiple pixels in the R channel information of the first image.

[0234] After obtaining the fourth channel information, this application embodiment can also determine multiple third mutual information based on multiple second coordinates in the fourth channel information and multiple fourth coordinates in the third channel information.

[0235] Optionally, multiple fourth coordinates are used to represent the positions of multiple pixels in the third channel information of the first image. For example, when the first image uses the RGB color space and the third channel information is the B channel information of the first image, multiple fourth coordinates are used to represent the positions of multiple pixels in the B channel information of the first image.

[0236] It should be noted that after setting the sampling window, this embodiment can calculate multiple second mutual information and multiple third mutual information within each sampling window. After obtaining multiple second mutual information and multiple third mutual information within each sampling window, this embodiment can determine the maximum mutual information among the multiple second mutual information and multiple third mutual information, i.e., the first mutual information.

[0237] Based on the description of S104, the first value can be determined in various possible ways in the embodiments of this application. The following describes one possible way in which the first value is determined in the embodiments of this application.

[0238] Optionally, in some embodiments, the first ratio can be determined based on a first offset coefficient and a preset offset range.

[0239] Optionally, the expression for determining the first ratio in this embodiment is as follows:

[0240]

[0241] Where, α norm Represents the first ratio; α represents the first offset coefficient; |α max -α min | represents the absolute value of the preset offset range, α max α represents the maximum offset coefficient within the preset offset range. min This represents the minimum offset coefficient within a preset offset range. For example, in α... min α is 0 max When α is 2 and α is 1.3, the first ratio α norm It is 0.65.

[0242] Optionally, in some embodiments, the present application embodiments may determine the purple region in the second image based on a preset hue range. For example, in a first image as shown... Figure 7 When showing the image of the checkerboard pattern card, the purple area in the second image is as follows: Figure 13 The white area shown. That is, after executing S103, the embodiments of this application can obtain the following: Figure 13 In the second image shown, the purple-edged area in this embodiment of the application is determined based on a preset color gamut range. Figure 13 The white area formed by the white lines shown. (Through...) Figure 13 This allows those skilled in the art to visually observe the size and extent of the purple fringing phenomenon in the second image, i.e. Figure 13 The white area shown.

[0243] After determining the purple region in the second image, embodiments of this application can determine the first pixel count based on the purple region in the second image. Furthermore, embodiments of this application can determine the second ratio based on the first pixel count and the second pixel count.

[0244] Optionally, the first pixel count is the number of pixels in the second image within a preset hue range. The preset hue range represents the purple range in the second color space. For example, when the resolution of the second image is 4032 pixels * 3024 pixels and the preset hue range is 0-2, the first pixel count is 1240.

[0245] Optionally, the second pixel count is the number of pixels included in the second image. For example, when the resolution of the second image is 4032 pixels * 3024 pixels, the second pixel count is 4032.

[0246] Optionally, the expression for determining the second ratio in this embodiment is as follows:

[0247]

[0248] Where, β nor, This represents the second ratio; β represents the first number of pixels; m represents the second number of pixels. For example, when β is 1240 and m is 4032, β... norm It is 0.3075.

[0249] After determining the first ratio and the second ratio, embodiments of this application can determine a first numerical value based on the first ratio and the second ratio. Determining the first numerical value provides an accurate data basis for evaluating image quality, i.e., the degree and / or range of purple fringing in the image.

[0250] It should be noted that, in practical applications, those skilled in the art can also set the weight ratios of the first ratio and the second ratio in the calculation of the first value according to the actual application requirements (such as the degree of purple fringing and the importance of the purple fringing range) to achieve different image quality evaluation effects.

[0251] Optionally, in some embodiments, the embodiments of this application may calculate the first value based on the first ratio, the first weight, the second ratio, and the second weight.

[0252] Optionally, the first weight is used to represent the weight ratio of the first ratio in calculating the first value. The second threshold is used to represent the weight ratio of the second ratio in calculating the first value. Both the first weight and the second weight are weight ratio values ​​pre-stored in the image processing apparatus of this application embodiment.

[0253] Optionally, the expression for calculating the first numerical value in this embodiment is as follows:

[0254]

[0255] Where x represents the first value; ω α Indicates the first weight; α norm Indicates the first ratio; ωβ Indicates the second weight; β norm This indicates the second ratio.

[0256] For example, in ω α It is 7, ω β 3, α min α is 0 max When α is 2, β is 1.3, β is 1240, and m is 4032, α norm It is 0.65, β norm The value is 0.3075, and x is...

[0257] The above text combined Figures 6 to 13 This application provides a detailed description of the specific implementation process of an image processing method provided in its embodiments. The following section, in conjunction with... Figure 14 The hardware structure of the apparatus for image processing in the embodiments of this application is described.

[0258] Please see Figure 14 , Figure 14 A schematic diagram of the hardware structure of an image processing apparatus provided in an embodiment of this application is shown.

[0259] like Figure 14 As shown, the image processing apparatus 300 of this application embodiment may include: a processor 110, a memory 111, a communication interface 112, and a bus 113. The processor 110, memory 111, and communication interface 112 communicate via the bus 113, or via other means such as wireless transmission. The memory 111 stores instructions, and the processor 110 executes the instructions stored in the memory 111. The memory 111 stores program code, and the processor 110 can call the program code stored in the memory 111 to execute. Figure 6 or Figure 11 The method shown is for image processing.

[0260] It should be understood that, in the embodiments of this application, processor 110 may include one or more processing units. For example, processor 110 may include at least one of the following processing units: application processor (AP), modem processor, graphics processing unit (GPU), image signal processor (ISP), controller, video codec, digital signal processor (DSP), baseband processor, neural network processing unit (NPU). The different processing units may be independent devices or integrated devices. The general-purpose processor may be a microprocessor or any conventional processor, etc.

[0261] The memory 111 may include read-only memory and random access memory, and provides instructions and data to the processor 110. The memory 111 may also include non-volatile random access memory. The memory 111 may be volatile memory or non-volatile memory, or may include both. The non-volatile memory may be read-only memory (ROM), programmable read-only memory (PROM), erasable programmable read-only memory (EPROM), electrically erasable programmable read-only memory (EEPROM), or flash memory. The volatile memory may be random access memory (RAM), which is used as an external cache. By way of example, but not limitation, many forms of RAM are available, such as static random access memory (SRAM), dynamic random access memory (DRAM), synchronous dynamic random access memory (SDRAM), double data rate synchronous dynamic random access memory (DDR SDRAM), enhanced synchronous dynamic random access memory (ESDRAM), synchronous linked dynamic random access memory (SLDRAM), and direct rambus RAM (DR RAM).

[0262] It should be noted that memory 111 is on-chip memory, which can store a defined first value.

[0263] In addition to the data bus, bus 113 may also include a power bus, a control bus, and a status signal bus. However, for clarity, in... Figure 14 The general will label all buses as bus 113.

[0264] It should be understood that the above and other operations and / or functions of the various modules in the image processing apparatus 300 according to the embodiments of this application are respectively for implementing Figure 6 or Figure 11 The operational steps of the image processing methods described herein will not be elaborated here for the sake of brevity.

[0265] The image processing apparatus in this application embodiment can be a terminal device. In this case, the image processing method in this application embodiment can be implemented based on the hardware and software systems of the terminal device. The following is in conjunction with... Figure 15 and Figure 16 The hardware system and software system of a terminal device in the embodiments of this application are described respectively.

[0266] Please see Figure 15 , Figure 15 A schematic diagram of the hardware system of a terminal device provided in an embodiment of this application is shown.

[0267] like Figure 15 As shown, the terminal device 400 may include a processor 110, an external memory interface 120, an internal memory 121, a universal serial bus (USB) interface 130, a charging management module 140, a power management module 141, a battery 142, an antenna 1, an antenna 2, a mobile communication module 150, a wireless communication module 160, an audio module 170, a speaker 170A, a receiver 170B, a microphone 170C, a headphone jack 170D, a sensor module 180, buttons 190, a motor 191, an indicator 192, a camera 193, a display screen 194, and a subscriber identification module (SIM) card interface 195, etc.

[0268] The sensor module 180 may include a pressure sensor 180A, a gyroscope sensor 180B, a barometric pressure sensor 180C, a magnetic sensor 180D, an accelerometer sensor 180E, a distance sensor 180F, a proximity light sensor 180G, a fingerprint sensor 180H, a temperature sensor 180J, a touch sensor 180K, an ambient light sensor 180L, and a bone conduction sensor 180M, etc.

[0269] It should be noted that, Figure 15The structure shown does not constitute a specific limitation on the hardware system of terminal device 400. In other embodiments of this application, the hardware system of terminal device 400 may include more than Figure 15 The components shown may include more or fewer components, or the hardware system of terminal device 400 may include... Figure 15 The components shown may be a combination of certain components, or the hardware system of terminal device 400 may include... Figure 15 The components shown are sub-components of certain components. For example, Figure 15 The proximity sensor 180G shown is optional. Figure 15 The components shown can be implemented in hardware, software, or a combination of both.

[0270] The controller can generate operation control signals based on the instruction opcode and timing signals to complete the control of instruction fetching and execution.

[0271] It should be noted that processor 110 can be found in [reference needed]. Figure 14 The description of the processor 110 is omitted here. Additionally, the processor 110 may include memory for storing instructions and data.

[0272] In some embodiments, the memory in processor 110 is a cache memory. This memory can store instructions or data that processor 110 has just used or that are used repeatedly. If processor 110 needs to use the instruction or data again, it can directly retrieve it from the memory. This avoids repeated accesses, reduces the waiting time of processor 110, and thus improves system efficiency.

[0273] Figure 15 The connection relationships between the modules shown are merely illustrative and do not constitute a limitation on the connection relationships between the modules of the terminal device 400. Optionally, the modules of the terminal device 400 may also adopt a combination of various connection methods described in the above embodiments.

[0274] The terminal device 400 can implement display functions through a GPU, a display screen 194, and an application processor. The GPU is a microprocessor for image processing, connected to the display screen 194 and the application processor. The GPU is used to perform mathematical and geometric calculations and for graphics rendering. The processor 110 may include one or more GPUs, which execute program instructions to generate or modify display information.

[0275] The display screen 194 can be used to display images or videos. The terminal device 400 can realize the shooting function through the ISP, camera 193, video codec, GPU, display screen 194 and application processor.

[0276] Digital signal processors (DSPs) are used to process digital signals. In addition to digital image signals, they can also process other digital signals. For example, DSPs can perform frequency response processing, harmonic enhancement processing, and equalization processing on audio signals to change the pitch or rhythm of the audio.

[0277] Optionally, in some embodiments, the processor 110 is configured to acquire a first image captured by the camera 193 by activating the camera 193; then, based on the channel information of the first image in a first color space, the maximum mutual information, i.e., the first mutual information, can be determined; simultaneously, the first image is subjected to color space conversion processing to obtain a second image in a second color space; further, a first value can be determined based on a first offset coefficient corresponding to the first mutual information and the second image. By determining the first value, the degree and / or range of purple fringing in the first image can be accurately and objectively evaluated, and an accurate data basis can be provided for subsequent purple fringing calibration or correction processing.

[0278] The hardware system of terminal device 400 has been described in detail above. The software system of terminal device 400 is described below. The software system can adopt a layered architecture, event-driven architecture, microkernel architecture, microservice architecture, or cloud architecture. This application embodiment takes a layered architecture as an example to exemplarily describe the software system of terminal device 400.

[0279] Please see Figure 16 , Figure 16 A schematic diagram of the software system of a terminal device provided in an embodiment of this application is shown.

[0280] The software system of the terminal device 400 can be divided into several layers, each with a clear role and division of labor. Layers communicate with each other through software interfaces. In some embodiments, such as... Figure 16 As shown, the software system of the terminal device 400 can be an Android system architecture. The Android system architecture can be divided into four layers, from top to bottom: application layer (APP), application framework layer, system runtime library layer, and kernel layer (Linux kernel).

[0281] The application layer can include multiple applications. For example, these applications could be a main application, a settings application, a camera application, a calendar application, and a music application. It's understood that the applications in the application layer can be third-party applications installed by the user, or they can be system applications.

[0282] The application framework layer is a framework layer used to support the execution of multiple applications within the application layer. In some embodiments, the application framework layer may include a binary archive file (Android archive, AAR) of an Android library project.

[0283] The system runtime library layer may include graphics hardware, which is used to abstract hardware. Graphics hardware may include external libraries and hardware abstraction layer libraries (HAL libraries).

[0284] The kernel layer is an abstraction layer between hardware and software. For example, the kernel layer may include driver modules such as Bluetooth driver, display driver, hardware interface driver (e.g., headphone jack driver), and sensor driver.

[0285] Optionally, the Bluetooth driver is used to ensure that the terminal device 400 can recognize and use the Bluetooth chip. In embodiments of this application, when the apparatus for generating image data is a server, the Bluetooth driver is further used to ensure that the terminal device 400 can wirelessly transmit the acquired first image to the server via the Bluetooth communication protocol, enabling the server to analyze and process the image quality of the first image.

[0286] Optionally, the display driver is used to ensure that the terminal device 400 can display the first image. After the terminal device 400 determines a first value based on the first image frame set and performs purple fringing correction processing on the first image based on the first value, the display driver is also used to ensure that the terminal device 400 can display the image after purple fringing correction processing of the first image, thereby improving the user's visual experience.

[0287] The image processing method of this application embodiment can be executed in the application layer. Specifically, the image processing method of this application embodiment can be executed through a first application in the application layer.

[0288] In some embodiments, a first application in the terminal device 400 can acquire a first image captured by a camera application; then, based on the channel information of the first image in a first color space, the maximum mutual information, i.e., the first mutual information, can be determined; simultaneously, a color space conversion process is performed on the first image to obtain a second image in a second color space; further, a first value can be determined based on a first offset coefficient corresponding to the first mutual information and the second image. By determining the first value, the degree and / or range of purple fringing in the first image can be accurately and objectively evaluated, and an accurate data basis can be provided for subsequent purple fringing calibration or correction processing.

[0289] It should be understood that Figure 16 The layered structure shown does not constitute a specific limitation on the software system of terminal device 400. In other embodiments of this application, the software system of terminal device 400 may include more than Figure 16 The layered architecture shown may have more or fewer layers, or each layer of the software system of terminal device 400 may include more than [a certain number of layers]. Figure 16 The embodiments shown may have more or fewer constituent structures, and the present application is not limited to these.

[0290] For example, this application provides a readable storage medium storing a computer program and processor calling instructions, which cause the image processing apparatus of this application to implement the method in the foregoing embodiments when executed.

[0291] For example, this application provides a chip system applied to an image processing apparatus including a memory, a display screen, and a sensor; the chip system includes: one or more interface circuits and one or more processors; the interface circuits and processors are interconnected via lines; the interface circuits are used to receive signals from the memory and send signals to the processors, the signals including computer code or instructions stored in the memory; the processor invokes instructions to cause the image processing apparatus of this application embodiment to perform the methods in the preceding embodiments.

[0292] For example, this application provides a computer program product that, when run on a computer, causes the image processing apparatus of this application embodiment to implement the method in the foregoing embodiments.

[0293] In the above embodiments, all or part of the functionality can be implemented by software, hardware, or a combination of software and hardware. When implemented using software, it can be implemented wholly or partially in the form of a computer program product. A computer program product includes one or more computer codes or instructions. When the computer program code or instructions are loaded and executed on a computer, all or part of the flow or function according to this application is generated. The computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer code or instructions can be stored in a computer-readable storage medium. The computer-readable storage medium can be any available medium that a computer can access, or a data storage device such as an image processing apparatus or a data center that integrates one or more available media. The available medium can be a magnetic medium (e.g., floppy disk, hard disk, magnetic tape), an optical medium (e.g., DVD), or a semiconductor medium (e.g., solid-state disk (SSD)).

[0294] Those skilled in the art will understand that all or part of the processes in the methods of the above embodiments can be implemented by a computer program instructing related hardware. This program can be stored in a computer-readable storage medium, and when executed, it can include the processes described in the above method embodiments. The aforementioned storage medium includes various media capable of storing program code, such as read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.

Claims

1. A method for image processing, characterized in that, The method includes: Acquire a first image; the first image uses a first color space; Based on the channel information of the first image in the first color space, a first mutual information is determined; the channel information includes first channel information, second channel information, and third channel information; the first mutual information is determined based on the second mutual information and the third mutual information, the second mutual information is determined based on the first channel information and the second channel information, and the third mutual information is determined based on the first channel information and the third channel information; the first mutual information corresponds to a first offset coefficient. The first image is subjected to color space conversion to obtain a second image, which is the image corresponding to the first image in a second color space; the second color space is different from the first color space. Based on the first offset coefficient and the second image, a first value is determined; the first value is used to represent the degree and / or range of purple fringing in the first image.

2. The method according to claim 1, characterized in that, The step of determining the first mutual information based on the channel information of the first image in the first color space includes: Based on each of the multiple offset coefficients, the first channel information is offset to obtain multiple fourth channel information; the multiple offset coefficients include the first offset coefficient. Based on each of the plurality of fourth channel information and the second channel information, a plurality of second mutual information is determined; the second mutual information is used to represent the dependency relationship between the first channel information and the second channel information under the corresponding offset coefficient; Based on each of the plurality of fourth channel information and the third channel information, a plurality of third mutual information is determined; the third mutual information is used to represent the dependency relationship between the first channel information and the third channel information under the corresponding offset coefficient; Based on the plurality of second mutual information and the plurality of third mutual information, the first mutual information is determined; the first mutual information is the maximum mutual information among the plurality of second mutual information and the plurality of third mutual information.

3. The method according to claim 2, characterized in that, The plurality of offset coefficients further includes a second offset coefficient; the first channel information includes a plurality of first coordinates; the plurality of first coordinates are used to represent the positions corresponding to a plurality of pixels in the first channel information; The method further includes: Based on the size of the first image, a sampling window and first information are determined; the sampling window is a local region in the first image; the first information includes at least one or more of the following: the size of the sampling window, the step size of the sampling window, the sampling range of the sampling window, and the center coordinates of the sampling window; Based on the second offset coefficient, each first coordinate in the sampling window is offset, and based on the sampling window, the first image is traversed to obtain fourth channel information; the fourth channel information includes multiple second coordinates; the multiple second coordinates are used to represent the position after offsetting the multiple first coordinates; The determination of multiple second mutual information based on each of the multiple fourth channel information and the second channel information includes: Based on the plurality of second coordinates and the plurality of third coordinates in the second channel information, the plurality of second mutual information is determined; the plurality of third coordinates are used to represent the positions corresponding to the plurality of pixels in the second channel information; The determination of multiple third mutual information based on each of the multiple fourth channel information and the third channel information includes: Based on the plurality of second coordinates and the plurality of fourth coordinates in the third channel information, the plurality of third mutual information is determined; the plurality of fourth coordinates are used to represent the positions corresponding to the plurality of pixels in the third channel information.

4. The method according to any one of claims 1 to 3, characterized in that, The first color space is the RGB color space; the first channel information is the G channel information of the first image in the RGB color space; the second channel information is the R channel information of the first image in the RGB color space; and the third channel information is the B channel information of the first image in the RGB color space.

5. The method according to any one of claims 1 to 4, characterized in that, Determining the first value based on the first offset coefficient and the second image includes: Based on the first offset coefficient and the preset offset range, a first ratio is determined; A second ratio is determined based on a first pixel count and a second pixel count; the first pixel count is the number of pixels in the second image within a preset hue range; the preset hue range is used to represent the purple range in the second color space; the second pixel count is the number of pixels included in the second image. The first value is calculated based on the first ratio, the first weight, the second ratio, and the second weight.

6. The method according to claim 5, characterized in that, Before determining the second ratio based on the first number of pixels and the second number of pixels, the method further includes: Based on the preset hue range, the purple area in the second image is determined; The first number of pixels is determined based on the purple area in the second image.

7. The method according to any one of claims 1 to 6, characterized in that, After determining the first value, the method further includes: Based on the first value, the first image is subjected to purple edge calibration processing or purple edge correction processing to obtain the processed image.

8. The method according to claim 7, characterized in that, The step of acquiring the first image includes: acquiring the first image in response to a first operation by the user; The method further includes: The processed image is displayed.

9. The method according to any one of claims 1 to 8, characterized in that, The second color space is any one of the following color spaces: HSV color space, LAB color space, and YUV color space.

10. An apparatus for image processing, characterized in that, The device includes a processor and a memory coupled together, the memory being used to store a computer program, and the processor invoking instructions to cause the image processing apparatus to perform the method of any one of claims 1 to 9.

11. A readable storage medium, characterized in that, The readable storage medium stores a computer program, and processor invocation instructions cause the apparatus for image processing to perform the method of any one of claims 1 to 9.

12. A chip system, characterized in that, The chip system is applied to a server including a memory, a display screen, and sensors; the chip system includes: one or more interface circuits and one or more processors; the interface circuits and processors are interconnected via lines; the interface circuits are used to receive signals from the memory and send signals to the processors, the signals including computer code or instructions stored in the memory; the processor invokes instructions to cause an apparatus for image processing to perform the method as described in any one of claims 1 to 9.