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

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

Info

Publication number
WO2023045857A1
WO2023045857A1 PCT/CN2022/119581 CN2022119581W WO2023045857A1 WO 2023045857 A1 WO2023045857 A1 WO 2023045857A1 CN 2022119581 W CN2022119581 W CN 2022119581W WO 2023045857 A1 WO2023045857 A1 WO 2023045857A1
Authority
WO
WIPO (PCT)
Prior art keywords
image
color
pixel block
sub
images
Prior art date
Application number
PCT/CN2022/119581
Other languages
French (fr)
Chinese (zh)
Inventor
吴禹辰
Original Assignee
维沃移动通信有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 维沃移动通信有限公司 filed Critical 维沃移动通信有限公司
Publication of WO2023045857A1 publication Critical patent/WO2023045857A1/en

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T7/00Image analysis
    • G06T7/0002Inspection of images, e.g. flaw detection
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T7/00Image analysis
    • G06T7/90Determination of colour characteristics
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T2207/00Indexing scheme for image analysis or image enhancement
    • G06T2207/10Image acquisition modality
    • G06T2207/10024Color image

Definitions

  • the present application belongs to the field of image processing, and in particular relates to an image processing method, device, electronic equipment and storage medium.
  • the purpose of the embodiments of the present application is to provide an image processing method, device, electronic equipment, and storage medium, which can solve the problem that the existing image processing methods cannot meet the personalized needs of users.
  • the embodiment of the present application provides an image processing method, the method comprising:
  • a pixel block image corresponding to the first image is obtained, wherein the pixel block image includes M pixel block sub- Image, M is a positive integer;
  • the fill color of each of the color block areas is determined from the N fill colors corresponding to the pixel block image to obtain a second image, wherein the fill color is used to fill its corresponding The color block area, the N filling colors corresponding to the pixel block image are determined based on the preset color category, the RGB value of each of the pixel block sub-images and the second color parameter, and the second color parameter includes lightness and Saturation, N is a positive integer.
  • an image processing device which includes:
  • the first dividing unit is configured to obtain a pixel block image corresponding to the first image based on the first image divided according to a preset size and the RGB values of each pixel in the first image, wherein the pixel block
  • the image includes M pixel block sub-images, where M is a positive integer
  • the second dividing unit is configured to divide the pixel block image into K color block regions based on the first color parameters of each of the pixel block sub-images, wherein the first color parameters include hue and lightness, and K is Positive integer, K ⁇ M;
  • a color filling unit configured to determine the fill color of each of the color block regions from the N fill colors corresponding to the pixel block image based on the RGB mean value of the color block region, to obtain a second image, wherein the fill The color is used to fill its corresponding color block area, and the N filling colors corresponding to the pixel block image are determined based on the preset color category, the RGB value of each of the pixel block sub-images and the second color parameter, and the first Two color parameters include lightness and saturation, and N is a positive integer.
  • an embodiment of the present application provides an electronic device, the electronic device includes a processor, a memory, and a program or instruction stored in the memory and operable on the processor, and the program or instruction is The processor implements the steps of the method described in the first aspect when executed.
  • an embodiment of the present application provides a readable storage medium, on which a program or an instruction is stored, and when the program or instruction is executed by a processor, the steps of the method described in the first aspect are implemented .
  • the embodiment of the present application provides a chip, the chip includes a processor and a communication interface, the communication interface is coupled to the processor, and the processor is used to run programs or instructions, so as to implement the first aspect the method described.
  • the first image is divided into a plurality of pixel block sub-images to obtain a pixel block image corresponding to the first image, and based on each pixel in the pixel block image
  • the degree of difference in lightness or hue between the block sub-images divides the pixel block image into multiple color block areas, and at the same time, based on the RGB value and preset color category of each pixel block sub-image in the pixel block image, it is determined that multiple color blocks belong to the same category
  • the color pixel block sub-image set so as to determine the few types of color categories with a large distribution range in the pixel block image, and then according to the lightness and saturation of each pixel block sub-image corresponding to each type of color, determine the color used for each color block
  • the fill color for color filling in the area so as to generate the second image through these few fill colors that can represent the main color and color distribution of the first image.
  • the second image is only
  • FIG. 1 is a schematic flow diagram of an image processing method provided in an embodiment of the present application
  • FIG. 2 is a schematic diagram of a second image generated by the image processing method provided in the embodiment of the present application.
  • Fig. 3 is a schematic diagram of dividing the color block area provided by the embodiment of the present application.
  • Fig. 4 is a schematic display of the theme color logo provided by the embodiment of the present application.
  • FIG. 5 is a schematic structural diagram of an image processing device provided in an embodiment of the present application.
  • FIG. 6 is a schematic structural diagram of an electronic device provided by an embodiment of the present application.
  • FIG. 7 is a schematic diagram of a hardware structure of an electronic device implementing an embodiment of the present application.
  • Fig. 1 is a schematic flow chart of the image processing method provided by the embodiment of the present application, as shown in Fig. 1, including:
  • Step 101 Obtain a pixel block image corresponding to the first image based on the first image divided according to a preset size and the RGB values of each pixel in the first image, wherein the pixel block image includes M Pixel block sub-image, M is a positive integer;
  • the first image described in the embodiment of the present application may be an image stored inside the electronic device, or an image received by the electronic device from the outside, which may include color images, grayscale images, and black and white images, and specifically It may be an image in the system theme stored in the electronic device or a captured image, which is not specifically limited in this application.
  • the preset size described in the embodiment of the present application may be a preset defined size.
  • the first image divided according to the preset size is composed of M first sub-images of the preset size.
  • M is a positive integer.
  • the electronic device can be any terminal device that supports image display, such as mobile phones, touch-screen computers, handheld computers, vehicle-mounted terminals, wearable devices, PAD (Portable Android Device, tablet computer) and other devices.
  • the embodiments are not specifically limited here.
  • the pixel block sub-image described in the embodiment of the present application calculates the average value of the RGB values of the pixels in each first sub-image in the first image, and adjusts all the pixels in each first sub-image to the obtained after the average.
  • the pixel block image described in the embodiment of the present application refers to an image composed of each pixel block sub-image after processing the M first sub-images in the first image into pixel block sub-images, wherein the pixel block image includes M Pixel block subimage.
  • Step 102 based on the first color parameters of each of the pixel block sub-images, divide the pixel block image into K color block regions, wherein the first color parameters include hue and lightness, K is a positive integer, K ⁇ M;
  • the first color parameter described in the embodiment of the present application includes hue and lightness, which are used to judge the color difference between sub-images of each pixel block in the pixel block image, so as to divide the color block area.
  • the color block area described in the embodiment of the present application refers to an area determined by dividing the pixel block image into color blocks based on the first color parameter among the sub-images of each pixel block.
  • Step 103 based on the RGB mean value of the color block area, determine the fill color of each of the color block areas from the N fill colors corresponding to the pixel block image to obtain a second image, wherein the fill color is used for Filling its corresponding color block area, the N filling colors corresponding to the pixel block image are determined based on the preset color category, the RGB value of each of the pixel block sub-images and the second color parameter, and the second color parameter Including lightness and saturation, N is a positive integer.
  • the sub-images of each pixel block in the color block area are similar in color, but there are some differences.
  • the main color of the color block area it is possible to calculate The average of the RGB values is determined.
  • the RGB mean value of the color block area described in the embodiment of the present application is obtained by calculating the average value of the RGB values of each pixel block sub-image in the color block area.
  • the preset color category described in the embodiment of this application refers to the preset color category of this application, for example, the preset color category can be red, orange, yellow, green, blue, blue, purple, black, white, gray10
  • the color category corresponding to each pixel block sub-image can be determined through the RGB value range corresponding to each color category and the RGB value of each pixel block sub-image.
  • the fill color described in the embodiment of the present application refers to the color used to fill each color block area.
  • the second image described in the embodiment of the present application refers to the color block image obtained by dividing the pixel block image into color block regions and filling each color block region with color.
  • the second color parameter described in the embodiment of the present application includes lightness or saturation, which is used for color expansion of the sub-image color of the pixel block selected from the pixel block image and having the main tone feature, so as to generate a filling color.
  • the N filling colors corresponding to the pixel block image described in the embodiment of this application refer to the colors that can represent the main color and color distribution of the pixel block image, which are based on the preset color category and the RGB value of each pixel block sub-image Determined with the second color parameter, its specific acquisition method can be, through the RGB value of each pixel block sub-image in the image and the RGB value corresponding to the preset color category, determine the corresponding value of each preset color category in the pixel block image Pixel block sub-images, so as to select the color categories that can represent the main hue and color distribution of the first image, and adjust the brightness or saturation of the pixel block sub-images corresponding to these color categories, so as to obtain N fill colors corresponding to the pixel block images , where N is a positive integer.
  • N may take a value of 4, 6, 12, etc., which is specifically determined according to actual computing requirements, and the present application does not specifically limit it here.
  • the filling color used to fill each color patch area can be determined from the N filling colors corresponding to the pixel block image.
  • the second image after determining the fill color of each color block area, filling each fill color into the corresponding color block area, thereby obtaining the color block image, that is, the second image.
  • the second image has a simple color block style, which can meet the individual needs of users.
  • Fig. 2 is a schematic diagram of a second image generated by the image processing method provided in the embodiment of the present application.
  • the second image is a color patch image, including 3 color patch areas, and in each color patch area The colors are all different, blue, orange and red.
  • the first image is divided into a plurality of pixel block sub-images to obtain a pixel block image corresponding to the first image, and based on each pixel in the pixel block image
  • the degree of difference in lightness or hue between the block sub-images divides the pixel block image into multiple color block areas, and at the same time, based on the RGB value and preset color category of each pixel block sub-image in the pixel block image, it is determined that multiple color blocks belong to the same category
  • the color pixel block sub-image set so as to determine the few types of color categories with a large distribution range in the pixel block image, and then according to the lightness and saturation of each pixel block sub-image corresponding to each type of color, determine the color used for each color block
  • the fill color for color filling in the area so as to generate the second image through these few fill colors that can represent the main color and color distribution of the first image.
  • the second image is only
  • the method before determining the fill color of each of the color block regions from the N fill colors corresponding to the pixel block image, the method further includes:
  • each of the pixel block sub-images Based on the RGB value of each of the pixel block sub-images and the RGB value interval corresponding to each of the preset color categories, determine the pixel block sub-image set corresponding to each preset color category, wherein each of the pixel block sub-image sets comprising one or more pixel block sub-images;
  • L target pixel block sub-image sets in each of the pixel block sub-image sets where L is a positive integer
  • each pixel block sub-image in the pixel block image is color-categorized, so as to subsequently determine the pixel block sub-image that can represent the main tone and color distribution of the first image.
  • the pixel block sub-image set described in the embodiment of the present application refers to a set of pixel block sub-images belonging to the same color category, which may include one or more pixel block sub-images.
  • the target pixel block sub-image set described in the embodiment of the present application refers to L pixel block sub-image sets selected from each pixel block sub-image set, wherein the color category corresponding to the target pixel block sub-image set can represent the first pixel block sub-image set
  • L is a positive integer.
  • L may be 4, 5, 7, etc., which are specifically determined according to actual calculations, and the present application does not specifically limit it here.
  • the distribution range of the preset color category corresponding to each pixel block sub-image set in the pixel block image can be determined.
  • the color category is The number of pixel block sub-images in the pixel block sub-image set corresponding to red is the largest, indicating that the color distribution range of red in the pixel block image is the largest; the color category is the pixel block sub-image set corresponding to yellow.
  • the number of pixel block sub-images is the least, It shows that the color distribution range of yellow in the pixel block image is the smallest.
  • each pixel block sub-image set sort them from most to least, and filter out the first few pixel block sub-image sets with a large number of pixel block sub-images, so as to determine the representative A plurality of pixel block sub-image sets of the main tone and color distribution of the first image are obtained to obtain each target pixel block sub-image set.
  • the target pixel block sub-image described in the embodiment of the present application refers to the second color parameter of each pixel block sub-image in the target pixel block sub-image set, that is, lightness and saturation, which can represent the same preset color The color with the most balanced color parameters in the category.
  • the colors of each pixel block sub-image are sorted from dark to bright, by It is obtained by sorting according to the rule of gray to pure, and then selecting the pixel block sub-image at the center position from the sorted pixel block sub-images, and using the pixel block sub-image at the center position as the target pixel block sub-image.
  • L target pixel block sub-images may be determined.
  • the saturation pre-saturation of the sub-image of the pixel block can be performed. processing to control the color saturation of the sub-image of the pixel block to be within a fixed preset saturation range to obtain the sub-image of the target pixel block.
  • the preset saturation range can be selected as (10-50). If the color saturation of the selected pixel block sub-image at the center position exceeds the preset saturation range, that is, the color saturation of the pixel block sub-image
  • the saturation of the color of the pixel block sub-image is adjusted to 10, so that the adjusted pixel block sub-image is used as the target pixel block sub-image;
  • the saturation of is greater than the interval threshold 50, the saturation of the color of the pixel block sub-image is adjusted to 50, so that the adjusted pixel block sub-image is used as the target pixel block sub-image.
  • each target pixel block sub-image After each target pixel block sub-image is obtained, the lightness or saturation of each target pixel block sub-image can be adjusted based on each target pixel block sub-image, and each target pixel block sub-image can be expanded into N color.
  • the lightness of each target pixel block sub-image can be added or subtracted by 10, and the color of the target pixel block sub-image can be extended to 3 colors, thus, the L colors corresponding to the L target pixel block sub-images, Through the above lightness adjustment, 3L colors can be obtained, and the 3L colors can be used as the final fill color.
  • N 3L; similarly, the saturation of each target pixel block sub-image can also be added or subtracted by 10, Add 20 or subtract 20 to the saturation of each target pixel block sub-image, so that the color of the target pixel block sub-image is expanded to 5 colors, thus, the L colors corresponding to the L target pixel block sub-images can pass the saturation Adjust the degree to obtain 5L colors, and use the 5L colors as the final fill color.
  • N 5L.
  • the color of each pixel block sub-image is classified based on the RGB value of each pixel block sub-image and the RGB value interval corresponding to each preset color category, and the pixel corresponding to each preset color category is obtained.
  • Block sub-image sets to determine multiple pixel block sub-image sets with a large color distribution range in the pixel block image, and then determine the target pixels that can represent the main tone and color distribution of the first image from these pixel block sub-image sets A block sub-image, so as to generate multiple fill colors corresponding to the pixel block image based on the target pixel block sub-image, so that each fill color can still maintain the main tone and color distribution of the pixel block image.
  • the dividing the pixel block image into K color block regions based on the first color parameters of each of the pixel block sub-images includes:
  • each color in the pixel block image in combination with the color distribution regionalization feature of image display, can be identified based on the first color parameter of each pixel block sub-image in the pixel block image, that is, hue or lightness
  • the distribution area is to determine each color block dividing line in the pixel block image, where there may be one or more color block dividing lines.
  • the color block dividing line described in the embodiment of this application is generated based on the hue or lightness of each pixel block sub-image in the pixel block image, and the color is generated between the pixel block sub-images in which the hue or lightness of the pixel block image has continuous and obvious changes. Block dividing line.
  • Fig. 3 is a schematic diagram of dividing the color block area provided by the embodiment of the present application. As shown in Fig. 3, the pixel block image is divided by the hue or lightness of each pixel block sub-image in the pixel block image to obtain three color block areas .
  • the sub-image regions of the pixel block with obvious brightness or hue differences in the pixel block image are divided to obtain K color block areas.
  • a point at any corner of the pixel block image as the origin establish an X-Y axis plane coordinate system, start from the sub-image of the pixel block where the origin is located, first along the X-axis direction, and then start from the origin along the Y-axis direction , identify the hue or lightness of each pixel block sub-image one by one, determine the pixel block sub-image area with close hue or lightness, when there is a continuous and obvious difference in hue or lightness in the pixel block sub-image area adjacent to the pixel block sub-image area , for example, the adjacent pixel block sub-image areas belong to different preset color categories, and the color block dividing line between the adjacent pixel block sub-image areas is determined, so as to determine the adjacent pixel block images with obvious differences
  • the color block division lines between the pixel block sub-image areas are finally divided into K color block areas, wherein the size of each color block area must exceed 2 pixel blocks.
  • any pixel block sub-image at the center of the pixel block image as the starting point take the pixel block sub-image as the center of the circle, and carry out diffuse recognition of the hue or lightness between the pixel block sub-images around the pixel block image, Determine the pixel block sub-image area with similar hue or lightness, and when there is a continuous and obvious difference in hue or lightness between the adjacent pixel block sub-image areas of the pixel block sub-image area, determine the difference between the adjacent pixel block sub-image areas
  • the color block division lines of the pixel block image are determined to determine the color block division lines between the adjacent pixel block sub-image areas with obvious differences in the pixel block image, and K color block areas are finally divided.
  • each color distribution area in the pixel block image is identified, and the color distribution area in the pixel block image is determined.
  • the color block dividing line and then divide the pixel block image into multiple color block areas according to each color block dividing line, so as to determine the main color distribution in the first image, which is beneficial to the color filling of the subsequent color block areas. Keep the original tonal style of the first image.
  • determining the fill color of each of the color block regions from the N fill colors corresponding to the pixel block image based on the RGB mean value of the color block region includes:
  • the fill color corresponding to each color block area is determined based on the difference between the RGB mean value of each color block area and the RGB value of each of the fill colors.
  • the fill color corresponding to each color block area it is necessary to determine the fill color corresponding to each color block area, so as to refill each color block area.
  • the difference between the RGB mean value of each color patch area and the RGB value of each fill color can be calculated, and the corresponding fill color when the difference is the smallest is determined, that is, the fill color is closest to the main color of the color patch area , so that the fill color is used as the color that fills the patch area.
  • the fill color corresponding to each color block area can be determined.
  • the fill color corresponding to the target pixel block sub-image among the fill colors close to the color block area may be preferentially filled.
  • the color filling the color block area when color filling the color block area, first identify the preset color category to which each pixel block sub-image in the color block area belongs, and compare the preset color category with all other color blocks belonging to the same preset color category If the color lightness of the color block area is lower, select a fill color with a similar color and a darker color from each fill color; if the color lightness of the color block area is higher, select a similar color from each fill color And fill with a brighter fill color.
  • the obtaining the pixel block image corresponding to the first image based on the first image divided according to the preset size and the RGB values of each pixel in the first image includes:
  • a pixel block image corresponding to the first image is obtained.
  • M first sub-images can be obtained, where M is a positive integer, and M means that after dividing the first image according to the preset size
  • M can be 20, 40, 50, etc., which is specifically determined according to actual computing requirements, and the present application does not specifically limit it here.
  • the image size of the first image is 300 ⁇ 500, that is, the length of the first image is 300 pixels and the width is 500 pixels
  • a preset size of 15 ⁇ 25 can be selected That is, the length is 15 pixels and the width is the preset size of 25 pixels, and the first image is divided to obtain 20 first sub-images; you can also choose the preset size of 6 ⁇ 10, that is, the length is 6 pixels
  • the first image is divided into 50 first sub-images by dividing the first image with a preset size whose width is 10 pixels.
  • the RGB average value of the first sub-image described in the embodiment of the present application is obtained by calculating the average value of the RGB values of each pixel in the first sub-image.
  • each pixel in the first sub-image is adjusted to the same average value, so as to obtain a pixel block sub-image corresponding to the first sub-image.
  • the pixel block image corresponding to the first image can be obtained.
  • a plurality of first sub-images are obtained by dividing the first image according to a preset size, based on calculating the RGB mean value of the first sub-image, each first sub-image is pixelated, thereby obtaining the first sub-image
  • the pixel block image corresponding to an image can make the generated pixel block image still maintain the main tone and color distribution of the first image.
  • the method further includes:
  • T theme color identifications wherein each of the theme color identifications corresponds to a theme color scheme, and the theme color scheme is based on each color patch area in the second image Generated by fill color, where T is a positive integer;
  • system control identifiers described in the embodiments of the present application may specifically be image identifiers of system components, system modules, desktop components, applications, lock screens, etc. in the electronic device system, where the system components include multiple selection, single selection , box selection, progress bar, volume bar, cue point, button, index, text box selection and other electronic equipment system components; system modules include control center, notification center, system settings, alarm clock, calculator, compass, tape recorder and other applications
  • the setting interface of the program; the system application program may specifically be an application program that comes with the electronic device, or an application program that the electronic device downloads and installs from outside.
  • the theme color scheme described in the embodiment of this application refers to the scheme used to adjust the color parameters of the system controls in the system interface, which can be specifically determined according to the fill color of each color block area in the second image.
  • color scheme the fill color of each color block area in the second image can have five colors of red, yellow, blue, green, and purple, and a plurality of three color combinations can be selected according to these five colors, such as red, yellow, Blue is a group of combinations, yellow, blue, and green are a group of combinations, and yellow, blue, and purple are a group of combinations.
  • three theme color schemes can be determined, that is, the theme tone with red, yellow, and blue as the theme colors.
  • the first input described in the embodiment of this application refers to the operation for generating a theme color scheme based on the fill color of each color block area in the second image.
  • the first input may be the user's input to the second image operation, which Specifically, it may be a single-click operation, a double-click operation, or a long-press operation, and the like.
  • the theme color logo described in this embodiment of the application refers to the theme color image logo corresponding to the theme color scheme, and each theme color logo corresponds to a theme color scheme.
  • the fill color of each color block area in the second image can have 6 colors of red, yellow, blue, green, purple, and white, and it can be set to select 4 combinations of 3 colors based on these 6 colors, such as Red, yellow, and white are a group combination, yellow, green, and white are a group combination, blue, purple, and white are a group combination, and red, blue, and white are a group combination, so four theme color schemes can be determined , that is, the theme color scheme with red, yellow, and white as the theme colors, the theme color scheme with yellow, green, and white as the theme colors, the theme color scheme with blue, purple, and white as the theme colors, and the theme color scheme with red, green, and white as the theme colors.
  • the theme color scheme of blue and white as the theme colors Therefore, according to the four theme color schemes, there can be four theme color identifications.
  • the electronic device After receiving the first input from the user, the electronic device will display T theme color logos in response to the first input, where T is a positive integer.
  • Fig. 4 is a schematic display diagram of the theme color logo provided by the embodiment of the present application.
  • theme color logos displayed, which are respectively the first theme color logo 41, which correspond to red, orange, and white.
  • the fourth theme color logo 44 corresponds to the theme color scheme with red, blue and white as the theme colors;
  • the fifth theme color logo 45 corresponds to orange, blue and white.
  • the theme color scheme with blue and white as theme colors; the sixth theme color mark 46 which corresponds to the theme color scheme with blue, green and white as theme colors.
  • the color attribute described in the embodiment of the present application refers to the hue, saturation and lightness of the displayed color identified by the system control.
  • the target theme color identification described in the embodiment of this application refers to the theme color identification selected by the user from various theme color identifications, which is used to adjust the color attributes of each system control identification in the system interface based on the corresponding theme color scheme .
  • the second input described in the embodiment of this application refers to the operation for selecting the target theme color logo from the T theme color logos.
  • the second input can be the user's input on the operation of the target theme color logo, which can be a single Click operation, double-click operation or long press operation, etc.
  • the electronic device will correspond to the target theme color identifier according to the target theme color identifier.
  • the theme color color attribute in the theme color scheme adjust the color attributes of each system control logo in the system interface, such as system components, system modules, desktop components, applications or lock screen image logos, to be consistent with the theme color Color attribute, so as to realize the color re-matching of the image identification display of each system component, system module, desktop component, application program or lock screen.
  • a blue theme color scheme and a green theme color scheme can be generated, and when the user clicks on the green theme color scheme corresponding
  • the green color scheme will be applied to each system control mark in the system interface, such as the progress bar image mark, the volume bar mark, the control center mark, the progress bar mark, and the display time mark , button image logos, etc. will all be adjusted to a green color scheme.
  • the theme color scheme generated according to the fill color of each color block area in the second image will also change the color matching of the system desktop application image logo and desktop component image logo, and the system reads the desktop application image
  • the color of the logo, the color of the image logo is divided into intelligent color partitions, and the theme color in the theme color scheme is filled into the color partition to generate a desktop application image logo with a new color matching, and the old image logo is divided into Replacement;
  • the theme color scheme of the desktop component image logo can change the color of the text logo in the desktop component and the color of the desktop component image logo.
  • the desktop component will calculate the difference between its own color and the background color of the desktop, and choose a color different from the background color. Avoid blending the color of the desktop component's image logo with the color of the desktop background and making it indistinguishable.
  • a purple theme color scheme and a yellow theme color scheme can also be generated, and when the user clicks the corresponding After the purple theme color is identified, the desktop application image logo and desktop component image logo will be adjusted to the purple color scheme.
  • the color of the system lock screen image logo can also be changed, so that each image logo in the system lock screen interface can be adjusted to the theme The theme color corresponding to the color scheme.
  • the toned color of the lock screen image logo is the same as the color of the desktop image logo after toning ;
  • the color scheme for the lock screen image logo is different from that of the desktop image logo, the color of the lock screen image logo is different from the color of the desktop image logo after toning, and the system can choose the lock screen
  • the colors in the two theme color schemes corresponding to the image logo and the desktop image logo are used to color the lock screen image logo, for example, the yellow theme color scheme corresponding to the lock screen image logo and the blue theme color scheme corresponding to the desktop image logo
  • the color schemes are all applied to the lock screen interface, so that the lock screen image logos in the interface include both yellow-based image logos and blue-based image logos.
  • multiple theme color schemes are generated for users to choose a theme color scheme according to their personal needs, and realize the color identification of system controls in electronic devices Custom settings and adjustments can make the system control logo color change with different theme color schemes, meeting the personalized needs of users.
  • the preset color block area division method can be used for area division and color filling, and the pure color image can be divided into three , 4 or more color block areas, and then based on the pure color, generate a corresponding number of gradient colors to fill each divided color block area to generate a color block image.
  • the preset color block area division method can be carried out to divide the three color block areas, and then fill the three color block areas with gray with three different RGB values, so that the pure gray image will not appear Instead of monotonous solid colors, minimalist color block patterns can be presented.
  • the image processing method provided in the embodiment of the present application may be executed by an image processing device, or a control module in the image processing device for executing the image processing method.
  • the method for performing image processing by the image processing apparatus is taken as an example to describe the image processing device provided in the embodiment of the present application.
  • Fig. 5 is a schematic structural diagram of an image processing device provided in an embodiment of the present application, as shown in Fig. 5 , including:
  • the first dividing unit 510 is configured to obtain a pixel block image corresponding to the first image based on the first image divided according to a preset size and the RGB values of each pixel in the first image, wherein the pixel
  • the block image includes M pixel block sub-images, where M is a positive integer;
  • the second dividing unit 520 is configured to divide the pixel block image into K color block regions based on the first color parameters of each of the pixel block sub-images, wherein the first color parameters include hue and lightness, K is a positive integer, K ⁇ M;
  • the color filling unit 530 is configured to determine the fill color of each of the color block regions from the N fill colors corresponding to the pixel block image based on the RGB mean value of the color block region, and obtain a second image, wherein the The fill color is used to fill its corresponding color block area, and the N fill colors corresponding to the pixel block image are determined based on the preset color category, the RGB value of each of the pixel block sub-images and the second color parameter, the The second color parameter includes lightness and saturation, and N is a positive integer.
  • the device also includes:
  • the first determining unit is configured to determine a set of pixel block sub-images corresponding to each preset color category based on the RGB values of each of the pixel block sub-images and the RGB value interval corresponding to each of the preset color categories, wherein each The pixel block sub-image set includes one or more pixel block sub-images;
  • the second determining unit is configured to determine L target pixel block sub-image sets in each of the pixel block sub-image sets based on the number of pixel block sub-image sets in each of the pixel block sub-image sets, wherein L is a positive integer;
  • a third determining unit configured to determine a target pixel block sub-image in the target pixel block sub-image set based on a second color parameter of each pixel block sub-image in the target pixel block sub-image set;
  • a generating unit configured to generate N fill colors corresponding to the pixel block image based on each of the target pixel block sub-images.
  • the second dividing unit 520 is specifically further configured to:
  • the coloring unit 530 is also specifically used for:
  • the fill color corresponding to each color block area is determined based on the difference between the RGB mean value of each color block area and the RGB value of each of the fill colors.
  • the first dividing unit 510 is specifically further configured to:
  • a pixel block image corresponding to the first image is obtained.
  • the device also includes:
  • a first input unit configured to receive a first input from a user
  • the first response unit is configured to display T theme color identifications in response to the first input, wherein each of the theme color identifications corresponds to a theme color scheme, and the theme color scheme is based on the second Generated by the filling color of each color block area in the image, where T is a positive integer;
  • the second input unit is configured to receive a second input from the user on the target theme color identifier in the T theme color identifiers;
  • the second response unit is configured to adjust the color attribute of the system control identifier in the system interface according to the theme color scheme corresponding to the target theme color identifier in response to the second input.
  • the first image is divided into a plurality of pixel block sub-images to obtain a pixel block image corresponding to the first image, and based on each pixel in the pixel block image
  • the degree of difference in lightness or hue between the block sub-images divides the pixel block image into multiple color block areas, and at the same time, based on the RGB value and preset color category of each pixel block sub-image in the pixel block image, it is determined that multiple color blocks belong to the same category
  • the color pixel block sub-image set so as to determine the few types of color categories with a large distribution range in the pixel block image, and then according to the lightness and saturation of each pixel block sub-image corresponding to each type of color, determine the color used for each color block
  • the fill color for color filling in the area so as to generate the second image through these few fill colors that can represent the main color and color distribution of the first image.
  • the second image is only
  • the image processing apparatus in the embodiment of the present application may be a device, or may be a component, an integrated circuit, or a chip in a terminal.
  • the device may be a mobile electronic device or a non-mobile electronic device.
  • the mobile electronic device may be a mobile phone, a tablet computer, a notebook computer, a handheld computer, a vehicle electronic device, a wearable device, an ultra-mobile personal computer (ultra-mobile personal computer, UMPC), a netbook or a personal digital assistant (personal digital assistant).
  • non-mobile electronic devices can be servers, network attached storage (Network Attached Storage, NAS), personal computer (personal computer, PC), television (television, TV), teller machine or self-service machine, etc., this application Examples are not specifically limited.
  • Network Attached Storage NAS
  • personal computer personal computer, PC
  • television television
  • teller machine or self-service machine etc.
  • the image processing device in the embodiment of the present application may be a device with an operating system.
  • the operating system may be an Android (Android) operating system, an ios operating system, or other possible operating systems, which are not specifically limited in this embodiment of the present application.
  • the image processing apparatus provided in the embodiment of the present application can realize various processes realized by the method embodiments in FIG. 1 to FIG. 6 , and details are not repeated here to avoid repetition.
  • FIG. 6 is a schematic structural diagram of an electronic device provided by an embodiment of the present application.
  • the program or instruction that can run on the processor 601 when the program or instruction is executed by the processor 601, realizes the various processes of the above-mentioned image processing method embodiment, and can achieve the same technical effect, in order to avoid repetition, it is not described here Let me repeat.
  • the electronic devices in the embodiments of the present application include the above-mentioned mobile electronic devices and non-mobile electronic devices.
  • FIG. 7 is a schematic diagram of a hardware structure of an electronic device implementing an embodiment of the present application.
  • the electronic device 700 includes, but is not limited to: a radio frequency unit 701, a network module 702, an audio output unit 703, an input unit 704, a sensor 705, a display unit 706, a user input unit 707, an interface unit 708, a memory 709, and a processor 710, etc. part.
  • the electronic device 700 can also include a power supply (such as a battery) for supplying power to various components, and the power supply can be logically connected to the processor 710 through the power management system, so that the management of charging, discharging, and function can be realized through the power management system. Consumption management and other functions.
  • a power supply such as a battery
  • the structure of the electronic device shown in FIG. 7 does not constitute a limitation to the electronic device.
  • the electronic device may include more or fewer components than shown in the figure, or combine some components, or arrange different components, and details will not be repeated here. .
  • the processor 710 is configured to obtain a pixel block image corresponding to the first image based on the first image divided according to a preset size and the RGB values of each pixel in the first image, wherein the pixel block
  • the image includes M pixel block sub-images, where M is a positive integer;
  • the processor 710 is configured to divide the pixel block image into K color block regions based on the first color parameters of each of the pixel block sub-images, wherein the first color parameters include hue and lightness, and K is a positive integer , K ⁇ M;
  • the processor 710 is configured to determine the fill color of each of the color block regions from the N fill colors corresponding to the pixel block image based on the RGB mean value of the color block region, to obtain a second image, wherein the fill color For filling the corresponding color block area, the N filling colors corresponding to the pixel block image are determined based on the preset color category, the RGB value of each of the pixel block sub-images and the second color parameter, and the second Color parameters include lightness and saturation, and N is a positive integer.
  • the processor 710 is configured to determine a set of pixel block sub-images corresponding to each preset color category based on the RGB values of each of the pixel block sub-images and the RGB value range corresponding to each of the preset color categories, wherein each of the The set of pixel block sub-images includes one or more pixel block sub-images;
  • L target pixel block sub-image sets in each of the pixel block sub-image sets where L is a positive integer
  • the processor 710 is configured to determine color block dividing lines in the pixel block image based on the first color parameters of each of the pixel block sub-images in the pixel block image;
  • the processor 710 is configured to determine the fill color corresponding to each of the color block areas based on the difference between the RGB mean value of each of the color block areas and the RGB value of each of the fill colors.
  • the processor 710 is configured to determine M first sub-images based on the first image divided according to a preset size
  • a pixel block image corresponding to the first image is obtained.
  • the user input unit 707 is configured to receive a first input from the user
  • the display unit 706 is configured to display T theme color identifications in response to the first input, wherein each of the theme color identifications corresponds to a theme color scheme, and the theme color scheme is based on the theme in the second image Generated by the fill color of each color block area, where T is a positive integer;
  • the user input unit 707 is also configured to receive a second input from the user on the target theme color identifier in the T theme color identifiers;
  • the processor 710 is configured to, in response to the second input, adjust the color attribute of the system control logo in the system interface according to the theme color scheme corresponding to the target theme color logo.
  • the first image is divided into a plurality of pixel block sub-images to obtain a pixel block image corresponding to the first image, and based on each pixel in the pixel block image
  • the degree of difference in lightness or hue between the block sub-images divides the pixel block image into multiple color block areas, and at the same time, based on the RGB value and preset color category of each pixel block sub-image in the pixel block image, it is determined that multiple color blocks belong to the same category
  • the color pixel block sub-image set so as to determine the few types of color categories with a large distribution range in the pixel block image, and then according to the lightness and saturation of each pixel block sub-image corresponding to each type of color, determine the color used for each color block
  • the fill color for color filling in the area so as to generate the second image through these few fill colors that can represent the main color and color distribution of the first image.
  • the second image is only
  • the input unit 704 may include a graphics processor (Graphics Processing Unit, GPU) 7041 and a microphone 7042, and the graphics processor 7041 is used for the image capture device (such as the image data of the still picture or video obtained by the camera) for processing.
  • the display unit 706 may include a display panel 7061, and the display panel 7061 may be configured in the form of a liquid crystal display, an organic light emitting diode, or the like.
  • the user input unit 707 includes a touch panel 7071 and other input devices 7072 .
  • the touch panel 7071 is also called a touch screen.
  • the touch panel 7071 may include two parts, a touch detection device and a touch controller.
  • Other input devices 7072 may include, but are not limited to, physical keyboards, function keys (such as volume control buttons, switch buttons, etc.), trackballs, mice, and joysticks, which will not be described in detail here.
  • Memory 709 may be used to store software programs as well as various data, including but not limited to application programs and operating systems.
  • the processor 710 may integrate an application processor and a modem processor, wherein the application processor mainly processes an operating system, user interface, application program, etc., and the modem processor mainly processes wireless communication. It can be understood that the foregoing modem processor may not be integrated into the processor 710 .
  • the embodiment of the present application also provides a readable storage medium, the readable storage medium stores a program or an instruction, and when the program or instruction is executed by a processor, each process of the above-mentioned image processing method embodiment is realized, and can achieve the same To avoid repetition, the technical effects will not be repeated here.
  • the processor is the processor in the electronic device described in the above embodiments.
  • the readable storage medium includes computer readable storage medium, such as computer read-only memory (Read-Only Memory, ROM), random access memory (Random Access Memory, RAM), magnetic disk or optical disk, etc.
  • the embodiment of the present application further provides a chip, the chip includes a processor and a communication interface, the communication interface is coupled to the processor, and the processor is used to run programs or instructions to implement the above image processing method embodiment Each process can achieve the same technical effect, so in order to avoid repetition, it will not be repeated here.
  • chips mentioned in the embodiments of the present application may also be called system-on-chip, system-on-chip, system-on-a-chip, or system-on-a-chip.
  • the term “comprising”, “comprising” or any other variation thereof is intended to cover a non-exclusive inclusion such that a process, method, article or apparatus comprising a set of elements includes not only those elements, It also includes other elements not expressly listed, or elements inherent in the process, method, article, or device. Without further limitations, an element defined by the phrase “comprising a " does not preclude the presence of additional identical elements in the process, method, article, or apparatus comprising that element.
  • the scope of the methods and devices in the embodiments of the present application is not limited to performing functions in the order shown or discussed, and may also include performing functions in a substantially simultaneous manner or in reverse order according to the functions involved. Functions are performed, for example, the described methods may be performed in an order different from that described, and various steps may also be added, omitted, or combined. Additionally, features described with reference to certain examples may be combined in other examples.

