Image Processing Method, Apparatus, and Electronic Device

By obtaining reference information to match material images and changing color, the problem that pre-made material images cannot adapt to user needs is solved, and flexible and diverse display of electronic device interface background or theme images is realized.

CN114841850BActive Publication Date: 2025-07-04GUANGDONG OPPO MOBILE TELECOMMUNICATIONS CORP LTD
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202110145856.8
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-02-02
Publication Date
2025-07-04
Estimated Expiration
2041-02-02

AI Technical Summary

Technical Problem

Existing electronic devices cannot flexibly and variably configure interface background images or theme images because pre-made material images cannot adapt to the personalized needs of each user.

Method used

By obtaining reference information, matching the corresponding material image, and obtaining color transformation parameters, color transformation of the material image is transformed to generate a second material image with stronger adaptability.

Benefits of technology

It realizes flexible and diverse display of material images, meets users' personalized needs, and improves the adaptability and diversity of electronic device interface display.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114841850B_ABST
    Figure CN114841850B_ABST
Patent Text Reader

Abstract

Embodiments of the present application disclose an image processing method, apparatus, and electronic device. The method includes: obtaining reference information; obtaining a first material image corresponding to the reference information; obtaining a color transformation parameter corresponding to the first material image, where the color transformation parameter includes a color transformation target value of a specified pixel in the first material image; and performing a color transformation on the first material image based on the color transformation parameter to obtain a second material image after the color transformation. Thus, through the above method, after the corresponding first material image is matched based on the reference information, the corresponding color transformation parameter can be obtained to perform a color transformation on the first material image, so as to obtain a second material image after the color transformation. Furthermore, for the pre-produced first material image, an adaptable color transformation can be performed according to actual needs to obtain the second material image, so as to realize more flexible and diverse display of the material image.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of image processing technology, and more particularly, to an image processing method, apparatus, and electronic device. Background Art

[0002] As the images that can be presented in electronic devices become more and more diverse, users of electronic devices have higher requirements for the experience in image display. Among them, an image can be used as the background image or theme image of a certain interface in an electronic device. For example, a dynamic image can be used as the image of the watch face in a smart watch. However, the relevant images are all pre-made, resulting in the inability of electronic devices to configure the background image or theme image of the interface more flexibly and diversely. Summary of the Invention

[0003] In view of the above problems, this application proposes an image processing method, apparatus, and electronic device to improve the above problems.

[0004] In a first aspect, this application provides an image processing method applied to an electronic device. The method includes: obtaining reference information; obtaining a first material image corresponding to the reference information; obtaining a color transformation parameter corresponding to the first material image, where the color transformation parameter includes a color transformation target value of a specified pixel in the first material image; and performing color transformation on the first material image based on the color transformation parameter to obtain a second material image after color transformation.

[0005] In a second aspect, this application provides an image processing method applied to an electronic device. The method includes: an image acquisition unit for obtaining reference information; a material matching unit for obtaining a first material image corresponding to the reference information; a parameter acquisition unit for obtaining a color transformation parameter corresponding to the first material image, where the color transformation parameter includes a color transformation target value of a specified pixel in the first material image; and an image processing unit for performing color transformation on the first material image based on the color transformation parameter to obtain a second material image after color transformation.

[0006] In a third aspect, this application provides an electronic device, including one or more processors and a memory; one or more programs are stored in the memory and configured to be executed by the one or more processors, and the one or more programs are configured to execute the above method.

[0007] In a fourth aspect, this application provides a computer-readable storage medium, in which program code is stored, and when the program code runs, it executes the above method.

[0008] An image processing method, apparatus, and electronic device provided by the present application, after obtaining reference information, obtain a first material image corresponding to the reference information, and obtain color transformation parameters corresponding to the first material image and including color transformation target values of specified pixels in the first material image. Then, based on the color transformation parameters, perform color transformation on the first material image to obtain a second material image after color transformation. Thus, through the above method, after matching the corresponding first material image based on the reference information, the corresponding color transformation parameters can be obtained to perform color transformation on the first material image, so as to obtain a second material image after color transformation. Furthermore, for the pre-made first material image, an adaptable color transformation can be performed according to actual needs to obtain the second material image, so as to realize more flexible and diverse display of the material image. BRIEF DESCRIPTION OF THE DRAWINGS

[0009] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the following will briefly introduce the drawings required for the description of the embodiments. Obviously, the following drawings are only some embodiments of the present application. For those skilled in the art, without creative efforts, other drawings can be obtained based on these drawings.

[0010] Figure 1 FIG. shows a schematic diagram of an application scenario of an image processing method proposed by the present application;

[0011] Figure 2 FIG. shows a flowchart of an image processing method proposed by the present application;

[0012] Figure 3 FIG. shows a flowchart of another image processing method proposed by the present application;

[0013] Figure 4 FIG. shows a schematic diagram of a color transformation selection interface proposed by the present application;

[0014] Figure 5 FIG. shows a schematic diagram of a color junction proposed by the present application;

[0015] Figure 6 FIG. shows schematic diagrams of three image types proposed by the present application;

[0016] Figure 7 FIG. shows a flowchart of yet another image processing method proposed by the present application;

[0017] Figure 8 FIG. shows a structural block diagram of an image processing apparatus proposed by the present application;

[0018] Figure 9The structural block diagram of an electronic device proposed by this application is shown;

[0019] Figure 10 It is a storage unit for storing or carrying program codes for implementing the image processing method according to the embodiments of this application. Detailed implementation manners

[0020] Next, the technical solutions in the embodiments of this application will be clearly and completely described in conjunction with the accompanying drawings in the embodiments of this application. Based on the embodiments in this application, all other embodiments obtained by those of ordinary skill in the art without creative efforts shall fall within the protection scope of this application.

