Image Processing Method, Apparatus, Device, and Storage Medium
By determining the target processing mode and corresponding image processing parameters, the applicability problem caused by the fixation of the electronic ink screen image processing parameters is solved, and image conversion with higher accuracy and effect is achieved to meet the needs of different scenarios.
Patent Information
- Application Number
- CN202210112881.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-01-29
- Publication Date
- 2025-07-11
- Estimated Expiration
- 2042-01-29
AI Technical Summary
The prior art When the image is displayed on the electronic ink screen, the image processing parameters remain unchanged, resulting in the converted image being unable to meet the user's use needs in different scenarios.
By determining the target processing mode of the image to be processed, determining the corresponding image processing parameters based on the mode, and determining the target pixel value from the pixel values corresponding to the multiple alternative colors, including steps such as contrast enhancement, sharpening processing and error diffusion, the image processing parameters are converted to meet different scene needs.
It improves the accuracy and display effect of image processing, meets users' usage needs in different scenarios, enhances the contrast, clarity and color saturation of images, reduces text jagging, and eliminates boundary problems.
Smart Images

Figure CN114494073B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of image processing technology, and in particular, to an image processing method, apparatus, device, and storage medium. Background Art
[0002] Electronic ink screens are widely used in e-books, electronic papers, shelf labels, and electronic table signs, etc. During the process of an electronic ink screen displaying an image, it is necessary to process the image to obtain a black-and-white image or a red-black-and-white image, and then display the processed image. Therefore, how to process the image has become an urgent problem to be solved currently. Summary of the Invention
[0003] This application provides an image processing method, apparatus, device, and storage medium. The technical solutions are as follows:
[0004] On the one hand, an image processing method is provided. The method includes:
[0005] Determine a target processing mode corresponding to a first image to be processed;
[0006] Based on the target processing mode, determine image processing parameters corresponding to the first image;
[0007] Based on the image processing parameters and the initial pixel values of the pixel points in the first image, determine the target pixel values of the pixel points from the pixel values corresponding to multiple alternative colors;
[0008] Convert the initial pixel values of the pixel points in the first image into the target pixel values to obtain a second image.
[0009] Optionally, the determining a target processing mode corresponding to a first image to be processed includes:
[0010] Identify the type of the object in the first image to obtain an identification result;
[0011] If the identification result includes one object type and it is the first object type, determine the image processing mode corresponding to the first object type among multiple image processing modes as the candidate processing mode corresponding to the first image;
[0012] Determine the target processing mode based on the candidate processing mode.
[0013] Optionally, the determining a target processing mode corresponding to a first image to be processed includes:
[0014] Identify the type of the object in the first image to obtain an identification result;
[0015] If the recognition result includes multiple object types, determine the area ratios of the imaging regions of the objects corresponding to the multiple object types in the first image respectively;
[0016] Determine the image processing mode corresponding to the second object type among the multiple image processing modes as the candidate processing mode corresponding to the first image, where the second object type is the object type with the largest area ratio among the multiple object types;
[0017] Determine the target processing mode based on the candidate processing mode.
[0018] Optionally, the determining the target processing mode based on the candidate processing mode includes:
[0019] Display a first user interface, where the first user interface includes description information of the candidate processing mode;
[0020] In response to a mode confirmation instruction, determine the candidate processing mode as the target processing mode;
[0021] In response to a mode customization instruction, determine a customized mode as the target processing mode.
[0022] Optionally, the determining the image processing parameters corresponding to the first image based on the target processing mode includes:
[0023] In the case where the target processing mode is one of the multiple image processing modes, determine the image processing parameters corresponding to the target processing mode as the image processing parameters corresponding to the first image.
[0024] Optionally, the determining the image processing parameters corresponding to the first image based on the target processing mode includes:
[0025] In the case where the target processing mode is a customized mode, display a second user interface, where the second user interface includes a plurality of customized parameter items;
[0026] Obtain the customized parameters input in the plurality of customized parameter items;
[0027] Determine the customized parameters input in the plurality of customized parameter items as the image processing parameters corresponding to the first image.
[0028] Optionally, the plurality of alternative colors include a first alternative color with a hue, and the image processing parameters include a first color ratio, where the first color ratio is used to distinguish the first alternative color from other alternative colors;
[0029] Determining the target pixel value of the pixel point from the pixel values corresponding to multiple alternative colors based on the image processing parameter and the initial pixel value of the pixel point in the first image includes:
[0030] Determining the distance between the initial pixel value of the pixel point and the pixel value corresponding to the first alternative color;
[0031] If the distance is less than the distance threshold corresponding to the first color ratio, determining the pixel value corresponding to the first alternative color as the target pixel value of the pixel point.
[0032] Optionally, the multiple alternative colors further include a second alternative color and a third alternative color without hue, the gray scale of the second alternative color is less than that of the third alternative color, the image processing parameter further includes a second color ratio, and the second color ratio is used to distinguish the second alternative color and the third alternative color;
[0033] After determining the distance between the initial pixel value of the pixel point and the pixel value corresponding to the first alternative color, it further includes:
[0034] In response to the distance being not less than the distance threshold corresponding to the first color ratio, determining the gray scale value of the pixel point in the first image based on the initial pixel value;
[0035] Determining the target pixel value of the pixel point according to the gray scale value; wherein,
[0036] If the gray scale value is less than the gray scale threshold corresponding to the second color ratio, determining the pixel value corresponding to the second alternative color as the target pixel value of the pixel point;
[0037] If the gray scale value is not less than the gray scale threshold corresponding to the second color ratio, determining the pixel value corresponding to the third alternative color as the target pixel value of the pixel point.
[0038] Optionally, the image processing parameter further includes a contrast enhancement ratio;
[0039] Before determining the target pixel value of the pixel point from the pixel values corresponding to multiple alternative colors based on the image processing parameter and the initial pixel value of the pixel point in the first image, it further includes:
[0040] Performing contrast enhancement processing on the first image based on the contrast enhancement ratio.
[0041] Optionally, performing contrast enhancement processing on the first image based on the contrast enhancement ratio includes:
[0042] Convert the first image from the RGB color space to the HSV color space;
[0043] Determine the average value of the V component of each pixel in the first image to obtain the first brightness;
[0044] Perform gamma transformation on the V component of each pixel based on the gamma transformation parameters corresponding to the contrast enhancement ratio;
[0045] Determine the average value of the V component of each pixel after gamma transformation to obtain the second brightness;
[0046] Keep the H component and S component of each pixel unchanged, and add the difference between the first brightness and the second brightness to the V component of each pixel after gamma transformation to obtain the first image with enhanced contrast in the HSV color space;
[0047] Convert the first image with enhanced contrast in the HSV color space to the RGB space to obtain the first image with enhanced contrast.
[0048] Optionally, the image processing parameter further includes a sharpening ratio;
[0049] Before determining the target pixel value of the pixel from the pixel values corresponding to multiple alternative colors based on the image processing parameter and the initial pixel value of the pixel in the first image, it further includes:
[0050] Perform sharpening processing on the first image based on the sharpening ratio.
[0051] Optionally, performing the sharpening processing on the first image based on the sharpening ratio includes:
[0052] Convert the first image from the RGB color space to the HSV color space to obtain a luminance channel map;
[0053] Perform guided filtering on the luminance channel map based on the sharpening ratio to obtain a first filtered map;
[0054] Separate the first filtered map from the luminance channel map to obtain a first detail map;
[0055] Overlay the first detail map on the luminance channel map to obtain a first enhanced map;
[0056] Perform Gaussian filtering on the first enhanced map based on the sharpening ratio to obtain a second filtered map;
[0057] Separate the second filtered map from the first enhanced map to obtain a second detail map;
[0058] Overlay the second detailed image onto the first enhanced image to obtain a second enhanced image;
[0059] Convert the second enhanced image from the HSV color space to the RGB color space to obtain a sharpened first image.
[0060] Optionally, the image processing parameter further includes an error truncation ratio;
[0061] Before converting the initial pixel value of the pixel point in the first image to the target pixel value, it further includes:
[0062] Determine the difference between the initial pixel value and the target pixel value to obtain an error value;
[0063] Perform error diffusion on the target pixel value based on the error value and the error truncation ratio.
[0064] Optionally, the method further includes:
[0065] Display a third user interface, where the third user interface includes a third image, and the third image includes at least two different second images converted from the first image.
[0066] On the other hand, an image processing apparatus is provided, and the apparatus includes:
[0067] A first determination module, configured to determine a target processing mode corresponding to a first image to be processed;
[0068] A second determination module, configured to determine an image processing parameter corresponding to the first image based on the target processing mode;
[0069] A third determination module, configured to determine a target pixel value of the pixel point from pixel values corresponding to multiple alternative colors based on the image processing parameter and the initial pixel value of the pixel point in the first image;
[0070] A conversion module, configured to convert the initial pixel value of the pixel point in the first image to the target pixel value to obtain a second image.
[0071] Optionally, the first determination module includes:
[0072] A first recognition unit, configured to recognize the type of an object in the first image to obtain a recognition result;
[0073] A first determination unit, configured to, if the recognition result includes one object type and it is a first object type, determine the image processing mode corresponding to the first object type among multiple image processing modes as the candidate processing mode corresponding to the first image;
[0074] A second determination unit, configured to determine the target processing mode based on the candidate processing mode.
[0075] Optionally, the first determination module includes:
[0076] A second recognition unit, configured to recognize the type of the object in the first image to obtain a recognition result;
[0077] A third determination unit, configured to, if the recognition result includes multiple object types, determine the area occupation ratios of the imaging areas of the objects corresponding to the multiple object types in the first image;
[0078] A fourth determination unit, configured to determine the image processing mode corresponding to the second object type among the multiple image processing modes as the candidate processing mode for the first image, where the second object type is the object type with the largest area occupation ratio among the multiple object types;
[0079] A fifth determination unit, configured to determine the target processing mode based on the candidate processing mode.
[0080] Optionally, the second determination unit or the fifth determination unit is specifically configured to:
[0081] Display a first user interface, where the first user interface includes description information of the candidate processing mode;
[0082] In response to a mode confirmation instruction, determine the candidate processing mode as the target processing mode;
[0083] In response to a mode customization instruction, determine the customized mode as the target processing mode.
[0084] Optionally, the second determination module is specifically configured to:
[0085] In the case where the target processing mode is an image processing mode among multiple image processing modes, determine the image processing parameters corresponding to the target processing mode as the image processing parameters for the first image.
[0086] Optionally, the second determination module is specifically configured to:
[0087] In the case where the target processing mode is a customized mode, display a second user interface, where the second user interface includes a plurality of customized parameter items;
[0088] Obtain the customized parameters input in the plurality of customized parameter items;
[0089] Determine the custom parameters input in the multiple custom parameter items as the image processing parameters corresponding to the first image.
[0090] Optionally, the multiple alternative colors include a first alternative color with a hue, and the image processing parameter includes a first color ratio, where the first color ratio is used to distinguish the first alternative color from other alternative colors;
[0091] The third determination module is specifically configured to:
[0092] Determine the distance between the initial pixel value of the pixel point and the pixel value corresponding to the first alternative color;
[0093] If the distance is less than the distance threshold corresponding to the first color ratio, determine the pixel value corresponding to the first alternative color as the target pixel value of the pixel point.
[0094] Optionally, the multiple alternative colors further include a second alternative color and a third alternative color without a hue, the gray level of the second alternative color is less than the gray level of the third alternative color, and the image processing parameter further includes a second color ratio, where the second color ratio is used to distinguish the second alternative color and the third alternative color;
[0095] The third determination module is further specifically configured to:
[0096] In response to the distance being not less than the distance threshold corresponding to the first color ratio, based on the initial pixel value, determine the gray level value of the pixel point in the first image;
[0097] Determine the target pixel value of the pixel point according to the gray level value; where,
[0098] If the gray level value is less than the gray level threshold corresponding to the second color ratio, determine the pixel value corresponding to the second alternative color as the target pixel value of the pixel point;
[0099] If the gray level value is not less than the gray level threshold corresponding to the second color ratio, determine the pixel value corresponding to the third alternative color as the target pixel value of the pixel point.
[0100] Optionally, the image processing parameter further includes a contrast enhancement ratio;
[0101] The device further includes:
[0102] A contrast enhancement processing module, configured to perform contrast enhancement processing on the first image based on the contrast enhancement ratio.
[0103] Optionally, the contrast enhancement processing module is specifically configured to:
[0104] Convert the first image from the RGB color space to the HSV color space;
[0105] Determine the average value of the V component of each pixel in the first image to obtain a first luminance;
[0106] Perform gamma transformation on the V component of each pixel based on the gamma transformation parameter corresponding to the contrast enhancement ratio;
[0107] Determine the average value of the V component of each pixel after gamma transformation to obtain a second luminance;
[0108] Keep the H component and S component of each pixel unchanged, and add the difference between the first luminance and the second luminance to the V component of each pixel after gamma transformation to obtain the first image with enhanced contrast in the HSV color space;
[0109] Convert the first image with enhanced contrast in the HSV color space to the RGB space to obtain the first image with enhanced contrast.
[0110] Optionally, the image processing parameter further includes a sharpening ratio;
[0111] The apparatus further includes:
[0112] A sharpening processing module, configured to perform sharpening processing on the first image based on the sharpening ratio.
[0113] Optionally, the sharpening processing module is specifically configured to:
[0114] Convert the first image from the RGB color space to the HSV color space to obtain a luminance channel map;
[0115] Perform guided filtering on the luminance channel map based on the sharpening ratio to obtain a first filtered map;
[0116] Separate the first filtered map from the luminance channel map to obtain a first detail map;
[0117] Overlay the first detail map on the luminance channel map to obtain a first enhanced map;
[0118] Perform Gaussian filtering on the first enhanced map based on the sharpening ratio to obtain a second filtered map;
[0119] Separate the second filtered map from the first enhanced map to obtain a second detail map;
[0120] Overlay the second detail map on the first enhanced map to obtain a second enhanced map;
[0121] Convert the second enhanced image from the HSV color space to the RGB color space to obtain a sharpened first image.
[0122] Optionally, the image processing parameter further includes an error truncation ratio;
[0123] The apparatus further includes:
[0124] A fourth determination module, configured to determine a difference between the initial pixel value and the target pixel value to obtain an error value;
[0125] An error diffusion module, configured to perform error diffusion on the target pixel value based on the error value and the error truncation ratio.
[0126] Optionally, the apparatus further includes:
[0127] A display module, configured to display a third user interface, where the third user interface includes a third image, and the third image includes at least two different second images converted from the first image.
[0128] On the other hand, an image processing device is provided, which includes a memory and a processor. The memory is used to store a computer program, and the processor is used to execute the computer program stored on the memory to implement the steps of the above-mentioned image processing method.
[0129] On the other hand, a non-transitory computer-readable storage medium is provided. The storage medium stores a computer program, and when the computer program is executed by a processor, the steps of the above-mentioned image processing method are implemented.
[0130] On the other hand, a computer program product including instructions is provided. When the instructions run on a computer, the computer is caused to execute the steps of the above-mentioned image processing method.
[0131] The technical solution provided by this application can at least bring the following beneficial effects:
[0132] Since different first images correspond to different target processing modes, and different target processing modes correspond to different image processing parameters. Therefore, the image processing parameters corresponding to the first image to be processed are related to the first image. In this way, the first image can be converted into a second image based on the image processing parameters related to the first image, thereby improving the accuracy of image processing and further improving the display effect of the second image. At the same time, different target processing modes can meet the usage requirements of users in different scenarios. Description of the Drawings
[0133] To more clearly illustrate the technical solutions in the embodiments of the present application, the following will briefly introduce the accompanying drawings required for the description of the embodiments. Obviously, the accompanying drawings in the following description are only some embodiments of the present application. For those of ordinary skill in the art, without creative efforts, other accompanying drawings can also be obtained based on these drawings.
[0134] Figure 1 is a flowchart of an image processing method provided by an embodiment of the present application;
[0135] Figure 2 is a schematic diagram of an RGB color space provided by an embodiment of the present application;
[0136] Figure 3 is a schematic diagram of an image conversion result provided by an embodiment of the present application;
[0137] Figure 4 is a flowchart of enhancing the contrast of a first image provided by an embodiment of the present application;
[0138] Figure 5 is a flowchart of sharpening a first image provided by an embodiment of the present application;
[0139] Figure 6 is a schematic diagram of the effect after preprocessing an image provided by an embodiment of the present application;
[0140] Figure 7 is a schematic diagram of the effect of error diffusion provided by an embodiment of the present application;
[0141] Figure 8 is a schematic diagram of the structure of an image processing apparatus provided by an embodiment of the present application;
[0142] Figure 9 is a schematic diagram of the structure of a mobile terminal provided by an embodiment of the present application. Detailed implementation manners
[0143] To make the objectives, technical solutions, and advantages of the embodiments of the present application clearer, the following will further describe the embodiments of the present application in detail with reference to the accompanying drawings.
[0144] Before explaining the image processing method provided by the embodiments of the present application in detail, the application scenarios provided by the embodiments of the present application will be introduced first.
[0145] The image processing method provided by the embodiments of this application can be applied to various scenarios. For example, in the scenario of displaying an image on an e-ink screen, a color first image is usually converted into a second image with only black and white colors or a second image with red, black, and white colors to display the second image. However, during the process of processing the first image, since the image processing parameters are fixed, the converted second image cannot meet the usage requirements of users in different scenarios. Therefore, through the image processing method provided by the embodiments of this application, a target processing mode corresponding to the first image to be processed can be determined, and based on the target processing mode, the image processing parameters corresponding to the first image can be determined. Then, based on the image processing parameters and the initial pixel value of the pixel point in the first image, the target pixel value of the pixel point can be determined from the pixel values corresponding to multiple alternative colors, and the initial pixel value of the pixel point in the first image is converted into the target pixel value to obtain the second image. In this way, the usage requirements of users in different scenarios can be met.
[0146] The image processing method provided by the embodiments of this application can be executed by an image processing device, and the image processing device can be a terminal device such as a fixed terminal or a mobile terminal. Among them, the terminal device can be any electronic product that can perform human-computer interaction with the user in one or more ways such as a keyboard, a touchpad, a touch screen, a remote control, voice interaction, or a handwriting device. For example, a PC (Personal Computer), a mobile phone, a smart phone, a PDA (Personal Digital Assistant), a pocket PC (Pocket PC), a tablet computer, etc.
[0147] Those skilled in the art should understand that the above application scenarios and image processing devices are only examples. Other existing or future possible application scenarios and image processing devices that are applicable to the embodiments of this application should also be included within the protection scope of the embodiments of this application and are hereby incorporated by reference.
[0148] It should be noted that the application scenarios described in the embodiments of this application are for more clearly explaining the technical solutions of the embodiments of this application and do not constitute a limitation on the technical solutions provided by the embodiments of this application. Those of ordinary skill in the art know that with the emergence of new application scenarios, the technical solutions provided by the embodiments of this application are equally applicable to similar technical problems.
[0149] Next, a detailed explanation of the image processing method provided by the embodiments of this application will be given.
[0150] Figure 1 is a flowchart of an image processing method provided by the embodiments of this application. Please refer to Figure 1 and the method includes the following steps.
[0151] Step 101: Determine the target processing mode corresponding to the first image to be processed.
[0152] The execution subject of the embodiments of the present application may be a terminal device such as a fixed terminal or a mobile terminal. For the convenience of description, the mobile terminal will be taken as an example for introduction hereinafter.
[0153] The mobile terminal identifies the type of the object in the first image to be processed to obtain an identification result. If the identification result includes one object type and it is the first object type, the image processing mode corresponding to the first object type among the multiple image processing modes is determined as the candidate processing mode corresponding to the first image. If the identification result includes multiple object types, the area ratio of the imaging regions of the objects corresponding to the multiple object types in the first image is determined, and the image processing mode corresponding to the second object type is determined as the candidate processing mode corresponding to the first image, where the second object type is the object type with the largest area ratio among the multiple object types. The target processing mode corresponding to the first image is determined based on the candidate processing mode corresponding to the first image.
[0154] The type of the object in the first image may be a portrait, text, or landscape. Of course, it may also be other types, which are not limited in the embodiments of the present application. The multiple image processing modes include a portrait mode, a text mode, and a landscape mode. Of course, the multiple image processing modes may also include other modes, which are not limited in the embodiments of the present application.
[0155] The first image to be processed may be downloaded by the user through the mobile terminal from other web pages, or may also be selected by the user from multiple images stored in the mobile terminal. When the mobile terminal detects the user's image processing operation, the mobile terminal displays an input interface for the first image to be processed, and the input interface includes two options: off-site download and local selection. When the user clicks the "off-site download" option, the user can download the first image to be processed through the mobile terminal from other web pages. When the user clicks the "local selection" option, the user can select the first image to be processed from multiple images stored in the mobile terminal.
[0156] Among them, the multiple image processing modes correspond one-to-one to the multiple object types. That is, different image processing modes correspond to different object types. Therefore, after the mobile terminal determines the first object type, it can select the image processing mode corresponding to the first object type from the multiple image processing modes and determine the image processing mode as the candidate processing mode corresponding to the first image. Similarly, after the mobile terminal determines the second object type, it can also select the image processing mode corresponding to the second object type from the multiple image processing modes and determine the image processing mode as the candidate processing mode corresponding to the first image.
[0157] If the recognition result only includes one object type and it is the first object type, it indicates that there is only an object of the first object type in the first image to be processed. The image processing mode corresponding to the first object type is more appropriate for the image content of the first image. At this time, the image processing mode corresponding to the first object type among the multiple image processing modes can be directly determined as the candidate processing mode corresponding to the first image. If the recognition result includes multiple object types, it indicates that there are objects of multiple object types in the first image to be processed. At this time, in order to accurately determine the candidate processing mode corresponding to the first image, the object type with the largest area proportion among the multiple object types is determined as the second object type, and then the image processing mode corresponding to the second object type among the multiple image processing modes is determined as the candidate processing mode corresponding to the first image. In this way, the second object type that is more suitable for the image content of the first image can be preferentially determined from the multiple object types.
[0158] Among them, the area proportion of the object type refers to the ratio between the area of the imaging region of the object corresponding to the object type in the first image and the total area of the first image.
[0159] For example, the recognition result includes multiple object types, which are respectively a person, text, and a landscape. The mobile terminal determines that the area proportions of the imaging regions of the objects corresponding to the multiple object types in the first image are 50%, 20%, and 30% respectively. That is, the area proportions of the imaging regions of the person, text, and landscape in the first image are 50%, 20%, and 30% respectively. Since the area proportion of the imaging region of the person in the first image is the largest, the person is determined as the second object type, and then the image processing mode corresponding to the person among the multiple image processing modes is determined as the candidate processing mode corresponding to the first image.
[0160] The mobile terminal can directly determine the candidate processing mode corresponding to the first image as the target processing mode corresponding to the first image. That is, after the mobile terminal determines the candidate processing mode, it automatically determines the candidate processing mode as the target processing mode. Or, it can also be determined by the user whether to use the candidate processing mode as the target processing mode.
[0161] As an example, the mobile terminal displays a first user interface, the first user interface includes the description information of the candidate processing mode, and in response to the mode confirmation instruction, determines the candidate processing mode as the target processing mode, and in response to the mode customization instruction, determines the customized mode as the target processing mode.
[0162] That is, the mobile terminal displays a first user interface, which includes description information of the candidate processing mode. Based on the description information of the candidate processing mode displayed in the first user interface, the user can determine whether to set the candidate processing mode as the target processing mode. When the mobile terminal detects a confirmation operation by the user, it indicates that the user is satisfied with the candidate processing mode recommended by the mobile terminal. At this time, the candidate processing mode is set as the target processing mode. When the mobile terminal detects a customization operation by the user, it indicates that the user is not satisfied with the candidate mode recommended by the mobile terminal. At this time, the user can customize the processing mode of the first image and then set the customized mode as the target processing mode.
[0163] In the case where the mobile terminal directly sets the candidate processing mode as the target processing mode corresponding to the first image, the operation process can be simplified and the operation speed can be improved. In the case where it is determined by the user whether to use the candidate processing mode as the target processing mode corresponding to the first image, a customization function can be provided to meet the user's usage requirements in different scenarios, so that the finally converted second image can better meet the user's needs.
[0164] The user's confirmation operation can be triggered by voice interaction or by clicking a confirmation button in the first user interface. The user's customization operation can be triggered by voice interaction or by clicking a customization button in the first user interface.
[0165] Among them, the description information of the candidate processing mode may include the name of the candidate processing mode and may also include the characteristics of the candidate processing mode. Alternatively, it may also include the image processing parameters corresponding to the candidate processing mode. Of course, the description information of the candidate processing mode may also include other information, which is not limited in the embodiments of the present application.
[0166] For example, Table 1 below shows the description information of multiple image processing modes. Suppose the candidate processing mode is the text mode. At this time, the description information of the text processing mode includes: Name: Text mode; Characteristics: The text has as few jagged edges as possible, is clear, and the image processing parameters used are increased contrast, as simple colors as possible, and a clean background; Image processing parameters are: Contrast enhancement ratio = 100%, Sharpening ratio = 100%, First color ratio = 84%, Second color ratio = 95%, Error truncation ratio = 0%.
[0167] Table 1
[0168]
[0169]
[0170] In some embodiments, before determining the target processing mode corresponding to the first image to be processed, the mobile terminal may also edit the first image to be processed. For example, operations such as cropping, deforming, magnifying, jigsaw puzzle, adding text, adding a LOGO (trademark), adjusting the image position, and adjusting the text position are performed on the first image to be processed. Alternatively, the mobile terminal may also preset multiple image templates to edit the first image to be processed, and the multiple image templates include work permits and medical bedside cards, etc.
[0171] Step 102: Based on the target processing mode, determine the image processing parameters corresponding to the first image.
[0172] Based on the above description, the target processing mode may be one of multiple image processing modes or a custom mode. In different cases, the process by which the mobile terminal determines the image processing parameters corresponding to the first image is different. Therefore, the following two cases will be described separately.
[0173] In the first case, when the target processing mode is one of multiple image processing modes, determine the image processing parameters corresponding to the target processing mode as the image processing parameters corresponding to the first image.
[0174] The multiple image processing modes correspond one-to-one with multiple image processing parameters. That is, different image processing modes correspond to different image processing parameters. Therefore, after the mobile terminal determines the target processing mode corresponding to the first image, it can select the image processing parameters corresponding to the target processing mode from the multiple image processing parameters and determine the image processing parameters as the image processing parameters corresponding to the first image.
[0175] In the second case, when the target processing mode is a custom mode, the mobile terminal displays a second user interface. The second user interface includes multiple custom parameter items. Obtain the custom parameters input in the multiple custom parameter items, and determine the custom parameters input in the multiple custom parameter items as the image processing parameters corresponding to the first image.
[0176] That is to say, if the user selects to determine the custom mode as the target processing mode corresponding to the first image to be processed, when the mobile terminal detects the user's custom operation, it displays a second user interface. The second user interface includes multiple custom parameter items. The user can input multiple custom parameters in the second user interface. When the mobile terminal detects the user's confirmation operation, obtain the custom parameters input by the user in the multiple custom parameter items, and determine the custom parameters input by the user in the multiple custom parameter items as the image processing parameters corresponding to the first image.
[0177] Among them, the custom parameter item can be an input box corresponding to the image processing parameter, and the user can input the image processing parameter in the input box. Alternatively, the custom parameter item can also be a progress bar corresponding to the image processing parameter, and the user can drag the progress bar to determine the image processing parameter.
[0178] Step 103: Based on the image processing parameter and the initial pixel value of the pixel point in the first image, determine the target pixel value of the pixel point from the pixel values corresponding to multiple alternative colors.
[0179] The image processing parameter includes at least one of a first color ratio, a second color ratio, a contrast enhancement ratio, a sharpening ratio, and an error truncation ratio. Of course, the image processing parameter can also include other parameters. Among them, the first color ratio is used to distinguish the first alternative color from other alternative colors, and the second color ratio is used to distinguish the second alternative color from the third alternative color.
[0180] The initial pixel value of the pixel point in the first image can be represented by three components R, G, and B in the RGB color space, and the pixel values corresponding to the multiple alternative colors can also be represented by three components R, G, and B in the RGB color space. The multiple alternative colors include a first alternative color with hue, a second alternative color without hue, and a third alternative color. For example, the first alternative color is red, the second alternative color is black, and the third alternative color is white. At this time, the pixel value corresponding to the first alternative color is (1, 0, 0), the pixel value corresponding to the second alternative color is (0, 0, 0), and the pixel value corresponding to the third alternative color white is (1, 1, 1).
[0181] The implementation process for the mobile terminal to determine the target pixel value of the pixel point from the pixel values corresponding to multiple alternative colors based on the image processing parameter and the initial pixel value of the pixel point in the first image includes: determining the distance between the initial pixel value of the pixel point and the pixel value corresponding to the first alternative color. If the distance is less than the distance threshold corresponding to the first color ratio, then determine the pixel value corresponding to the first alternative color as the target pixel value of the pixel point.
[0182] The mobile terminal stores the correspondence between the color ratio and the distance threshold. Therefore, the mobile terminal can obtain the distance threshold corresponding to the first color ratio from the stored correspondence between the color ratio and the distance threshold based on the first color ratio included in the image processing parameter.
[0183] In some embodiments, in order to improve the accuracy of the first image processing, the accuracy of the first color ratio can be accurate to 1%. That is, if the difference between two color ratios is greater than or equal to 1%, then the two color ratios correspond to different distance thresholds.
[0184] Since the distance between the initial pixel value of a pixel point and the pixel value corresponding to the first alternative color is used to characterize the similarity between the color of the pixel point and the first alternative color, if this distance is less than the distance threshold corresponding to the first color ratio, it indicates that the color of the pixel point is relatively similar to the first alternative color. Therefore, the pixel value corresponding to the first alternative color is determined as the target pixel value of this pixel point.
[0185] As an example, the mobile terminal can determine the distance between the initial pixel value of the pixel point and the pixel value corresponding to the first alternative color according to the following formula (1).
[0186]
[0187] Wherein, in the above formula (1), d represents the distance between the initial pixel value of the pixel point and the pixel value corresponding to the first alternative color, R represents the R component of the initial pixel value of the pixel point, G represents the G component of the initial pixel value of the pixel point, B represents the B component of the initial pixel value of the pixel point, R1 represents the R component of the pixel value corresponding to the first alternative color, G1 represents the G component of the pixel value corresponding to the first alternative color, and B1 represents the B component of the pixel value corresponding to the first alternative color.
[0188] Exemplarily, taking the first alternative color as red as an example. At this time, the pixel value corresponding to red is (1, 0, 0). That is, the R component of the pixel value corresponding to red is 1, the G component of the pixel value corresponding to red is 0, and the B component of the pixel value corresponding to red is 0.
[0189] It should be noted that the way for the mobile terminal to determine the distance between the initial pixel value of the pixel point and the pixel value corresponding to the first alternative color according to the above formula (1) is an example. In some other embodiments, the mobile terminal can also determine the distance between the initial pixel value of the pixel point and the pixel value corresponding to the first alternative color in other ways.
[0190] Exemplarily, please refer to Figure 2 , Figure 2 which is a schematic diagram of an RGB color space provided by an embodiment of the present application. In Figure 2 , a coordinate system is established with a certain point in the space as the origin, the coordinate corresponding to red is (1, 0, 0), the coordinate corresponding to black is (0, 0, 0), and the coordinate corresponding to white is (1, 1, 1). The mobile terminal draws a sphere with the coordinate (1, 0, 0) corresponding to red as the center of the sphere and the distance threshold corresponding to the first color ratio as the radius. At this time, the target pixel values of each pixel point whose coordinate is in the overlapping part of the sphere and the cube are all the pixel values corresponding to red.
[0191] In some embodiments, the distance between the initial pixel value of the pixel point and the pixel value corresponding to the first alternative color may be not less than the distance threshold corresponding to the first color ratio. At this time, in order to determine the target pixel value of the pixel point, the mobile terminal may determine the gray value of the pixel point in the first image based on the initial pixel value of the pixel point. If the gray value is less than the gray threshold corresponding to the second color ratio, the pixel value corresponding to the second alternative color is determined as the target pixel value of the pixel point. If the gray value is not less than the gray threshold corresponding to the second color ratio, the pixel value corresponding to the third alternative color is determined as the target pixel value of the pixel point.
[0192] As an example, the mobile terminal may determine the gray value of the pixel point in the first image according to the following formula (2).
[0193] V = 0.299 * R + 0.587 * G + 0.114 * B (2)
[0194] Wherein, in the above formula (2), V represents the gray value of the pixel point in the first image, R represents the R component of the initial pixel value of the pixel point, G represents the G component of the initial pixel value of the pixel point, and B represents the B component of the initial pixel value of the pixel point.
[0195] The mobile terminal stores the correspondence between the color ratio and the gray threshold. Therefore, the mobile terminal can obtain the gray threshold corresponding to the second color ratio from the stored correspondence between the color ratio and the gray threshold based on the second color ratio included in the image processing parameters.
[0196] In some embodiments, in order to improve the accuracy of the first image processing, the accuracy of the second color ratio can be accurate to 1%. That is, if the difference between two color ratios is greater than or equal to 1%, the two color ratios correspond to different gray thresholds.
[0197] Since the second alternative color and the third alternative color are colors without hue, and the gray of the second alternative color is less than the gray of the third alternative color, if the gray value of the pixel point is less than the gray threshold corresponding to the second color ratio, it indicates that the color of the pixel point is more similar to the second alternative color. Therefore, the pixel value corresponding to the second alternative color is determined as the target pixel value of the pixel point. If the gray value is not less than the gray threshold corresponding to the second color ratio, it indicates that the color of the pixel point is more similar to the third alternative color. Therefore, the pixel value corresponding to the third alternative color is determined as the target pixel value of the pixel point.
[0198] By determining the target pixel value of the pixel point in the first image from the pixel values corresponding to multiple alternative colors through the above method, some boundary problems of the first image can be eliminated, and thus the transition at the boundary of the converted second image becomes more delicate. At the same time, since the above method only calculates the distance between the initial pixel value of the pixel point and the pixel value corresponding to the first alternative color and the gray value of the pixel point in the first image, the operation process is greatly simplified and the operation speed is improved.
[0199] Exemplarily, please refer to Figure 3 , Figure 3 which is a schematic diagram of an image conversion result provided by an embodiment of the present application. In Figure 3 , the left figure is an image obtained after conversion by determining the target pixel value of each pixel point in the first image through other methods, and the right figure is an image obtained after conversion by determining the target pixel value of each pixel point in the first image through the method provided by the present application. Comparing the area corresponding to the black frame in the left figure in Figure 3 with the area corresponding to the black frame in the right figure, it can be seen that by determining the target pixel value of the pixel point in the first image from the pixel values corresponding to multiple alternative colors through the method provided by the present application, some boundary problems of the first image can be eliminated.
[0200] In some embodiments, before the mobile terminal determines the target pixel value of the pixel point from the pixel values corresponding to multiple alternative colors based on the image processing parameter and the initial pixel value of the pixel point in the first image, the first image can also be preprocessed to improve the clarity of the first image, and thus improve the display effect of the second image.
[0201] The preprocessing may include contrast enhancement processing and sharpening processing. Of course, the preprocessing may also include other processing, which is not limited in the embodiments of the present application. Next, the processes of contrast enhancement processing and sharpening processing of the first image are introduced.
[0202] The image processing parameter further includes a contrast enhancement ratio. The mobile terminal can perform contrast enhancement processing on the first image based on this contrast enhancement ratio. Among them, the implementation process of this contrast enhancement processing includes: converting the first image from the RGB color space to the HSV color space, determining the average value of the V components of each pixel point in the first image to obtain the first brightness, performing gamma transformation on the V components of each pixel point based on the gamma transformation parameters corresponding to this contrast enhancement ratio, determining the average value of the V components of each pixel point after gamma transformation to obtain the second brightness, keeping the H components and S components of each pixel point unchanged, adding the difference between the first brightness and the second brightness to the V components of each pixel point after gamma transformation to obtain the first image with enhanced contrast in the HSV color space, and converting the first image with enhanced contrast in the HSV color space to the RGB space. In this way, the contrast, clarity, color saturation of the first image can be improved, and text jaggedness can be reduced.
[0203] Since the mobile terminal stores the correspondence between the contrast enhancement ratio and the gamma transformation parameters. Therefore, the mobile terminal can, based on the contrast enhancement ratio included in this image processing parameter, obtain the gamma transformation parameters corresponding to this contrast enhancement ratio from the stored correspondence between the contrast enhancement ratio and the gamma transformation parameters. Then, perform gamma transformation on the V components of each pixel point based on this gamma transformation parameter to obtain the V components of each pixel point after gamma transformation.
[0204] As an example, the gamma transformation parameters can include a first parameter and a second parameter. At this time, the mobile terminal can perform gamma transformation on the V components of each pixel point according to the following formula (3).
[0205] V' = CV γ (3)
[0206] Among them, in the above formula (3), V' represents the V components of each pixel point after gamma transformation, C represents the first parameter, the first parameter is usually 1, V represents the V components of each pixel point before gamma transformation, γ represents the second parameter, and the second parameter is a correction parameter. When γ is less than 1, the area with a lower gray value in the first image is stretched, and the area with a higher gray value is compressed. When γ is greater than 1, the area with a higher gray value in the first image is stretched, and the area with a lower gray value is compressed. In this way, the area with a higher or lower gray value in the first image can be corrected through the correction parameter, thereby enhancing the contrast of the first image.
[0207] Exemplarily, please refer to Figure 4 , Figure 4 which is a flowchart of a method for performing contrast enhancement processing on the first image provided by an embodiment of the present application. In Figure 4In this case, the mobile terminal converts the first image from the RGB color space to the HSV color space, determines the average value of the V component of each pixel in the first image to obtain the first luminance L. Based on the gamma transformation parameter corresponding to the contrast enhancement ratio, the V component of each pixel is subjected to gamma transformation, and the average value of the V component of each pixel after gamma transformation is determined to obtain the second luminance L'. Then, while keeping the H component and S component of each pixel unchanged, the difference between the first luminance and the second luminance is added to the V component of each pixel after gamma transformation to obtain the first image with enhanced contrast in the HSV color space, and then the first image with enhanced contrast in the HSV color space is converted to the RGB space.
[0208] The image processing parameter further includes a sharpening ratio. The mobile terminal can perform sharpening processing on the first image based on this sharpening ratio. The implementation process of this sharpening processing includes: converting the first image from the RGB color space to the HSV color space to obtain a luminance channel map, performing guided filtering on the luminance channel map based on this sharpening ratio to obtain a first filtered map, separating the first filtered map from the luminance channel map to obtain a first detail map, and superimposing the first detail map on the luminance channel map to obtain a first enhanced map. Then, based on this sharpening ratio, Gaussian filtering is performed on the first enhanced map to obtain a second filtered map, the second filtered map is separated from the first enhanced map to obtain a second detail map, the second detail map is superimposed on the first enhanced map to obtain a second enhanced map, and the second enhanced map is converted from the HSV color space to the RGB color space to obtain the sharpened first image. In this way, the contrast, sharpness, and color saturation of the boundary of the first image can be improved.
[0209] In some embodiments, the above sharpening ratio corresponds to a first filtering parameter and a second filtering parameter. At this time, the mobile terminal can perform guided filtering on the luminance channel map based on the first filtering parameter according to a related algorithm to obtain a first filtered map. At the same time, Gaussian filtering is performed on the first enhanced map based on the second filtering parameter according to a related algorithm to obtain a second filtered map.
[0210] Optionally, the above sharpening ratio further corresponds to a sharpening degree. In this way, the mobile terminal can also perform detail enhancement on the first detail map and the second detail map based on this sharpening degree according to a related algorithm, superimpose the first detail map after detail enhancement on the luminance channel map to obtain a first enhanced map, and superimpose the second detail map after detail enhancement on the first enhanced map to obtain a second enhanced map. The sharpening degree is used to indicate the intensity of sharpening the first image. The larger the value, the higher the intensity of sharpening the first image.
[0211] It should be noted that the mobile terminal stores the corresponding relationships between different sharpening ratios, filtering parameters, and sharpening degrees. Therefore, after determining the image processing parameters corresponding to the first image, the corresponding first filtering parameter, second filtering parameter, and sharpening degree can be obtained from this corresponding relationship based on the sharpening ratio included in the image processing parameters.
[0212] Exemplarily, please refer to Figure 5 , Figure 5 which is a flowchart for sharpening the first image provided by an embodiment of the present application. In Figure 5 , the mobile terminal converts the first image from the RGB color space to the HSV color space to obtain a luminance channel map, performs guided filtering on the luminance channel map based on the sharpening ratio to obtain a first filtered map, separates the first filtered map from the luminance channel map to obtain a first detail map, and superimposes the first detail map on the luminance channel map to obtain a first enhanced map. Then, based on the sharpening ratio, Gaussian filtering is performed on the first enhanced map to obtain a second filtered map, the second filtered map is separated from the first enhanced map to obtain a second detail map, and the second detail map is superimposed on the first enhanced map to obtain a second enhanced map. Finally, the second enhanced map is converted from the HSV color space to the RGB color space to obtain the sharpened first image.
[0213] Based on the above description, preprocessing the first image can improve the overall contrast, clarity, color saturation of the first image, and reduce text jaggedness. For example, please refer to Figure 6 , Figure 6 which is a schematic diagram of the effect after image preprocessing provided by an embodiment of the present application. In Figure 6 , the left figure is the first image before preprocessing, and the right figure is the first image after preprocessing.
[0214] Step 104: Convert the initial pixel value of the pixel point in the first image into a target pixel value to obtain a second image.
[0215] When the image processing parameters further include an error truncation ratio, before the mobile terminal converts the initial pixel value of the pixel point in the first image into a target pixel value, error diffusion can also be performed on the target pixel value to reduce background noise. That is, the mobile terminal determines the difference between the initial pixel value and the target pixel value of the pixel point in the first image to obtain an error value, and performs error diffusion on the target pixel value based on the error value and the error truncation ratio.
[0216] As an example, the mobile terminal can determine the difference between the initial pixel value and the target pixel value of the pixel point according to the following formula (4).
[0217] Error(R,G,B) = SRC(R,G,B) - DST(R,G,B) (4)
[0218] Among them, in the above formula (4), Error(R,G,B) represents the difference between the initial pixel value and the target pixel value of this pixel point, that is, the error value, SRC(R,G,B) represents the initial pixel value of this pixel point, and DST(R,G,B) represents the target pixel value of this pixel point.
[0219] In some embodiments, the implementation process of the mobile terminal performing error diffusion on the target pixel value based on the error value and the error truncation ratio includes: based on the error value and the error truncation ratio, determining the difference between the initial pixel value and the target pixel value of this pixel point after error truncation, that is, the error value after error truncation. Then, based on the error value after error truncation, error diffusion is performed on this pixel point.
[0220] As an example, the mobile terminal can determine the error value after error truncation according to the following formula (5).
[0221] Error(R,G,B)' = floor(Error(R,G,B) * Norm) / Norm (5)
[0222] Among them, in the above formula (5), Error(R,G,B)' represents the difference between the initial pixel value and the target pixel value of this pixel point after error truncation, that is, the error value after error truncation, floor represents the floor function, Error(R,G,B) represents the difference between the initial pixel value and the target pixel value of this pixel point before error truncation, and Norm represents the error truncation value corresponding to the error truncation ratio, and this error truncation value is a positive integer.
[0223] In some embodiments, the mobile terminal stores the correspondence between the error truncation ratio and the error truncation value. Therefore, the mobile terminal can, based on the error truncation ratio included in this image processing parameter, obtain the error truncation value corresponding to this error truncation ratio from the stored correspondence between the error truncation ratio and the error truncation value. Then, based on the error value of this pixel point and this error truncation value, the error value after error truncation is determined according to the above method.
[0224] Among them, the error truncation value is used to indicate the intensity of error truncation for this pixel point. The smaller the error truncation value, the greater the truncation intensity. According to experience, the value range of the error truncation value is between 40 - 128, which can effectively reduce the color jitter in the first image, thereby improving the graininess of the converted second image and increasing the color saturation.
[0225] After determining the error value after error truncation, the mobile terminal can determine the error diffusion window corresponding to the pixel point. The error diffusion window corresponding to the pixel point is a window centered on the pixel point, and the error diffusion window also includes other pixel points located in the neighborhood of the pixel point. For ease of description, this pixel point is referred to as pixel point A, and other pixel points within the error diffusion window are referred to as pixel point B. For any pixel point B within the error diffusion window whose target pixel value has not been determined, the mobile terminal can obtain the error diffusion ratio corresponding to the pixel point B. Then, multiply the error value after error truncation by the error diffusion ratio corresponding to the pixel point B to obtain the current error diffusion value of the pixel point B, and add the current error diffusion value of the pixel point B to the pixel value of the pixel point B before the current error diffusion to complete the error diffusion from pixel point A to pixel point B. That is, the mobile terminal distributes the error value after error truncation of pixel point A to other pixel points within the error diffusion window whose target pixel values have not been determined. In this way, the boundary of the first image can be enhanced, thereby improving the display effect of the processed second image.
[0226] Among them, the error diffusion window can be a 3*3 window or a 5*5 window. Of course, the error diffusion window can also be a window of other sizes, and the embodiments of the present application do not limit this. The error diffusion ratios corresponding to other pixel points within the error diffusion window are set in advance. Moreover, the error diffusion ratios corresponding to other pixel points can be stored in the form of a table or in the form of a matrix. Of course, the error diffusion ratios corresponding to other pixel points can also be stored in other forms, and the embodiments of the present application do not limit this.
[0227] It should be noted that for any pixel point among other pixel points within the error diffusion window, before the mobile terminal determines the target pixel value of the any pixel point, there may be multiple pixel points that need to perform error diffusion to the any pixel point. In this case, the mobile terminal will, on the basis of the initial pixel value of the any pixel point, superimpose the error diffusion values of each of the multiple pixel points performing error diffusion to the any pixel point. Then, based on the image processing parameters and the pixel value obtained by the any pixel point after superimposing each error diffusion value, determine the target pixel value of the any pixel point from the pixel values corresponding to multiple alternative colors.
[0228] For example, take the error diffusion window determined by the mobile terminal as a 5*5 window. Table 2 below shows the error diffusion ratios corresponding to other pixel points within the 5*5 error diffusion window centered on pixel point A for which the target pixel values have not been determined. Assume that the mobile terminal currently needs to spread the error value Error' after truncating the error of pixel point A to the surrounding pixel points B, C, D, E, F, G, H, I, J, K, L, and M. For pixel point B, the mobile terminal multiplies the error diffusion ratio corresponding to pixel point B by the error value Error' after truncating the error of pixel point A to obtain the error diffusion value of pixel point B for this time The error diffusion value of pixel point B for this time is added to the pixel value of pixel point B before the error diffusion for this time to obtain the pixel value of pixel point B after the error diffusion for this time.
[0229] Table 2
[0230]
[0231] Exemplarily, please refer to Figure 7 , Figure 7 which is a schematic diagram of the effect of error diffusion provided by an embodiment of the present application. In Figure 7 , the left figure is the first image before error diffusion, and the right figure is the first image after error diffusion. Comparing the area corresponding to the black frame in the left figure in Figure 7 with the area corresponding to the black frame in the right figure, it can be seen that the background noise is reduced through error diffusion.
[0232] The pixel points in the first image in the above steps 102-104 can generally refer to all pixel points in the first image, or specifically refer to some pixel points in the first image. That is, the mobile terminal can convert the initial pixel values of all pixel points in the first image into target pixel values, or only convert the initial pixel values of some pixel points in the first image into target pixel values. If the mobile terminal converts the initial pixel values of all pixel points in the first image into target pixel values, then the initial pixel values of all pixel points in the first image are sequentially converted according to the above steps 102-104. At this time, after the mobile terminal traverses each pixel point, it is necessary to convert the initial pixel value of this pixel point into a target pixel value. Then, it is judged whether the traversal of all pixel points in the first image is completed. If the traversal of all pixel points in the first image is completed, the second image is output. If the traversal of all pixel points in the first image is not completed, then continue to determine the target pixel values of other non-traversed pixel points in the first image according to the above steps 102-104 until all pixel points in the first image are traversed, and then the second image is output. Exemplarily, if there is no initial pixel value for the next pixel point adjacent to the current pixel point, it indicates that the current pixel point is the last pixel point in the first image to be processed. That is, the traversal of the first image is completed, and the mobile terminal outputs the second image.
[0233] In the case where the traversal of the first image is completed, the mobile terminal can directly output the second image. At this time, the mobile terminal displays the second image. In some embodiments, since the second image output by the mobile terminal may not meet the user's usage requirements, the mobile terminal can display a third user interface, and the third user interface includes the second image. The user can preview the second image in the third user interface to determine whether the second image meets the user's usage requirements. If the second image meets the user's usage requirements, the mobile terminal displays the second image. If the second image does not meet the user's usage requirements, the mobile terminal reprocesses the first image according to the above steps 101-104 until the second image meets the user's usage requirements, and then displays the second image. That is to say, the mobile terminal displays a third user interface, and the third user interface includes the second image. The user can preview the second image in the third user interface. When the mobile terminal detects the user's confirmation operation, it indicates that the second image meets the user's usage requirements. At this time, the mobile terminal displays the second image. When the mobile terminal detects the user's reprocessing operation, it indicates that the second image does not meet the user's usage requirements. At this time, the mobile terminal reprocesses the first image according to the above steps 101-104 until the second image meets the user's usage requirements, and then displays the second image.
[0234] In some embodiments, after obtaining the second image, the mobile terminal can also send the second image to other devices through means such as NFC (Near Field Communication) and Bluetooth communication. After receiving the second image, the other devices display the second image.
[0235] The above-mentioned first image can be a partial area in the original color image, such as a person area, a text area, or a landscape area. The mobile terminal can process at least two different first images respectively according to the above steps 101-104 to obtain at least two different second images. After that, the mobile terminal can display a third user interface, and the third user interface includes the at least two different second images.
[0236] That is to say, the mobile terminal can separately convert at least two different first images in the original color image to obtain at least two different second images. Then, the at least two different second images are spliced to obtain a third image, and the third image is displayed in the third user interface.
[0237] In the embodiments of the present application, since different first images correspond to different target processing modes, and different target processing modes correspond to different image processing parameters. Therefore, the image processing parameters corresponding to the first image to be processed are related to the first image. In this way, the first image can be converted into a second image based on the image processing parameters related to the first image, so as to improve the accuracy of image processing, and further improve the display effect of the second image, so that the second image can clearly reflect the visual information of the first image. At the same time, different target processing modes can meet the user's usage requirements in different scenarios. In addition, by performing contrast enhancement processing on the first image, the contrast, clarity, color saturation of the first image can be improved, and text jaggedness can be reduced. By performing sharpening processing on the first image, the contrast, clarity, and color saturation of the boundary of the first image can be improved. By performing error diffusion on the target pixel value, background noise can be reduced, and the display effect of the second image can be further improved.
[0238] Figure 8 It is a schematic structural diagram of an image processing device provided by an embodiment of the present application. The image processing device can be implemented by software, hardware, or a combination of both to become part or all of an image processing device. Please refer to Figure 8 This device includes: a first determination module 801, a second determination module 802, a third determination module 803, and a conversion module 804.
[0239] The first determination module 801 is used to determine the target processing mode corresponding to the first image to be processed;
[0240] The second determination module 802 is configured to determine image processing parameters corresponding to the first image based on the target processing mode;
[0241] The third determination module 803 is configured to determine the target pixel value of the pixel point from the pixel values corresponding to multiple alternative colors based on the image processing parameters and the initial pixel value of the pixel point in the first image;
[0242] The conversion module 804 is configured to convert the initial pixel value of the pixel point in the first image into the target pixel value to obtain the second image.
[0243] Optionally, the first determination module 801 includes:
[0244] The first recognition unit is configured to recognize the type of the object in the first image to obtain a recognition result;
[0245] The first determination unit is configured to, if the recognition result includes one object type and it is the first object type, determine the image processing mode corresponding to the first object type among multiple image processing modes as the candidate processing mode corresponding to the first image;
[0246] The second determination unit is configured to determine the target processing mode based on the candidate processing mode.
[0247] Optionally, the first determination module 801 includes:
[0248] The second recognition unit is configured to recognize the type of the object in the first image to obtain a recognition result;
[0249] The third determination unit is configured to, if the recognition result includes multiple object types, determine the area proportion of the imaging regions of the objects corresponding to the multiple object types in the first image;
[0250] The fourth determination unit is configured to determine the image processing mode corresponding to the second object type among the multiple image processing modes as the candidate processing mode corresponding to the first image, where the second object type is the object type with the largest area proportion among the multiple object types;
[0251] The fifth determination unit is configured to determine the target processing mode based on the candidate processing mode.
[0252] Optionally, the second determination unit or the fifth determination unit is specifically configured to:
[0253] Display the first user interface, where the first user interface includes the description information of the candidate processing mode;
[0254] In response to the mode confirmation instruction, determine the candidate processing mode as the target processing mode;
[0255] In response to the mode customization instruction, determine the customized mode as the target processing mode.
[0256] Optionally, the second determination module 802 is specifically configured to:
[0257] When the target processing mode is one of multiple image processing modes, determine the image processing parameters corresponding to the target processing mode as the image processing parameters of the first image.
[0258] Optionally, the second determination module 802 is specifically configured to:
[0259] When the target processing mode is the customized mode, display a second user interface, where the second user interface includes multiple customized parameter items;
[0260] Obtain the customized parameters input in the multiple customized parameter items;
[0261] Determine the customized parameters input in the multiple customized parameter items as the image processing parameters of the first image.
[0262] Optionally, the multiple alternative colors include a first alternative color with a hue, and the image processing parameter includes a first color ratio, where the first color ratio is used to distinguish the first alternative color from other alternative colors;
[0263] The third determination module 803 is specifically configured to:
[0264] Determine the distance between the initial pixel value of the pixel point and the pixel value corresponding to the first alternative color;
[0265] If the distance is less than the distance threshold corresponding to the first color ratio, determine the pixel value corresponding to the first alternative color as the target pixel value of the pixel point.
[0266] Optionally, the multiple alternative colors further include a second alternative color and a third alternative color without a hue, the gray scale of the second alternative color is less than the gray scale of the third alternative color, and the image processing parameter further includes a second color ratio, where the second color ratio is used to distinguish the second alternative color and the third alternative color;
[0267] The third determination module 803 is further specifically configured to:
[0268] In response to the distance being not less than the distance threshold corresponding to the first color ratio, based on the initial pixel value, determine the gray scale value of the pixel point in the first image;
[0269] Determine the target pixel value of the pixel point according to the gray scale value; where
[0270] If the grayscale value is less than the grayscale threshold corresponding to the second color ratio, the pixel value corresponding to the second alternative color is determined as the target pixel value of the pixel point;
[0271] If the grayscale value is not less than the grayscale threshold corresponding to the second color ratio, the pixel value corresponding to the third alternative color is determined as the target pixel value of the pixel point.
[0272] Optionally, the image processing parameter further includes a contrast enhancement ratio;
[0273] The apparatus further includes:
[0274] A contrast enhancement processing module, configured to perform contrast enhancement processing on the first image based on the contrast enhancement ratio.
[0275] Optionally, the contrast enhancement processing module is specifically configured to:
[0276] Convert the first image from the RGB color space to the HSV color space;
[0277] Determine the average value of the V components of each pixel point in the first image to obtain the first brightness;
[0278] Perform gamma transformation on the V component of each pixel point based on the gamma transformation parameter corresponding to the contrast enhancement ratio;
[0279] Determine the average value of the V components of each pixel point after gamma transformation to obtain the second brightness;
[0280] Keep the H component and S component of each pixel point unchanged, and add the difference between the first brightness and the second brightness to the V component of each pixel point after gamma transformation to obtain the first image with enhanced contrast in the HSV color space;
[0281] Convert the first image with enhanced contrast in the HSV color space to the RGB space to obtain the first image with enhanced contrast.
[0282] Optionally, the image processing parameter further includes a sharpening ratio;
[0283] The apparatus further includes:
[0284] A sharpening processing module, configured to perform sharpening processing on the first image based on the sharpening ratio.
[0285] Optionally, the sharpening processing module is specifically configured to:
[0286] Convert the first image from the RGB color space to the HSV color space to obtain a luminance channel map;
[0287] Perform guided filtering on the luminance channel map based on the sharpening ratio to obtain a first filtered map;
[0288] Separate the first filtering image from the luminance channel image to obtain a first detail image;
[0289] Overlay the first detail image onto the luminance channel image to obtain a first enhanced image;
[0290] Perform Gaussian filtering on the first enhanced image based on a sharpening ratio to obtain a second filtering image;
[0291] Separate the second filtering image from the first enhanced image to obtain a second detail image;
[0292] Overlay the second detail image onto the first enhanced image to obtain a second enhanced image;
[0293] Convert the second enhanced image from the HSV color space to the RGB color space to obtain a sharpened first image.
[0294] Optionally, the image processing parameter further includes an error truncation ratio;
[0295] The apparatus further includes:
[0296] A fourth determination module, configured to determine a difference between an initial pixel value and a target pixel value to obtain an error value;
[0297] An error diffusion module, configured to perform error diffusion on the target pixel value based on the error value and the error truncation ratio.
[0298] Optionally, the apparatus further includes:
[0299] A display module, configured to display a third user interface, where the third user interface includes a third image, and the third image includes at least two second images converted from different first images.
[0300] In the embodiments of the present application, since different first images correspond to different target processing modes, and different target processing modes correspond to different image processing parameters. Therefore, the image processing parameters corresponding to the first image to be processed are related to the first image. In this way, the first image can be converted into a second image based on the image processing parameters related to the first image, thereby improving the accuracy of image processing, and further improving the display effect of the second image, so that the second image can clearly reflect the visual information of the first image. At the same time, different target processing modes can meet the usage requirements of users in different scenarios. In addition, by performing contrast enhancement processing on the first image, the contrast, clarity, color saturation of the first image can be improved, and text jaggedness can be reduced. By performing sharpening processing on the first image, the contrast, clarity, and color saturation of the boundaries of the first image can be improved. By performing error diffusion on the target pixel value, background noise can be reduced, and the display effect of the second image can be further improved.
[0301] It should be noted that: when the image processing apparatus provided in the above embodiments performs image processing, only the division of the above functional modules is used for illustration. In actual applications, the above functions can be allocated to different functional modules according to needs, that is, the internal structure of the apparatus is divided into different functional modules to complete all or part of the functions described above. In addition, the image processing apparatus provided in the above embodiments and the embodiments of the image processing method belong to the same concept. For the specific implementation process, please refer to the method embodiments, which will not be elaborated here.
[0302] Figure 9 It is a structural block diagram of a mobile terminal 900 provided by an embodiment of the present application. The mobile terminal 900 can be a portable mobile terminal, such as: a smart phone, a tablet computer, an MP3 player (Moving Picture Experts Group Audio Layer III), an MP4 (Moving Picture Experts Group Audio Layer IV) player, a notebook computer or a desktop computer. The mobile terminal 900 may also be referred to by other names such as user equipment, portable terminal, laptop terminal, desktop terminal, etc.
[0303] Generally, the mobile terminal 900 includes: a processor 901 and a memory 902.
[0304] The processor 901 may include one or more processing cores, such as a quad-core processor, an octa-core processor, etc. The processor 901 may be implemented in at least one hardware form of DSP (Digital Signal Processing), FPGA (Field-Programmable Gate Array), or PLA (Programmable Logic Array). The processor 901 may also include a main processor and a coprocessor. The main processor is a processor for processing data in the wake state, also known as the CPU (Central Processing Unit); the coprocessor is a low-power processor for processing data in the standby state. In some embodiments, the processor 901 may be integrated with a GPU (Graphics Processing Unit), and the GPU is responsible for rendering and drawing the content to be displayed on the display screen. In some embodiments, the processor 901 may further include an AI (Artificial Intelligence) processor, and the AI processor is used to process computational operations related to machine learning.
[0305] The memory 902 may include one or more computer-readable storage media, and the computer-readable storage media may be non-transitory. The memory 902 may further include high-speed random access memory and non-volatile memory, such as one or more disk storage devices and flash storage devices. In some embodiments, the non-transitory computer-readable storage media in the memory 902 is used to store at least one instruction, and the at least one instruction is used to be executed by the processor 901 to implement the image processing method provided in the method embodiments of the present application.
[0306] In some embodiments, the mobile terminal 900 may further optionally include: a peripheral device interface 903 and at least one peripheral device. The processor 901, the memory 902, and the peripheral device interface 903 may be connected by a bus or signal lines. Each peripheral device may be connected to the peripheral device interface 903 through a bus, signal lines, or a circuit board. Specifically, the peripheral devices include at least one of a radio frequency circuit 904, a touch display screen 905, a camera 906, an audio circuit 907, a positioning component 908, and a power supply 909.
[0307] The peripheral device interface 903 can be used to connect at least one I / O (Input / Output) related peripheral device to the processor 901 and the memory 902. In some embodiments, the processor 901, the memory 902, and the peripheral device interface 903 are integrated on the same chip or circuit board; in some other embodiments, any one or two of the processor 901, the memory 902, and the peripheral device interface 903 can be implemented on a separate chip or circuit board, and this embodiment does not limit this.
[0308] The radio frequency circuit 904 is used to receive and transmit RF (Radio Frequency) signals, also known as electromagnetic signals. The radio frequency circuit 904 communicates with a communication network and other communication devices through electromagnetic signals. The radio frequency circuit 904 converts an electrical signal into an electromagnetic signal for transmission, or converts the received electromagnetic signal into an electrical signal. Optionally, the radio frequency circuit 904 includes: an antenna system, an RF transceiver, one or more amplifiers, a tuner, an oscillator, a digital signal processor, a codec chipset, a subscriber identity module card, and so on. The radio frequency circuit 904 can communicate with other terminals through at least one wireless communication protocol. The wireless communication protocol includes but is not limited to: the World Wide Web, a metropolitan area network, an intranet, generations of mobile communication networks (2G, 3G, 4G, and 5G), a wireless local area network, and / or a WiFi (Wireless Fidelity) network. In some embodiments, the radio frequency circuit 904 may further include a circuit related to NFC (Near Field Communication), and this application embodiment does not limit this.
[0309] The display screen 905 is used to display the UI (User Interface). The UI may include graphics, text, icons, videos, and any combination thereof. When the display screen 905 is a touch display screen, the display screen 905 also has the ability to collect touch signals on or above the surface of the display screen 905. The touch signals can be input as control signals to the processor 901 for processing. At this time, the display screen 905 can also be used to provide virtual buttons and / or virtual keyboards, also known as soft buttons and / or soft keyboards. In some embodiments, there may be one display screen 905, which is disposed on the front panel of the mobile terminal 900; in other embodiments, there may be at least two display screens 905, which are respectively disposed on different surfaces of the mobile terminal 900 or are in a foldable design; in still other embodiments, the display screen 905 may be a flexible display screen, which is disposed on the curved surface or the folding surface of the mobile terminal 900. Even, the display screen 905 can also be set as an irregular non-rectangular shape, that is, a special-shaped screen. The display screen 905 can be prepared using materials such as LCD (Liquid Crystal Display) and OLED (Organic Light-Emitting Diode).
[0310] The camera module 906 is used to capture images or videos. Optionally, the camera module 906 includes a front camera and a rear camera. Generally, the front camera is disposed on the front panel of the terminal, and the rear camera is disposed on the back of the terminal. In some embodiments, there are at least two rear cameras, which are any one of a main camera, a depth-of-field camera, a wide-angle camera, and a telephoto camera, so as to realize the function of background blurring by fusing the main camera and the depth-of-field camera, the function of panoramic shooting by fusing the main camera and the wide-angle camera, and the VR (Virtual Reality) shooting function or other fusion shooting functions. In some embodiments, the camera module 906 may further include a flash. The flash can be a single-color temperature flash or a two-color temperature flash. The two-color temperature flash refers to the combination of a warm light flash and a cold light flash, and can be used for light compensation under different color temperatures.
[0311] The audio circuit 907 may include a microphone and a speaker. The microphone is used to collect sound waves of the user and the environment, and convert the sound waves into electrical signals for input to the processor 901 for processing, or input to the radio frequency circuit 904 to achieve voice communication. For the purpose of stereo collection or noise reduction, there may be multiple microphones, which are respectively arranged at different parts of the mobile terminal 900. The microphone may also be an array microphone or an omnidirectional collection microphone. The speaker is used to convert the electrical signal from the processor 901 or the radio frequency circuit 904 into sound waves. The speaker may be a traditional thin film speaker or a piezoelectric ceramic speaker. When the speaker is a piezoelectric ceramic speaker, it can not only convert the electrical signal into sound waves audible to humans, but also convert the electrical signal into sound waves inaudible to humans for uses such as ranging. In some embodiments, the audio circuit 907 may further include a headphone jack.
[0312] The positioning component 908 is used to locate the current geographical location of the mobile terminal 900 to achieve navigation or LBS (Location Based Service). The positioning component 908 may be a positioning component based on the GPS (Global Positioning System) of the United States, the Beidou system of China, or the Galileo system of Russia.
[0313] The power supply 909 is used to supply power to each component in the mobile terminal 900. The power supply 909 may be alternating current, direct current, a disposable battery, or a rechargeable battery. When the power supply 909 includes a rechargeable battery, the rechargeable battery may be a wired rechargeable battery or a wireless rechargeable battery. A wired rechargeable battery is a battery charged through a wired line, and a wireless rechargeable battery is a battery charged through a wireless coil. The rechargeable battery can also be used to support fast charging technology.
[0314] In some embodiments, the mobile terminal 900 further includes one or more sensors 910. The one or more sensors 910 include but are not limited to: an acceleration sensor 911, a gyroscope sensor 912, a pressure sensor 913, a fingerprint sensor 914, an optical sensor 915, and a proximity sensor 916.
[0315] The acceleration sensor 911 can detect the magnitude of acceleration on the three coordinate axes of the coordinate system established with the mobile terminal 900. For example, the acceleration sensor 911 can be used to detect the components of the gravitational acceleration on the three coordinate axes. The processor 901 can control the touch display screen 905 to display the user interface in a landscape view or a portrait view according to the gravitational acceleration signal collected by the acceleration sensor 911. The acceleration sensor 911 can also be used for game or collection of the user's motion data.
[0316] The gyroscope sensor 912 can detect the body direction and rotation angle of the mobile terminal 900. The gyroscope sensor 912 can cooperate with the acceleration sensor 911 to collect the 3D actions of the user on the mobile terminal 900. Based on the data collected by the gyroscope sensor 912, the processor 901 can implement the following functions: motion sensing (such as changing the UI according to the user's tilting operation), image stabilization during shooting, game control, and inertial navigation.
[0317] The pressure sensor 913 can be disposed on the side frame of the mobile terminal 900 and / or the lower layer of the touch display screen 905. When the pressure sensor 913 is disposed on the side frame of the mobile terminal 900, it can detect the holding signal of the user on the mobile terminal 900, and the processor 901 can perform left / right hand recognition or shortcut operations based on the holding signal collected by the pressure sensor 913. When the pressure sensor 913 is disposed on the lower layer of the touch display screen 905, the processor 901 can control the operable controls on the UI interface according to the pressure operation of the user on the touch display screen 905. The operable controls include at least one of button controls, scroll bar controls, icon controls, and menu controls.
[0318] The fingerprint sensor 914 is used to collect the fingerprint of the user. The processor 901 can identify the user's identity based on the fingerprint collected by the fingerprint sensor 914, or the fingerprint sensor 914 can identify the user's identity based on the collected fingerprint. When the identified user identity is a trusted identity, the processor 901 authorizes the user to perform relevant sensitive operations, and the sensitive operations include unlocking the screen, viewing encrypted information, downloading software, making payments, and changing settings, etc. The fingerprint sensor 914 can be disposed on the front, back, or side of the mobile terminal 900. When there are physical buttons or manufacturer Logos on the mobile terminal 900, the fingerprint sensor 914 can be integrated with the physical buttons or manufacturer Logos.
[0319] The optical sensor 915 is used to collect the ambient light intensity. In one embodiment, the processor 901 can control the display brightness of the touch display screen 905 according to the ambient light intensity collected by the optical sensor 915. Specifically, when the ambient light intensity is high, the display brightness of the touch display screen 905 is increased; when the ambient light intensity is low, the display brightness of the touch display screen 905 is decreased. In another embodiment, the processor 901 can also dynamically adjust the shooting parameters of the camera module 906 according to the ambient light intensity collected by the optical sensor 915.
[0320] The proximity sensor 916, also known as a distance sensor, is typically disposed on the front panel of the mobile terminal 900. The proximity sensor 916 is used to collect the distance between the user and the front of the mobile terminal 900. In one embodiment, when the proximity sensor 916 detects that the distance between the user and the front of the mobile terminal 900 is gradually decreasing, the touch display screen 905 is controlled by the processor 901 to switch from the lit screen state to the off-screen state; when the proximity sensor 916 detects that the distance between the user and the front of the mobile terminal 900 is gradually increasing, the touch display screen 905 is controlled by the processor 901 to switch from the off-screen state to the lit screen state.
[0321] Those skilled in the art can understand that Figure 9 the structure shown in does not constitute a limitation on the mobile terminal 900, and it may include more or fewer components than shown in the figure, or combine some components, or adopt a different component arrangement.
[0322] In some embodiments, a non-transitory computer-readable storage medium is also provided. The computer program stored in the storage medium, when executed by a processor, implements the steps of the image processing method in the above embodiments. For example, the computer-readable storage medium may be a ROM, a RAM, a CD-ROM, a magnetic tape, a floppy disk, and an optical data storage device, etc.
[0323] It should be noted that the computer-readable storage medium mentioned in the embodiments of the present application may be a non-volatile storage medium, in other words, it may be a non-transitory storage medium.
[0324] It should be understood that all or part of the steps of implementing the above embodiments can be achieved by software, hardware, firmware, or any combination thereof. When implemented using software, it can be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer instructions. The computer instructions can be stored in the above computer-readable storage medium.
[0325] That is, in some embodiments, a computer program product containing instructions is also provided. When it runs on a computer, it causes the computer to execute the steps of the image processing method described above.
[0326] It should be understood that the "at least one" mentioned herein refers to one or more, and the "multiple" refers to two or more. In the description of the embodiments of the present application, unless otherwise specified, " / " means "or". For example, A / B may represent A or B. The "and / or" herein is merely a description of the association relationship between associated objects, indicating that there can be three relationships. For example, A and / or B can represent: A exists alone, A and B exist simultaneously, and B exists alone. In addition, for the convenience of clearly describing the technical solutions of the embodiments of the present application, in the embodiments of the present application, words such as "first" and "second" are used to distinguish the same items or similar items with basically the same functions and effects. Those skilled in the art can understand that the words such as "first" and "second" do not limit the quantity and execution order, and the words such as "first" and "second" do not necessarily limit to be different.
[0327] The above are the embodiments provided by the present application, which are not intended to limit the present application. Any modifications, equivalent replacements, improvements, etc. made within the spirit and principle of the present application shall be included in the protection scope of the present application.
Claims
1. An image processing method, characterized in that, The method includes: Determine a target processing mode corresponding to a first image to be processed; Based on the target processing mode, determine image processing parameters corresponding to the first image; Based on the image processing parameters and the initial pixel values of the pixel points in the first image, determine the target pixel values of the pixel points from the pixel values corresponding to multiple alternative colors; Convert the initial pixel values of the pixel points in the first image into the target pixel values to obtain a second image; Wherein, the image processing parameters include a contrast enhancement ratio; before determining the target pixel values of the pixel points from the pixel values corresponding to multiple alternative colors based on the image processing parameters and the initial pixel values of the pixel points in the first image, it includes Convert the first image from the RGB color space to the HSV color space; Determine the average value of the V components of each pixel point in the first image to obtain a first brightness; Perform gamma transformation on the V components of each pixel point based on the gamma transformation parameters corresponding to the contrast enhancement ratio; Determine the average value of the V components of each pixel point after gamma transformation to obtain a second brightness; Keep the H components and S components of each pixel point unchanged, and add the difference between the first brightness and the second brightness to the V components of each pixel point after gamma transformation to obtain the first image with enhanced contrast in the HSV color space; Convert the first image with enhanced contrast in the HSV color space to the RGB color space to obtain the first image with enhanced contrast.
2. The method according to claim 1, wherein The determining of the target processing mode corresponding to the first image to be processed includes: Identify the type of the object in the first image to obtain an identification result; If the identification result includes one object type and it is the first object type, determine the image processing mode corresponding to the first object type among multiple image processing modes as the candidate processing mode corresponding to the first image; Determine the target processing mode based on the candidate processing mode.
3. The method according to claim 1, wherein The determining of the target processing mode corresponding to the first image to be processed includes: Identify the type of the object in the first image to obtain an identification result; If the identification result includes multiple object types, determine the area occupancy ratios of the imaging regions of the objects corresponding to the multiple object types in the first image; Determine the image processing mode corresponding to a second object type among multiple image processing modes as the candidate processing mode corresponding to the first image, where the second object type is the object type with the largest area occupancy ratio among the multiple object types; Determine the target processing mode based on the candidate processing mode.
4. The method according to claim 2 or 3, characterized in that, The determining of the target processing mode based on the candidate processing mode includes: Display a first user interface, where the first user interface includes description information of the candidate processing mode; In response to a mode confirmation instruction, determine the candidate processing mode as the target processing mode; In response to a mode customization instruction, determine the customized mode as the target processing mode.
5. The method according to claim 1, wherein Determining the image processing parameters corresponding to the first image based on the target processing mode includes: When the target processing mode is one of multiple image processing modes, determining the image processing parameters corresponding to the target processing mode as the image processing parameters corresponding to the first image.
6. The method according to claim 1, wherein Determining the image processing parameters corresponding to the first image based on the target processing mode includes: When the target processing mode is a custom mode, displaying a second user interface, where the second user interface includes multiple custom parameter items; Obtaining the custom parameters input in the multiple custom parameter items; Determining the custom parameters input in the multiple custom parameter items as the image processing parameters corresponding to the first image.
7. The method according to any one of claims 1-3 or 5-6, characterized in that, The multiple alternative colors include a first alternative color with a hue, and the image processing parameters further include a first color ratio, where the first color ratio is used to distinguish the first alternative color from other alternative colors; Based on the image processing parameters and the initial pixel values of the pixel points in the first image, determining the target pixel values of the pixel points from the pixel values corresponding to the multiple alternative colors includes: Determining the distance between the initial pixel value of the pixel point and the pixel value corresponding to the first alternative color; If the distance is less than the distance threshold corresponding to the first color ratio, determining the pixel value corresponding to the first alternative color as the target pixel value of the pixel point.
8. The method according to claim 7, wherein The multiple alternative colors further include a second alternative color and a third alternative color without a hue, where the gray level of the second alternative color is less than the gray level of the third alternative color, and the image processing parameters further include a second color ratio, where the second color ratio is used to distinguish the second alternative color and the third alternative color; After determining the distance between the initial pixel value of the pixel point and the pixel value corresponding to the first alternative color, it further includes: In response to the distance being not less than the distance threshold corresponding to the first color ratio, determining the gray level value of the pixel point in the first image based on the initial pixel value; Determining the target pixel value of the pixel point according to the gray level value; where If the gray level value is less than the gray level threshold corresponding to the second color ratio, determining the pixel value corresponding to the second alternative color as the target pixel value of the pixel point; If the gray level value is not less than the gray level threshold corresponding to the second color ratio, determining the pixel value corresponding to the third alternative color as the target pixel value of the pixel point.
9. The method according to any one of claims 1-3 or 5-6 or 8, characterized in that, The image processing parameters further include a sharpening ratio; Before determining the target pixel values of the pixel points from the pixel values corresponding to the multiple alternative colors based on the image processing parameters and the initial pixel values of the pixel points in the first image, it further includes: Performing a sharpening process on the first image based on the sharpening ratio.
10. The method according to claim 9, characterized in that, Performing a sharpening process on the first image based on the sharpening ratio includes: Converting the first image from the RGB color space to the HSV color space to obtain a luminance channel map; Perform guided filtering on the luminance channel map based on the sharpening ratio to obtain a first filtered map; Separate the first filtered map from the luminance channel map to obtain a first detail map; Overlay the first detail map onto the luminance channel map to obtain a first enhanced map; Perform Gaussian filtering on the first enhanced map based on the sharpening ratio to obtain a second filtered map; Separate the second filtered map from the first enhanced map to obtain a second detail map; Overlay the second detail map onto the first enhanced map to obtain a second enhanced map; Convert the second enhanced map from the HSV color space to the RGB color space to obtain a first sharpened image.
11. The method according to any one of claims 1-3 or 5-6 or 8, characterized in that, The image processing parameters further include an error truncation ratio; Before converting the initial pixel value of the pixel point in the first image to the target pixel value, it further includes: Determine the difference between the initial pixel value and the target pixel value to obtain an error value; Perform error diffusion on the target pixel value based on the error value and the error truncation ratio.
12. The method according to claim 1, characterized in that, The method further includes: Display a third user interface, where the third user interface includes a third image, and the third image includes at least two different second images converted from the first image.
13. An image processing apparatus, characterized in that, The apparatus includes: A first determination module, configured to determine a target processing mode corresponding to a first image to be processed; A second determination module, configured to determine image processing parameters corresponding to the first image based on the target processing mode; A third determination module, configured to determine a target pixel value of the pixel point from pixel values corresponding to multiple alternative colors based on the image processing parameters and the initial pixel value of the pixel point in the first image; A conversion module, configured to convert the initial pixel value of the pixel point in the first image to the target pixel value to obtain a second image; Wherein, the image processing parameters include a contrast enhancement ratio; the apparatus further includes: A contrast enhancement processing module, configured to, before determining the target pixel value of the pixel point from pixel values corresponding to multiple alternative colors based on the image processing parameters and the initial pixel value of the pixel point in the first image: Convert the first image from the RGB color space to the HSV color space; Determine the average value of the V components of each pixel point in the first image to obtain a first luminance; Perform gamma transformation on the V components of each pixel point based on the gamma transformation parameters corresponding to the contrast enhancement ratio; Determine the average value of the V components of each pixel point after gamma transformation to obtain a second luminance; Keep the H components and S components of each pixel point unchanged, and increase the difference between the first luminance and the second luminance on the V components of each pixel point after gamma transformation to obtain the first image with enhanced contrast in the HSV color space; Convert the first image with enhanced contrast in the HSV color space to the RGB color space to obtain the first image with enhanced contrast.
14. An image processing apparatus, characterized in that, The image processing device includes a memory and a processor. The memory is used to store a computer program, and the processor is used to execute the computer program stored on the memory to implement the steps of the method according to any one of claims 1-12 above.
15. A non-transitory computer-readable storage medium, characterized in that, A computer program is stored in the storage medium, and when the computer program is executed by a processor, the steps of the method according to any one of claims 1-12 are implemented.
Citation Information
Patent Citations
Image processing method and device, electronic equipment and storage medium
CN113011328A
Scene type judgment method and device, electronic equipment and storage medium
CN113705309A
Color converting device
JP1993290156A