Image processing method and apparatus

By acquiring the grayscale, contour and dark side information of the image, images of different styles are generated, which solves the problem of cumbersome image processing in the existing technology and simplifies the image conversion process of electronic devices.

CN114170117BActive Publication Date: 2025-10-21VIVO MOBILE COMM CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202111141824.7
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-09-28
Publication Date
2025-10-21
Estimated Expiration
2041-09-28

AI Technical Summary

Technical Problem

In the prior art, when an electronic device converts an image into a comic style, it needs to identify each part and match models from a large number of models, resulting in a cumbersome processing process.

Method used

By obtaining the grayscale information, contour information and dark surface information of the image, images with different styles are generated to simplify the processing process.

Benefits of technology

There is no need to match models from a large number of models. Images of different styles can be generated directly through color value processing, which simplifies the processing flow of electronic devices.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114170117B_ABST
    Figure CN114170117B_ABST
Patent Text Reader

Abstract

The application discloses an image processing method and device, and belongs to the technical field of communication. The method comprises the following steps: acquiring gray information, contour line information and dark surface information of a first image, wherein the dark surface information is used for indicating a region with a color value less than or equal to a first threshold in the first image; and generating a second image based on the gray information, the contour line information and the dark surface information, wherein the second image and the first image are images with different styles.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application belongs to the field of communication technology, and specifically relates to an image processing method and device. Background Art

[0002] With the continuous development of communication technology, the functions of electronic devices are becoming more and more abundant. For example, electronic devices can process images stored in the electronic devices to obtain comic-style images.