Abstract

The present application discloses an image processing method and apparatus, an electronic device and a storage medium, and belongs to the field of image processing. The method comprises: on the basis of a first image divided according to a preset size and the RGB value of each pixel point in the first image, obtaining a pixel block image corresponding to the first image, the pixel block image comprising M pixel block sub-images, and M being a positive integer; dividing the pixel block image into K color block regions on the basis of first color parameters of each pixel block sub-image, the first color parameters comprising hue and brightness, K being a positive integer, and K≤M; and determining, on the basis of the RGB average value of the color block regions, a filling color of each color block region from among N filling colors corresponding to the pixel block image to obtain a second image, wherein the filling colors are used to fill a corresponding color block region thereof, the N filling colors corresponding to the pixel block image are determined on the basis of a preset color category, the RGB value of each pixel block sub-image and second color parameters, the second color parameters comprise brightness and saturation, and N is a positive integer.

Description

图像处理方法、装置、电子设备及存储介质Image processing method, device, electronic device and storage medium
相关申请的交叉引用Cross References to Related Applications
本申请要求于2021年09月24日提交的申请号为202111123949.7,发明名称为“图像处理方法、装置、电子设备及存储介质”的中国专利申请的优先权,其通过引用方式全部并入本申请。This application claims the priority of the Chinese patent application with the application number 202111123949.7 filed on September 24, 2021, and the title of the invention is "image processing method, device, electronic equipment and storage medium", which is fully incorporated by reference into this application .
技术领域technical field
本申请属于图像处理领域,具体涉及一种图像处理方法、装置、电子设备及存储介质。The present application belongs to the field of image processing, and in particular relates to an image processing method, device, electronic equipment and storage medium.
背景技术Background technique
随着图像处理技术的发展和用户对图像观感的追求,图像展现的元素越来越多元化,颜色也越来越丰富。With the development of image processing technology and users' pursuit of image perception, the elements displayed in images are becoming more and more diversified, and the colors are becoming more and more abundant.
然而,由于用户审美的差异性,用户对个性化图像的需求越来越高,现有的图像处理方式依然无法满足用户的个性化需求。However, due to the differences in user aesthetics, users have higher and higher demands for personalized images, and the existing image processing methods still cannot meet the personalized needs of users.
发明内容Contents of the invention
本申请实施例的目的是提供一种图像处理方法、装置、电子设备及存储介质,能够解决现有的图像处理方式无法满足用户的个性化需求的问题。The purpose of the embodiments of the present application is to provide an image processing method, device, electronic equipment, and storage medium, which can solve the problem that the existing image processing methods cannot meet the personalized needs of users.
第一方面,本申请实施例提供了一种图像处理方法,该方法包括:In the first aspect, the embodiment of the present application provides an image processing method, the method comprising:
基于按照预设尺寸划分后的第一图像和所述第一图像中各个像素点的RGB值,得到所述第一图像对应的像素块图像,其中,所述像素块图像包括M个像素块子图像,M为正整数;Based on the first image divided according to the preset size and the RGB values of each pixel in the first image, a pixel block image corresponding to the first image is obtained, wherein the pixel block image includes M pixel block sub- Image, M is a positive integer;
基于各个所述像素块子图像的第一颜色参数,将所述像素块图像划分为K个色块区域,其中,所述第一颜色参数包括色相和明度,K为正整数, K≤M;Divide the pixel block image into K color block regions based on the first color parameters of each of the pixel block sub-images, where the first color parameters include hue and lightness, K is a positive integer, K≤M;
基于所述色块区域的RGB均值,从所述像素块图像对应的N个填充色中确定各个所述色块区域的填充色,得到第二图像,其中,所述填充色用于填充其对应的色块区域,所述像素块图像对应的N个填充色是基于预设颜色类别、各个所述像素块子图像的RGB值和第二颜色参数确定的,所述第二颜色参数包括明度和饱和度,N为正整数。Based on the RGB mean value of the color block area, the fill color of each of the color block areas is determined from the N fill colors corresponding to the pixel block image to obtain a second image, wherein the fill color is used to fill its corresponding The color block area, the N filling colors corresponding to the pixel block image are determined based on the preset color category, the RGB value of each of the pixel block sub-images and the second color parameter, and the second color parameter includes lightness and Saturation, N is a positive integer.
第二方面,本申请实施例提供了一种图像处理装置,该装置包括:In a second aspect, an embodiment of the present application provides an image processing device, which includes:
第一划分单元,用于基于按照预设尺寸划分后的第一图像和所述第一图像中各个像素点的RGB值,得到所述第一图像对应的像素块图像,其中,所述像素块图像包括M个像素块子图像,M为正整数;The first dividing unit is configured to obtain a pixel block image corresponding to the first image based on the first image divided according to a preset size and the RGB values of each pixel in the first image, wherein the pixel block The image includes M pixel block sub-images, where M is a positive integer;
第二划分单元,用于基于各个所述像素块子图像的第一颜色参数,将所述像素块图像划分为K个色块区域,其中,所述第一颜色参数包括色相和明度,K为正整数,K≤M;The second dividing unit is configured to divide the pixel block image into K color block regions based on the first color parameters of each of the pixel block sub-images, wherein the first color parameters include hue and lightness, and K is Positive integer, K≤M;
填色单元,用于基于所述色块区域的RGB均值,从所述像素块图像对应的N个填充色中确定各个所述色块区域的填充色,得到第二图像,其中,所述填充色用于填充其对应的色块区域,所述像素块图像对应的N个填充色是基于预设颜色类别、各个所述像素块子图像的RGB值和第二颜色参数确定的,所述第二颜色参数包括明度和饱和度,N为正整数。A color filling unit, configured to determine the fill color of each of the color block regions from the N fill colors corresponding to the pixel block image based on the RGB mean value of the color block region, to obtain a second image, wherein the fill The color is used to fill its corresponding color block area, and the N filling colors corresponding to the pixel block image are determined based on the preset color category, the RGB value of each of the pixel block sub-images and the second color parameter, and the first Two color parameters include lightness and saturation, and N is a positive integer.
第三方面,本申请实施例提供了一种电子设备,该电子设备包括处理器、存储器及存储在所述存储器上并可在所述处理器上运行的程序或指令,所述程序或指令被所述处理器执行时实现如第一方面所述的方法的步骤。In a third aspect, an embodiment of the present application provides an electronic device, the electronic device includes a processor, a memory, and a program or instruction stored in the memory and operable on the processor, and the program or instruction is The processor implements the steps of the method described in the first aspect when executed.
第四方面,本申请实施例提供了一种可读存储介质,所述可读存储介质上存储程序或指令,所述程序或指令被处理器执行时实现如第一方面所述的方法的步骤。In a fourth aspect, an embodiment of the present application provides a readable storage medium, on which a program or an instruction is stored, and when the program or instruction is executed by a processor, the steps of the method described in the first aspect are implemented .
第五方面,本申请实施例提供了一种芯片,所述芯片包括处理器和通信接口,所述通信接口和所述处理器耦合,所述处理器用于运行程序或指令,实现如第一方面所述的方法。In the fifth aspect, the embodiment of the present application provides a chip, the chip includes a processor and a communication interface, the communication interface is coupled to the processor, and the processor is used to run programs or instructions, so as to implement the first aspect the method described.
在本申请实施例中,基于第一图像中各个像素点的RGB值,将第一图像划分为多个像素块子图像,得到第一图像对应的像素块图像,基于该像素块图像中各个像素块子图像之间明度或色相的差异程度,将像素块图像划分为多个色块区域,同时基于像素块图像中各个像素块子图像的RGB值和预设颜色类别,确定多个属于同一类颜色的像素块子图像集,从而确定像素块图像中分布范围大的少数几类颜色类别,进而根据每类颜色对应的各个像素块子图像的明度和饱和度,确定出用于对各个色块区域进行颜色填充的填充色,以通过这少数几种可以代表第一图像的主色调和颜色分布的填充色,来生成第二图像,此时第二图像只由几种纯色色块拼接而成,可以给用户一种色彩简单、醒目的极简化风格视觉效果,实现用户对图像进行个性化样式的设置,满足用户的个性化需求。In the embodiment of the present application, based on the RGB values of each pixel in the first image, the first image is divided into a plurality of pixel block sub-images to obtain a pixel block image corresponding to the first image, and based on each pixel in the pixel block image The degree of difference in lightness or hue between the block sub-images divides the pixel block image into multiple color block areas, and at the same time, based on the RGB value and preset color category of each pixel block sub-image in the pixel block image, it is determined that multiple color blocks belong to the same category The color pixel block sub-image set, so as to determine the few types of color categories with a large distribution range in the pixel block image, and then according to the lightness and saturation of each pixel block sub-image corresponding to each type of color, determine the color used for each color block The fill color for color filling in the area, so as to generate the second image through these few fill colors that can represent the main color and color distribution of the first image. At this time, the second image is only spliced by several solid color blocks , can give users a minimalist style visual effect with simple colors and eye-catching, realize the user's personalized style setting of the image, and meet the user's individual needs.
附图说明Description of drawings
图1是本申请实施例提供的图像处理方法的流程示意图;FIG. 1 is a schematic flow diagram of an image processing method provided in an embodiment of the present application;
图2是本申请实施例提供的图像处理方法生成的第二图像的示意图;2 is a schematic diagram of a second image generated by the image processing method provided in the embodiment of the present application;
图3是本申请实施例提供的划分色块区域的示意图;Fig. 3 is a schematic diagram of dividing the color block area provided by the embodiment of the present application;
图4是本申请实施例提供的主题色标识的显示示意图;Fig. 4 is a schematic display of the theme color logo provided by the embodiment of the present application;
图5是本申请实施例提供的图像处理装置的结构示意图;FIG. 5 is a schematic structural diagram of an image processing device provided in an embodiment of the present application;
图6是本申请实施例提供的电子设备的结构示意图;FIG. 6 is a schematic structural diagram of an electronic device provided by an embodiment of the present application;
图7为实现本申请实施例的电子设备的硬件结构示意图。FIG. 7 is a schematic diagram of a hardware structure of an electronic device implementing an embodiment of the present application.
具体实施方式Detailed ways
下面将结合本申请实施例中的附图,对本申请实施例中的技术方案进行清楚地描述,显然,所描述的实施例是本申请一部分实施例,而不是全部的实施例。基于本申请中的实施例,本领域普通技术人员获得的所有其他实施例,都属于本申请保护的范围。The following will clearly describe the technical solutions in the embodiments of the present application with reference to the drawings in the embodiments of the present application. Obviously, the described embodiments are part of the embodiments of the present application, but not all of them. All other embodiments obtained by persons of ordinary skill in the art based on the embodiments in this application belong to the protection scope of this application.
本申请的说明书和权利要求书中的术语“第一”、“第二”等是用于 区别类似的对象,而不用于描述特定的顺序或先后次序。应该理解这样使用的数据在适当情况下可以互换,以便本申请的实施例能够以除了在这里图示或描述的那些以外的顺序实施,且“第一”、“第二”等所区分的对象通常为一类,并不限定对象的个数,例如第一对象可以是一个,也可以是多个。此外,说明书以及权利要求中“和/或”表示所连接对象的至少其中之一,字符“/”,一般表示前后关联对象是一种“或”的关系。The terms "first", "second" and the like in the description and claims of the present application are used to distinguish similar objects, and are not used to describe a specific order or sequence. It should be understood that the terms so used are interchangeable under appropriate circumstances such that the embodiments of the application can be practiced in sequences other than those illustrated or described herein, and that references to "first," "second," etc. distinguish Objects are generally of one type, and the number of objects is not limited. For example, there may be one or more first objects. In addition, "and/or" in the specification and claims means at least one of the connected objects, and the character "/" generally means that the related objects are an "or" relationship.
下面结合附图,通过具体的实施例及其应用场景对本申请实施例提供的图像处理方法、装置、电子设备及存储介质进行详细地说明。The image processing method, device, electronic device, and storage medium provided by the embodiments of the present application will be described in detail below through specific embodiments and application scenarios with reference to the accompanying drawings.
下面结合附图,通过具体的实施例及其应用场景对本申请实施例提供的图像处理方法、装置、电子设备及存储介质进行详细地说明。The image processing method, device, electronic device, and storage medium provided by the embodiments of the present application will be described in detail below through specific embodiments and application scenarios with reference to the accompanying drawings.
图1是本申请实施例提供的图像处理方法的流程示意图,如图1所示,包括:Fig. 1 is a schematic flow chart of the image processing method provided by the embodiment of the present application, as shown in Fig. 1, including:
步骤101,基于按照预设尺寸划分后的第一图像和所述第一图像中各个像素点的RGB值,得到所述第一图像对应的像素块图像,其中,所述像素块图像包括M个像素块子图像,M为正整数;Step 101: Obtain a pixel block image corresponding to the first image based on the first image divided according to a preset size and the RGB values of each pixel in the first image, wherein the pixel block image includes M Pixel block sub-image, M is a positive integer;
具体地,本申请实施例中所描述的第一图像可以是电子设备内部存储的图像,也可以是电子设备从外部接收到的图像,其可以包括彩色图像、灰度图像和黑白图像,其具体可以是电子设备存储的系统主题中的图像或拍摄得到的图像,本申请在此不对其做具体限定。Specifically, the first image described in the embodiment of the present application may be an image stored inside the electronic device, or an image received by the electronic device from the outside, which may include color images, grayscale images, and black and white images, and specifically It may be an image in the system theme stored in the electronic device or a captured image, which is not specifically limited in this application.
本申请实施例中所描述的预设尺寸可以是预设限定的尺寸。按照预设尺寸划分后的第一图像,由M个预设尺寸的第一子图像构成。其中,M为正整数。The preset size described in the embodiment of the present application may be a preset defined size. The first image divided according to the preset size is composed of M first sub-images of the preset size. Wherein, M is a positive integer.
在本申请实施例中,电子设备可以为支持图像显示的任何终端设备,如手机、触屏电脑、掌上电脑、车载终端、可穿戴设备、PAD(Portable Android Device,平板电脑)等设备,本申请实施例在此不作具体限定。In this embodiment of the application, the electronic device can be any terminal device that supports image display, such as mobile phones, touch-screen computers, handheld computers, vehicle-mounted terminals, wearable devices, PAD (Portable Android Device, tablet computer) and other devices. The embodiments are not specifically limited here.
本申请实施例所描述的像素块子图像是通过对第一图像中每个第一子图像内像素点的RGB值进行平均值计算,将每个第一子图像内的所有 像素点调整为该平均值后得到的。The pixel block sub-image described in the embodiment of the present application calculates the average value of the RGB values of the pixels in each first sub-image in the first image, and adjusts all the pixels in each first sub-image to the obtained after the average.
本申请实施例所描述的像素块图像指的是将第一图像中M个第一子图像处理为像素块子图像后,由各个像素块子图像组成的图像,其中,像素块图像包括M个像素块子图像。The pixel block image described in the embodiment of the present application refers to an image composed of each pixel block sub-image after processing the M first sub-images in the first image into pixel block sub-images, wherein the pixel block image includes M Pixel block subimage.
步骤102,基于各个所述像素块子图像的第一颜色参数,将所述像素块图像划分为K个色块区域,其中,所述第一颜色参数包括色相和明度,K为正整数,K≤M; Step 102, based on the first color parameters of each of the pixel block sub-images, divide the pixel block image into K color block regions, wherein the first color parameters include hue and lightness, K is a positive integer, K ≤ M;
具体地,本申请实施例所描述的第一颜色参数包括色相和明度,其用于判断像素块图像中各个像素块子图像之间的颜色差异,以进行色块区域划分。Specifically, the first color parameter described in the embodiment of the present application includes hue and lightness, which are used to judge the color difference between sub-images of each pixel block in the pixel block image, so as to divide the color block area.
需要说明的是,为保证最终生成的色块图像的观感,在本申请的实施例中,划分的色块区域内至少包含两个像素块子图像。It should be noted that, in order to ensure the appearance of the finally generated color patch image, in the embodiment of the present application, at least two pixel block sub-images are included in the divided color patch area.
在本申请实施例中,由于用户通过色相和明度可以直观地感受出不同颜色之间的差别,因此可以选择根据像素块图像中各个像素块子图像的色相或明度,来判断出像素块图像中色相或明度存在明显变化的像素块子图像区域,即在该像素块子图像区域中相邻像素块子图像的色相或明度有着明显差异,相邻像素块子图像对应的颜色类别明显不同,进而对像素块图像中各处存在色相或明度差异的像素块子图像区域进行划分,从而可以得到K个色块区域。示例性地,K可以取值为5、7、10等,其具体根据实际第一图像中的颜色分布确定,本申请在此不对其做具体限定。In the embodiment of this application, since the user can intuitively feel the difference between different colors through the hue and lightness, it is possible to choose to judge the color of the pixel block image according to the hue or lightness of each pixel block sub-image in the pixel block image. A pixel block sub-image area with obvious changes in hue or lightness, that is, in the pixel block sub-image area, the hue or lightness of adjacent pixel block sub-images has obvious differences, and the color categories corresponding to adjacent pixel block sub-images are obviously different, and then Divide the sub-image regions of pixel blocks that have hue or lightness differences everywhere in the pixel block image, so that K color block regions can be obtained. Exemplarily, K may take a value of 5, 7, 10, etc., which is specifically determined according to the color distribution in the actual first image, and the present application does not specifically limit it here.
本申请实施例所描述的色块区域指的是基于各个像素块子图像之间第一颜色参数,对像素块图像进行色块划分而确定的区域。The color block area described in the embodiment of the present application refers to an area determined by dividing the pixel block image into color blocks based on the first color parameter among the sub-images of each pixel block.
步骤103,基于所述色块区域的RGB均值,从所述像素块图像对应的N个填充色中确定各个所述色块区域的填充色,得到第二图像,其中,所述填充色用于填充其对应的色块区域,所述像素块图像对应的N个填充色是基于预设颜色类别、各个所述像素块子图像的RGB值和第二颜色参数确定的,所述第二颜色参数包括明度和饱和度,N为正整数。 Step 103, based on the RGB mean value of the color block area, determine the fill color of each of the color block areas from the N fill colors corresponding to the pixel block image to obtain a second image, wherein the fill color is used for Filling its corresponding color block area, the N filling colors corresponding to the pixel block image are determined based on the preset color category, the RGB value of each of the pixel block sub-images and the second color parameter, and the second color parameter Including lightness and saturation, N is a positive integer.
具体地,在本申请实施例中,色块区域内的各个像素块子图像色彩相近,但也存在些许差异,为了确定出色块区域的主色调,可以通过计算色块区域内各个像素块子图像的RGB值的平均值来确定。Specifically, in the embodiment of the present application, the sub-images of each pixel block in the color block area are similar in color, but there are some differences. In order to determine the main color of the color block area, it is possible to calculate The average of the RGB values is determined.
本申请实施例所描述的色块区域的RGB均值是通过对色块区域内各个像素块子图像的RGB值进行平均值计算得到的。The RGB mean value of the color block area described in the embodiment of the present application is obtained by calculating the average value of the RGB values of each pixel block sub-image in the color block area.
本申请实施例所描述的预设颜色类别指的是本申请预先设置的颜色类别,例如,预设颜色类别可以为红、橙、黄、绿、青、蓝、紫、黑、白、灰10类颜色,每类颜色都存在一个对应的RGB值区域,通过各个颜色类别对应的RGB值区间和各个像素块子图像的RGB值,可以确定各个像素块子图像对应的颜色类别。The preset color category described in the embodiment of this application refers to the preset color category of this application, for example, the preset color category can be red, orange, yellow, green, blue, blue, purple, black, white, gray10 There is a corresponding RGB value area for each color category, and the color category corresponding to each pixel block sub-image can be determined through the RGB value range corresponding to each color category and the RGB value of each pixel block sub-image.
本申请实施例所描述的填充色指的是用于填充各个色块区域的颜色。The fill color described in the embodiment of the present application refers to the color used to fill each color block area.
本申请实施例所描述的第二图像指的是对像素块图像进行色块区域划分后,对各个色块区域填色后的色块图像。The second image described in the embodiment of the present application refers to the color block image obtained by dividing the pixel block image into color block regions and filling each color block region with color.
本申请实施例所描述的第二颜色参数包括明度或饱和度,其用于对从像素块图像中选出的具有主色调特征的像素块子图像颜色进行颜色扩展,以生成填充色。The second color parameter described in the embodiment of the present application includes lightness or saturation, which is used for color expansion of the sub-image color of the pixel block selected from the pixel block image and having the main tone feature, so as to generate a filling color.
本申请实施例所描述的所述像素块图像对应的N个填充色指的是可以表示像素块图像主色调和颜色分布的颜色,其是基于预设颜色类别、各个像素块子图像的RGB值和第二颜色参数确定的,其具体获取的方式可以是,通过图像中各个像素块子图像的RGB值以及预设颜色类别对应的RGB值,确定各个预设颜色类别在像素块图像中对应的像素块子图像,从而选出可以代表第一图像主色调和颜色分布的颜色类别,对这些颜色类别对应的像素块子图像进行明度或饱和度调整,从而得到像素块图像对应的N个填充色,其中,N为正整数。示例性地,N可以取值为4、6、12等,其具体根据实际计算需求确定,本申请在此不对其做具体限定。The N filling colors corresponding to the pixel block image described in the embodiment of this application refer to the colors that can represent the main color and color distribution of the pixel block image, which are based on the preset color category and the RGB value of each pixel block sub-image Determined with the second color parameter, its specific acquisition method can be, through the RGB value of each pixel block sub-image in the image and the RGB value corresponding to the preset color category, determine the corresponding value of each preset color category in the pixel block image Pixel block sub-images, so as to select the color categories that can represent the main hue and color distribution of the first image, and adjust the brightness or saturation of the pixel block sub-images corresponding to these color categories, so as to obtain N fill colors corresponding to the pixel block images , where N is a positive integer. Exemplarily, N may take a value of 4, 6, 12, etc., which is specifically determined according to actual computing requirements, and the present application does not specifically limit it here.
进一步地,根据色块区域的RGB均值和各个填充色的RGB值,可以从像素块图像对应的N个填充色中确定出用于对各个色块区域进行颜色 填充的填充色。Further, according to the RGB average value of the color patch area and the RGB value of each filling color, the filling color used to fill each color patch area can be determined from the N filling colors corresponding to the pixel block image.
在本申请实施例中,通过确定好各个色块区域的填充色后,将各个填充色填充到各自对应的色块区域中,由此可以得到色块图像,即第二图像。第二图像具有简约的色块风格,可以满足用户的个性化需求。In the embodiment of the present application, after determining the fill color of each color block area, filling each fill color into the corresponding color block area, thereby obtaining the color block image, that is, the second image. The second image has a simple color block style, which can meet the individual needs of users.
图2是本申请实施例提供的图像处理方法生成的第二图像的示意图,示例性地,如图2所示,第二图像为色块图像,包括3个色块区域,各个色块区域中的颜色均不相同,分别为蓝色、橙色和红色。Fig. 2 is a schematic diagram of a second image generated by the image processing method provided in the embodiment of the present application. Exemplarily, as shown in Fig. 2 , the second image is a color patch image, including 3 color patch areas, and in each color patch area The colors are all different, blue, orange and red.
在本申请实施例中,基于第一图像中各个像素点的RGB值,将第一图像划分为多个像素块子图像,得到第一图像对应的像素块图像,基于该像素块图像中各个像素块子图像之间明度或色相的差异程度,将像素块图像划分为多个色块区域,同时基于像素块图像中各个像素块子图像的RGB值和预设颜色类别,确定多个属于同一类颜色的像素块子图像集,从而确定像素块图像中分布范围大的少数几类颜色类别,进而根据每类颜色对应的各个像素块子图像的明度和饱和度,确定出用于对各个色块区域进行颜色填充的填充色,以通过这少数几种可以代表第一图像的主色调和颜色分布的填充色,来生成第二图像,此时第二图像只由几种纯色色块拼接而成,可以给用户一种色彩简单、醒目的极简化风格视觉效果,实现用户对图像进行个性化样式的设置,满足用户的个性化需求。In the embodiment of the present application, based on the RGB values of each pixel in the first image, the first image is divided into a plurality of pixel block sub-images to obtain a pixel block image corresponding to the first image, and based on each pixel in the pixel block image The degree of difference in lightness or hue between the block sub-images divides the pixel block image into multiple color block areas, and at the same time, based on the RGB value and preset color category of each pixel block sub-image in the pixel block image, it is determined that multiple color blocks belong to the same category The color pixel block sub-image set, so as to determine the few types of color categories with a large distribution range in the pixel block image, and then according to the lightness and saturation of each pixel block sub-image corresponding to each type of color, determine the color used for each color block The fill color for color filling in the area, so as to generate the second image through these few fill colors that can represent the main color and color distribution of the first image. At this time, the second image is only spliced by several solid color blocks , can give users a minimalist style visual effect with simple colors and eye-catching, realize the user's personalized style setting of the image, and meet the user's individual needs.
可选地,在所述从所述像素块图像对应的N个填充色中确定各个所述色块区域的填充色之前,还包括:Optionally, before determining the fill color of each of the color block regions from the N fill colors corresponding to the pixel block image, the method further includes:
基于各个所述像素块子图像的RGB值和各个所述预设颜色类别对应的RGB值区间,确定各个预设颜色类别对应的像素块子图像集,其中,每个所述像素块子图像集中包括一个或多个像素块子图像;Based on the RGB value of each of the pixel block sub-images and the RGB value interval corresponding to each of the preset color categories, determine the pixel block sub-image set corresponding to each preset color category, wherein each of the pixel block sub-image sets comprising one or more pixel block sub-images;
基于各个所述像素块子图像集中像素块子图像的数量,确定各个所述像素块子图像集中的L个目标像素块子图像集,其中,L为正整数;Based on the number of pixel block sub-images in each of the pixel block sub-image sets, determine L target pixel block sub-image sets in each of the pixel block sub-image sets, where L is a positive integer;
基于所述目标像素块子图像集中各个像素块子图像的第二颜色参数,确定所述目标像素块子图像集中的目标像素块子图像;determining a target pixel block sub-image in the target pixel block sub-image set based on a second color parameter of each pixel block sub-image in the target pixel block sub-image set;
基于各个所述目标像素块子图像,生成所述像素块图像对应的N个填充色。Based on each sub-image of the target pixel block, generate N filling colors corresponding to the pixel block image.
具体地,本申请实施例中,通过将各个像素块子图像的RGB值与各个预设颜色类别对应的RGB值区间进行比对,将像素块图像中的各个像素块子图像进行颜色归类,确定各个像素块子图像对应的预设颜色类别,以便后续确定出可以代表第一图像主色调和颜色分布的像素块子图像。Specifically, in the embodiment of the present application, by comparing the RGB value of each pixel block sub-image with the RGB value interval corresponding to each preset color category, each pixel block sub-image in the pixel block image is color-categorized, The preset color category corresponding to each pixel block sub-image is determined, so as to subsequently determine the pixel block sub-image that can represent the main tone and color distribution of the first image.
本申请实施例所描述的像素块子图像集指的是属于同一颜色类别的像素块子图像组成的集合,其可以包括一个或多个像素块子图像。The pixel block sub-image set described in the embodiment of the present application refers to a set of pixel block sub-images belonging to the same color category, which may include one or more pixel block sub-images.
本申请实施例所描述的目标像素块子图像集指的是从各个像素块子图像集中选出的L个像素块子图像集,其中,目标像素块子图像集所对应的颜色类别可以代表第一图像的主色调和颜色分布,L为正整数。示例性地,L可以为4、5、7等,其具体根据实际计算确定,本申请在此不对其做具体限定。The target pixel block sub-image set described in the embodiment of the present application refers to L pixel block sub-image sets selected from each pixel block sub-image set, wherein the color category corresponding to the target pixel block sub-image set can represent the first pixel block sub-image set The main tone and color distribution of an image, L is a positive integer. Exemplarily, L may be 4, 5, 7, etc., which are specifically determined according to actual calculations, and the present application does not specifically limit it here.
本申请实施例中,通过判定像素块子图像集中的各个像素块子图像的数量,可以确定各个像素块子图像集对应的预设颜色类别在像素块图像中的分布范围,例如,颜色类别为红色对应的像素块子图像集中的像素块子图像的数量最多,说明红色在像素块图像中的颜色分布范围最大;颜色类别为黄色对应的像素块子图像集中的像素块子图像的数量最少,说明黄色在像素块图像中的颜色分布范围最小。In the embodiment of the present application, by determining the number of each pixel block sub-image set in the pixel block sub-image set, the distribution range of the preset color category corresponding to each pixel block sub-image set in the pixel block image can be determined. For example, the color category is The number of pixel block sub-images in the pixel block sub-image set corresponding to red is the largest, indicating that the color distribution range of red in the pixel block image is the largest; the color category is the pixel block sub-image set corresponding to yellow. The number of pixel block sub-images is the least, It shows that the color distribution range of yellow in the pixel block image is the smallest.
进一步地,基于各个像素块子图像集中的像素块子图像的数量,按照由多至少进行排序,筛选出像素块子图像的数量较多的前几个像素块子图像集,从而确定出可以代表第一图像的主色调和颜色分布的多个像素块子图像集,得到各个目标像素块子图像集。Further, based on the number of pixel block sub-images in each pixel block sub-image set, sort them from most to least, and filter out the first few pixel block sub-image sets with a large number of pixel block sub-images, so as to determine the representative A plurality of pixel block sub-image sets of the main tone and color distribution of the first image are obtained to obtain each target pixel block sub-image set.
本申请实施例所描述的目标像素块子图像指的是基于目标像素块子图像集中各个像素块子图像的第二颜色参数,即明度和饱和度,来确定的,其可以代表同一预设颜色类别中颜色参数最为均衡的颜色。The target pixel block sub-image described in the embodiment of the present application refers to the second color parameter of each pixel block sub-image in the target pixel block sub-image set, that is, lightness and saturation, which can represent the same preset color The color with the most balanced color parameters in the category.
可选地,在本申请的实施例中,通过将目标像素块子图像集中的各个 像素块子图像进行明度和饱和度排序,例如,对各个像素块子图像的颜色按照由暗至亮、由灰至纯的规则进行排序,然后从排序后的各个像素块子图像中,选取处于中心位置的像素块子图像,将该中心位置的像素块子图像作为目标像素块子图像而得到的。可以理解的是,在L个像素块子图像集中,可以确定出L个目标像素块子图像。Optionally, in this embodiment of the present application, by sorting the brightness and saturation of each pixel block sub-image in the target pixel block sub-image set, for example, the colors of each pixel block sub-image are sorted from dark to bright, by It is obtained by sorting according to the rule of gray to pure, and then selecting the pixel block sub-image at the center position from the sorted pixel block sub-images, and using the pixel block sub-image at the center position as the target pixel block sub-image. It can be understood that, in the set of L pixel block sub-images, L target pixel block sub-images may be determined.
在本申请实施例中,为了使最终生成的填充色的色彩鲜艳程度更均衡,保证颜色纯度,还可以在选取出上述中心位置的像素块子图像后,对该像素块子图像进行饱和度预处理,以控制该像素块子图像的颜色的饱和度处于固定的预设饱和度区间内,得到目标像素块子图像。In the embodiment of the present application, in order to make the color of the final fill color more balanced and ensure the color purity, after selecting the sub-image of the pixel block at the center position above, the saturation pre-saturation of the sub-image of the pixel block can be performed. processing to control the color saturation of the sub-image of the pixel block to be within a fixed preset saturation range to obtain the sub-image of the target pixel block.
可选地,可以选择预设饱和度区间为(10~50),若选取出的上述中心位置像素块子图像的颜色的饱和度超出预设饱和度区间,即在该像素块子图像的颜色的饱和度小于区间阈值10时,则将该像素块子图像的颜色的饱和度调整为10,从而将调整后的该像素块子图像作为目标像素块子图像;在该像素块子图像的颜色的饱和度大于区间阈值50时,则将该像素块子图像的颜色的饱和度调整为50,从而将调整后的该像素块子图像作为目标像素块子图像。Optionally, the preset saturation range can be selected as (10-50). If the color saturation of the selected pixel block sub-image at the center position exceeds the preset saturation range, that is, the color saturation of the pixel block sub-image When the saturation of the pixel block sub-image is less than the interval threshold 10, the saturation of the color of the pixel block sub-image is adjusted to 10, so that the adjusted pixel block sub-image is used as the target pixel block sub-image; When the saturation of is greater than the interval threshold 50, the saturation of the color of the pixel block sub-image is adjusted to 50, so that the adjusted pixel block sub-image is used as the target pixel block sub-image.
进一步地,在得到各个目标像素块子图像后,可以以各个目标像素块子图像为基准,对各个目标像素块子图像的明度或饱和度进行调整,将各个目标像素块子图像扩展为N个颜色。Further, after each target pixel block sub-image is obtained, the lightness or saturation of each target pixel block sub-image can be adjusted based on each target pixel block sub-image, and each target pixel block sub-image can be expanded into N color.
可选地,可以将各个目标像素块子图像的明度加10或减10,将目标像素块子图像的颜色扩展为3个颜色,由此,L个目标像素块子图像对应的L个颜色,通过上述的明度调整可以得到3L个颜色,将该3L个颜色作为最终的填充色,此时,N=3L;同样地,也可以将各个目标像素块子图像的饱和度加10或减10,将各个目标像素块子图像的饱和度加20或减20,使目标像素块子图像的颜色扩展为5个颜色,由此,L个目标像素块子图像对应的L个颜色,可以通过上述饱和度调整得到5L个颜色,将该5L个颜色作为最终的填充色,此时,N=5L。Optionally, the lightness of each target pixel block sub-image can be added or subtracted by 10, and the color of the target pixel block sub-image can be extended to 3 colors, thus, the L colors corresponding to the L target pixel block sub-images, Through the above lightness adjustment, 3L colors can be obtained, and the 3L colors can be used as the final fill color. At this time, N=3L; similarly, the saturation of each target pixel block sub-image can also be added or subtracted by 10, Add 20 or subtract 20 to the saturation of each target pixel block sub-image, so that the color of the target pixel block sub-image is expanded to 5 colors, thus, the L colors corresponding to the L target pixel block sub-images can pass the saturation Adjust the degree to obtain 5L colors, and use the 5L colors as the final fill color. At this time, N=5L.
在本申请实施例中,通过基于各个像素块子图像的RGB值和各个预设颜色类别对应的RGB值区间,对各个像素块子图像的颜色进行归类,得到各个预设颜色类别对应的像素块子图像集,以确定出像素块图像中颜色分布范围较大的多个像素块子图像集,进而从这些像素块子图像集中确定出可以代表第一图像的主色调和颜色分布的目标像素块子图像,从而基于目标像素块子图像来生成像素块图像对应的多个填充色,使各个填充色仍然可以保持像素块图像的主色调和颜色分布。In the embodiment of the present application, the color of each pixel block sub-image is classified based on the RGB value of each pixel block sub-image and the RGB value interval corresponding to each preset color category, and the pixel corresponding to each preset color category is obtained. Block sub-image sets to determine multiple pixel block sub-image sets with a large color distribution range in the pixel block image, and then determine the target pixels that can represent the main tone and color distribution of the first image from these pixel block sub-image sets A block sub-image, so as to generate multiple fill colors corresponding to the pixel block image based on the target pixel block sub-image, so that each fill color can still maintain the main tone and color distribution of the pixel block image.
可选地,所述基于各个所述像素块子图像的第一颜色参数,将所述像素块图像划分为K个色块区域,包括:Optionally, the dividing the pixel block image into K color block regions based on the first color parameters of each of the pixel block sub-images includes:
基于所述像素块图像中各个所述像素块子图像的第一颜色参数,确定所述像素块图像中的色块划分线;Based on the first color parameters of each of the pixel block sub-images in the pixel block image, determine the color block division lines in the pixel block image;
根据所述色块划分线,将所述像素块图像划分为K个色块区域。Divide the pixel block image into K color block regions according to the color block dividing line.
具体地,在本申请实施例中,结合图像显示的颜色分布区域化特征,可以基于像素块图像中各个像素块子图像的第一颜色参数即色相或明度,识别出像素块图像中的各个颜色分布区域,确定像素块图像中的各个色块划分线,其中,色块划分线可以为一条或多条。Specifically, in the embodiment of the present application, in combination with the color distribution regionalization feature of image display, each color in the pixel block image can be identified based on the first color parameter of each pixel block sub-image in the pixel block image, that is, hue or lightness The distribution area is to determine each color block dividing line in the pixel block image, where there may be one or more color block dividing lines.
本申请实施例所描述的色块划分线是基于像素块图像中各个像素块子图像的色相或明度生成的,在像素块图像中色相或明度存在连续明显变化的像素块子图像之间生成色块划分线。The color block dividing line described in the embodiment of this application is generated based on the hue or lightness of each pixel block sub-image in the pixel block image, and the color is generated between the pixel block sub-images in which the hue or lightness of the pixel block image has continuous and obvious changes. Block dividing line.
图3是本申请实施例提供的划分色块区域的示意图,如图3所示,通过像素块图像中各个像素块子图像的色相或明度,对像素块图像进行划分,得到3个色块区域。Fig. 3 is a schematic diagram of dividing the color block area provided by the embodiment of the present application. As shown in Fig. 3, the pixel block image is divided by the hue or lightness of each pixel block sub-image in the pixel block image to obtain three color block areas .
在本申请实施例中,通过确定像素块图像中的色块划分线,将像素块图像中存在明显明度或色相差异的像素块子图像区域之间进行划分,以得到K个色块区域。In the embodiment of the present application, by determining the dividing line of the color block in the pixel block image, the sub-image regions of the pixel block with obvious brightness or hue differences in the pixel block image are divided to obtain K color block areas.
可选地,选取像素块图像中任一顶角处的点为原点,建立X-Y轴平面坐标系,以原点所在像素块子图像为起点,先沿X轴方向,再从原点出发 沿Y轴方向,逐一识别各个像素块子图像的色相或明度,确定出色相或明度接近的像素块子图像区域,当与该像素块子图像区域相邻像素块子图像区域出现连续明显的色相或明度差异时,例如,相邻像素块子图像区域属于不同的预设颜色类别,确定出该相邻像素块子图像区域之间的色块划分线,从而确定出像素块图像中各个存在明显差异的相邻像素块子图像区域之间的色块划分线,最终划分得到K个色块区域,其中,每个色块区域的尺寸必须超过2个像素块。Optionally, select a point at any corner of the pixel block image as the origin, establish an X-Y axis plane coordinate system, start from the sub-image of the pixel block where the origin is located, first along the X-axis direction, and then start from the origin along the Y-axis direction , identify the hue or lightness of each pixel block sub-image one by one, determine the pixel block sub-image area with close hue or lightness, when there is a continuous and obvious difference in hue or lightness in the pixel block sub-image area adjacent to the pixel block sub-image area , for example, the adjacent pixel block sub-image areas belong to different preset color categories, and the color block dividing line between the adjacent pixel block sub-image areas is determined, so as to determine the adjacent pixel block images with obvious differences The color block division lines between the pixel block sub-image areas are finally divided into K color block areas, wherein the size of each color block area must exceed 2 pixel blocks.
可选地,选取像素块图像中心位置的任一像素块子图像为起点,以该像素块子图像为圆心,进行扩散式识别该像素子图像周围的像素块子图像之间的色相或明度,确定出色相或明度接近的像素块子图像区域,当与该像素块子图像区域相邻像素块子图像区域出现连续明显的色相或明度差异时,确定出该相邻像素块子图像区域之间的色块划分线,从而确定出像素块图像中各个存在明显差异的相邻像素块子图像区域之间的色块划分线,最终划分得到K个色块区域。Optionally, select any pixel block sub-image at the center of the pixel block image as the starting point, take the pixel block sub-image as the center of the circle, and carry out diffuse recognition of the hue or lightness between the pixel block sub-images around the pixel block image, Determine the pixel block sub-image area with similar hue or lightness, and when there is a continuous and obvious difference in hue or lightness between the adjacent pixel block sub-image areas of the pixel block sub-image area, determine the difference between the adjacent pixel block sub-image areas The color block division lines of the pixel block image are determined to determine the color block division lines between the adjacent pixel block sub-image areas with obvious differences in the pixel block image, and K color block areas are finally divided.
在本申请实施例中,基于图像显示的颜色分布区域化特征,通过识别像素块图像中各个像素块子图像的色相或明度,识别出像素块图像中的各个颜色分布区域,确定像素块图像中的色块划分线,进而根据各个色块划分线,将像素块图像划分为多个色块区域,以确定出第一图像中的主体颜色分布情况,有利于后续色块区域进行颜色填充后可以保持第一图像的原始色调风格。In the embodiment of the present application, based on the regionalization feature of the color distribution displayed in the image, by identifying the hue or lightness of each pixel block sub-image in the pixel block image, each color distribution area in the pixel block image is identified, and the color distribution area in the pixel block image is determined. The color block dividing line, and then divide the pixel block image into multiple color block areas according to each color block dividing line, so as to determine the main color distribution in the first image, which is beneficial to the color filling of the subsequent color block areas. Keep the original tonal style of the first image.
可选地,所述基于所述色块区域的RGB均值,从所述像素块图像对应的N个填充色中确定各个所述色块区域的填充色,包括:Optionally, determining the fill color of each of the color block regions from the N fill colors corresponding to the pixel block image based on the RGB mean value of the color block region includes:
基于每个所述色块区域的RGB均值和各个所述填充色的RGB值之间的差值,确定各个所述色块区域对应的填充色。The fill color corresponding to each color block area is determined based on the difference between the RGB mean value of each color block area and the RGB value of each of the fill colors.
具体地,在本申请实施例中,在像素块划分出色块区域和填充色之后,需要确定各个色块区域对应的填充色,以对各个色块区域进行重新填色。为保持各个色块区域的主体色调不变,可以通过计算每个色块区域中所有 像素点的RGB值的平均值,获取每个色块区域的RGB均值来实现。Specifically, in the embodiment of the present application, after the pixel block is divided into the color block area and the fill color, it is necessary to determine the fill color corresponding to each color block area, so as to refill each color block area. In order to keep the main body tone of each color patch area unchanged, it can be realized by calculating the average value of the RGB values of all pixels in each color patch area and obtaining the RGB mean value of each color patch area.
进一步地,可以计算每个色块区域的RGB均值和各个填充色的RGB值之间的差值,确定该差值最小时对应的填充色,即该填充色与色块区域的主体色调最为接近,从而将该填充色作为填充该色块区域的颜色。由此,可以确定出各个色块区域对应的填充色。Further, the difference between the RGB mean value of each color patch area and the RGB value of each fill color can be calculated, and the corresponding fill color when the difference is the smallest is determined, that is, the fill color is closest to the main color of the color patch area , so that the fill color is used as the color that fills the patch area. Thus, the fill color corresponding to each color block area can be determined.
可选地,在对各个色块区域进行颜色填充时,可以优先填充与色块区域颜色接近的填充色中目标像素块子图像对应的填充色。Optionally, when color filling is performed on each color block area, the fill color corresponding to the target pixel block sub-image among the fill colors close to the color block area may be preferentially filled.
可选地,在对色块区域进行颜色填充时,先识别色块区域内各个像素块子图像所属的预设颜色种类,根据该预设颜色种类与其他所有属于同一预设颜色类别的色块区域进行比较,若该色块区域颜色明度更低,则从各个填充色中选择颜色相近且偏暗的填充色填充,若该色块区域颜色明度更高,则从各个填充色中选择颜色相近且更亮的填充色进行填充。Optionally, when color filling the color block area, first identify the preset color category to which each pixel block sub-image in the color block area belongs, and compare the preset color category with all other color blocks belonging to the same preset color category If the color lightness of the color block area is lower, select a fill color with a similar color and a darker color from each fill color; if the color lightness of the color block area is higher, select a similar color from each fill color And fill with a brighter fill color.
在本申请实施例中,通过计算每个所述色块区域的RGB均值和各个填充色的RGB值之间的差值,从各个填充色中,确定出与各个色块区域的主色调最为接近的填充色,从而可以确定出各个色块区域对应的填充色,使得色块区域进行颜色填充后依然保持第一图像的原始色调风格。In the embodiment of the present application, by calculating the difference between the RGB mean value of each color patch area and the RGB value of each fill color, from each fill color, determine the color that is closest to the main color of each color patch area fill color, so that the fill color corresponding to each color block area can be determined, so that the color block area still maintains the original tone style of the first image after color filling.
可选地,所述基于按照预设尺寸划分后的第一图像和所述第一图像中各个像素点的RGB值,得到所述第一图像对应的像素块图像,包括:Optionally, the obtaining the pixel block image corresponding to the first image based on the first image divided according to the preset size and the RGB values of each pixel in the first image includes:
基于按照预设尺寸划分后的第一图像,确定M个第一子图像;Determine M first sub-images based on the first image divided according to the preset size;
基于所述第一子图像的RGB均值,得到所述第一子图像对应的像素块子图像;Obtaining a pixel block sub-image corresponding to the first sub-image based on the RGB mean value of the first sub-image;
基于各个所述第一子图像对应的像素块子图像,得到所述第一图像对应的像素块图像。Based on the pixel block sub-images corresponding to each of the first sub-images, a pixel block image corresponding to the first image is obtained.
具体地,在本申请实施例中,按照预设尺寸对第一图像进行划分后,可以得到M个第一子图像,其中,M为正整数,M表示对第一图像按照预设尺寸划分后得到的第一子图像的数目,M可以取值为20、40、50等,其具体根据实际计算需求确定,本申请在此不对其做具体限定。Specifically, in the embodiment of the present application, after dividing the first image according to the preset size, M first sub-images can be obtained, where M is a positive integer, and M means that after dividing the first image according to the preset size The number of obtained first sub-images, M, can be 20, 40, 50, etc., which is specifically determined according to actual computing requirements, and the present application does not specifically limit it here.
可选地,以像素点为单位,第一图像的图像尺寸为300×500,即第一图像的长度为300个像素点,宽度为500个像素点,则可以选择15×25的预设尺寸即长度为15个像素点和宽度为25个像素点的预设尺寸,对第一图像进行划分,得到20个第一子图像;也可以选择6×10的预设尺寸即长度为6个像素点和宽度为10个像素点的预设尺寸对第一图像进行划分,得到50个第一子图像。Optionally, in units of pixels, the image size of the first image is 300×500, that is, the length of the first image is 300 pixels and the width is 500 pixels, then a preset size of 15×25 can be selected That is, the length is 15 pixels and the width is the preset size of 25 pixels, and the first image is divided to obtain 20 first sub-images; you can also choose the preset size of 6×10, that is, the length is 6 pixels The first image is divided into 50 first sub-images by dividing the first image with a preset size whose width is 10 pixels.
本申请实施例所描述的第一子图像的RGB均值是通过对第一子图像中各个像素点的RGB值进行平均值计算得到的。The RGB average value of the first sub-image described in the embodiment of the present application is obtained by calculating the average value of the RGB values of each pixel in the first sub-image.
通过第一子图像的RGB均值,将该第一子图像中的各个像素点均调整为同一平均值,从而得到该第一子图像对应的像素块子图像。By using the RGB average value of the first sub-image, each pixel in the first sub-image is adjusted to the same average value, so as to obtain a pixel block sub-image corresponding to the first sub-image.
进一步地,在得到各个第一子图像对应的像素块子图像后,即可以得到第一图像对应的像素块图像。Further, after the pixel block sub-image corresponding to each first sub-image is obtained, the pixel block image corresponding to the first image can be obtained.
在本申请实施例中,通过按照预设尺寸划分后的第一图像,得到多个第一子图像,基于计算第一子图像的RGB均值,对各个第一子图像进行像素化,从而得到第一图像对应的像素块图像,可以使生成的像素块图像仍热保持有第一图像的主色调和颜色分布。In the embodiment of the present application, a plurality of first sub-images are obtained by dividing the first image according to a preset size, based on calculating the RGB mean value of the first sub-image, each first sub-image is pixelated, thereby obtaining the first sub-image The pixel block image corresponding to an image can make the generated pixel block image still maintain the main tone and color distribution of the first image.
可选地,在所述从所述像素块图像对应的N个填充色中确定各个所述色块区域的填充色,得到第二图像之后,还包括:Optionally, after determining the fill color of each of the color block regions from the N fill colors corresponding to the pixel block image to obtain the second image, the method further includes:
接收用户的第一输入;receiving a first input from the user;
响应于所述第一输入,显示T个主题色标识,其中,每个所述主题色标识对应一个主题调色方案,所述主题调色方案是基于所述第二图像中各个色块区域的填充色生成的,其中,T为正整数;In response to the first input, display T theme color identifications, wherein each of the theme color identifications corresponds to a theme color scheme, and the theme color scheme is based on each color patch area in the second image Generated by fill color, where T is a positive integer;
接收用户对所述T个主题色标识中目标主题色标识的第二输入;receiving a second input from the user on the target theme color identifier in the T theme color identifiers;
响应于所述第二输入,根据所述目标主题色标识对应的主题调色方案,调整系统界面内系统控件标识的颜色属性。In response to the second input, adjust the color attribute of the system control identifier in the system interface according to the theme color scheme corresponding to the target theme color identifier.
具体地,本申请实施例所描述的系统控件标识具体可以是电子设备系统中的系统组件、系统模块、桌面组件、应用程序和锁屏等的图像标识, 其中,系统组件包括复选、单选、框选、进度条、音量条、提示点、按键、索引、文本框选等电子设备系统的组成控件;系统模块包括控制中心、通知中心、系统设置、闹钟、计算器、指南针、录音机等应用程序的设置界面;系统应用程序具体可以是电子设备自带应用程序,也可以是电子设备从外部下载安装的应用程序。Specifically, the system control identifiers described in the embodiments of the present application may specifically be image identifiers of system components, system modules, desktop components, applications, lock screens, etc. in the electronic device system, where the system components include multiple selection, single selection , box selection, progress bar, volume bar, cue point, button, index, text box selection and other electronic equipment system components; system modules include control center, notification center, system settings, alarm clock, calculator, compass, tape recorder and other applications The setting interface of the program; the system application program may specifically be an application program that comes with the electronic device, or an application program that the electronic device downloads and installs from outside.
本申请实施例所描述的主题调色方案指的是用于对系统界面内的系统控件的颜色参数进行调整的方案,其具体可以是根据第二图像中各个色块区域的填充色确定的调色方案。可选地,第二图像中各个色块区域的填充色可以有红、黄、蓝、绿、紫5种颜色,可以根据这5种颜色选出多个3种颜色组合,如红、黄、蓝为一组组合,黄、蓝、绿为一组组合,黄、蓝、紫为一组组合,由此可以确定3种主题调色方案,即以红、黄、蓝为主题色的主题调色方案,以黄、蓝、绿为主题色的主题调色方案,以黄、蓝、紫为主题色的主题调色方案。The theme color scheme described in the embodiment of this application refers to the scheme used to adjust the color parameters of the system controls in the system interface, which can be specifically determined according to the fill color of each color block area in the second image. color scheme. Optionally, the fill color of each color block area in the second image can have five colors of red, yellow, blue, green, and purple, and a plurality of three color combinations can be selected according to these five colors, such as red, yellow, Blue is a group of combinations, yellow, blue, and green are a group of combinations, and yellow, blue, and purple are a group of combinations. From this, three theme color schemes can be determined, that is, the theme tone with red, yellow, and blue as the theme colors. Color scheme, theme color scheme with yellow, blue, and green as theme colors, theme color scheme with yellow, blue, and purple as theme colors.
本申请实施例所描述的第一输入指的是用于基于第二图像中各个色块区域的填充色生成主题调色方案的操作,第一输入可以是用户对第二图像操作的输入,其具体可以是单击操作、双击操作或长按操作等。The first input described in the embodiment of this application refers to the operation for generating a theme color scheme based on the fill color of each color block area in the second image. The first input may be the user's input to the second image operation, which Specifically, it may be a single-click operation, a double-click operation, or a long-press operation, and the like.
本申请实施例所描述的主题色标识指的是与主题调色方案对应的主题色图像标识,每一个主题色标识对应有一种主题调色方案。The theme color logo described in this embodiment of the application refers to the theme color image logo corresponding to the theme color scheme, and each theme color logo corresponds to a theme color scheme.
可选地,第二图像中各个色块区域的填充色可以有红、黄、蓝、绿、紫、白6种颜色,可以设定根据这6种颜色选出4个3种颜色组合,如红、黄、白为一组组合,黄、绿、白为一组组合,蓝、紫、白为一组组合,红、蓝、白为一组组合,由此可以确定4种主题调色方案,即以红、黄、白为主题色的主题调色方案,以黄、绿、白为主题色的主题调色方案,以蓝、紫、白为主题色的主题调色方案,以红、蓝、白为主题色的主题调色方案,由此,根据该4种主题调色方案,可以对应有4种主题色标识。Optionally, the fill color of each color block area in the second image can have 6 colors of red, yellow, blue, green, purple, and white, and it can be set to select 4 combinations of 3 colors based on these 6 colors, such as Red, yellow, and white are a group combination, yellow, green, and white are a group combination, blue, purple, and white are a group combination, and red, blue, and white are a group combination, so four theme color schemes can be determined , that is, the theme color scheme with red, yellow, and white as the theme colors, the theme color scheme with yellow, green, and white as the theme colors, the theme color scheme with blue, purple, and white as the theme colors, and the theme color scheme with red, green, and white as the theme colors. The theme color scheme of blue and white as the theme colors. Therefore, according to the four theme color schemes, there can be four theme color identifications.
进一步地,电子设备在接收用户的第一输入后,会响应于该第一输入,显示T个主题色标识,其中,T为正整数。Further, after receiving the first input from the user, the electronic device will display T theme color logos in response to the first input, where T is a positive integer.
图4是本申请实施例提供的主题色标识的显示示意图,如图4所示,显示有6种主题色标识,分别为第一主题色标识41,其对应的是以红、橙、白为主题色的主题调色方案;第二主题色标识42,其对应的是以橙、绿、白为主题色的主题调色方案;第三主题色标识43,其对应的是以蓝、紫、白为主题色的主题调色方案;第四主题色标识44,其对应的是以红、蓝、白为主题色的主题调色方案;第五主题色标识45,其对应的是以橙、蓝、白为主题色的主题调色方案;第六主题色标识46,其对应的是以蓝、绿、白为主题色的主题调色方案。Fig. 4 is a schematic display diagram of the theme color logo provided by the embodiment of the present application. As shown in Fig. 4, there are 6 kinds of theme color logos displayed, which are respectively the first theme color logo 41, which correspond to red, orange, and white. The theme color scheme of theme color; the second theme color logo 42, which corresponds to the theme color scheme with orange, green and white as theme colors; the third theme color logo 43, which corresponds to blue, purple, White is the theme color scheme of the theme color; the fourth theme color logo 44 corresponds to the theme color scheme with red, blue and white as the theme colors; the fifth theme color logo 45 corresponds to orange, blue and white. The theme color scheme with blue and white as theme colors; the sixth theme color mark 46, which corresponds to the theme color scheme with blue, green and white as theme colors.
本申请实施例所描述的颜色属性指的是系统控件标识显示颜色的色相、饱和度和明度。The color attribute described in the embodiment of the present application refers to the hue, saturation and lightness of the displayed color identified by the system control.
本申请实施例所描述的目标主题色标识指的是用户从各个主题色标识中选中的主题色标识,其用于基于对应的主题调色方案,调整系统界面内的各个系统控件标识的颜色属性。The target theme color identification described in the embodiment of this application refers to the theme color identification selected by the user from various theme color identifications, which is used to adjust the color attributes of each system control identification in the system interface based on the corresponding theme color scheme .
本申请实施例所描述的第二输入指的是用于在T个主题色标识中选中目标主题色标识的操作,第二输入可以是用户对目标主题色标识操作的输入,其具体可以是单击操作、双击操作或长按操作等。The second input described in the embodiment of this application refers to the operation for selecting the target theme color logo from the T theme color logos. The second input can be the user's input on the operation of the target theme color logo, which can be a single Click operation, double-click operation or long press operation, etc.
进一步地,接收用户对T个主题色标识中目标主题色标识的第二输入,例如用户点击选中或长按目标主题色标识的操作,响应于第二输入,电子设备将根据目标主题色标识对应的主题调色方案中的主题色颜色属性,将系统界面内各个系统控件标识如系统组件、系统模块、桌面组件、应用程序或锁屏等图像标识的颜色属性,调整为与该主题色一致的颜色属性,以实现对各个系统组件、系统模块、桌面组件、应用程序或锁屏等图像标识显示的颜色重新配色。Further, receiving the user's second input on the target theme color identifier among the T theme color identifiers, for example, the user clicks to select or press and hold the target theme color identifier, and in response to the second input, the electronic device will correspond to the target theme color identifier according to the target theme color identifier. The theme color color attribute in the theme color scheme, adjust the color attributes of each system control logo in the system interface, such as system components, system modules, desktop components, applications or lock screen image logos, to be consistent with the theme color Color attribute, so as to realize the color re-matching of the image identification display of each system component, system module, desktop component, application program or lock screen.
在本申请实施例中,当根据第二图像中各个色块区域的填充色,可以生成蓝色系主题调色方案和绿色系主题调色方案,在用户点选绿色系主题调色方案对应的绿色系主题色标识后,则绿色系配色将会被应用到系统界面中各个系统控件标识上,如进度条图像标识、音量条图像标识、控制中 心图像标识、进度条图像标识、显示时间图像标识、按钮图像标识等都将调整为绿色系配色。In this embodiment of the application, according to the fill color of each color block area in the second image, a blue theme color scheme and a green theme color scheme can be generated, and when the user clicks on the green theme color scheme corresponding After the green theme color is marked, the green color scheme will be applied to each system control mark in the system interface, such as the progress bar image mark, the volume bar mark, the control center mark, the progress bar mark, and the display time mark , button image logos, etc. will all be adjusted to a green color scheme.
在本申请实施例中,根据第二图像中各个色块区域的填充色生成的主题调色方案,也会改变系统桌面应用程序图像标识和桌面组件图像标识的配色,系统读取桌面应用程序图像标识的颜色,将该图像标识的颜色进行智能颜色分区,并将根据主题调色方案中的主题色填入该颜色分区中,生成新配色的桌面应用程序图像标识,并将旧的图像标识进行替换;桌面组件图像标识的主题调色方案可以改变桌面组件中文字标识的颜色及桌面组件图像标识的颜色,桌面组件会计算自身颜色与桌面背景颜色的差别,选择与背景颜色不同的配色,以避免桌面组件图像标识的颜色与桌面背景的颜色融为一体而无法区分。In the embodiment of this application, the theme color scheme generated according to the fill color of each color block area in the second image will also change the color matching of the system desktop application image logo and desktop component image logo, and the system reads the desktop application image The color of the logo, the color of the image logo is divided into intelligent color partitions, and the theme color in the theme color scheme is filled into the color partition to generate a desktop application image logo with a new color matching, and the old image logo is divided into Replacement; the theme color scheme of the desktop component image logo can change the color of the text logo in the desktop component and the color of the desktop component image logo. The desktop component will calculate the difference between its own color and the background color of the desktop, and choose a color different from the background color. Avoid blending the color of the desktop component's image logo with the color of the desktop background and making it indistinguishable.
在本申请实施例中,当根据第二图像中各个色块区域的填充色,也可以生成紫色系主题调色方案和黄色系主题调色方案,在用户点选紫色系主题调色方案对应的紫色系主题色标识后,桌面应用程序图像标识和桌面组件图像标识将被调整为紫色系配色。In this embodiment of the application, according to the fill color of each color block area in the second image, a purple theme color scheme and a yellow theme color scheme can also be generated, and when the user clicks the corresponding After the purple theme color is identified, the desktop application image logo and desktop component image logo will be adjusted to the purple color scheme.
在本申请实施例中,根据第二图像中各个色块区域的填充色生成的主题调色方案,还可以改变系统锁屏图像标识的颜色,使系统锁屏界面中的各个图像标识调整为主题调色方案对应的主题色。In this embodiment of the application, according to the theme color scheme generated by the fill color of each color block area in the second image, the color of the system lock screen image logo can also be changed, so that each image logo in the system lock screen interface can be adjusted to the theme The theme color corresponding to the color scheme.
在本申请实施例中,针对锁屏图像标识的主题调色方案与桌面图像标识的主题调色方案相同时,锁屏图像标识调色后的颜色与桌面图像标识调色后的颜色是一样的;当针对锁屏图像标识的调色方案与桌面图像标识的调色方案不同时,锁屏图像标识调色后的颜色与桌面图像标识调色后的颜色是不一样的,系统可以选用锁屏图像标识和桌面图像标识对应的两种主题调色方案中的颜色对锁屏图像标识进行配色,如将锁屏图像标识对应的黄色系主题调色方案和桌面图像标识对应的蓝色系主题调色方案都应用到锁屏的界面中,使界面中的锁屏图像标识中既有黄色系配色的图像标识,也有蓝色系配色的图像标识。In this embodiment of the application, when the theme color scheme for the lock screen image logo is the same as the theme color scheme for the desktop image logo, the toned color of the lock screen image logo is the same as the color of the desktop image logo after toning ; When the color scheme for the lock screen image logo is different from that of the desktop image logo, the color of the lock screen image logo is different from the color of the desktop image logo after toning, and the system can choose the lock screen The colors in the two theme color schemes corresponding to the image logo and the desktop image logo are used to color the lock screen image logo, for example, the yellow theme color scheme corresponding to the lock screen image logo and the blue theme color scheme corresponding to the desktop image logo The color schemes are all applied to the lock screen interface, so that the lock screen image logos in the interface include both yellow-based image logos and blue-based image logos.
在本申请实施例中,基于第二图像中各个色块区域的填充色生成多个主题调色方案,供用户按照个人需求进行主题调色方案的选择,实现对电子设备中系统控件标识的颜色进行自定义设置和调整,可以让系统控件标识颜色跟随不同的主题调色方案而变化,满足了用户的个性化需求。In the embodiment of the present application, based on the fill color of each color block area in the second image, multiple theme color schemes are generated for users to choose a theme color scheme according to their personal needs, and realize the color identification of system controls in electronic devices Custom settings and adjustments can make the system control logo color change with different theme color schemes, meeting the personalized needs of users.
在本申请实施例中,对于纯色图像,例如纯灰色、纯白色、纯黑色、纯绿色等,可以使用预设的色块区域划分方式进行区域划分及填色,可以将纯色图像划分为3个、4个或者更多色块区域,进而以该纯色为基准,生成对应数目的渐变色,来填充划分好的各个色块区域,生成色块图像。In the embodiment of this application, for pure color images, such as pure gray, pure white, pure black, pure green, etc., the preset color block area division method can be used for area division and color filling, and the pure color image can be divided into three , 4 or more color block areas, and then based on the pure color, generate a corresponding number of gradient colors to fill each divided color block area to generate a color block image.
可选地,对于纯灰色图像可以进行预设的色块区域划分方式,划分出3个色块区域,进而对3个色块区域填充3种不同RGB值的灰色,使纯灰色图像不会呈现单调的纯色,而可以呈现极简的色块图案。Optionally, for the pure gray image, the preset color block area division method can be carried out to divide the three color block areas, and then fill the three color block areas with gray with three different RGB values, so that the pure gray image will not appear Instead of monotonous solid colors, minimalist color block patterns can be presented.
需要说明的是,本申请实施例提供的图像处理方法,执行主体可以为图像处理装置,或者该图像处理装置中的用于执行图像处理方法的控制模块。本申请实施例中以图像处理装置执行图像处理的方法为例,说明本申请实施例提供的图像处理的装置。It should be noted that, the image processing method provided in the embodiment of the present application may be executed by an image processing device, or a control module in the image processing device for executing the image processing method. In the embodiment of the present application, the method for performing image processing by the image processing apparatus is taken as an example to describe the image processing device provided in the embodiment of the present application.
图5是本申请实施例提供的图像处理装置的结构示意图,如图5所示,包括:Fig. 5 is a schematic structural diagram of an image processing device provided in an embodiment of the present application, as shown in Fig. 5 , including:
第一划分单元510,用于基于按照预设尺寸划分后的第一图像和所述第一图像中各个像素点的RGB值,得到所述第一图像对应的像素块图像,其中,所述像素块图像包括M个像素块子图像,M为正整数;The first dividing unit 510 is configured to obtain a pixel block image corresponding to the first image based on the first image divided according to a preset size and the RGB values of each pixel in the first image, wherein the pixel The block image includes M pixel block sub-images, where M is a positive integer;
第二划分单元520,用于基于各个所述像素块子图像的第一颜色参数,将所述像素块图像划分为K个色块区域,其中,所述第一颜色参数包括色相和明度,K为正整数,K≤M;The second dividing unit 520 is configured to divide the pixel block image into K color block regions based on the first color parameters of each of the pixel block sub-images, wherein the first color parameters include hue and lightness, K is a positive integer, K≤M;
填色单元530,用于基于所述色块区域的RGB均值,从所述像素块图像对应的N个填充色中确定各个所述色块区域的填充色,得到第二图像,其中,所述填充色用于填充其对应的色块区域,所述像素块图像对应的N个填充色是基于预设颜色类别、各个所述像素块子图像的RGB值和第二 颜色参数确定的,所述第二颜色参数包括明度和饱和度,N为正整数。The color filling unit 530 is configured to determine the fill color of each of the color block regions from the N fill colors corresponding to the pixel block image based on the RGB mean value of the color block region, and obtain a second image, wherein the The fill color is used to fill its corresponding color block area, and the N fill colors corresponding to the pixel block image are determined based on the preset color category, the RGB value of each of the pixel block sub-images and the second color parameter, the The second color parameter includes lightness and saturation, and N is a positive integer.
可选地,所述装置还包括:Optionally, the device also includes:
第一确定单元,用于基于各个所述像素块子图像的RGB值和各个所述预设颜色类别对应的RGB值区间,确定各个预设颜色类别对应的像素块子图像集,其中,每个所述像素块子图像集中包括一个或多个像素块子图像;The first determining unit is configured to determine a set of pixel block sub-images corresponding to each preset color category based on the RGB values of each of the pixel block sub-images and the RGB value interval corresponding to each of the preset color categories, wherein each The pixel block sub-image set includes one or more pixel block sub-images;
第二确定单元,用于基于各个所述像素块子图像集中像素块子图像的数量,确定各个所述像素块子图像集中的L个目标像素块子图像集,其中,L为正整数;The second determining unit is configured to determine L target pixel block sub-image sets in each of the pixel block sub-image sets based on the number of pixel block sub-image sets in each of the pixel block sub-image sets, wherein L is a positive integer;
第三确定单元,用于基于所述目标像素块子图像集中各个像素块子图像的第二颜色参数,确定所述目标像素块子图像集中的目标像素块子图像;A third determining unit, configured to determine a target pixel block sub-image in the target pixel block sub-image set based on a second color parameter of each pixel block sub-image in the target pixel block sub-image set;
生成单元,用于基于各个所述目标像素块子图像,生成所述像素块图像对应的N个填充色。A generating unit, configured to generate N fill colors corresponding to the pixel block image based on each of the target pixel block sub-images.
可选地,所述第二划分单元520具体还用于:Optionally, the second dividing unit 520 is specifically further configured to:
基于所述像素块图像中各个所述像素块子图像的第一颜色参数,确定所述像素块图像中的色块划分线;Based on the first color parameters of each of the pixel block sub-images in the pixel block image, determine the color block division lines in the pixel block image;
根据所述色块划分线,将所述像素块图像划分为K个色块区域。Divide the pixel block image into K color block regions according to the color block dividing line.
可选地,所述填色单元530具体还用于:Optionally, the coloring unit 530 is also specifically used for:
基于每个所述色块区域的RGB均值和各个所述填充色的RGB值之间的差值,确定各个所述色块区域对应的填充色。The fill color corresponding to each color block area is determined based on the difference between the RGB mean value of each color block area and the RGB value of each of the fill colors.
可选地,所述第一划分单元510具体还用于:Optionally, the first dividing unit 510 is specifically further configured to:
基于按照预设尺寸划分后的第一图像,确定M个第一子图像;Determine M first sub-images based on the first image divided according to the preset size;
基于所述第一子图像的RGB均值,得到所述第一子图像对应的像素块子图像;Obtaining a pixel block sub-image corresponding to the first sub-image based on the RGB mean value of the first sub-image;
基于各个所述第一子图像对应的像素块子图像,得到所述第一图像对应的像素块图像。Based on the pixel block sub-images corresponding to each of the first sub-images, a pixel block image corresponding to the first image is obtained.
可选地,所述装置,还包括:Optionally, the device also includes:
第一输入单元,用于接收用户的第一输入;a first input unit, configured to receive a first input from a user;
第一响应单元,用于响应于所述第一输入,显示T个主题色标识,其中,每个所述主题色标识对应一个主题调色方案,所述主题调色方案是基于所述第二图像中各个色块区域的填充色生成的,其中,T为正整数;The first response unit is configured to display T theme color identifications in response to the first input, wherein each of the theme color identifications corresponds to a theme color scheme, and the theme color scheme is based on the second Generated by the filling color of each color block area in the image, where T is a positive integer;
第二输入单元,用于接收用户对所述T个主题色标识中目标主题色标识的第二输入;The second input unit is configured to receive a second input from the user on the target theme color identifier in the T theme color identifiers;
第二响应单元,用于响应于所述第二输入,根据所述目标主题色标识对应的主题调色方案,调整系统界面内系统控件标识的颜色属性。The second response unit is configured to adjust the color attribute of the system control identifier in the system interface according to the theme color scheme corresponding to the target theme color identifier in response to the second input.
在本申请实施例中,基于第一图像中各个像素点的RGB值,将第一图像划分为多个像素块子图像,得到第一图像对应的像素块图像,基于该像素块图像中各个像素块子图像之间明度或色相的差异程度,将像素块图像划分为多个色块区域,同时基于像素块图像中各个像素块子图像的RGB值和预设颜色类别,确定多个属于同一类颜色的像素块子图像集,从而确定像素块图像中分布范围大的少数几类颜色类别,进而根据每类颜色对应的各个像素块子图像的明度和饱和度,确定出用于对各个色块区域进行颜色填充的填充色,以通过这少数几种可以代表第一图像的主色调和颜色分布的填充色,来生成第二图像,此时第二图像只由几种纯色色块拼接而成,可以给用户一种色彩简单、醒目的极简化风格视觉效果,实现用户对图像进行个性化样式的设置,满足用户的个性化需求。In the embodiment of the present application, based on the RGB values of each pixel in the first image, the first image is divided into a plurality of pixel block sub-images to obtain a pixel block image corresponding to the first image, and based on each pixel in the pixel block image The degree of difference in lightness or hue between the block sub-images divides the pixel block image into multiple color block areas, and at the same time, based on the RGB value and preset color category of each pixel block sub-image in the pixel block image, it is determined that multiple color blocks belong to the same category The color pixel block sub-image set, so as to determine the few types of color categories with a large distribution range in the pixel block image, and then according to the lightness and saturation of each pixel block sub-image corresponding to each type of color, determine the color used for each color block The fill color for color filling in the area, so as to generate the second image through these few fill colors that can represent the main color and color distribution of the first image. At this time, the second image is only spliced by several solid color blocks , can give users a minimalist style visual effect with simple colors and eye-catching, realize the user's personalized style setting of the image, and meet the user's individual needs.
本申请实施例中的图像处理装置可以是装置,也可以是终端中的部件、集成电路、或芯片。该装置可以是移动电子设备,也可以为非移动电子设备。示例性的,移动电子设备可以为手机、平板电脑、笔记本电脑、掌上电脑、车载电子设备、可穿戴设备、超级移动个人计算机(ultra-mobile personal computer,UMPC)、上网本或者个人数字助理(personal digital assistant,PDA)等,非移动电子设备可以为服务器、网络附属存储器(Network Attached Storage,NAS)、个人计算机(personal computer,PC)、电视机(television,TV)、柜员机或者自助机等,本申请实施例不作具体 限定。The image processing apparatus in the embodiment of the present application may be a device, or may be a component, an integrated circuit, or a chip in a terminal. The device may be a mobile electronic device or a non-mobile electronic device. Exemplarily, the mobile electronic device may be a mobile phone, a tablet computer, a notebook computer, a handheld computer, a vehicle electronic device, a wearable device, an ultra-mobile personal computer (ultra-mobile personal computer, UMPC), a netbook or a personal digital assistant (personal digital assistant). assistant, PDA), etc., non-mobile electronic devices can be servers, network attached storage (Network Attached Storage, NAS), personal computer (personal computer, PC), television (television, TV), teller machine or self-service machine, etc., this application Examples are not specifically limited.
本申请实施例中的图像处理装置可以为具有操作系统的装置。该操作系统可以为安卓(Android)操作系统,可以为ios操作系统,还可以为其他可能的操作系统,本申请实施例不作具体限定。The image processing device in the embodiment of the present application may be a device with an operating system. The operating system may be an Android (Android) operating system, an ios operating system, or other possible operating systems, which are not specifically limited in this embodiment of the present application.
本申请实施例提供的图像处理装置能够实现图1至图6的方法实施例实现的各个过程,为避免重复,这里不再赘述。The image processing apparatus provided in the embodiment of the present application can realize various processes realized by the method embodiments in FIG. 1 to FIG. 6 , and details are not repeated here to avoid repetition.
可选地,图6是本申请实施例提供的电子设备的结构示意图,如图6所示,本申请实施例还提供一种电子设备600,包括处理器601,存储器602,存储在存储器602上并可在所述处理器601上运行的程序或指令,该程序或指令被处理器601执行时实现上述图像处理方法实施例的各个过程,且能达到相同的技术效果,为避免重复,这里不再赘述。Optionally, FIG. 6 is a schematic structural diagram of an electronic device provided by an embodiment of the present application. As shown in FIG. And the program or instruction that can run on the processor 601, when the program or instruction is executed by the processor 601, realizes the various processes of the above-mentioned image processing method embodiment, and can achieve the same technical effect, in order to avoid repetition, it is not described here Let me repeat.
需要说明的是,本申请实施例中的电子设备包括上述所述的移动电子设备和非移动电子设备。It should be noted that the electronic devices in the embodiments of the present application include the above-mentioned mobile electronic devices and non-mobile electronic devices.
图7为实现本申请实施例的电子设备的硬件结构示意图。FIG. 7 is a schematic diagram of a hardware structure of an electronic device implementing an embodiment of the present application.
该电子设备700包括但不限于:射频单元701、网络模块702、音频输出单元703、输入单元704、传感器705、显示单元706、用户输入单元707、接口单元708、存储器709、以及处理器710等部件。The electronic device 700 includes, but is not limited to: a radio frequency unit 701, a network module 702, an audio output unit 703, an input unit 704, a sensor 705, a display unit 706, a user input unit 707, an interface unit 708, a memory 709, and a processor 710, etc. part.
本领域技术人员可以理解,电子设备700还可以包括给各个部件供电的电源(比如电池),电源可以通过电源管理系统与处理器710逻辑相连,从而通过电源管理系统实现管理充电、放电、以及功耗管理等功能。图7中示出的电子设备结构并不构成对电子设备的限定,电子设备可以包括比图示更多或更少的部件,或者组合某些部件,或者不同的部件布置,在此不再赘述。Those skilled in the art can understand that the electronic device 700 can also include a power supply (such as a battery) for supplying power to various components, and the power supply can be logically connected to the processor 710 through the power management system, so that the management of charging, discharging, and function can be realized through the power management system. Consumption management and other functions. The structure of the electronic device shown in FIG. 7 does not constitute a limitation to the electronic device. The electronic device may include more or fewer components than shown in the figure, or combine some components, or arrange different components, and details will not be repeated here. .
其中,处理器710用于基于按照预设尺寸划分后的第一图像和所述第一图像中各个像素点的RGB值,得到所述第一图像对应的像素块图像,其中,所述像素块图像包括M个像素块子图像,M为正整数;Wherein, the processor 710 is configured to obtain a pixel block image corresponding to the first image based on the first image divided according to a preset size and the RGB values of each pixel in the first image, wherein the pixel block The image includes M pixel block sub-images, where M is a positive integer;
处理器710用于基于各个所述像素块子图像的第一颜色参数,将所述 像素块图像划分为K个色块区域,其中,所述第一颜色参数包括色相和明度,K为正整数,K≤M;The processor 710 is configured to divide the pixel block image into K color block regions based on the first color parameters of each of the pixel block sub-images, wherein the first color parameters include hue and lightness, and K is a positive integer , K≤M;
处理器710用于基于所述色块区域的RGB均值,从所述像素块图像对应的N个填充色中确定各个所述色块区域的填充色,得到第二图像,其中,所述填充色用于填充其对应的色块区域,所述像素块图像对应的N个填充色是基于预设颜色类别、各个所述像素块子图像的RGB值和第二颜色参数确定的,所述第二颜色参数包括明度和饱和度,N为正整数。The processor 710 is configured to determine the fill color of each of the color block regions from the N fill colors corresponding to the pixel block image based on the RGB mean value of the color block region, to obtain a second image, wherein the fill color For filling the corresponding color block area, the N filling colors corresponding to the pixel block image are determined based on the preset color category, the RGB value of each of the pixel block sub-images and the second color parameter, and the second Color parameters include lightness and saturation, and N is a positive integer.
处理器710用于基于各个所述像素块子图像的RGB值和各个所述预设颜色类别对应的RGB值区间,确定各个预设颜色类别对应的像素块子图像集,其中,每个所述像素块子图像集中包括一个或多个像素块子图像;The processor 710 is configured to determine a set of pixel block sub-images corresponding to each preset color category based on the RGB values of each of the pixel block sub-images and the RGB value range corresponding to each of the preset color categories, wherein each of the The set of pixel block sub-images includes one or more pixel block sub-images;
基于各个所述像素块子图像集中像素块子图像的数量,确定各个所述像素块子图像集中的L个目标像素块子图像集,其中,L为正整数;Based on the number of pixel block sub-images in each of the pixel block sub-image sets, determine L target pixel block sub-image sets in each of the pixel block sub-image sets, where L is a positive integer;
基于所述目标像素块子图像集中各个像素块子图像的第二颜色参数,确定所述目标像素块子图像集中的目标像素块子图像;determining a target pixel block sub-image in the target pixel block sub-image set based on a second color parameter of each pixel block sub-image in the target pixel block sub-image set;
基于各个所述目标像素块子图像,生成所述像素块图像对应的N个填充色。Based on each sub-image of the target pixel block, generate N filling colors corresponding to the pixel block image.
处理器710用于基于所述像素块图像中各个所述像素块子图像的第一颜色参数,确定所述像素块图像中的色块划分线;The processor 710 is configured to determine color block dividing lines in the pixel block image based on the first color parameters of each of the pixel block sub-images in the pixel block image;
根据所述色块划分线,将所述像素块图像划分为K个色块区域。Divide the pixel block image into K color block regions according to the color block dividing line.
处理器710用于基于每个所述色块区域的RGB均值和各个所述填充色的RGB值之间的差值,确定各个所述色块区域对应的填充色。The processor 710 is configured to determine the fill color corresponding to each of the color block areas based on the difference between the RGB mean value of each of the color block areas and the RGB value of each of the fill colors.
处理器710用于基于按照预设尺寸划分后的第一图像,确定M个第一子图像;The processor 710 is configured to determine M first sub-images based on the first image divided according to a preset size;
基于所述第一子图像的RGB均值,得到所述第一子图像对应的像素块子图像;Obtaining a pixel block sub-image corresponding to the first sub-image based on the RGB mean value of the first sub-image;
基于各个所述第一子图像对应的像素块子图像,得到所述第一图像对应的像素块图像。Based on the pixel block sub-images corresponding to each of the first sub-images, a pixel block image corresponding to the first image is obtained.
用户输入单元707用于接收用户的第一输入;The user input unit 707 is configured to receive a first input from the user;
显示单元706用于响应于所述第一输入,显示T个主题色标识,其中,每个所述主题色标识对应一个主题调色方案,所述主题调色方案是基于所述第二图像中各个色块区域的填充色生成的,其中,T为正整数;The display unit 706 is configured to display T theme color identifications in response to the first input, wherein each of the theme color identifications corresponds to a theme color scheme, and the theme color scheme is based on the theme in the second image Generated by the fill color of each color block area, where T is a positive integer;
用户输入单元707还用于接收用户对所述T个主题色标识中目标主题色标识的第二输入;The user input unit 707 is also configured to receive a second input from the user on the target theme color identifier in the T theme color identifiers;
处理器710用于响应于所述第二输入,根据所述目标主题色标识对应的主题调色方案,调整系统界面内系统控件标识的颜色属性。The processor 710 is configured to, in response to the second input, adjust the color attribute of the system control logo in the system interface according to the theme color scheme corresponding to the target theme color logo.
在本申请实施例中,基于第一图像中各个像素点的RGB值,将第一图像划分为多个像素块子图像,得到第一图像对应的像素块图像,基于该像素块图像中各个像素块子图像之间明度或色相的差异程度,将像素块图像划分为多个色块区域,同时基于像素块图像中各个像素块子图像的RGB值和预设颜色类别,确定多个属于同一类颜色的像素块子图像集,从而确定像素块图像中分布范围大的少数几类颜色类别,进而根据每类颜色对应的各个像素块子图像的明度和饱和度,确定出用于对各个色块区域进行颜色填充的填充色,以通过这少数几种可以代表第一图像的主色调和颜色分布的填充色,来生成第二图像,此时第二图像只由几种纯色色块拼接而成,可以给用户一种色彩简单、醒目的极简化风格视觉效果,实现用户对图像进行个性化样式的设置,满足用户的个性化需求。In the embodiment of the present application, based on the RGB values of each pixel in the first image, the first image is divided into a plurality of pixel block sub-images to obtain a pixel block image corresponding to the first image, and based on each pixel in the pixel block image The degree of difference in lightness or hue between the block sub-images divides the pixel block image into multiple color block areas, and at the same time, based on the RGB value and preset color category of each pixel block sub-image in the pixel block image, it is determined that multiple color blocks belong to the same category The color pixel block sub-image set, so as to determine the few types of color categories with a large distribution range in the pixel block image, and then according to the lightness and saturation of each pixel block sub-image corresponding to each type of color, determine the color used for each color block The fill color for color filling in the area, so as to generate the second image through these few fill colors that can represent the main color and color distribution of the first image. At this time, the second image is only spliced by several solid color blocks , can give users a minimalist style visual effect with simple colors and eye-catching, realize the user's personalized style setting of the image, and meet the user's individual needs.
应理解的是,本申请实施例中,输入单元704可以包括图形处理器(Graphics Processing Unit,GPU)7041和麦克风7042,图形处理器7041对在视频捕获模式或图像捕获模式中由图像捕获装置(如摄像头)获得的静态图片或视频的图像数据进行处理。显示单元706可包括显示面板7061,可以采用液晶显示器、有机发光二极管等形式来配置显示面板7061。用户输入单元707包括触控面板7071以及其他输入设备7072。触控面板7071,也称为触摸屏。触控面板7071可包括触摸检测装置和触摸控制器两个部分。其他输入设备7072可以包括但不限于物理键盘、功能键(比如音量 控制按键、开关按键等)、轨迹球、鼠标、操作杆,在此不再赘述。存储器709可用于存储软件程序以及各种数据,包括但不限于应用程序和操作系统。处理器710可集成应用处理器和调制解调处理器,其中,应用处理器主要处理操作系统、用户界面和应用程序等,调制解调处理器主要处理无线通信。可以理解的是,上述调制解调处理器也可以不集成到处理器710中。It should be understood that, in the embodiment of the present application, the input unit 704 may include a graphics processor (Graphics Processing Unit, GPU) 7041 and a microphone 7042, and the graphics processor 7041 is used for the image capture device ( Such as the image data of the still picture or video obtained by the camera) for processing. The display unit 706 may include a display panel 7061, and the display panel 7061 may be configured in the form of a liquid crystal display, an organic light emitting diode, or the like. The user input unit 707 includes a touch panel 7071 and other input devices 7072 . The touch panel 7071 is also called a touch screen. The touch panel 7071 may include two parts, a touch detection device and a touch controller. Other input devices 7072 may include, but are not limited to, physical keyboards, function keys (such as volume control buttons, switch buttons, etc.), trackballs, mice, and joysticks, which will not be described in detail here. Memory 709 may be used to store software programs as well as various data, including but not limited to application programs and operating systems. The processor 710 may integrate an application processor and a modem processor, wherein the application processor mainly processes an operating system, user interface, application program, etc., and the modem processor mainly processes wireless communication. It can be understood that the foregoing modem processor may not be integrated into the processor 710 .
本申请实施例还提供一种可读存储介质,所述可读存储介质上存储有程序或指令,该程序或指令被处理器执行时实现上述图像处理方法实施例的各个过程,且能达到相同的技术效果,为避免重复,这里不再赘述。The embodiment of the present application also provides a readable storage medium, the readable storage medium stores a program or an instruction, and when the program or instruction is executed by a processor, each process of the above-mentioned image processing method embodiment is realized, and can achieve the same To avoid repetition, the technical effects will not be repeated here.
其中,所述处理器为上述实施例中所述的电子设备中的处理器。所述可读存储介质,包括计算机可读存储介质,如计算机只读存储器(Read-Only Memory,ROM)、随机存取存储器(Random Access Memory,RAM)、磁碟或者光盘等。Wherein, the processor is the processor in the electronic device described in the above embodiments. The readable storage medium includes computer readable storage medium, such as computer read-only memory (Read-Only Memory, ROM), random access memory (Random Access Memory, RAM), magnetic disk or optical disk, etc.
本申请实施例另提供了一种芯片,所述芯片包括处理器和通信接口,所述通信接口和所述处理器耦合,所述处理器用于运行程序或指令,实现上述图像处理方法实施例的各个过程,且能达到相同的技术效果,为避免重复,这里不再赘述。The embodiment of the present application further provides a chip, the chip includes a processor and a communication interface, the communication interface is coupled to the processor, and the processor is used to run programs or instructions to implement the above image processing method embodiment Each process can achieve the same technical effect, so in order to avoid repetition, it will not be repeated here.
应理解,本申请实施例提到的芯片还可以称为系统级芯片、系统芯片、芯片系统或片上系统芯片等。It should be understood that the chips mentioned in the embodiments of the present application may also be called system-on-chip, system-on-chip, system-on-a-chip, or system-on-a-chip.
需要说明的是,在本文中,术语“包括”、“包含”或者其任何其他变体意在涵盖非排他性的包含,从而使得包括一系列要素的过程、方法、物品或者装置不仅包括那些要素,而且还包括没有明确列出的其他要素,或者是还包括为这种过程、方法、物品或者装置所固有的要素。在没有更多限制的情况下,由语句“包括一个……”限定的要素,并不排除在包括该要素的过程、方法、物品或者装置中还存在另外的相同要素。此外,需要指出的是,本申请实施方式中的方法和装置的范围不限按示出或讨论的顺序来执行功能,还可包括根据所涉及的功能按基本同时的方式或按相反 的顺序来执行功能,例如,可以按不同于所描述的次序来执行所描述的方法,并且还可以添加、省去、或组合各种步骤。另外,参照某些示例所描述的特征可在其他示例中被组合。It should be noted that, in this document, the term "comprising", "comprising" or any other variation thereof is intended to cover a non-exclusive inclusion such that a process, method, article or apparatus comprising a set of elements includes not only those elements, It also includes other elements not expressly listed, or elements inherent in the process, method, article, or device. Without further limitations, an element defined by the phrase "comprising a ..." does not preclude the presence of additional identical elements in the process, method, article, or apparatus comprising that element. In addition, it should be pointed out that the scope of the methods and devices in the embodiments of the present application is not limited to performing functions in the order shown or discussed, and may also include performing functions in a substantially simultaneous manner or in reverse order according to the functions involved. Functions are performed, for example, the described methods may be performed in an order different from that described, and various steps may also be added, omitted, or combined. Additionally, features described with reference to certain examples may be combined in other examples.
通过以上的实施方式的描述,本领域的技术人员可以清楚地了解到上述实施例方法可借助软件加必需的通用硬件平台的方式来实现,当然也可以通过硬件,但很多情况下前者是更佳的实施方式。基于这样的理解,本申请的技术方案本质上或者说对现有技术做出贡献的部分可以以计算机软件产品的形式体现出来,该计算机软件产品存储在一个存储介质(如ROM/RAM、磁碟、光盘)中,包括若干指令用以使得一台终端(可以是手机,计算机,服务器,或者网络设备等)执行本申请各个实施例所述的方法。Through the description of the above embodiments, those skilled in the art can clearly understand that the methods of the above embodiments can be implemented by means of software plus a necessary general-purpose hardware platform, and of course also by hardware, but in many cases the former is better implementation. Based on such an understanding, the technical solution of the present application can be embodied in the form of computer software products, which are stored in a storage medium (such as ROM/RAM, magnetic disk, etc.) , optical disc), including several instructions to enable a terminal (which may be a mobile phone, computer, server, or network device, etc.) to execute the methods described in various embodiments of the present application.
上面结合附图对本申请的实施例进行了描述,但是本申请并不局限于上述的具体实施方式,上述的具体实施方式仅仅是示意性的,而不是限制性的,本领域的普通技术人员在本申请的启示下,在不脱离本申请宗旨和权利要求所保护的范围情况下,还可做出很多形式,均属于本申请的保护之内。The embodiments of the present application have been described above in conjunction with the accompanying drawings, but the present application is not limited to the above-mentioned specific implementations. The above-mentioned specific implementations are only illustrative and not restrictive. Those of ordinary skill in the art will Under the inspiration of this application, without departing from the purpose of this application and the scope of protection of the claims, many forms can also be made, all of which belong to the protection of this application.