[0021] As the requirements of electronic device users for visual experience are getting higher and higher, many interfaces in electronic devices can replace the background image or theme image. For example, in a smart watch, the theme image of the watch face can be replaced according to the user's own preferences. For another example, in a smart phone, the background image of the desktop can also be replaced according to the user's own preferences. Among them, in an electronic device, a material image can be obtained in advance, and then the electronic device can be operated to use the obtained material image as the background image or theme image of a certain interface.

[0022] The inventor found in the research on related material images that the material images that can be used as background images or theme images are usually pre-made, which may cause the material images to not well adapt to the personalized needs of each user.

[0023] Therefore, the inventor proposed an image processing method, device, and electronic device in this application. After obtaining reference information, a first material image corresponding to the reference information is obtained, and color transformation parameters including color transformation target values of specified pixels in the first material image are obtained corresponding to the first material image. Then, based on the color transformation parameters, color transformation is performed on the first material image to obtain a second material image after color transformation.

[0024] Thus, through the above method, after the first material image corresponding to the reference information is matched based on the reference information, the corresponding color transformation parameters can be obtained to perform color transformation on the first material image to obtain a second material image after color transformation. Furthermore, the pre-made first material image can be adaptively color-transformed according to actual needs to obtain a second material image, so as to realize more flexible and diverse display of material images.

[0025] Next, the application scenarios involved in the embodiments of this application will be introduced first.

[0026] Such as Figure 1As shown, in Figure 1 In the scenario shown, there is a smart phone 100 and a smart watch 200. The smart phone 100 and the smart watch 200 can communicate with each other through short-range wireless communication (for example, WiFi or Bluetooth) or mobile communication (for example, a communication base station). Among them, the image processing method provided in the embodiments of the present application can be independently completed by the smart phone 100, or can be independently completed by the smart watch 200, or can also be completed by the cooperation of the smart phone 100 and the smart watch 200. For example, the smart phone 100 can be used to obtain reference information, obtain a first material image corresponding to the reference information, and obtain a color transformation parameter corresponding to the first material image, and then transmit the color transformation parameter to the smart watch 200. The smart watch 200 then continues to perform color transformation on the first material image based on the color transformation parameter to obtain a second material image after color transformation, and display the second material image.

[0027] It should be noted that the smart phone 100 here is only exemplary, and the smart phone 100 can also be replaced by devices such as a tablet computer or a computer.

[0028] Please refer to Figure 2 , an image processing method provided by the present application is applied to an electronic device, and the method includes:

[0029] S110: Obtain reference information.

[0030] In the embodiments of the present application, the reference information is the basis for obtaining the material image, and thus the obtained material image can be a material image related to the reference information. In the embodiments of the present application, the reference information can be text or image.

[0031] Among them, the reference information can be obtained by user input. For example, an input interface can be configured in the electronic device, and reference information can be input in the input interface. Optionally, the image can be obtained by an image acquisition device of the electronic device channel. For example, in the embodiments of the present application, if color transformation is to be performed according to the user's clothing, then the reference information can be an image of the clothing obtained by the electronic device through the image acquisition device.

[0032] S120: Obtain a first material image corresponding to the reference information.

[0033] Among them, the first material image is the base image for subsequent color transformation. In the embodiments of the present application, multiple material images may be pre-stored, and then the first material image corresponding to the reference information may be obtained from the multiple pre-stored material images based on the reference information. Optionally, the multiple pre-stored material images may be material images pre-produced by developers.

[0034] When the reference information can be in various forms, the methods for obtaining the corresponding first material image for different forms of reference information may be different.

[0035] As a way, the reference information is text. In this way, each material image may correspond to its own description information, and the description information is used to describe the image content of the corresponding material image. For example, for a material image with an image content of natural scenery, the description information corresponding to the material image is "natural scenery". For another example, for a material image with an image content of the sky, the description information corresponding to the material image is "sky". In this way, the electronic device can match the parameter information in text form with the description information corresponding to each material image, and then use the material image corresponding to the description information that matches the reference information as the first material image.

[0036] Optionally, in the process of determining whether the reference information matches the description information, the vector of the reference information and the vector of the description information may be calculated respectively, and then the vector distance between the vector of the reference information and the vector of the description information is calculated to characterize the matching degree between the reference information and the description information, that is, the smaller the vector distance, the higher the corresponding matching degree. Correspondingly, the material image corresponding to the description information with a corresponding vector distance greater than the first specified distance threshold may be used as the material image that matches the reference information. In addition, the calculation results of the vector distances may also be sorted, and then the material image corresponding to the description information corresponding to the first vector distance in the sorting may be used as the material image that matches the reference information.

[0037] Furthermore, optionally, the matching degree may also be directly determined based on the amount of content jointly included in the reference information and the description information. Correspondingly, the more content is jointly included, the higher the matching degree between the reference information and the description information, and then the reference information and the description information with the most jointly included content may be used as the matching reference information and description information.

[0038] Exemplarily, if there are multiple pre-stored material images including material image A, material image B, material image C, and material image D. Among them, material image A corresponds to description information d1, material image B corresponds to description information d2, material image C corresponds to description information d3, and material image D corresponds to description information d4. If the matching degree between the reference information and description information d1 is m1, if the matching degree between the reference information and description information d2 is m2, if the matching degree between the reference information and description information d3 is m3, if the matching degree between the reference information and description information d4 is m4, and the result of sorting m1 to m4 is that m4 is greater than m3, m3 is greater than m2, and m2 is greater than m1. Then, when determining the matching degree based on vectors and determining the first material image through the first specified distance threshold, if the first specified distance threshold is m5 and only when m4 is greater than m5, the material image D corresponding to the description information d4 corresponding to m4 will be used as the first material image. Then, when determining the first material image based on the sorting result, the material image D corresponding to the description information d4 corresponding to m4 ranked first will be used as the first material image.