[0003] Currently, when a user wants to convert an image (e.g., a person's image) into a comic-style image corresponding to that person, the user can trigger an electronic device to use an artificial intelligence (AI) algorithm to identify each part of the person's image (e.g., nose, eyes, legs). The electronic device can then determine a comic model corresponding to each part from a large number of comic models. The electronic device can then use the comic model corresponding to each part to process each part and synthesize the processed images to obtain the comic-style image corresponding to the person.

[0004] However, according to the above method, since the electronic device needs to identify each part in the image and determine the comic model corresponding to each part from a large number of comic models, and use different models to process different parts in the image before obtaining the comic-style image corresponding to the image, the process of image processing by the electronic device may be more cumbersome. Summary of the Invention

[0005] The purpose of the embodiments of the present application is to provide an image processing method and apparatus that can solve the problem that the image processing process of electronic devices is relatively complicated.

[0006] In a first aspect, an embodiment of the present application provides an image processing method, comprising: obtaining grayscale information, contour line information, and dark side information of a first image, the dark side information being used to indicate an area in the first image whose color value is less than or equal to a first threshold; generating a second image based on the grayscale information, contour line information, and dark side information, the second image being an image of a different style from the first image.

[0007] In second aspect, an embodiment of the present application provides an image processing device, which includes a processing module and a fusion module; the processing module is used to obtain grayscale information, contour line information and dark side information of a first image, and the dark side information is used to indicate an area in the first image whose color value is less than or equal to a first threshold; the fusion module is used to generate a second image based on the grayscale information, contour line information and dark side information, and the second image is an image of a different style from the first image.

[0008] In a third aspect, an embodiment of the present application provides an electronic device comprising a processor, a memory, and a program or instruction stored in the memory and executable on the processor, wherein the program or instruction, when executed by the processor, implements the steps of the method of the first aspect.

[0009] In a fourth aspect, an embodiment of the present application provides 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 method of the first aspect are implemented.

[0010] In a fifth aspect, an embodiment of the present application provides a chip, which includes a processor and a communication interface, wherein the communication interface is coupled to the processor, and the processor is used to run programs or instructions to implement the method of the first aspect.

[0011] In an embodiment of the present application, the grayscale information, contour line information, and dark surface information of the first image can be obtained, and the dark surface information is used to indicate the area in the first image whose color value is less than or equal to the first threshold value; and based on the grayscale information, contour line information, and dark surface information, a second image is generated, and the second image and the first image are images of different styles. Through this solution, since the electronic device can obtain the grayscale information, contour line information, and dark surface information of an image (such as the first image), and can generate another image (such as the second image) with a different style from the image based on the grayscale information, contour line information, and dark surface information, that is, the electronic device can obtain an image of another style by processing the color value of the image, without the need for the electronic device to determine the model corresponding to each part in the image from a large number of image models, and then use different models to process different parts in the image, as in traditional technology, thereby simplifying the process of image processing by the electronic device. BRIEF DESCRIPTION OF THE DRAWINGS

[0012] Figure 1 A schematic diagram of an image processing method provided in an embodiment of the present application;

[0013] Figure 2 One of the interface diagrams of the image processing method provided in the embodiment of the present application;

[0014] Figure 3 The second schematic diagram of the interface for applying the image processing method provided in the embodiment of the present application;

[0015] Figure 4 The third schematic diagram of the interface for applying the image processing method provided in the embodiment of the present application;

[0016] Figure 5 This is a fourth schematic diagram of an interface for applying the image processing method provided in an embodiment of the present application;

[0017] Figure 6The fifth interface diagram of the image processing method application provided in the embodiment of the present application;

[0018] Figure 7 A schematic diagram of an image processing device provided in an embodiment of the present application;

[0019] Figure 8 A schematic diagram of an electronic device provided in an embodiment of the present application;

[0020] Figure 9 A hardware diagram of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION

[0021] The following will be combined with the accompanying drawings in the embodiments of the present application to clearly describe the technical solutions in the embodiments of the present application. Obviously, the embodiments described are part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field are within the scope of protection of this application.

[0022] The terms "first," "second," and the like in the specification and claims of this application are used to distinguish similar objects and are not used to describe a particular order or precedence. It should be understood that the terms used in this manner are interchangeable where appropriate so that the embodiments of this application can be implemented in an order other than those illustrated or described herein. In addition, the term "and / or" in the specification and claims refers to at least one of the connected objects, and the character " / " generally indicates that the objects associated with each other are in an "or" relationship.

[0023] The image processing method and apparatus provided in the embodiments of the present application are described in detail below through specific embodiments and their application scenarios in conjunction with the accompanying drawings.

[0024] The image processing method provided in the embodiment of the present application can be applied to scenarios where the user needs to convert the style of an image.

[0025] For example, taking the example of an electronic device converting a landscape image (hereinafter referred to as image a, such as the first image in the embodiment of the present application) into a comic-style image corresponding to the landscape image (hereinafter referred to as image b, such as the second image in the embodiment of the present application), the electronic device can obtain the grayscale information of image a, the contour line information indicating the contour of the object in image a, and the information indicating the area in image a whose color value is less than or equal to (72, 72, 72) (such as the first threshold in the embodiment of the present application) (such as the dark side information in the embodiment of the present application), and can generate image b based on the above-mentioned information obtained, so that the electronic device can obtain the comic-style image b corresponding to image a by only processing the color value of image a, thereby simplifying the process of image processing by the electronic device.

[0026] Combine Figure 1 The embodiment of the present application provides an image processing method, which may include the following steps 101 and 102. The following is an example of an electronic device executing the method.

[0027] Step 101: The electronic device obtains grayscale information, contour line information, and dark surface information of a first image.

[0028] In the embodiment of the present application, the dark surface information can be used to indicate an area in the first image whose color value is less than or equal to a first threshold.

[0029] Optionally, in an embodiment of the present application, the grayscale information may be used to indicate the brightness of an object in the first image.

[0030] Optionally, in an embodiment of the present application, the above-mentioned contour line information can be used to indicate the contour of an object in the first image. For example, if the first image is a face image, the contour line information can be used to indicate the contour of a face in the face image.

[0031] Optionally, in the embodiment of the present application, the grayscale information, the contour line information and the dark surface information can be stored in the electronic device in the form of images / layers respectively.

[0032] Optionally, in an embodiment of the present application, the first image may be any image in the electronic device, or the first image may be any video frame image in any video in the electronic device.

[0033] The method for the electronic device to obtain the grayscale information, contour line information and dark surface information of the first image will be described in detail in the following embodiments. To avoid repetition, it will not be described here.

[0034] Step 102: The electronic device generates a second image based on the grayscale information, the contour line information, and the dark surface information.

[0035] In the embodiment of the present application, the second image and the first image are images of different styles.

[0036] For example, Figure 2 The image shown in (a) is the first image, as shown in Figure 2 The image shown in (b) is the second image.

[0037] It can be understood that in the embodiment of the present application, the color values ​​of the three channels (ie, R channel, G channel, and B channel) of each pixel in the second image are the same, ie, R=G=B.

[0038] Optionally, in an embodiment of the present application, the electronic device generates the second image based on the grayscale information, contour line information and dark side information. Specifically, the electronic device can fuse the images corresponding to the grayscale information, contour line information and dark side information of the first image to generate the second image.

[0039] It can be understood that the image corresponding to the grayscale information of the first image (hereinafter referred to as image 1) is an image generated based on the grayscale information, the image corresponding to the contour line information of the first image (hereinafter referred to as image 2) is an image generated based on the contour line information, and the image corresponding to the dark side information of the first image (hereinafter referred to as image 3) is an image generated based on the dark side information.

[0040] Optionally, in an embodiment of the present application, the electronic device may fuse the images corresponding to the grayscale information, the contour information, and the dark surface information, respectively, by performing a multiplication operation on the 8-bit per-channel color value in image 2 by the 8-bit per-channel color value in image 1 to obtain image 4. Since the 8-bit per-channel color value in the black area is 0, any multiplication thereof is 0, while the 8-bit per-channel color value in the white area is 1, any multiplication thereof is the original color value itself. In this way, the electronic device may filter out the white areas in image 2 and image 1 to obtain image 4. Then, the electronic device may multiply the 8-bit per-channel color value in image 3 by the 8-bit per-channel color value in image 4 to obtain a second image.

[0041] In the image processing method provided in the embodiment of the present application, since the electronic device can obtain the grayscale information, contour line information and dark side information of an image (for example, a first image), and can generate another image (for example, a second image) with a style different from the image based on the grayscale information, contour line information and dark side information, that is, the electronic device can obtain an image of another style by processing the color value of the image, without the need for the electronic device to determine the model corresponding to each part in the image from a large number of image models, and then use different models to process different parts of the image as in traditional technology, thereby simplifying the process of image processing by the electronic device.

[0042] Optionally, in the embodiment of the present application, after the above step 102, the image processing method provided in the embodiment of the present application may further include the following step 103.

[0043] Step 103: The electronic device adds image material to at least one area in the second image.

[0044] In the embodiment of the present application, the color value of each area in the at least one area is greater than or equal to the average color value of the second image.

[0045] For example, assuming that the average value of the color values ​​of the second image is (130, 130, 130), the electronic device may add image material to each region of the second image having a color value greater than or equal to (130, 130, 130).

[0046] It can be understood that the at least one area mentioned above can be called a highlight area of ​​the second image.

[0047] Optionally, in an embodiment of the present application, the above-mentioned image material may be an image material specified / selected by a user.

[0048] Optionally, in an embodiment of the present application, the above-mentioned image material may be any image that can enhance the style of the second image. For example, if the style of the second image is a comic style, the image material may be a grid material.

[0049] For example, Figure 3 As shown, assuming the second image is Figure 3 If the image shown in (a) is shown in FIG, then the electronic device can obtain the following after adding image material to at least one area of ​​the second image: Figure 3 The image shown in (b).

[0050] In the embodiment of the present application, since the electronic device can add image materials to the highlight area of ​​an image, thereby enhancing the stylization of the image, the effect of the electronic device in processing the image can be improved.

[0051] Hereinafter, methods for the electronic device to obtain the grayscale information of the first image, the contour line information of the first image, and the dark surface information of the first image will be described in detail respectively.

[0052] 1. The electronic device obtains grayscale information of a first image.

[0053] Optionally, in an embodiment of the present application, the electronic device may obtain the grayscale information of the first image through the following steps A, B, and C.

[0054] Step A: The electronic device performs decolorization processing on the first image to obtain a decolorized image.

[0055] Optionally, in the embodiment of the present application, the decolorized image may be a grayscale image corresponding to the first image.

[0056] Optionally, in the embodiment of the present application, the decolorization processing may be for the electronic device to convert each color value in the first image into a grayscale color value corresponding to each color value.

[0057] Step B: The electronic device performs inversion processing on the decolorized image to obtain a third image.

[0058] Optionally, in the embodiment of the present application, the inversion processing may be that the electronic device inverts the hue of the desaturated image, converting the positive black and white image into a negative image, that is, the third image is an image with a hue opposite to that of the desaturated image.

[0059] Step C: The electronic device calculates the color value of the third image and the color value of the desaturated image to obtain grayscale information in the first image.

[0060] Optionally, in an embodiment of the present application, the electronic device calculates the color values ​​of the third image and the color values ​​of the decolored image, and can add the 8-bit per-channel color values ​​of the third image and the 8-bit per-channel color values ​​of the decolored image (i.e., fuse the third image and the decolored image) to obtain a new 8-bit per-channel color value result, so that the electronic device can make the color values ​​of the image after the fusion of the third image and the decolored image except for pure black become brighter, so as to strip out the grayscale information between the black and white values.

[0061] For example, Figure 4 As shown, assuming the first image is Figure 4 The image shown in (a) in FIG, then the image generated based on the grayscale information of the first image can be as follows Figure 4 The image shown in (b).

[0062] Optionally, in an embodiment of the present application, before the above step C, the method for the electronic device to obtain the grayscale information of the first image may further include the following step D.

[0063] Step D: The electronic device performs minimum value processing on the color values ​​of the third image.

[0064] Optionally, in an embodiment of the present application, the minimum value processing may be that the electronic device replaces the color value of each pixel grid in the third image with the color value of a pixel located around the pixel and having the minimum brightness (ie, color value).

[0065] Optionally, in an embodiment of the present application, each pixel grid may include one or more pixels.

[0066] Optionally, in an embodiment of the present application, the pixel grid may be retained as a square.

[0067] Optionally, in an embodiment of the present application, the calculation formula for the unit pixel grid is lA*wA / 100000*2, where lA is the length of the image and wA is the width of the image.

[0068] In the embodiment of the present application, since the electronic device can perform minimum value processing on an image that has been decolorized and inverted, the grayscale information of the image can be obtained more accurately, thereby further improving the effect of the electronic device in processing images.

[0069] In an embodiment of the present application, since the electronic device can decolorize an image and invert the decolorized image, and then calculate the color value of the decolorized image and the color value of the inverted image, the grayscale information of the image can be obtained, so that the electronic device can further generate a second image based on the grayscale information, thereby further simplifying the steps of the electronic device to process the image.

[0070] 2. The electronic device obtains contour line information of the first image.

[0071] Optionally, in the embodiment of the present application, the electronic device may obtain the contour line information of the first image through the following step E.

[0072] In step E, the electronic device performs high-contrast retention processing on the color values ​​of the first image, and uses a second threshold value to perform threshold processing on the color values ​​after the high-contrast retention processing to obtain contour line information.

[0073] Optionally, in an embodiment of the present application, high-contrast retention processing can enable the electronic device to automatically retrieve parts of the image that have a larger contrast with the surrounding area and retain the unit pixel value, while filling other areas with smaller contrast with grayscale.

[0074] Optionally, in the embodiment of the present application, the high contrast retention processing can extract contour line information of the first image.

[0075] In an embodiment of the present application, threshold processing can enable an electronic device to change the color value of a pixel in an image whose color value is lower than a threshold to (0, 0, 0), even if the pixel appears black; and change the color value of a pixel in an image whose color value is higher than a threshold to (255, 255, 255), even if the pixel appears white.

[0076] Optionally, in an embodiment of the present application, the electronic device uses a second threshold to perform threshold processing on the color value after high-contrast retention processing, so that the electronic device adjusts the color value of the area in the image after high-contrast retention processing whose color value is less than or equal to the second threshold to (0, 0, 0), so that it appears black; and adjusts the color value of the area in the image after high-contrast retention processing whose color value is greater than the second threshold to (255, 255, 255), so that it appears white, so as to convert the image corresponding to the extracted contour line information into a line drawing style image with a white background and black lines.

[0077] Optionally, in an embodiment of the present application, the second threshold value may be a grayscale value arbitrarily set by the user according to actual usage requirements. For example, the second threshold value may be (108, 108, 108), that is, the first threshold value corresponds to 108 color levels.

[0078] For example, Figure 5 As shown, assuming the first image is Figure 5 If the image is shown in (a) in FIG, then the image generated by the electronic device according to the contour line information of the acquired first image can be Figure 5 Furthermore, the electronic device fuses the grayscale information of the first image with the contour line information to form the effect diagram shown in (b). Figure 5 The image shown in (c) in .

[0079] In an embodiment of the present application, since the electronic device can perform high-contrast retention processing on the color values ​​of an image and use a second threshold to perform threshold processing on the color values ​​after high-contrast processing, the contour line information of the image can be obtained, so that the electronic device can further generate a second image based on the contour line information, thereby further simplifying the steps of the electronic device to process the image.

[0080] 3. The electronic device obtains dark side information of the first image.

[0081] Optionally, in the embodiment of the present application, the electronic device may obtain the dark side information of the first image through the following step F.

[0082] In step F, the electronic device performs threshold processing on the color value of the first image using the first threshold to obtain dark surface information.

[0083] In the embodiment of the present application, the first threshold and the second threshold may be the same or different.

[0084] Optionally, in an embodiment of the present application, the first threshold may be a color value arbitrarily set by the user according to actual usage requirements. For example, the first threshold may be (72, 72, 72), that is, the first threshold corresponds to 72 color levels.

[0085] Optionally, in an embodiment of the present application, the electronic device may perform threshold processing on the color value of the first image using a first threshold value, such that: the electronic device adjusts the color value of the area in the first image whose color value is lower than the first threshold value to (0, 0, 0) so that it appears black; and adjusts the color value of the area in the first image whose color value is higher than the first threshold value to (255, 255, 255) so that it appears white, so as to obtain dark surface information in the first image.

[0086] For example, Figure 6 As shown, assuming the first image is Figure 6 The image shown in (a) in FIG, then the image generated by the electronic device according to the acquired dark side information can be Figure 6 The image shown in (b).

[0087] In an embodiment of the present application, since the electronic device can use a first threshold to perform threshold processing on the color value of an image, the dark side information in the image can be obtained, so that the electronic device can further generate a second image based on the dark side information, thereby further simplifying the steps of the electronic device to process the image.

[0088] It should be noted that the image processing method provided in the embodiments of the present application can be executed by an image processing device or a control module in the image processing device for executing the image processing method. In the embodiments of the present application, the image processing device provided in the embodiments of the present application is described by taking the image processing device executing the image processing method as an example.

[0089] Combine Figure 7 An embodiment of the present application provides an image processing device 60, which may include a processing module 61 and a fusion module 62. The processing module 61 may be configured to obtain grayscale information, contour information, and dark surface information of a first image, where the dark surface information indicates areas in the first image whose color values ​​are less than or equal to a first threshold. The fusion module 62 may be configured to generate a second image based on the grayscale information, contour information, and dark surface information, where the second image is of a different style than the first image.

[0090] In one possible implementation, the processing module 61 can be specifically used to decolorize the first image to obtain a decolorized image; and invert the decolorized image to obtain a third image; and calculate the color value of the third image and the color value of the decolorized image to obtain grayscale information.

[0091] In a possible implementation, the processing module 61 may be further configured to perform minimum value processing on the color value of the third image before adding the color value of the third image to the color value of the desaturated image to obtain grayscale information.

[0092] In a possible implementation, the processing module 61 may be specifically configured to sequentially perform high-contrast retention processing on the color values ​​of the first image, and perform threshold processing on the color values ​​after the high-contrast retention processing using a second threshold value to obtain contour line information.

[0093] In a possible implementation, the processing module 61 may be configured to perform threshold processing on the color value of the first image using a first threshold to obtain dark surface information.

[0094] In one possible implementation, the image processing device 60 may further include an adding module. The adding module may be configured to add image material to at least one region of the second image after the fusion module 62 fuses the grayscale information, contour information, and dark surface information to obtain the second image, wherein the color value of each region in the at least one region is greater than or equal to the average color value of the second image.

[0095] In the image processing device provided in the embodiment of the present application, since the image processing device can obtain the grayscale information, contour line information and dark surface information in an image (for example, a first image), and can generate another image (for example, a second image) with a style different from the image based on the grayscale information, contour line information and dark surface information, that is, the image processing device can obtain an image of other styles by processing the color values ​​of the image, without the need for electronic equipment to determine the model corresponding to each part in the image from a large number of image models, and then use different models to process different parts of the image as in traditional technologies, the process of image processing by the image processing device can be simplified.

[0096] The beneficial effects of various implementations in this embodiment can be specifically referred to the beneficial effects of the corresponding implementations in the above method embodiment. To avoid repetition, they will not be described here.

[0097] The image processing device in the embodiments of the present application can be a device, or a component, integrated circuit, or chip in a terminal. The device can be a mobile electronic device or a non-mobile electronic device. For example, the mobile electronic device can be a mobile phone, a tablet computer, a laptop computer, a PDA, an in-vehicle electronic device, a wearable device, an ultra-mobile personal computer (UMPC), a netbook, or a personal digital assistant (PDA), etc. The non-mobile electronic device can be a server, a network attached storage (NAS), a personal computer (PC), a television (TV), an ATM, or an kiosks, etc., which are not specifically limited in the embodiments of the present application.

[0098] The image processing device in the embodiment of the present application may be a device having an operating system. The operating system may be an Android operating system, an iOS operating system, or other possible operating systems, which are not specifically limited in the embodiment of the present application.

[0099] The image processing device provided in the embodiment of the present application can achieve Figures 1 to 6 To avoid repetition, the various processes implemented in the method embodiment are not described here.

[0100] like Figure 8As shown, an embodiment of the present application also provides an electronic device 200, including a processor 202, a memory 201, and a program or instruction stored in the memory 201 and executable on the processor 202. When the program or instruction is executed by the processor 202, each process of the above-mentioned image processing method embodiment is implemented, and the same technical effect can be achieved. To avoid repetition, it will not be described here.

[0101] It should be noted that the electronic devices in the embodiments of the present application include the mobile electronic devices and non-mobile electronic devices mentioned above.

[0102] Figure 9 A schematic diagram of the hardware structure of an electronic device implementing an embodiment of the present application.

[0103] The electronic device 1000 includes but is not limited to components such as a radio frequency unit 1001 , a network module 1002 , an audio output unit 1003 , an input unit 1004 , a sensor 1005 , a display unit 1006 , a user input unit 1007 , an interface unit 1008 , a memory 1009 , and a processor 1010 .

[0104] Those skilled in the art will understand that the electronic device 1000 may also include a power source (such as a battery) to power each component, and the power source may be logically connected to the processor 1010 through a power management system, thereby implementing functions such as charging, discharging, and power consumption management through the power management system. Figure 9 The electronic device structure shown in the figure does not constitute a limitation on the electronic device. The electronic device may include more or fewer components than shown in the figure, or combine certain components, or arrange the components differently, which will not be repeated here.

[0105] Processor 1010 may be configured to obtain grayscale information, contour information, and dark surface information of a first image, where the dark surface information indicates regions in the first image whose color values ​​are less than or equal to a first threshold. Processor 1010 may also be configured to generate a second image based on the grayscale information, contour information, and dark surface information, where the second image has a different style than the first image.

[0106] In one possible implementation, the processor 1010 can be specifically used to decolorize the first image to obtain a decolorized image; and invert the decolorized image to obtain a third image; and calculate the color value of the third image and the color value of the decolorized image to obtain grayscale information.

[0107] In a possible implementation, the processor 1010 may be further configured to perform minimum value processing on the color value of the third image before adding the color value of the third image to the color value of the decolored image to obtain grayscale information.

[0108] In a possible implementation, the processor 1010 may be specifically configured to sequentially perform high-contrast retention processing on the color values ​​of the first image, and perform threshold processing on the color values ​​after the high-contrast retention processing using a second threshold value to obtain contour line information.

[0109] In a possible implementation, the processor 1010 may be configured to perform threshold processing on the color value of the first image using a first threshold to obtain dark surface information.

[0110] In one possible implementation, the processor 1010 can also be used to add image material to at least one area in the second image after fusing the grayscale information, contour information and dark surface information to obtain the second image, and the color value of each area in the at least one area is greater than or equal to the average color value of the second image.

[0111] In the electronic device provided in the embodiment of the present application, since the electronic device can obtain the grayscale information, contour line information and dark side information in an image (for example, a first image), and can generate another image (for example, a second image) with a style different from the image based on the grayscale information, contour line information and dark side information, that is, the electronic device can obtain an image of another style by processing the color value of the image, without the need for the electronic device to determine the model corresponding to each part in the image from a large number of image models, and then use different models to process different parts of the image as in traditional technology, thereby simplifying the process of image processing by the electronic device.

[0112] The beneficial effects of various implementations in this embodiment can be specifically referred to the beneficial effects of the corresponding implementations in the above method embodiment. To avoid repetition, they will not be described here.

[0113] It should be understood that in an embodiment of the present application, the input unit 1004 may include a graphics processing unit (GPU) 10041 and a microphone 10042, and the graphics processor 10041 processes the image data of a static picture or video obtained by an image capture device (such as a camera) in a video capture mode or an image capture mode. The display unit 1006 may include a display panel 10061, and the display panel 10061 may be configured in the form of a liquid crystal display, an organic light emitting diode, etc. The user input unit 1007 includes a touch panel 10071 and other input devices 10072. The touch panel 10071 is also called a touch screen. The touch panel 10071 may include two parts: a touch detection device and a touch controller. Other input devices 10072 may include but are not limited to a physical keyboard, function keys (such as volume control keys, switch keys, etc.), a trackball, a mouse, and an operating stick, which will not be repeated here. The memory 1009 can be used to store software programs and various data, including but not limited to applications and operating systems. The processor 1010 may integrate an application processor and a modem processor, wherein the application processor mainly processes the operating system, user interface, and application programs, and the modem processor mainly processes wireless communications. It is understood that the modem processor may not be integrated into the processor 1010.

[0114] An embodiment of the present application also provides a readable storage medium, which stores a program or instruction. When the program or instruction is executed by a processor, the various processes of the above-mentioned image processing method embodiment are implemented and the same technical effect can be achieved. To avoid repetition, it will not be repeated here.

[0115] The processor is the processor in the electronic device in the above embodiment. The readable storage medium includes a computer-readable storage medium, such as a computer read-only memory (ROM), random access memory (RAM), a magnetic disk, or an optical disk.

[0116] An embodiment of the present application further provides a chip, which includes a processor and a communication interface, the communication interface and the processor are coupled, and the processor is used to run programs or instructions to implement the various processes of the above-mentioned image processing method embodiment, and can achieve the same technical effect. To avoid repetition, it will not be repeated here.

[0117] It should be understood that the chip mentioned in the embodiments of the present application can also be called a system-level chip, a system chip, a chip system or a system-on-chip chip, etc.

[0118] It should be noted that, in this article, the terms "comprise", "include" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device comprising a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, an element defined by the statement "comprises a ..." does not exclude the presence of other identical elements in the process, method, article or device comprising the element. In addition, it should be noted 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 the opposite order according to the functions involved. For example, the described method may be performed in an order different from that described, and various steps may also be added, omitted, or combined. In addition, the features described with reference to certain examples may be combined in other examples.

[0119] Through the description of the above implementation methods, those skilled in the art can clearly understand that the above-mentioned embodiment methods can be implemented by means of software plus the necessary general hardware platform, and of course can also be implemented by hardware, but in many cases the former is a better implementation method. Based on this understanding, the technical solution of the present application is essentially or the part that contributes to the prior art can be embodied in the form of a computer software product, which is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk), including a number of instructions for enabling a terminal (which can be a mobile phone, computer, server, or network device, etc.) to execute the methods described in each embodiment of the present application.