Claims (17)

  1. 一种图像处理方法,包括:An image processing method, comprising:
    基于按照预设尺寸划分后的第一图像和所述第一图像中各个像素点的RGB值,得到所述第一图像对应的像素块图像,其中,所述像素块图像包括M个像素块子图像,M为正整数;Based on the first image divided according to the preset size and the RGB values of each pixel in the first image, a pixel block image corresponding to the first image is obtained, wherein the pixel block image includes M pixel block sub- Image, M is a positive integer;
    基于各个所述像素块子图像的第一颜色参数,将所述像素块图像划分为K个色块区域,其中,所述第一颜色参数包括色相和明度,K为正整数,K≤M;Divide the pixel block image into K color block regions based on the first color parameters of each of the pixel block sub-images, where the first color parameters include hue and lightness, K is a positive integer, and K≤M;
    基于所述色块区域的RGB均值,从所述像素块图像对应的N个填充色中确定各个所述色块区域的填充色,得到第二图像,其中,所述填充色用于填充其对应的色块区域,所述像素块图像对应的N个填充色是基于预设颜色类别、各个所述像素块子图像的RGB值和第二颜色参数确定的,所述第二颜色参数包括明度和饱和度,N为正整数。Based on the RGB mean value of the color block area, the fill color of each of the color block areas is determined from the N fill colors corresponding to the pixel block image to obtain a second image, wherein the fill color is used to fill its corresponding The color block area, the N filling colors corresponding to the pixel block image are determined based on the preset color category, the RGB value of each of the pixel block sub-images and the second color parameter, and the second color parameter includes lightness and Saturation, N is a positive integer.
  2. 根据权利要求1所述的图像处理方法,其中,在所述从所述像素块图像对应的N个填充色中确定各个所述色块区域的填充色之前,还包括:The image processing method according to claim 1, wherein, before determining the fill color of each of the color block regions from the N fill colors corresponding to the pixel block image, further comprising:
    基于各个所述像素块子图像的RGB值和各个所述预设颜色类别对应的RGB值区间,确定各个预设颜色类别对应的像素块子图像集,其中,每个所述像素块子图像集中包括一个或多个像素块子图像;Based on the RGB value of each of the pixel block sub-images and the RGB value interval corresponding to each of the preset color categories, determine the pixel block sub-image set corresponding to each preset color category, wherein each of the pixel block sub-image sets comprising one or more pixel block sub-images;
    基于各个所述像素块子图像集中像素块子图像的数量,确定各个所述像素块子图像集中的L个目标像素块子图像集,其中,L为正整数;Based on the number of pixel block sub-images in each of the pixel block sub-image sets, determine L target pixel block sub-image sets in each of the pixel block sub-image sets, where L is a positive integer;
    基于所述目标像素块子图像集中各个像素块子图像的第二颜色参数,确定所述目标像素块子图像集中的目标像素块子图像;determining a target pixel block sub-image in the target pixel block sub-image set based on a second color parameter of each pixel block sub-image in the target pixel block sub-image set;
    基于各个所述目标像素块子图像,生成所述像素块图像对应的N个填充色。Based on each sub-image of the target pixel block, generate N filling colors corresponding to the pixel block image.
  3. 根据权利要求1所述的图像处理方法,其中,所述基于各个所述像素块子图像的第一颜色参数,将所述像素块图像划分为K个色块区域,包 括:The image processing method according to claim 1, wherein said dividing the pixel block image into K color block regions based on the first color parameters of each of the pixel block sub-images comprises:
    基于所述像素块图像中各个所述像素块子图像的第一颜色参数,确定所述像素块图像中的色块划分线;Based on the first color parameters of each of the pixel block sub-images in the pixel block image, determine the color block division lines in the pixel block image;
    根据所述色块划分线,将所述像素块图像划分为K个色块区域。Divide the pixel block image into K color block regions according to the color block dividing line.
  4. 根据权利要求1所述的图像处理方法,其中,所述基于所述色块区域的RGB均值,从所述像素块图像对应的N个填充色中确定各个所述色块区域的填充色,包括:The image processing method according to claim 1, wherein, based on the RGB mean value of the color block area, determining the fill color of each of the color block areas from the N fill colors corresponding to the pixel block image includes :
    基于每个所述色块区域的RGB均值和各个所述填充色的RGB值之间的差值,确定各个所述色块区域对应的填充色。The fill color corresponding to each color block area is determined based on the difference between the RGB mean value of each color block area and the RGB value of each of the fill colors.
  5. 根据权利要求1所述的图像处理方法,其中,所述基于按照预设尺寸划分后的第一图像和所述第一图像中各个像素点的RGB值,得到所述第一图像对应的像素块图像,包括:The image processing method according to claim 1, wherein the pixel block corresponding to the first image is obtained based on the first image divided according to the preset size and the RGB values of each pixel in the first image images, including:
    基于按照预设尺寸划分后的第一图像,确定M个第一子图像;Determine M first sub-images based on the first image divided according to the preset size;
    基于所述第一子图像的RGB均值,得到所述第一子图像对应的像素块子图像;Obtaining a pixel block sub-image corresponding to the first sub-image based on the RGB mean value of the first sub-image;
    基于各个所述第一子图像对应的像素块子图像,得到所述第一图像对应的像素块图像。Based on the pixel block sub-images corresponding to each of the first sub-images, a pixel block image corresponding to the first image is obtained.
  6. 根据权利要求1所述的图像处理方法,其中,在所述从所述像素块图像对应的N个填充色中确定各个所述色块区域的填充色,得到第二图像之后,还包括:The image processing method according to claim 1, wherein, after determining the fill color of each of the color block regions from the N fill colors corresponding to the pixel block image and obtaining the second image, further comprising:
    接收用户的第一输入;receiving a first input from the user;
    响应于所述第一输入,显示T个主题色标识,其中,每个所述主题色标识对应一个主题调色方案,所述主题调色方案是基于所述第二图像中各个色块区域的填充色生成的,其中,T为正整数;In response to the first input, display T theme color identifications, wherein each of the theme color identifications corresponds to a theme color scheme, and the theme color scheme is based on each color patch area in the second image Generated by fill color, where T is a positive integer;
    接收用户对所述T个主题色标识中目标主题色标识的第二输入;receiving a second input from the user on the target theme color identifier in the T theme color identifiers;
    响应于所述第二输入,根据所述目标主题色标识对应的主题调色方案,调整系统界面内系统控件标识的颜色属性。In response to the second input, adjust the color attribute of the system control identifier in the system interface according to the theme color scheme corresponding to the target theme color identifier.
  7. 一种图像处理装置,包括:An image processing device, comprising:
    第一划分单元,用于基于按照预设尺寸划分后的第一图像和所述第一图像中各个像素点的RGB值,得到所述第一图像对应的像素块图像,其中,所述像素块图像包括M个像素块子图像,M为正整数;The first dividing unit is configured to obtain a pixel block image corresponding to the first image based on the first image divided according to a preset size and the RGB values of each pixel in the first image, wherein the pixel block The image includes M pixel block sub-images, where M is a positive integer;
    第二划分单元,用于基于各个所述像素块子图像的第一颜色参数,将所述像素块图像划分为K个色块区域,其中,所述第一颜色参数包括色相和明度,K为正整数,K≤M;The second dividing unit is configured to divide the pixel block image into K color block regions based on the first color parameters of each of the pixel block sub-images, wherein the first color parameters include hue and lightness, and K is Positive integer, K≤M;
    填色单元,用于基于所述色块区域的RGB均值,从所述像素块图像对应的N个填充色中确定各个所述色块区域的填充色,得到第二图像,其中,所述填充色用于填充其对应的色块区域,所述像素块图像对应的N个填充色是基于预设颜色类别、各个所述像素块子图像的RGB值和第二颜色参数确定的,所述第二颜色参数包括明度和饱和度,N为正整数。A color filling unit, configured to determine the fill color of each of the color block regions from the N fill colors corresponding to the pixel block image based on the RGB mean value of the color block region, to obtain a second image, wherein the fill The color is used to fill its corresponding color block area, and the N filling colors corresponding to the pixel block image are determined based on the preset color category, the RGB value of each of the pixel block sub-images and the second color parameter, and the first Two color parameters include lightness and saturation, and N is a positive integer.
  8. 根据权利要求7所述的图像处理装置,其中,所述装置还包括:The image processing device according to claim 7, wherein the device further comprises:
    第一确定单元,用于基于各个所述像素块子图像的RGB值和各个所述预设颜色类别对应的RGB值区间,确定各个预设颜色类别对应的像素块子图像集,其中,每个所述像素块子图像集中包括一个或多个像素块子图像;The first determining unit is configured to determine a set of pixel block sub-images corresponding to each preset color category based on the RGB values of each of the pixel block sub-images and the RGB value interval corresponding to each of the preset color categories, wherein each The pixel block sub-image set includes one or more pixel block sub-images;
    第二确定单元,用于基于各个所述像素块子图像集中像素块子图像的数量,确定各个所述像素块子图像集中的L个目标像素块子图像集,其中,L为正整数;The second determining unit is configured to determine L target pixel block sub-image sets in each of the pixel block sub-image sets based on the number of pixel block sub-image sets in each of the pixel block sub-image sets, wherein L is a positive integer;
    第三确定单元,用于基于所述目标像素块子图像集中各个像素块子图像的第二颜色参数,确定所述目标像素块子图像集中的目标像素块子图像;A third determining unit, configured to determine a target pixel block sub-image in the target pixel block sub-image set based on a second color parameter of each pixel block sub-image in the target pixel block sub-image set;
    生成单元,用于基于各个所述目标像素块子图像,生成所述像素块图像对应的N个填充色。A generating unit, configured to generate N fill colors corresponding to the pixel block image based on each of the target pixel block sub-images.
  9. 根据权利要求7所述的图像处理装置,其中,所述第二划分单元具体还用于:The image processing device according to claim 7, wherein the second dividing unit is specifically further configured to:
    基于所述像素块图像中各个所述像素块子图像的第一颜色参数,确定 所述像素块图像中的色块划分线;Based on the first color parameters of each of the pixel block sub-images in the pixel block image, determine the color block division lines in the pixel block image;
    根据所述色块划分线,将所述像素块图像划分为K个色块区域。Divide the pixel block image into K color block regions according to the color block dividing line.
  10. 根据权利要求7所述的图像处理装置,其中,所述填色单元具体还用于:The image processing device according to claim 7, wherein the coloring unit is further configured to:
    基于每个所述色块区域的RGB均值和各个所述填充色的RGB值之间的差值,确定各个所述色块区域对应的填充色。The fill color corresponding to each color block area is determined based on the difference between the RGB mean value of each color block area and the RGB value of each of the fill colors.
  11. 根据权利要求7所述的图像处理装置,其中,所述第一划分单元具体还用于:The image processing device according to claim 7, wherein the first dividing unit is specifically further configured to:
    基于按照预设尺寸划分后的第一图像,确定M个第一子图像;Determine M first sub-images based on the first image divided according to the preset size;
    基于所述第一子图像的RGB均值,得到所述第一子图像对应的像素块子图像;Obtaining a pixel block sub-image corresponding to the first sub-image based on the RGB mean value of the first sub-image;
    基于各个所述第一子图像对应的像素块子图像,得到所述第一图像对应的像素块图像。Based on the pixel block sub-images corresponding to each of the first sub-images, a pixel block image corresponding to the first image is obtained.
  12. 根据权利要求7所述的图像处理装置,其中,所述装置,还包括:The image processing device according to claim 7, wherein the device further comprises:
    第一输入单元,用于接收用户的第一输入;a first input unit, configured to receive a first input from a user;
    第一响应单元,用于响应于所述第一输入,显示T个主题色标识,其中,每个所述主题色标识对应一个主题调色方案,所述主题调色方案是基于所述第二图像中各个色块区域的填充色生成的,其中,T为正整数;The first response unit is configured to display T theme color identifications in response to the first input, wherein each of the theme color identifications corresponds to a theme color scheme, and the theme color scheme is based on the second Generated by the filling color of each color block area in the image, where T is a positive integer;
    第二输入单元,用于接收用户对所述T个主题色标识中目标主题色标识的第二输入;The second input unit is configured to receive a second input from the user on the target theme color identifier in the T theme color identifiers;
    第二响应单元,用于响应于所述第二输入,根据所述目标主题色标识对应的主题调色方案,调整系统界面内系统控件标识的颜色属性。The second response unit is configured to adjust the color attribute of the system control identifier in the system interface according to the theme color scheme corresponding to the target theme color identifier in response to the second input.
  13. 一种电子设备,包括处理器,存储器及存储在所述存储器上并可在所述处理器上运行的程序或指令,所述程序或指令被所述处理器执行时实现如权利要求1-6任一项所述的图像处理方法的步骤。An electronic device, comprising a processor, a memory, and a program or instruction stored on the memory and operable on the processor, when the program or instruction is executed by the processor, claims 1-6 are realized The steps of any one of the image processing methods.
  14. 一种可读存储介质,所述可读存储介质上存储程序或指令,所述程序或指令被处理器执行时实现如权利要求1-6任一项所述的图像处理方 法的步骤。A readable storage medium, on which a program or instruction is stored, and when the program or instruction is executed by a processor, the steps of the image processing method according to any one of claims 1-6 are realized.
  15. 一种芯片,所述芯片包括处理器和通信接口,所述通信接口和所述处理器耦合,所述处理器用于运行程序或指令,实现如权利要求1-6任一项所述的图像处理方法的步骤。A chip, the chip includes a processor and a communication interface, the communication interface is coupled to the processor, the processor is used to run programs or instructions, and realize the image processing as described in any one of claims 1-6 method steps.
  16. 一种计算机程序产品,所述程序产品被至少一个处理器执行以实现如权利要求1-6任一项所述的图像处理方法的步骤。A computer program product, the program product is executed by at least one processor to implement the steps of the image processing method according to any one of claims 1-6.
  17. 一种电子设备,包括所述电子设备被配置成用于执行如权利要求1-6任一项所述的图像处理方法的步骤。An electronic device, comprising the electronic device configured to execute the steps of the image processing method according to any one of claims 1-6.