[0039] As another way, the reference information can be an image. In this way, the first material image can be selected by comparing the reference information with multiple pre-stored material images. Among them, the purpose of this image comparison is to determine the matching degree between the reference information and multiple material images respectively, and then use the material image with the largest corresponding matching degree as the first material image. In this embodiment, the image can be characterized by the feature vector corresponding to the image, and then the feature vectors corresponding to each image can be compared to determine the matching degree of the image. For the reference information and material images in the form of images, they can be respectively input into the CNN (Convolutional Neural Networks) model to obtain their respective feature vectors, and then calculate the distance between the feature vectors of the reference information in the form of an image and the material images respectively. If the distance is less than the second specified threshold, it is determined that the reference information in the form of an image and the material image match.

[0040] As yet another way, the first material image corresponding to the reference information can be obtained through AI. In this way, a neural network model can be pre-trained. The training samples for the trained neural network model can include text and images, so that the input of the neural network model can be either text or image. Then, in the process of obtaining the first material image, the reference information (which can be either text or image) can be directly input into the trained neural network model, and then the first material image output by the neural network model can be obtained.

[0041] S130: Obtain the color transformation parameters corresponding to the first material image, where the color transformation parameters include the color transformation target values of specified pixels in the first material image.

[0042] Among them, the specified pixels in the first material image can be all pixels in the first material image, or can be pixels in a partial area. This partial area can be an area corresponding to partial colors, or a partial position area.

[0043] It should be noted that the first material image can include multiple colors. During the color transformation process, it can be that each color is transformed, or only some of the colors are transformed. Then, in this embodiment, the pixels included in the area that needs to be color-transformed can be used as the specified pixels. Exemplarily, the first material image includes a black area, a red area, a green area, and a blue area. Among them, the pixel values of the pixels in the black area are pixel values representing black, the pixel values of the pixels in the red area are pixel values representing red, the pixel values of the pixels in the green area are pixel values representing green, and the pixel values of the pixels in the blue area are pixel values representing blue. Then, in the case of determining that red needs to be transformed into sky blue, green needs to be transformed into purple, and blue needs to be transformed into brown, the specified pixels are the pixels included in the areas corresponding to the pixel values representing red, green, or blue in the first material image. Among them, the color transformation parameters include the pixel values corresponding to sky blue, the pixel values corresponding to purple, and the pixel values corresponding to brown.

[0044] S140: Perform color transformation on the first material image based on the color transformation parameters to obtain a second material image after color transformation.

[0045] Correspondingly, after obtaining the color transformation parameters based on the foregoing steps, the specified pixels in the first material image can be color-transformed, and then a second material image can be obtained. For example, based on the foregoing color transformation parameters including that red becomes sky blue, green is transformed into purple, and blue is transformed into brown, the second material image will include sky blue, purple, and brown.

[0046] An image processing method provided in this embodiment, after obtaining reference information, obtains a first material image corresponding to the reference information, and obtains color transformation parameters corresponding to the first material image, including color transformation target values of specified pixels in the first material image. Then, based on the color transformation parameters, color transformation is performed on the first material image to obtain a second material image after color transformation. Thus, through the above method, after matching the corresponding first material image based on the reference information, the corresponding color transformation parameters can be obtained to perform color transformation on the first material image, obtaining a second material image after color transformation. Furthermore, for the pre-produced first material image, adaptable color transformation can be performed according to actual needs to obtain a second material image, so as to realize more flexible and diverse display of the material image.

[0047] Please refer to Figure 3 , an image processing method provided in this application, which is applied to an electronic device. The method includes:

[0048] S210: Obtain reference information.

[0049] S220: Obtain a first material image corresponding to the reference information.

[0050] S230: Obtain reference transformation colors corresponding to the colors to be transformed in the first material image respectively.

[0051] As shown in the foregoing content, only some colors in the first material image can be color-transformed. Then, in this embodiment, there are multiple ways to determine the colors to be transformed in the first material image.

[0052] As one way, it can be selected by the user. In this way, a color transformation selection interface can be configured in the electronic device. In this color transformation selection interface, the colors included in the determined first material image can be displayed, and a target color selection control is respectively displayed corresponding to the included colors, so that the user can use the target color selection control to correspond to the reference transformation color. Exemplarily, as Figure 4 shown, the color transformation selection interface 10 includes an area 11 and an area 12. Among them, the colors included in the detected first material image can be displayed in the area 11, and the target color selection controls corresponding to the colors displayed in the area 11 can be included in the area 12.

[0053] S240: Obtain the proportionality coefficients of multiple color channels of the specified pixels in the first material image.

[0054] It should be noted that in the areas where different colors in the image are in contact with each other, there may be mutual color crossovers, so that the pixel values of the pixels in the areas in contact may have color values on multiple color channels. For example, in Figure 5 In the shown image, the color of the circular area is red, and the color of the area outside the circular area is black. Then, among the multiple color channels of the pixels in the central part of the circular area, the values of the green channel and the blue channel are both 0, while the value of the red channel can be 255. However, at the boundary between the circular area and other areas, the same pixel may cross the colors of red and other areas, so that the values of the green channel and the blue channel of the pixels in the boundary area are both greater than 0, and the value of the red channel is less than 255. Therefore, in order to accurately determine how the specified pixels in the first material image change in color, the proportionality coefficients of the multiple color channels of the specified pixels can be determined first, and the proportionality coefficient is used to determine the proportion of the color value corresponding to each color channel after color transformation.