[0120] The embodiments of the present application are described above in conjunction with the accompanying drawings, but the present application is not limited to the above-mentioned specific implementation methods. The above-mentioned specific implementation methods are merely illustrative and not restrictive. Under the guidance of this application, ordinary technicians in this field can also make many forms without departing from the purpose of this application and the scope of protection of the claims, all of which are within the protection of this application.

Claims

1. An image processing method, characterized in that: The method comprises: Acquire grayscale information, contour line information, and dark surface information of the first image, where the dark surface information is used to indicate an area in the first image whose color value is less than or equal to a first threshold; generating a second image based on the grayscale information, the contour line information, and the dark surface information, wherein the second image and the first image are images of different styles; Acquiring contour line information in the first image includes: performing high-contrast retention processing on the color values ​​of the first image, and performing threshold processing on the color values ​​after the high-contrast retention processing using a second threshold value to obtain the contour line information; Acquiring grayscale information in the first image includes: performing decolorization processing on the first image to obtain a decolorized image; performing an inversion process on the decolorized image to obtain a third image; The color value of the third image and the color value of the decolored image are calculated to obtain the grayscale information.

2. The method according to claim 1, characterized in that Acquiring dark surface information in the first image includes: The first threshold is used to perform threshold processing on the color value of the first image to obtain the dark surface information.