PCT/CN2022/119581 2021-09-24 2022-09-19 Image processing method and apparatus, electronic device and storage medium WO2023045857A1 (en)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN202111123949.7A CN113808120A (en) 2021-09-24 2021-09-24 Image processing method, image processing device, electronic equipment and storage medium
CN202111123949.7 2021-09-24

Publications (1)

Publication Number Publication Date
WO2023045857A1 true WO2023045857A1 (en) 2023-03-30

Family

ID=78896581

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2022/119581 WO2023045857A1 (en) 2021-09-24 2022-09-19 Image processing method and apparatus, electronic device and storage medium

Country Status (2)

Country Link
CN (1) CN113808120A (en)
WO (1) WO2023045857A1 (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116703916A (en) * 2023-08-07 2023-09-05 山东正基药业有限公司 Washing water quality monitoring method based on image processing

Families Citing this family (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113808120A (en) * 2021-09-24 2021-12-17 维沃移动通信有限公司 Image processing method, image processing device, electronic equipment and storage medium
CN115408552B (en) * 2022-07-28 2023-05-26 深圳市磐鼎科技有限公司 Display adjustment method, device, equipment and storage medium
CN117596489A (en) * 2024-01-18 2024-02-23 荣耀终端有限公司 Image processing method, image processing apparatus, electronic device, and storage medium

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2011142471A (en) * 2010-01-06 2011-07-21 Canon Inc Image processing apparatus, control method, and program
JP2013031000A (en) * 2011-07-28 2013-02-07 Kyocera Document Solutions Inc Image processing program and image processing method
CN109358926A (en) * 2018-09-20 2019-02-19 珠海市君天电子科技有限公司 A kind of color setting method, device and electronic equipment
CN109783178A (en) * 2019-01-24 2019-05-21 北京字节跳动网络技术有限公司 A kind of color adjustment method of interface assembly, device, equipment and medium
CN112395030A (en) * 2019-08-16 2021-02-23 腾讯科技(深圳)有限公司 Page processing method and device, electronic device and storage medium
CN113808120A (en) * 2021-09-24 2021-12-17 维沃移动通信有限公司 Image processing method, image processing device, electronic equipment and storage medium

Family Cites Families (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US10460475B2 (en) * 2012-02-07 2019-10-29 Zencolor Global, Llc Normalization of color from a captured image into a universal digital color system for specification and matching
CN103106670B (en) * 2013-01-16 2015-06-24 西安理工大学 Automatic establishing and converting method for color models of computer input device
CN111062993B (en) * 2019-12-12 2023-09-26 广东智媒云图科技股份有限公司 Color combined painting image processing method, device, equipment and storage medium

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2011142471A (en) * 2010-01-06 2011-07-21 Canon Inc Image processing apparatus, control method, and program
JP2013031000A (en) * 2011-07-28 2013-02-07 Kyocera Document Solutions Inc Image processing program and image processing method
CN109358926A (en) * 2018-09-20 2019-02-19 珠海市君天电子科技有限公司 A kind of color setting method, device and electronic equipment
CN109783178A (en) * 2019-01-24 2019-05-21 北京字节跳动网络技术有限公司 A kind of color adjustment method of interface assembly, device, equipment and medium
CN112395030A (en) * 2019-08-16 2021-02-23 腾讯科技(深圳)有限公司 Page processing method and device, electronic device and storage medium
CN113808120A (en) * 2021-09-24 2021-12-17 维沃移动通信有限公司 Image processing method, image processing device, electronic equipment and storage medium

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116703916A (en) * 2023-08-07 2023-09-05 山东正基药业有限公司 Washing water quality monitoring method based on image processing
CN116703916B (en) * 2023-08-07 2023-10-20 山东正基药业有限公司 Washing water quality monitoring method based on image processing

Also Published As

Publication number Publication date
CN113808120A (en) 2021-12-17

Similar Documents

Publication Publication Date Title
WO2023045857A1 (en) Image processing method and apparatus, electronic device and storage medium
CN109191410B (en) Face image fusion method and device and storage medium
CN111654635A (en) Shooting parameter adjusting method and device and electronic equipment
CN109298912B (en) Theme color adjusting method and device, storage medium and electronic equipment
WO2023066294A1 (en) Icon display method and apparatus, and electronic device
US20230345113A1 (en) Display control method and apparatus, electronic device, and medium
CN109859283A (en) One kind taking color method, takes color device, electronic equipment and can storage medium
CN107203312B (en) Mobile terminal and picture rendering method and storage device thereof
CN113157357A (en) Page display method, device, terminal and storage medium
CN112702531B (en) Shooting method and device and electronic equipment
CN111105474A (en) Font drawing method and device, computer equipment and computer readable storage medium
US20230362293A1 (en) Method for Configuring Theme Color of Terminal Device, Apparatus, and Terminal Device
CN112184581B (en) Image processing method, device, computer equipment and medium
CN111901519B (en) Screen light supplement method and device and electronic equipment
CN107665694A (en) The luminance regulating method and system of display device
CN112541955A (en) Image processing method, device and equipment
CN113645476A (en) Picture processing method and device, electronic equipment and storage medium
CN113018856A (en) Image processing method, image processing device, electronic equipment and storage medium
CN112817555A (en) Volume control method and volume control device
CN112634155B (en) Image processing method, device, electronic equipment and storage medium
CN113379866A (en) Wallpaper setting method and device
CN113962840A (en) Image processing method, image processing device, electronic equipment and storage medium
CN113747076A (en) Shooting method and device and electronic equipment
JP2023526779A (en) Font file processing method, electronic device and readable storage medium
CN112511890A (en) Video image processing method and device and electronic equipment

Legal Events

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

Ref document number: 22871903

Country of ref document: EP

Kind code of ref document: A1