[0055] As a method, obtaining the proportionality coefficients of the multiple color channels of the specified pixels in the first material image includes: obtaining the image type corresponding to the first material image; based on the image type, obtaining the proportionality coefficients of the multiple color channels of the specified pixels in the first material image. Among them, in this embodiment, the image type is determined based on the color boundary method in the first material image. Exemplarily, as Figure 6 shown, the filled color corresponding to each area is marked. Among them, in the image corresponding to the first type, the red, green, and blue included in the first material image are respectively in contact with the black as the background, and there is no contact between them. In the image corresponding to the second type, there are areas where the red, green, and blue included in the first material image are in contact. In the image corresponding to the third type, there are the corresponding situations of the first type and the second type included in the first material image.

[0056] In this embodiment, the type corresponding to each material image can be pre-annotated. Then, when the electronic device obtains the first material image, the image type corresponding to the first material image can be obtained correspondingly.

[0057] Among them, optionally, the obtaining the proportionality coefficients of the multiple color channels of the specified pixels in the first material image based on the image type includes:

[0058] If the image type is the first type, obtain the proportionality coefficients of the respective color channels based on the first proportionality coefficient determination method, where the first proportionality coefficient determination method includes: obtaining a target color channel among the multiple color channels of a specified pixel, and the target color channel is the color channel with the largest corresponding color value; configuring the proportionality coefficient of the target color channel of the specified pixel to 1, and configuring the proportionality coefficients of the color channels other than the target color channel to 0. Exemplarily, if the color value corresponding to the red channel of a pixel is 255 and the values of the green channel and the blue channel are both 0, then it is determined that the target color channel of this pixel is the red channel. For another example, if the color value corresponding to the red channel of a pixel is 20, the color value of the green channel is 200, and the value of the blue channel is 0, then it is determined that the target color channel of this pixel is the green channel.

[0059] Optionally, obtaining the proportionality coefficients of the respective color channels of the specified pixel in the first material image based on the image type further includes:

[0060] If the image type is the second type, obtain the proportionality coefficients of the respective color channels based on the second proportionality coefficient determination method, where the second proportionality coefficient determination method includes: obtaining a corresponding first target color parameter value of the specified pixel, and the first target color parameter value is the minimum value among the original color values of the multiple color channels and a first reference color value.

[0061] Optionally, the min function can be used to obtain the minimum value among the function input parameters. In this way, the original color values of the multiple color channels of the specified pixel and the first reference color value can be input into the min function, and then the output value of the min function is used as the first target color parameter value. For example, the original color values of the multiple color channels include the original color value of the red channel, the original color value of the green channel, and the original color value of the blue channel. Among them, the first reference color value can be 0.2. The role of this first reference color value is to prevent the problem of too low brightness after color transformation.

[0062] Obtain the maximum value among the differences between the original color values of the multiple color channels and the first target color parameter value and a second color reference value as the current color values of the multiple color channels.

[0063] Optionally, taking the RGB mode as an example, the following function can be used to determine the current color values of the multiple color channels. The function is: max((R - min, G - min, B - min), 0), where min is the first target color parameter value determined above, 0 is the second color reference value, R represents the original color value of the red channel, G represents the original color value of the green channel, and B represents the original color value of the blue channel.

[0064] Obtain the maximum value between the sum of the current color values of the multiple color channels and the third color reference value as the second target color parameter value. Among them, the second target color parameter value can be calculated through the following function: sum = max(R + G + B, 0.001), where in this formula, R represents the current color value of the red channel, G represents the current color value of the green channel, B represents the current color value of the blue channel, 0.001 is the third color reference value, and sun represents the second target color parameter value.

[0065] Take the ratio of the current color values of the multiple color channels to the second target color parameter value as the respective proportionality coefficients of the multiple color channels of the specified pixel. Among them, the proportionality coefficient of the red channel is the ratio of the current color value of the red channel to the second target color parameter value, the proportionality coefficient of the green channel is the ratio of the current color value of the green channel to the second target color parameter value, and the proportionality coefficient of the blue channel is the ratio of the current color value of the blue channel to the second target color parameter value.

[0066] Optionally, obtaining the respective proportionality coefficients of the multiple color channels of the specified pixel in the first material image based on the image type further includes:

[0067] If the image type is the third type, obtain the respective proportionality coefficients of the multiple color channels based on the third proportionality coefficient determination method, where the third proportionality coefficient determination method includes:

[0068] Based on the type of the current pixel in the specified pixel and the magnitude of the color values of the multiple color channels corresponding to the current pixel, determine one method from the first proportionality coefficient determination method and the second proportionality coefficient determination method to determine the proportionality coefficients of the multiple color channels of the current pixel.

[0069] Among them, if the color to be transformed in the first material image includes three colors, then determining one method from the first proportionality coefficient determination method and the second proportionality coefficient determination method to determine the proportionality coefficients of the multiple color channels of the current pixel may include:

[0070] If the values of the blue channel and the green channel of the first pixel in the specified pixel are both less than the fourth reference color value, determine the proportionality coefficients of the multiple color channels of the first pixel through the first proportionality coefficient determination method, otherwise determine the proportionality coefficients of the multiple color channels of the first pixel through the second proportionality coefficient determination method;

[0071] If the values of the red channel and the green channel of the second pixel in the specified pixel are both less than the fourth reference color value, determine the proportionality coefficients of the multiple color channels of the second pixel through the first proportionality coefficient determination method; otherwise, determine the proportionality coefficients of the multiple color channels of the second pixel through the second proportionality coefficient determination method.