3. The method according to claim 1, characterized in that After generating the second image based on the grayscale information, the contour line information, and the dark surface information, the method further includes: Image material is added to at least one area in the second image, wherein a color value of each area in the at least one area is greater than or equal to an average value of color values ​​of the second image.

4. An image processing device, characterized in that The device includes a processing module and a fusion module; The processing module is configured to obtain grayscale information, contour line information, and dark surface information of the first image, wherein the dark surface information is used to indicate an area in the first image whose color value is less than or equal to a first threshold value; The fusion module is configured to generate a second image based on the grayscale information, the contour information, and the dark surface information obtained by the processing module, wherein the second image is an image of a different style from the first image; The processing module is specifically configured to perform high-contrast retention processing on the color values ​​of the first image, and perform threshold processing on the color values ​​after the high-contrast retention processing using a second threshold value to obtain the contour line information; The processing module is specifically configured to perform decolorization processing on the first image to obtain a decolorized image; and perform inversion processing on the decolorized image to obtain a third image; and calculate the color value of the third image and the color value of the decolorized image to obtain the grayscale information.

5. The device according to claim 4, characterized in that The processing module is specifically configured to perform threshold processing on the color value of the first image using the first threshold to obtain the dark surface information.

6. The device according to claim 4, characterized in that The device further comprises an adding module; The adding module is used to add image material to at least one area in the second image after the fusion module generates the second image based on the grayscale information, the contour line information and the dark surface information, and the color value of each area in the at least one area is greater than or equal to the average color value of the second image.

Citation Information

Patent Citations

  • Image processing method and device, electronic equipment and computer readable storage medium

    CN111028137A

  • Information processor and program thereof

    JP2014206849A