[0072] If the values of the red channel and the blue channel of the third pixel in the specified pixel are both less than the fourth reference color value, determine the proportionality coefficients of the multiple color channels of the third pixel through the first proportionality coefficient determination method; otherwise, determine the proportionality coefficients of the multiple color channels of the third pixel through the second proportionality coefficient determination method.

[0073] Among them, the three colors included in the color to be transformed include the first color, the second color, and the third color. The first pixel is the pixel corresponding to the target color channel in the corresponding multiple color channels and the first color. The second pixel is the pixel corresponding to the target color channel in the corresponding multiple color channels and the second color. The third pixel is the pixel corresponding to the target color channel in the corresponding multiple color channels and the third color. Here, the correspondence between a color channel and a certain color can be understood as that the color represented by the color channel is the same as that certain color. For example, if the first color is red, the second color is green, and the third color is blue, then the first pixel is the pixel with the red channel as the target color channel in the corresponding multiple color channels.

[0074] Optionally, in the embodiments of the present application, the fourth reference color value is 0.3.

[0075] S250: Based on the proportionality coefficients of the multiple color channels of the specified pixel respectively, and the reference transformation colors corresponding to each color respectively, obtain the color transformation target value of the specified pixel in the first material image.

[0076] As a method, the obtaining the color transformation target value of the specified pixel in the first material image based on the proportionality coefficients of the multiple color channels of the specified pixel respectively, and the reference transformation colors corresponding to each color respectively, includes:

[0077] Multiply the proportionality coefficients of the multiple color channels of the specified pixel by the reference transformation colors corresponding to the multiple color channels respectively to obtain multiple intermediate transformation target values. Among them, if the color corresponding to the color channel is the same as the color to be transformed corresponding to the reference transformation color, then the color channel corresponds to the reference transformation color.

[0078] Add the multiple intermediate transformation target values to obtain the color transformation target value of the specified pixel.

[0079] Exemplarily, taking the case where multiple color channels include a red channel, a green channel, and a blue channel, the colors to be transformed include red, green, and brown. Among them, the reference transformation color corresponding to red is sky blue, and red corresponds to the red channel. Then, the reference transformation color corresponding to the red channel can be sky blue. The reference transformation color corresponding to green is purple, and green corresponds to the green channel. Then, the reference transformation color corresponding to the green channel can be purple. The reference transformation color corresponding to blue is brown, and blue corresponds to the blue channel. Then, the reference transformation color corresponding to the blue channel can be brown. The following can illustrate the acquisition of the color transformation target value through a formula, and the formula is:

[0080] out = R_ratio * firstColor + G_ratio * secondColor + B_ratio * thirdColor

[0081] Among them, R_ratio is the proportionality coefficient corresponding to the red channel, G_ratio is the proportionality coefficient corresponding to the green channel, and B_ratio is the proportionality coefficient corresponding to the blue channel. firstColor is sky blue, secondColor is purple, and thirdColor is brown. Among them, out is the color transformation target value corresponding to this pixel. Correspondingly, R_ratio * firstColor, G_ratio * secondColor, and B_ratio * thirdColor respectively represent the calculated intermediate transformation target values.

[0082] It should be noted that for each intermediate transformation target value, it also includes the color values of multiple color channels. Then, when adding multiple intermediate transformation target values, it will be adding the values of each color channel respectively to obtain the color transformation target value. Exemplarily, if the intermediate transformation target value obtained based on the aforementioned red channel is (R1, G1, B1), if the intermediate transformation target value obtained based on the aforementioned green channel is (R2, G2, B2), and if the intermediate transformation target value obtained based on the aforementioned blue channel is (R3, G3, B3), then the color transformation target value obtained by adding the intermediate transformation target values is (R1 + R2 + R3, G1 + G2 + G3, B1 + B2 + B3). Among them, R1 is obtained by multiplying R_ratio by the color value of the red channel corresponding to firstColor, R2 is obtained by multiplying G_ratio by the color value of the red channel corresponding to secondColor, R3 is obtained by multiplying B_ratio by the color value of the red channel corresponding to thirdColor, and the same is true for the color values corresponding to the other color channels. For example, G1 is obtained by multiplying R_ratio by the color value of the green channel corresponding to firstColor.

[0083] S260: Perform color transformation on the first material image based on the color transformation parameters to obtain a second material image after color transformation.

[0084] It should be noted that the color transformation target value corresponding to a pixel actually also includes color values of multiple color channels. Then, performing color transformation on the first material image based on the color transformation parameters can be understood as replacing the original color values of multiple color channels of the pixel with the color values of multiple color channels included in the color transformation target value.

[0085] It should be noted that the specified pixels pointed out in the embodiments of the present application may include multiple pixels. Then, in the case where the specified pixels include multiple pixels, S240 to S260 in this embodiment will be respectively executed for each of the multiple pixels included in the specified pixels, so as to sequentially perform color transformation on each pixel included in the specified pixels to obtain a second material image.

[0086] An image processing method provided in this embodiment enables, through the above method, after matching the corresponding first material image based on the reference information, to obtain the corresponding color transformation parameters and perform color transformation on the first material image to obtain a second material image after color transformation, so that the pre-made first material image can be adaptively color-transformed according to actual needs to obtain a second material image, thereby enabling more flexible and diverse display of the material image. Moreover, in this embodiment, after obtaining the color change target corresponding to the color to be changed in the material image, the color transformation target value corresponding to each specified pixel is determined one by one, thereby improving the accuracy of color transformation.

[0087] Please refer to Figure 7 , an image processing method provided in the present application is applied to an electronic device, and the method includes:

[0088] S310: Obtain reference information.

[0089] S320: Obtain a first material image corresponding to the reference information.

[0090] S330: Obtain color transformation parameters corresponding to the first material image, where the color transformation parameters include color transformation target values of specified pixels in the first material image.

[0091] S340: Send the color transformation parameters to a target terminal so that the target terminal performs color transformation on the first material image based on the color transformation parameters and displays the second material image after color transformation.

[0092] Optionally, the electronic device is a smart phone, the target terminal is a smart watch, the reference information is the wearing image collected by the smart collection, and the first material image is the dial image of the smart watch. Then, after obtaining the color transformation parameter, the smart phone can send the color transformation parameter to the smart watch, so that the smart watch can perform color transformation on the dial image based on the color transformation parameter to obtain the dial image after color transformation (i.e., the second material image), and further enable the smart watch to perform color transformation according to the user's wearing. Optionally, in order to avoid the target terminal running stuck due to color transformation, the foregoing color transformation of the first material image based on the color transformation parameter can be executed by the GPU (Graphics Processing Unit) of the target terminal, and the second material image after color transformation can be displayed.

[0093] Optionally, after the electronic device obtains the color transformation parameter, the reference information, the color transformation parameter, and the first material parameter can be stored correspondingly. In this way, after the electronic device obtains the reference information, it can first detect whether there is a corresponding color transformation parameter and the first material image stored for the reference information. If the electronic device stores them, it can directly send the already correspondingly stored first material image and color transformation parameter to the target terminal. If the electronic device does not store them, it will start to execute to obtain the first material image corresponding to the reference information, so that in this way, it can be realized that the electronic device collects the reference information to directly trigger the display of the second material image by the target terminal, improving the efficiency of the target terminal to switch the background image or the theme image of certain interfaces. For example, after the electronic device collects the image of its own wearing as the reference information through the image acquisition device, if the electronic device recognizes that there is a correspondingly stored first material image and color transformation information for the image of its own wearing, it will directly transmit the correspondingly stored first material image and color transformation information to the target terminal, and the target terminal can perform color transformation according to the received first material image and color transformation information to obtain the second material image, and then directly trigger to replace the image of the specified interface (for example, the dial interface) with the second material image.

[0094] An image processing method provided in this embodiment enables, through the above method, after a corresponding first material image is matched based on reference information, to obtain corresponding color transformation parameters to perform color transformation on the first material image, thereby obtaining a second material image after color transformation, and further enabling the pre-produced first material image to be adaptively color-transformed according to actual needs to obtain a second material image, so as to achieve more flexible and diverse display of material images. Moreover, in this embodiment, the actually obtained first material image is an image for display in a target terminal. Then, by the electronic device pre-obtaining corresponding color transformation parameters, it can enable the target terminal to have more diverse material image displays while also reducing the data operation pressure on the target terminal.

[0095] Please refer to Figure 8 , an image processing apparatus 400 provided in this application, which is applied to an electronic device. The apparatus 400 includes:

[0096] An image acquisition unit 410, configured to acquire reference information.

[0097] A material matching unit 420, configured to acquire a first material image corresponding to the reference information.

[0098] A parameter acquisition unit 430, configured to acquire color transformation parameters corresponding to the first material image, where the color transformation parameters include color transformation target values of specified pixels in the first material image.

[0099] An image processing unit 440, configured to perform color transformation on the first material image based on the color transformation parameters to obtain a second material image after color transformation.

[0100] As a method, the parameter acquisition unit 430 is specifically configured to acquire respective reference transformation colors corresponding to the colors to be transformed in the first material image; acquire proportionality coefficients of multiple color channels of the specified pixels in the first material image; and obtain the color transformation target values of the specified pixels in the first material image based on the proportionality coefficients of the multiple color channels of the specified pixels and the respective reference transformation colors corresponding to each color.

[0101] Optionally, the parameter acquisition unit 430 is specifically configured to acquire the image type corresponding to the first material image; based on the image type, acquire the proportionality coefficient of each of the multiple color channels of the specified pixel in the first material image. Among them, the parameter acquisition unit 430 is specifically configured to, if the image type is the first type, acquire the proportionality coefficient of each of the multiple color channels based on the first proportionality coefficient determination method, where the first proportionality coefficient determination method includes: acquiring the target color channel among the multiple color channels of the specified pixel, and the target color channel is the color channel with the largest corresponding color value; configuring the proportionality coefficient of the target color channel of the specified pixel to 1, and configuring the proportionality coefficient of the color channels other than the target color channel to 0.

[0102] Furthermore, the parameter acquisition unit 430 is also specifically configured to, if the image type is the second type, acquire the proportionality coefficient of each of the multiple color channels based on the second proportionality coefficient determination method, where the second proportionality coefficient determination method includes: acquiring the corresponding first target color parameter value of the specified pixel, and the first target color parameter value is the minimum value among the original color values of the multiple color channels and the first reference color value; acquiring the maximum value among the differences between the original color values of the multiple color channels and the first target color parameter value and the second color reference value as the current color value of the multiple color channels; acquiring the maximum value between the sum of the current color values of the multiple color channels and the third color reference value as the second target color parameter value; taking the ratio of the current color values of the multiple color channels to the second target color parameter value as the proportionality coefficient of each of the multiple color channels of the specified pixel.

[0103] In addition, the parameter acquisition unit 430 is also specifically configured to, if the image type is the third type, acquire the proportionality coefficient of each of the multiple color channels based on the third proportionality coefficient determination method, where the third proportionality coefficient determination method includes: determining one method from the first proportionality coefficient determination method and the second proportionality coefficient determination method based on the type of the current pixel in the specified pixel and the magnitude relationship of the color values of the multiple color channels corresponding to the current pixel to determine the proportionality coefficient of the multiple color channels of the current pixel.

[0104] As a method, the parameter acquisition unit 430 is specifically configured to, if the values of the blue channel and the green channel of the first pixel in the specified pixel are both less than the fourth reference color value, determine the proportionality coefficient of the multiple color channels of the first pixel through the first proportionality coefficient determination method, otherwise determine the proportionality coefficient of the multiple color channels of the first pixel through the second proportionality coefficient determination method;

[0105] If the values of the red channel and the green channel of the second pixel in the specified pixel are both less than the fourth reference color value, determine the scale factors of the multiple color channels of the second pixel through the first scale factor determination method; otherwise, determine the scale factors of the multiple color channels of the second pixel through the second scale factor determination method;

[0106] If the values of the red channel and the blue channel of the third pixel in the specified pixel are both less than the fourth reference color value, determine the scale factors of the multiple color channels of the third pixel through the first scale factor determination method; otherwise, determine the scale factors of the multiple color channels of the third pixel through the second scale factor determination method.

[0107] An image processing apparatus provided in the present application, after obtaining reference information, obtains a first material image corresponding to the reference information, and obtains color transformation parameters corresponding to the first material image and including the color transformation target values of specified pixels in the first material image, and then performs color transformation on the first material image based on the color transformation parameters to obtain a second material image after color transformation. Thus, through the above method, after matching the corresponding first material image based on the reference information, the corresponding color transformation parameters can be obtained to perform color transformation on the first material image to obtain a second material image after color transformation, and then the pre-made first material image can be adaptively color-transformed according to actual needs to obtain a second material image, so as to realize more flexible and diverse display of the material image.

[0108] The following will be combined with Figure 9 to describe an electronic device provided in the present application.

[0109] Please refer to Figure 9 , based on the above image processing method and apparatus, another electronic device 100 capable of executing the foregoing terminal control method is further provided in an embodiment of the present application. The electronic device 100 includes one or more (only one is shown in the figure) processors 102, a memory 104, a network module 106, and an image acquisition device 108 that are coupled to each other. Among them, a program that can execute the content in the foregoing embodiment is stored in the memory 104, and the processor 102 can execute the program stored in the memory 104.

[0110] Among them, the processor 102 may include one or more processing cores. The processor 102 connects various parts within the entire electronic device 100 through various interfaces and lines. By running or executing instructions, programs, code sets, or instruction sets stored in the memory 104, and by invoking the data stored in the memory 104, it performs various functions of the electronic device 100 and processes data. Optionally, the processor 102 may be implemented in at least one hardware form of digital signal processing (DSP), field-programmable gate array (FPGA), or programmable logic array (PLA). The processor 102 may integrate a combination of one or several of a central processing unit (CPU), a graphics processing unit (GPU), and a modem, etc. Among them, the CPU mainly processes the operating system, user interface, application programs, etc.; the GPU is responsible for rendering and drawing the displayed content; the modem is used to process wireless communications. It can be understood that the above-mentioned modem may not be integrated into the processor 102 and may be implemented separately through a communication chip.

[0111] The memory 104 may include random access memory (RAM) and may also include read-only memory. The memory 104 can be used to store instructions, programs, code, code sets, or instruction sets. The memory 104 may include a program storage area and a data storage area. Among them, the program storage area may store instructions for implementing the operating system, instructions for implementing at least one function (such as touch function, sound playback function, image playback function, etc.), instructions for implementing the following various method embodiments, etc. The data storage area may also store data created during the use of the terminal 100 (such as phone book, audio and video data, chat record data, etc.).

[0112] The network module 106 is used to receive and send electromagnetic waves, realize the mutual conversion between electromagnetic waves and electrical signals, so as to communicate with a communication network or other devices, for example, communicate with an audio playback device. The wireless module 106 may include various existing circuit elements for performing these functions. For example, antennas, radio frequency transceivers, digital signal processors, encryption / decryption chips, subscriber identity module (SIM) cards, memories, and so on. The wireless module 106 can communicate with various networks such as the Internet, enterprise intranets, wireless networks, or communicate with other devices through a wireless network. The above-mentioned wireless networks may include cellular phone networks, wireless local area networks, or metropolitan area networks.

[0113] Furthermore, the image acquisition device 108 can be used for image acquisition. Optionally, the image acquisition device 108 can include a color image acquisition device and a depth image acquisition device.

[0114] Please refer to Figure 10 , which shows a structural block diagram of a computer-readable storage medium provided by an embodiment of the present application. Program code is stored in the computer-readable medium 800, and the program code can be called by a processor to execute the method described in the above method embodiment.

[0115] The computer-readable storage medium 800 can be an electronic memory such as a flash memory, an EEPROM (electrically erasable programmable read-only memory), an EPROM, a hard disk, or a ROM. Optionally, the computer-readable storage medium 800 includes a non-transitory computer-readable storage medium. The computer-readable storage medium 800 has a storage space for the program code 810 that executes any method step in the above method. These program codes can be read from or written into one or more computer program products. The program code 810 can be compressed in an appropriate form, for example.

[0116] In summary, for an image processing method, device, and electronic device provided by the present application, after obtaining reference information, a first material image corresponding to the reference information is obtained, and a color transformation parameter including a color transformation target value of a specified pixel in the first material image corresponding to the first material image is obtained. Then, based on the color transformation parameter, color transformation is performed on the first material image to obtain a second material image after color transformation. Thus, through the above method, after the first material image corresponding to the reference information is matched based on the reference information, the corresponding color transformation parameter can be obtained to perform color transformation on the first material image to obtain a second material image after color transformation. Furthermore, for the pre-produced first material image, an adaptable color transformation can be performed according to actual needs to obtain a second material image, so as to realize more flexible and diverse display of the material image.

[0117] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present application, and are not intended to limit them; although the present application has been described in detail with reference to the foregoing embodiments, those of ordinary skill in the art should understand that they can still modify the technical solutions described in the foregoing embodiments, or perform equivalent replacements for some of the technical features; and these modifications or replacements do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of the present application.

Claims

1. An image processing method, characterized in that, Applied to an electronic device, the method includes: Obtaining reference information, where the reference information includes an image collected by the electronic device through an image acquisition device, and the image acquisition device includes a color image acquisition component; Obtaining a first material image corresponding to the reference information; Obtaining a color transformation parameter corresponding to the first material image, where the color transformation parameter includes a color transformation target value of a specified pixel in the first material image; Performing color transformation on the first material image based on the color transformation parameter to obtain a second material image after color transformation, where the second material image is used as a background image or a theme image; Replacing the image of a specified interface with the second material image.

2. The method according to claim 1, wherein The obtaining of the color transformation parameter corresponding to the first material image includes: Obtaining respective reference transformation colors corresponding to the colors to be transformed in the first material image; Obtaining respective proportionality coefficients of multiple color channels of the specified pixel in the first material image; Based on the respective proportionality coefficients of the multiple color channels of the specified pixel and the respective reference transformation colors corresponding to each color, obtaining the color transformation target value of the specified pixel in the first material image.

3. The method according to claim 2, characterized in that, The obtaining of the respective proportionality coefficients of the multiple color channels of the specified pixel in the first material image includes: Obtaining the image type corresponding to the first material image; Based on the image type, obtaining the respective proportionality coefficients of the multiple color channels of the specified pixel in the first material image.

4. The method according to claim 3, wherein The obtaining of the respective proportionality coefficients of the multiple color channels of the specified pixel in the first material image based on the image type includes: If the image type is the first type, obtaining the respective proportionality coefficients of the multiple color channels based on a first proportionality coefficient determination method, where the first proportionality coefficient determination method includes: Obtaining a target color channel among the multiple color channels of the specified pixel, where the target color channel is the color channel with the largest corresponding color value; Configuring the proportionality coefficient of the target color channel of the specified pixel to 1, and configuring the proportionality coefficients of the color channels other than the target color channel to 0.

5. The method according to claim 4, characterized in that, The obtaining of the respective proportionality coefficients of the multiple color channels of the specified pixel in the first material image based on the image type further includes: If the image type is the second type, obtaining the respective proportionality coefficients of the multiple color channels based on a second proportionality coefficient determination method, where the second proportionality coefficient determination method includes: Obtaining a first target color parameter value corresponding to the specified pixel, where the first target color parameter value is the smallest value among the original color values of the multiple color channels and a first reference color value; Obtaining the largest value among the differences between the original color values of the multiple color channels and the first target color parameter value and a second color reference value as the current color values of the multiple color channels; Obtaining the maximum value between the sum of the current color values of the multiple color channels and a third color reference value as a second target color parameter value; Taking the ratio of the current color values of the multiple color channels to the second target color parameter value as the respective proportionality coefficients of the multiple color channels of the specified pixel.

6. The method according to claim 5, wherein Based on the image type, obtaining the proportionality coefficient of each of multiple color channels of a specified pixel in the first material image further includes: If the image type is the third type, obtaining the proportionality coefficient of each of the multiple color channels based on a third proportionality coefficient determination method, where the third proportionality coefficient determination method includes: Based on the type of the current pixel in the specified pixel and the magnitude relationship of the color values of the multiple color channels corresponding to the current pixel, determining one method from the first proportionality coefficient determination method and the second proportionality coefficient determination method to determine the proportionality coefficient of the multiple color channels of the current pixel.

7. The method according to any one of claims 2-6, characterized in that, Based on the proportionality coefficient of each of the multiple color channels of the specified pixel and the reference transformation color corresponding to each color, obtaining the color transformation target value of the specified pixel in the first material image includes: Multiplying the proportionality coefficient of each of the multiple color channels of the specified pixel by the reference transformation color corresponding to each of the multiple color channels to obtain multiple intermediate transformation target values, where if the color corresponding to the color channel is the same as the color to be transformed corresponding to the reference transformation color, then the color channel corresponds to the reference transformation color; Adding the multiple intermediate transformation target values to obtain the color transformation target value of the specified pixel.

8. The method according to claim 1, wherein Based on the color transformation parameter, performing color transformation on the first material image to obtain a second material image after color transformation includes: Sending the color transformation parameter to a target terminal, so that the target terminal performs color transformation on the first material image based on the color transformation parameter and displays the second material image after color transformation.

9. An image processing apparatus, characterized in that, Applied to an electronic device, the apparatus includes: An image acquisition unit, configured to acquire reference information, where the reference information includes an image acquired by the electronic device through an image acquisition device, and the image acquisition device includes a color image acquisition component; A material matching unit, configured to acquire a first material image corresponding to the reference information; A parameter acquisition unit, configured to acquire a color transformation parameter corresponding to the first material image, where the color transformation parameter includes the color transformation target value of a specified pixel in the first material image; An image processing unit, configured to perform color transformation on the first material image based on the color transformation parameter to obtain a second material image after color transformation, where the second material image is used as a background image or a theme image, and replaces the image of a specified interface with the second material image.

10. An electronic device, characterized in that, Including one or more processors and a memory; One or more programs are stored in the memory and configured to be executed by the one or more processors, and the one or more programs are configured to execute the method according to any one of claims 1-7.

11. A computer-readable storage medium, characterized in that, Program code is stored in the computer-readable storage medium, where the method according to any one of claims 1-7 is executed when the program code runs.

Citation Information

Patent Citations

  • Interface processing method and apparatus

    CN106547530A