CN114529474A - Image processing method and processing device, electronic device and readable storage medium - Google Patents
Image processing method and processing device, electronic device and readable storage medium Download PDFInfo
- Publication number
- CN114529474A CN114529474A CN202210164195.8A CN202210164195A CN114529474A CN 114529474 A CN114529474 A CN 114529474A CN 202210164195 A CN202210164195 A CN 202210164195A CN 114529474 A CN114529474 A CN 114529474A
- Authority
- CN
- China
- Prior art keywords
- image
- processed
- pixels
- curve
- brightness
- Prior art date
- Legal status (The legal status 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 status listed.)
- Granted
Links
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T5/00—Image enhancement or restoration
- G06T5/77—Retouching; Inpainting; Scratch removal
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T5/00—Image enhancement or restoration
- G06T5/40—Image enhancement or restoration using histogram techniques
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T5/00—Image enhancement or restoration
- G06T5/90—Dynamic range modification of images or parts thereof
- G06T5/94—Dynamic range modification of images or parts thereof based on local image properties, e.g. for local contrast enhancement
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T2207/00—Indexing scheme for image analysis or image enhancement
- G06T2207/20—Special algorithmic details
- G06T2207/20016—Hierarchical, coarse-to-fine, multiscale or multiresolution image processing; Pyramid transform
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T2207/00—Indexing scheme for image analysis or image enhancement
- G06T2207/30—Subject of image; Context of image processing
- G06T2207/30196—Human being; Person
- G06T2207/30201—Face
Landscapes
- Physics & Mathematics (AREA)
- General Physics & Mathematics (AREA)
- Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- Image Processing (AREA)
- Image Analysis (AREA)
- Facsimile Image Signal Circuits (AREA)
Abstract
本申请公开了一种图像处理方法和处理装置、电子设备和可读存储介质。图像处理方法,包括:获取原始图像;建立原始图像对应的图像金字塔;将图像金字塔的低频图,确定为待处理图像;对待处理图像进行模糊化处理,得到第一图像;根据待处理图像和第一图像,生成第二图像;根据待处理图像的直方图分布,确定对应的第一曲线,其中,第一曲线用于提高或降低第二图像中第一目标区域的亮度值;基于第一曲线处理第二图像;在处理后的第二图像满足预设条件的情况下,输出处理后的第二图像。
The present application discloses an image processing method and processing device, an electronic device and a readable storage medium. An image processing method includes: acquiring an original image; establishing an image pyramid corresponding to the original image; determining a low-frequency map of the image pyramid as an image to be processed; performing a blurring process on the image to be processed to obtain a first image; An image is generated, and a second image is generated; according to the histogram distribution of the image to be processed, a corresponding first curve is determined, wherein the first curve is used to increase or decrease the brightness value of the first target area in the second image; based on the first curve Process the second image; if the processed second image satisfies the preset condition, output the processed second image.
Description
技术领域technical field
本申请属于图像处理技术领域,具体涉及一种图像处理方法和处理装置、电子设备和可读存储介质。The present application belongs to the technical field of image processing, and in particular relates to an image processing method and processing device, an electronic device and a readable storage medium.
背景技术Background technique
在相关技术中,算法磨皮是美颜中的基础效果,现有的传统磨皮算法一般都采用分频的方式进行滤波,分频滤波算法难以兼容在保持人脸结构立体的情况下对底层瑕疵亮度的均匀化,导致磨皮效果不好。In the related art, algorithmic skin resurfacing is the basic effect in beauty. The existing traditional skin resurfacing algorithms generally use frequency division for filtering. The uniformity of the brightness of the flaws results in a poor microdermabrasion effect.
发明内容SUMMARY OF THE INVENTION
本申请实施例的目的是提供一种图像处理方法和处理装置、电子设备和可读存储介质,能够解决磨皮效果不好的问题。The purpose of the embodiments of the present application is to provide an image processing method and processing device, an electronic device and a readable storage medium, which can solve the problem of poor skin grinding effect.
第一方面,本申请实施例提供了一种图像处理方法,包括:In a first aspect, an embodiment of the present application provides an image processing method, including:
获取原始图像;get the original image;
建立原始图像对应的图像金字塔;Build an image pyramid corresponding to the original image;
将图像金字塔的低频图,确定为待处理图像;Determine the low-frequency map of the image pyramid as the image to be processed;
对待处理图像进行模糊化处理,得到第一图像;Blur the image to be processed to obtain a first image;
根据待处理图像和第一图像,生成第二图像;generating a second image according to the to-be-processed image and the first image;
根据待处理图像的直方图分布,确定对应的第一曲线,其中,第一曲线用于提高或降低第二图像中第一目标区域的亮度值;Determine a corresponding first curve according to the histogram distribution of the image to be processed, wherein the first curve is used to increase or decrease the brightness value of the first target area in the second image;
基于第一曲线处理第二图像;processing the second image based on the first curve;
在处理后的第二图像满足预设条件的情况下,输出处理后的第二图像。In the case that the processed second image satisfies the preset condition, the processed second image is output.
第二方面,本申请实施例提供了一种图像处理装置,包括:In a second aspect, an embodiment of the present application provides an image processing apparatus, including:
获取模块,用于获取原始图像;The acquisition module is used to acquire the original image;
建立模块,用于建立原始图像对应的图像金字塔;A building module is used to build an image pyramid corresponding to the original image;
确定模块,用于将图像金字塔的低频图,确定为待处理图像;A determination module, used to determine the low-frequency map of the image pyramid as the image to be processed;
处理模块,用于对待处理图像进行模糊化处理,得到第一图像;a processing module, used for blurring the to-be-processed image to obtain a first image;
生成模块,用于根据待处理图像和第一图像,生成第二图像;a generating module for generating a second image according to the to-be-processed image and the first image;
确定模块,还用于根据待处理图像的直方图分布,确定对应的第一曲线,其中,第一曲线用于提高或降低第二图像中第一目标区域的亮度值;The determining module is further configured to determine the corresponding first curve according to the histogram distribution of the image to be processed, wherein the first curve is used to increase or decrease the brightness value of the first target area in the second image;
处理模块,还用于基于第一曲线处理第二图像;a processing module, further configured to process the second image based on the first curve;
输出模块,用于在处理后的第二图像满足预设条件的情况下,输出处理后的第二图像。The output module is configured to output the processed second image under the condition that the processed second image satisfies the preset condition.
第三方面,本申请实施例提供了一种电子设备,包括处理器和存储器,存储器存储可在处理器上运行的程序或指令,程序或指令被处理器执行时实现如第一方面的方法的步骤。In a third aspect, embodiments of the present application provide an electronic device, including a processor and a memory, where the memory stores programs or instructions that can be run on the processor, and when the programs or instructions are executed by the processor, the method of the first aspect is implemented step.
第四方面,本申请实施例提供了一种可读存储介质,该可读存储介质上存储程序或指令,该程序或指令被处理器执行时实现如第一方面的方法的步骤。In a fourth aspect, an embodiment of the present application provides a readable storage medium, where a program or an instruction is stored on the readable storage medium, and when the program or instruction is executed by a processor, the steps of the method of the first aspect are implemented.
第五方面,本申请实施例提供了一种芯片,该芯片包括处理器和通信接口,该通信接口和该处理器耦合,该处理器用于运行程序或指令,实现如第一方面的方法的步骤。In a fifth aspect, an 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 configured to run a program or an instruction to implement the steps of the method of the first aspect .
第六方面,本申请实施例提供一种计算机程序产品,该程序产品被存储在存储介质中,该程序产品被至少一个处理器执行以实现如第一方面所述的方法。In a sixth aspect, an embodiment of the present application provides a computer program product, where the program product is stored in a storage medium, and the program product is executed by at least one processor to implement the method according to the first aspect.
本申请实施例通过基于对原始图像的图像金字塔,确定待处理图像,并进一步对待处理图像进行Blur(模糊化)处理,基于处理前后的图片,确定待提亮的mask(遮罩)区域,并基于原待处理图像的直方图分布的均匀程度,确定用于对mask区域进行提亮处理的第一区域,基于该第一曲线,对待提亮的mask区域进行提亮处理,从而能够有效提亮人脸图像中的暗部区域,如斑点、伤疤等区域,该处理不会对人脸增提进行提亮,因此不会伤害人脸的立体结构,且无需利用AI算法,对设备性能的占用和开销均较小,实现了在保持人脸结构立体的情况下,实现对瑕疵部分亮度的均匀化,提高了磨皮效果。The embodiment of the present application determines the image to be processed based on the image pyramid of the original image, and further performs Blur (blur) processing on the image to be processed, and determines the mask area to be brightened based on the pictures before and after processing, and Based on the uniformity of the histogram distribution of the original image to be processed, determine the first area for brightening the mask area, and based on the first curve, perform brightening processing on the mask area to be brightened, so as to effectively brighten The dark areas in the face image, such as spots, scars and other areas, will not be brightened by the enhancement of the face, so the three-dimensional structure of the face will not be damaged, and there is no need to use the AI algorithm, which will occupy and reduce the performance of the device. The overhead is relatively small, which realizes the uniformity of the brightness of the flawed part while maintaining the three-dimensional structure of the face, and improves the skin resurfacing effect.
附图说明Description of drawings
图1示出了根据本申请实施例的图像处理方法流程图;FIG. 1 shows a flowchart of an image processing method according to an embodiment of the present application;
图2示出了根据本申请实施例的图像处理方法的算法示意图;FIG. 2 shows a schematic diagram of an algorithm of an image processing method according to an embodiment of the present application;
图3示出了根据本申请实施例的图像处理装置的结构框图;3 shows a structural block diagram of an image processing apparatus according to an embodiment of the present application;
图4示出了根据本申请实施例的电子设备的结构框图;FIG. 4 shows a structural block diagram of an electronic device according to an embodiment of the present application;
图5为实现本申请实施例的一种电子设备的硬件结构示意图。FIG. 5 is a schematic diagram of a hardware structure of an electronic device implementing an embodiment of the present application.
具体实施方式Detailed ways
下面将结合本申请实施例中的附图,对本申请实施例中的技术方案进行清楚地描述,显然,所描述的实施例是本申请一部分实施例,而不是全部的实施例。基于本申请中的实施例,本领域普通技术人员获得的所有其他实施例,都属于本申请保护的范围。The technical solutions in the embodiments of the present application will be clearly described below with reference to the accompanying 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 the embodiments. Based on the embodiments in this application, all other embodiments obtained by those of ordinary skill in the art fall within 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 is to be understood that the data so used are interchangeable under appropriate circumstances so that the embodiments of the present application can be practiced in sequences other than those illustrated or described herein, and distinguish between "first", "second", etc. The objects are usually of one type, and the number of objects is not limited. For example, the first object may be one or more than one. In addition, "and/or" in the description and claims indicates at least one of the connected objects, and the character "/" generally indicates that the associated objects are in an "or" relationship.
下面结合附图,通过具体的实施例及其应用场景对本申请实施例提供的图像处理方法和处理装置、电子设备和可读存储介质进行详细地说明。The image processing method and processing apparatus, electronic device, and readable storage medium provided by the embodiments of the present application will be described in detail below with reference to the accompanying drawings through specific embodiments and application scenarios thereof.
在本申请的一些实施例中,提供了一种图像处理方法,图1示出了根据本申请实施例的图像处理方法流程图,如图1所示,方法包括:In some embodiments of the present application, an image processing method is provided. FIG. 1 shows a flowchart of an image processing method according to an embodiment of the present application. As shown in FIG. 1 , the method includes:
步骤102,获取原始图像;
步骤104,建立原始图像对应的图像金字塔;
步骤106,将图像金字塔的低频图,确定为待处理图像;
步骤108,对待处理图像进行模糊化处理,得到第一图像;
步骤110,根据待处理图像和第一图像,生成第二图像;
步骤112,根据待处理图像的直方图分布,确定对应的第一曲线;
在步骤112中,第一曲线用于提高或降低第二图像中第一目标区域的亮度值;In
步骤114,基于第一曲线处理第二图像;
步骤116,在处理后的第二图像满足预设条件的情况下,输出处理后的第二图像。Step 116 , if the processed second image satisfies the preset condition, output the processed second image.
在本申请实施例中,原始图像,即输入算法图像,具体为用户选择的需要进行美颜处理的图像。由于原始图像的分辨率、图像尺寸很大,因此在接收到原始图像之后,首先,建立原始图像对应的图像金字塔。In the embodiment of the present application, the original image, that is, the input algorithm image, is specifically an image selected by the user and needs to be processed for beauty. Since the resolution and size of the original image are large, after the original image is received, first, an image pyramid corresponding to the original image is established.
图像金字塔具体是分辨率逐步降低的图像集合,图像所处的层级越高,图像尺寸越小,分辨率越低。根据图像金字塔降低原始图像的尺寸和分辨率,能够有效减少磨皮算法对设备性能的开销,提高磨皮效率。Specifically, the image pyramid is a collection of images whose resolution is gradually reduced. The higher the level of the image, the smaller the image size and the lower the resolution. Reducing the size and resolution of the original image according to the image pyramid can effectively reduce the performance overhead of the microdermabrasion algorithm and improve the microdermabrasion efficiency.
具体地,可以选取图像金字塔中从顶端开始的第四层图像,作为待处理图像,有利于减少磨皮算法的性能开销,同时保留细节。Specifically, the fourth layer image from the top of the image pyramid can be selected as the image to be processed, which is beneficial to reduce the performance overhead of the microdermabrasion algorithm while preserving the details.
其中,待处理图像具体为人脸图像,在接收到待处理图像后,首先,对待处理图像进行模糊化处理,具体地,可通过对待处理图像做Blur处理,从而进行模糊化。其中,Blur处理的处理面积可以是待处理图像中,人脸部分面积的四分之一。进行Blur处理后,得到与待处理图像对应的、模糊化的第一图像。根据第一图像和模糊化处理前的待处理图像,得到第二图像,该第二图像,即是待提亮处理的遮罩(mask)区域。The image to be processed is specifically a face image. After the image to be processed is received, first, the image to be processed is blurred. Specifically, the image to be processed can be blurred by performing Blur processing. The processing area of the Blur processing may be a quarter of the area of the face part in the image to be processed. After performing Blur processing, a first blurred image corresponding to the image to be processed is obtained. According to the first image and the to-be-processed image before the blurring process, a second image is obtained, and the second image is the mask area to be brightened.
进一步地,基于待处理图像的直方图分布,具体基于待处理图像的直方图分布的均匀程度,结合预设的经验映射关系,确定对应的第一曲线,该第一曲线具体是用于调节第二图像中的第一目标区域,也即待提亮处理的mask区域的亮度的曲线。Further, based on the distribution of the histogram of the image to be processed, specifically based on the uniformity of the distribution of the histogram of the image to be processed, combined with a preset empirical mapping relationship, a corresponding first curve is determined, and the first curve is specifically used to adjust the first curve. The first target area in the two images, that is, the brightness curve of the mask area to be brightened.
通过第一曲线,能够对第二图像的亮度值进行提亮或压暗。以先进行提亮处理为例,通过该第一曲线,对第二图像,也即待处理图像中的mask区域进行LUT(Look-Up-Table)映射操作处理,从而提亮人脸中的暗部区域(脏污区域,如斑点、伤疤等),在处理后,判断处理后的第二图像是否满足预设条件,如果满足,则输出该第二图像,作为磨皮后的mask区域,最终得到美颜后的人脸照片。Through the first curve, the brightness value of the second image can be brightened or darkened. Taking the brightening process first as an example, through the first curve, the second image, that is, the mask area in the image to be processed, is subjected to LUT (Look-Up-Table) mapping operation, so as to brighten the dark parts of the face. area (dirty area, such as spots, scars, etc.), after processing, determine whether the processed second image satisfies the preset conditions, if so, output the second image as the mask area after dermabrasion, and finally get A photo of a face after beautification.
本申请实施例通过对待处理图像进行Blur处理,基于处理前后的图片,确定待提亮的mask区域,并基于原待处理图像的直方图分布的均匀程度,确定用于对mask区域进行提亮处理的第一区域,基于该第一曲线,对待提亮的mask区域进行提亮处理,从而能够有效提亮人脸图像中的暗部区域,如斑点、伤疤等区域,该处理不会对人脸增提进行提亮,因此不会伤害人脸的立体结构,且无需利用AI算法,对设备性能的占用和开销均较小,实现了在保持人脸结构立体的情况下,实现对瑕疵部分亮度的均匀化,提高了磨皮效果。In this embodiment of the present application, by performing Blur processing on the image to be processed, based on the pictures before and after processing, the mask area to be brightened is determined, and based on the uniformity of the distribution of the histogram of the original image to be processed, the mask area used for brightening processing is determined Based on the first curve, the mask area to be brightened is brightened, so that the dark areas in the face image, such as spots and scars, can be effectively brightened. It does not damage the three-dimensional structure of the face, and does not need to use AI algorithms, so it occupies less equipment performance and costs less, and realizes the brightness of the flawed part while maintaining the three-dimensional structure of the face. Homogenizes and improves the dermabrasion effect.
在本申请的一些实施例中,待处理图像包括N个第一像素,第一图像包括N个第二像素,N个第一像素与N个第二像素一一对应,N为正整数;In some embodiments of the present application, the image to be processed includes N first pixels, the first image includes N second pixels, the N first pixels are in one-to-one correspondence with the N second pixels, and N is a positive integer;
根据待处理图像和第一图像,生成第二图像,包括:Generate a second image according to the image to be processed and the first image, including:
根据待处理图像,确定第一亮度值集合,第一亮度值集合包括N个第一像素的亮度值;determining a first brightness value set according to the image to be processed, where the first brightness value set includes the brightness values of N first pixels;
根据第一图像,确定第二亮度值集合,第二亮度值集合包括N个第二像素的亮度值;determining, according to the first image, a second set of luminance values, where the second set of luminance values includes luminance values of N second pixels;
根据第一亮度值集合和第二亮度值集合,生成第二图像。A second image is generated from the first set of luminance values and the second set of luminance values.
在本申请实施例中,在确定第二图像,也即待提亮的mask区域时,可根据原始的待处理图像和第一图像的亮度差,来对待提亮的mask区域进行确定。In this embodiment of the present application, when determining the second image, that is, the mask area to be brightened, the mask area to be brightened may be determined according to the brightness difference between the original to-be-processed image and the first image.
具体地,第一图像是由待处理图像经Blur处理后得到,因此第一图像和第二图像中的像素点是一一对应的。其中,待处理图像中的像素记为第一像素,第一图像中的像素记为第二像素。Specifically, the first image is obtained by Blur processing the image to be processed, so the pixels in the first image and the second image are in one-to-one correspondence. The pixels in the image to be processed are denoted as first pixels, and the pixels in the first image are denoted as second pixels.
由于Blur处理能够在图像中产生高反差,即能够使图像中,亮的像素更亮,暗的像素更暗。其中,图像的亮度值,指的是图像中像素点的亮度值的集合,因此,原始的待处理图像的亮度值,即N个第一像素对应的N个第一亮度值的集合,同理,第一图像的亮度值,即N个第二像素对应的N个第二亮度值的集合。Because Blur processing can produce high contrast in the image, it can make bright pixels brighter and dark pixels darker in the image. Among them, the brightness value of the image refers to the set of brightness values of the pixels in the image. Therefore, the brightness value of the original image to be processed is the set of N first brightness values corresponding to the N first pixels. Similarly, , the luminance value of the first image, that is, the set of N second luminance values corresponding to the N second pixels.
通过第一亮度值集合和第二亮度值集合,能够得到待处理图像中的暗部区域,也即需要进行提亮处理的mask区域,也即上述第二图像。Through the first set of luminance values and the second set of luminance values, the dark area in the image to be processed, that is, the mask area that needs to be brightened, that is, the above-mentioned second image can be obtained.
本申请通过根据Blur处理前后的图像亮度,确定待提亮的mask区域,也即人脸图像中的脏污部分,针对该部分进行有针对性的提亮处理,能够在保证人脸图像整体立体结构的情况下,对底层瑕疵亮度进行提亮和均匀化,有效地提高了磨皮效果。In this application, the mask area to be brightened, that is, the dirty part in the face image, is determined according to the image brightness before and after Blur processing, and targeted brightening processing is performed on this part, which can ensure the overall three-dimensional structure of the face image. Under the circumstance, the brightness of the underlying flaws is brightened and homogenized, which effectively improves the microdermabrasion effect.
在本申请的一些实施例中,根据第一亮度值集合和第二亮度值集合,生成第二图像,包括:In some embodiments of the present application, generating the second image according to the first set of brightness values and the second set of brightness values includes:
根据第一亮度值集合和第二亮度值集合的差值,确定第一差值集合;determining the first difference set according to the difference between the first luminance value set and the second luminance value set;
根据第一差值集合中,亮度值小于零的M个差值,确定对应的M个第一目标像素,M为小于N的正整数;According to the M difference values whose luminance values are less than zero in the first difference value set, the corresponding M first target pixels are determined, where M is a positive integer less than N;
在待处理图像中去除M个第一目标像素,得到第二图像。The M first target pixels are removed from the to-be-processed image to obtain a second image.
在本申请实施例中,第一亮度值集合,即待处理图像中,N个第一像素的亮度值的集合。同理,第二亮度值集合,是第一图像中,N个第二像素的亮度值的集合。其中,像素点的亮度值即像素值,其范围是[0,255]。In this embodiment of the present application, the first set of luminance values is a set of luminance values of N first pixels in the image to be processed. Similarly, the second set of luminance values is a set of luminance values of N second pixels in the first image. Among them, the brightness value of the pixel point is the pixel value, and its range is [0, 255].
计算第一亮度值集合与第二亮度值集合时,将对应的第一像素的亮度值,减去对应的第二像素的亮度值,得到N个差值,这N个差值的集合,即上述第一差值集合。When calculating the first brightness value set and the second brightness value set, the brightness value of the corresponding first pixel is subtracted from the brightness value of the corresponding second pixel to obtain N difference values. The set of N difference values is The above-mentioned first set of difference values.
由于第一图像是在原始的待处理图像的基础上,经过Blur处理后得到的图像,其N个第二像素中,亮的像素变得更亮,也即亮度值提高,暗的像素变得更案,也即亮度值减少。因此,在第一图像中,“亮”的像素的亮度值变得更高,而“暗”的像素的亮度值变得更低。Since the first image is an image obtained by Blur processing on the basis of the original image to be processed, among the N second pixels, the bright pixels become brighter, that is, the brightness value increases, and the dark pixels become brighter. Change the case, that is, the brightness value is reduced. Thus, in the first image, the luminance values of "bright" pixels become higher, and the luminance values of "dark" pixels become lower.
因此,在计算第一亮度值集合与第二亮度值集合的差值时,由于第一图像中,“亮”的像素的亮度值变大了,因此会大于原始的待处理图像中对应像素的亮度值,也就是说,对于“亮”的像素,差值会小于零。Therefore, when calculating the difference between the first set of brightness values and the second set of brightness values, since the brightness values of the "bright" pixels in the first image become larger, they will be larger than the corresponding pixels in the original image to be processed. Brightness value, that is, for "bright" pixels, the difference will be less than zero.
同理,在第二图像中,“暗”的像素的亮度值变小了,因此会小于原始的待处理图像中对应像素的亮度值,也就是说,对于“暗”的像素,差值会大于零。Similarly, in the second image, the brightness value of the "dark" pixels is smaller, so it will be smaller than the brightness value of the corresponding pixels in the original image to be processed, that is to say, for the "dark" pixels, the difference will be Greater than zero.
因此,在得到第一亮度值集合与第二亮度值集合的第一差值集合后,在其中确定亮度值小于零的M个差值,也就相当于得到了待处理图像中的M个“亮”像素,这M个亮像素是不需要提亮处理的,正常人脸的像素,而剩下的N-M个像素,则是人脸图像中,需要提亮的“脏污”部分。Therefore, after obtaining the first set of difference values between the first set of luminance values and the second set of luminance values, M difference values with luminance values less than zero are determined in it, which is equivalent to obtaining M "" Bright" pixels, these M bright pixels do not need to be brightened, the pixels of normal faces, and the remaining N-M pixels are the "dirty" parts of the face image that need to be brightened.
在待处理图像中,去除M个亮像素后,得到仅包含需要提亮的N-M个暗像素,即得到了第二图像。基于第一曲线对第二图像中的暗像素进行调亮处理,即相当于进行了“加深”处理,能够有效去除人脸图像中的脏污部分,同时不会对正常像素进行调整,保证了人脸的立体结构,提高了磨皮效果。In the image to be processed, after removing M bright pixels, only N-M dark pixels that need to be brightened are obtained, that is, a second image is obtained. Brightening the dark pixels in the second image based on the first curve is equivalent to "deepening" processing, which can effectively remove the dirty part in the face image without adjusting the normal pixels, ensuring that The three-dimensional structure of the human face improves the effect of microdermabrasion.
在本申请的一些实施例中,在基于第一曲线处理第二图像之后,图像处理方法还包括:In some embodiments of the present application, after processing the second image based on the first curve, the image processing method further includes:
在处理后的第二图像不满足预设条件的情况下,根据直方图分布,确定对应的第二曲线,其中,第二曲线用于提高或降低第一目标区域的亮度值,预设条件包括处理后的第二图像的强度值小于预设阈值;In the case where the processed second image does not meet the preset condition, a corresponding second curve is determined according to the histogram distribution, wherein the second curve is used to increase or decrease the brightness value of the first target area, and the preset condition includes The intensity value of the processed second image is less than a preset threshold;
对处理后的第二图像进行模糊化处理,得到第三图像;blurring the processed second image to obtain a third image;
根据第三图像,确定第三亮度值集合;According to the third image, determine a third set of brightness values;
根据第二亮度值集合和第三亮度值集合的差值,确定第二差值集合;determining a second difference set according to the difference between the second set of brightness values and the third set of brightness values;
根据第二差值集合中,亮度值大于零的O个差值,确定对应的O个第二目标像素,O为小于N的正整数;According to the second difference set, O difference values whose brightness values are greater than zero are determined to correspond to O second target pixels, where O is a positive integer less than N;
在处理后的第二图像中,去除O个第二目标像素,得到第四图像;In the processed second image, remove 0 second target pixels to obtain a fourth image;
基于第二图像处理第四图像;processing the fourth image based on the second image;
将处理后的第四图像更新为待处理图像,并再次执行对待处理图像进行模糊化处理的步骤。The processed fourth image is updated to the image to be processed, and the step of blurring the image to be processed is performed again.
在本申请实施例中,预设条件,指的是第二图像的强度值小于预设阈值。其中,第二图像的强度值,指的是经第一曲线提亮后,第二图像中每一个像素的像素值的集合。如果在经过第一曲线提亮后,第二图像中的每一个像素的像素值,均小于预设的像素值阈值,即上述预设阈值。In the embodiment of the present application, the preset condition refers to that the intensity value of the second image is smaller than the preset threshold. The intensity value of the second image refers to a set of pixel values of each pixel in the second image after being brightened by the first curve. If after the first curve is highlighted, the pixel value of each pixel in the second image is smaller than the preset pixel value threshold, that is, the above-mentioned preset threshold.
能够理解的是,像素值的取值范围是0至255,预设阈值的取值范围也在0至255之间,可根据实际需求自由设置。It can be understood that the value range of the pixel value is 0 to 255, and the value range of the preset threshold is also between 0 and 255, which can be freely set according to actual needs.
如果在经过第一曲线提亮后,第二图像没有满足预设条件,则进一步根据待处理图像的直方图分布的均匀程度,结合预设的经验映射关系,确定对应的第二曲线,该第二曲线具体用于降低待提亮处理的mask区域的亮度的曲线。If the second image does not meet the preset conditions after the first curve is highlighted, the corresponding second curve is determined according to the uniformity of the distribution of the histogram of the image to be processed and the preset empirical mapping relationship. The second curve is specifically used to reduce the brightness of the mask area to be brightened.
在得到第二曲线后,进一步对第二图像进行再次的模糊化处理,即Blur处理,得到处理后的第三图像,其中,Blur处理的处理面积可以是待处理图像中,人脸部分面积的四分之一。进行Blur处理后,得到与待处理图像对应的、模糊化的第三图像。After the second curve is obtained, the second image is further subjected to blurring processing, namely Blur processing, to obtain a processed third image, wherein the processing area of the Blur processing can be the area of the face part in the image to be processed. quarter. After performing the Blur processing, a blurred third image corresponding to the image to be processed is obtained.
进一步地,与确定待处理图像和第一图像的亮度值相同,确定第二图像的第三亮度值集合,和第三图像的第四亮度值集合。其中,相较于第二图像,第三图像中,“亮”的像素的亮度值变得更高,而“暗”的像素的亮度值变得更低。Further, in the same way as determining the brightness values of the image to be processed and the first image, a third brightness value set of the second image and a fourth brightness value set of the third image are determined. Wherein, compared with the second image, in the third image, the brightness value of the "bright" pixels becomes higher, and the brightness value of the "dark" pixels becomes lower.
因此,计算第三亮度值集合和第四亮度值集合的差,得到第二差值集合后,在其中确定亮度值大于零的O个差值,也就相当于得到了待处理图像中的M个“暗”像素,这暗个亮像素是需要提亮处理的,人脸图像中,需要提亮的“脏污”部分。Therefore, after calculating the difference between the third set of luminance values and the fourth set of luminance values, and after obtaining the second set of difference values, determine O difference values with luminance values greater than zero in it, which is equivalent to obtaining M in the image to be processed. This dark and bright pixel needs to be brightened. In the face image, the "dirty" part that needs to be brightened.
在第二图像中,去除这O个差值对应的第二目标像素,即得到需要压暗亮度的mask区域,即第四图像,通过第二曲线,对第四图像进行再次的LUT映射操作处理,从而拉暗mask区域,即相当于进行了“减淡”处理。In the second image, remove the second target pixels corresponding to the 0 differences, that is, obtain the mask area that needs to be darkened, that is, the fourth image, and perform the LUT mapping operation processing again on the fourth image through the second curve , so as to darken the mask area, which is equivalent to "dodge" processing.
通过“减淡”处理后的第四图像,作为新的待处理图像,并重新执行图1中的步骤102,直至最终处理后得到的第二图像满足预设条件后,确定磨破结束。The fourth image processed by "lightening" is regarded as a new image to be processed, and step 102 in FIG. 1 is re-executed until the second image obtained after final processing satisfies the preset condition, and it is determined that the abrasion is over.
本申请实施例能够有效提亮人脸图像中的暗部区域,如斑点、伤疤等区域,该处理不会对人脸增提进行提亮,因此不会伤害人脸的立体结构,且无需利用AI算法,对设备性能的占用和开销均较小,实现了在保持人脸结构立体的情况下,实现对瑕疵部分亮度的均匀化,提高了磨皮效果。The embodiments of the present application can effectively brighten the dark areas in the face image, such as spots, scars and other areas, the processing will not enhance the face enhancement and brighten, so the three-dimensional structure of the face will not be damaged, and AI does not need to be used The algorithm, which occupies less equipment performance and costs less, realizes the uniformity of the brightness of the flawed part while maintaining the three-dimensional structure of the face, and improves the effect of skin resurfacing.
在本申请的一些实施例中,在基于第一曲线处理第二图像,或基于第二曲线处理第二图像之前,方法还包括:In some embodiments of the present application, before processing the second image based on the first curve, or before processing the second image based on the second curve, the method further includes:
获取预设遮罩,预设遮罩用于使第二图像的第二目标区域的亮度值保持不变;obtaining a preset mask, where the preset mask is used to keep the brightness value of the second target area of the second image unchanged;
通过预设遮罩处理第二目标区域。The second target area is processed by a preset mask.
在本申请实施例中,在基于第一曲线对第二图像进行提亮,或基于第二图像对第二图像进行拉暗时,获取预设遮罩,该预设遮罩为五官保护mask,用于对人脸的五官区域进行保护,从而避免将人脸的五官误判为人脸脏污进行提亮,能够保留人脸五官细节。In the embodiment of the present application, when the second image is brightened based on the first curve, or the second image is darkened based on the second image, a preset mask is obtained, and the preset mask is a facial features protection mask, It is used to protect the facial features of the human face, so as to avoid misjudging the facial features of the human face as dirty and brighten them, and to preserve the facial features of the human face.
具体地,在通过预设遮罩处理第二图像的第二目标区域,也即五官区域后,五官区域内的亮度值在预设遮罩的保护下,不会收到第一曲线和第二曲线的影响,因此人脸五官不会收到磨皮算法的影响,能够准确还原五官细节,保证磨皮效果。Specifically, after processing the second target area of the second image, that is, the facial features area, through the preset mask, the brightness values in the facial features area will not receive the first curve and the second curve under the protection of the preset mask. Therefore, the facial features of the face will not be affected by the microdermabrasion algorithm, and the details of the facial features can be accurately restored to ensure the microdermabrasion effect.
在本申请的一些实施例中,在输出处理后的第二图像之后,方法还包括:通过第二图像,对原始图像进行处理,得到处理后的目标图像。In some embodiments of the present application, after outputting the processed second image, the method further includes: processing the original image through the second image to obtain a processed target image.
在本申请实施例中,在输出第二图像,作为磨皮后的mask区域后,通过该mask区域与原始图像,也即最初的人脸图像进行处理,从而提亮人脸图像中的暗部区域,如斑点、伤疤等区域,得到磨皮美颜后的人脸图像。该过程不会对人脸增提进行提亮,因此不会伤害人脸的立体结构,且无需利用AI算法,对设备性能的占用和开销均较小,实现了在保持人脸结构立体的情况下,实现对瑕疵部分亮度的均匀化,提高了磨皮效果。图2示出了根据本申请实施例的图像处理方法的算法示意图,如图2所示,算法包括:In the embodiment of the present application, after outputting the second image as the mask area after dermabrasion, the mask area is processed with the original image, that is, the original face image, so as to brighten the dark area in the face image , such as spots, scars and other areas, and get the face image after microdermabrasion. This process will not brighten the face enhancement, so it will not damage the three-dimensional structure of the face, and does not need to use AI algorithms, the occupation and cost of equipment performance are small, and the three-dimensional structure of the face is maintained. It achieves the uniformity of the brightness of the flawed part and improves the effect of microdermabrasion. FIG. 2 shows a schematic diagram of an algorithm of an image processing method according to an embodiment of the present application. As shown in FIG. 2 , the algorithm includes:
在得到原始图像后,通过图像金字塔得到待处理图像,并根据直方图经验获取第一曲线和第二曲线。After the original image is obtained, the image to be processed is obtained through the image pyramid, and the first curve and the second curve are obtained according to the histogram experience.
对待处理图像进行blur处理,得到第一图像,并根据待处理图像和blur处理后的第一图像,得到高反差的第二图像,通过预设遮罩对第二图像中的目标区域进行保护,并基于第一曲线对其进行处理,得到提亮后的第二图像。Perform blur processing on the image to be processed to obtain a first image, and obtain a second image with high contrast according to the image to be processed and the first image after blur processing, and protect the target area in the second image through a preset mask, and process it based on the first curve to obtain a brightened second image.
判断第二图像是否满足预设条件,如果满足,则输出第二图像,如果不满足,则对第二图像进行blur处理,得到高反差的第三图像,并根据第二图像和第三图像,得到高反差的第四图像。通过预设遮罩对第四图像中的目标区域进行保护,并基于第二曲线对其进行处理,得到压暗后的第四图像。Determine whether the second image satisfies the preset condition, if so, output the second image, if not, perform blur processing on the second image to obtain a third image with high contrast, and according to the second image and the third image, A high-contrast fourth image is obtained. The target area in the fourth image is protected by a preset mask, and processed based on the second curve to obtain a darkened fourth image.
将压暗后的第四图像,作为新的待处理图像,并重新进行blur处理等算法处理步骤,直至生成的第二图像满足预设条件。The darkened fourth image is used as a new image to be processed, and algorithm processing steps such as blur processing are performed again until the generated second image satisfies the preset conditions.
在本申请的一些实施例中,提供了一种图像处理装置,图3示出了根据本申请实施例的图像处理装置的结构框图,如图3所示,图像处理装置300包括:In some embodiments of the present application, an image processing apparatus is provided. FIG. 3 shows a structural block diagram of an image processing apparatus according to an embodiment of the present application. As shown in FIG. 3 , the
获取模块302,用于获取原始图像;an
建立模块304,用于建立原始图像对应的图像金字塔;Establishing
确定模块306,用于将图像金字塔的低频图,确定为待处理图像;A
处理模块308,用于对待处理图像进行模糊化处理,得到第一图像;a
生成模块310,用于根据待处理图像和第一图像,生成第二图像;a
确定模块306,用于根据待处理图像的直方图分布,确定对应的第一曲线,其中,第一曲线用于提高或降低第二图像中目标区域的亮度值;A
处理模块308,还用于基于第一曲线处理第二图像;a
输出模块312,用于在处理后的第二图像满足预设条件的情况下,输出处理后的第二图像。The
在本申请实施例中,原始图像,即输入算法图像,具体为用户选择的需要进行美颜处理的图像。由于原始图像的分辨率、图像尺寸很大,因此在接收到原始图像之后,首先,建立原始图像对应的图像金字塔。In the embodiment of the present application, the original image, that is, the input algorithm image, is specifically an image selected by the user and needs to be processed for beauty. Since the resolution and size of the original image are large, after the original image is received, first, an image pyramid corresponding to the original image is established.
图像金字塔具体是分辨率逐步降低的图像集合,图像所处的层级越高,图像尺寸越小,分辨率越低。根据图像金字塔降低原始图像的尺寸和分辨率,能够有效减少磨皮算法对设备性能的开销,提高磨皮效率。Specifically, the image pyramid is a collection of images whose resolution is gradually reduced. The higher the level of the image, the smaller the image size and the lower the resolution. Reducing the size and resolution of the original image according to the image pyramid can effectively reduce the performance overhead of the microdermabrasion algorithm and improve the microdermabrasion efficiency.
具体地,可以选取图像金字塔中从顶端开始的第四层图像,作为待处理图像,有利于减少磨皮算法的性能开销,同时保留细节。Specifically, the fourth layer image from the top of the image pyramid can be selected as the image to be processed, which is beneficial to reduce the performance overhead of the microdermabrasion algorithm while preserving the details.
其中,待处理图像具体为人脸图像,在接收到待处理图像后,首先,对待处理图像进行模糊化处理,具体地,可通过对待处理图像做Blur处理,从而进行模糊化。其中,Blur处理的处理面积可以是待处理图像中,人脸部分面积的四分之一。进行Blur处理后,得到与待处理图像对应的、模糊化的第一图像。根据第一图像和模糊化处理前的待处理图像,得到第二图像,该第二图像,即是待提亮处理的遮罩(mask)区域。The image to be processed is specifically a face image. After the image to be processed is received, first, the image to be processed is blurred. Specifically, the image to be processed can be blurred by performing Blur processing. The processing area of the Blur processing may be a quarter of the area of the face part in the image to be processed. After performing Blur processing, a first blurred image corresponding to the image to be processed is obtained. According to the first image and the to-be-processed image before the blurring process, a second image is obtained, and the second image is the mask area to be brightened.
进一步地,基于待处理图像的直方图分布,具体基于待处理图像的直方图分布的均匀程度,结合预设的经验映射关系,确定对应的第一曲线,该第一曲线具体是用于调节第二图像中的第一目标区域,也即待提亮处理的mask区域的亮度的曲线。Further, based on the histogram distribution of the to-be-processed image, specifically based on the uniformity of the histogram distribution of the to-be-processed image, combined with a preset empirical mapping relationship, a corresponding first curve is determined, and the first curve is specifically used to adjust the first curve. The first target area in the two images, that is, the brightness curve of the mask area to be brightened.
通过第一曲线,能够对第二图像的亮度值进行提亮或压暗。以先进行提亮处理为例,通过该第一曲线,对第二图像,也即待处理图像中的mask区域进行LUT(Look-Up-Table)映射操作处理,从而提亮人脸中的暗部区域(脏污区域,如斑点、伤疤等),在处理后,判断处理后的第二图像是否满足预设条件,如果满足,则输出该第二图像,作为磨皮后的mask区域,最终得到美颜后的人脸照片。Through the first curve, the brightness value of the second image can be brightened or darkened. Taking the brightening process first as an example, through the first curve, perform LUT (Look-Up-Table) mapping operation processing on the second image, that is, the mask area in the image to be processed, so as to brighten the dark parts of the face. area (dirty area, such as spots, scars, etc.), after processing, determine whether the processed second image satisfies the preset conditions, if so, output the second image as the mask area after dermabrasion, and finally get A photo of a face after beautification.
图2示出了根据本申请实施例的图像处理方法的算法示意图,如图2所示,算法包括:FIG. 2 shows a schematic diagram of an algorithm of an image processing method according to an embodiment of the present application. As shown in FIG. 2 , the algorithm includes:
在得到原始图像后,通过图像金字塔得到待处理图像,并根据直方图经验获取第一曲线和第二曲线。After the original image is obtained, the image to be processed is obtained through the image pyramid, and the first curve and the second curve are obtained according to the histogram experience.
对待处理图像进行blur处理,得到第一图像,并根据待处理图像和blur处理后的第一图像,得到高反差的第二图像,通过预设遮罩对第二图像中的目标区域进行保护,并基于第一曲线对其进行处理,得到提亮后的第二图像。Perform blur processing on the image to be processed to obtain a first image, and obtain a second image with high contrast according to the image to be processed and the first image after blur processing, and protect the target area in the second image through a preset mask, and process it based on the first curve to obtain a brightened second image.
判断第二图像是否满足预设条件,如果满足,则输出第二图像,如果不满足,则对第二图像进行blur处理,得到高反差的第三图像,并根据第二图像和第三图像,得到高反差的第四图像。通过预设遮罩对第四图像中的目标区域进行保护,并基于第二曲线对其进行处理,得到压暗后的第四图像。Determine whether the second image satisfies the preset condition, if so, output the second image, if not, perform blur processing on the second image to obtain a third image with high contrast, and according to the second image and the third image, A high-contrast fourth image is obtained. The target area in the fourth image is protected by a preset mask, and processed based on the second curve to obtain a darkened fourth image.
将压暗后的第四图像,作为新的待处理图像,并重新进行blur处理等算法处理步骤,直至生成的第二图像满足预设条件。The darkened fourth image is used as a new image to be processed, and algorithm processing steps such as blur processing are performed again until the generated second image satisfies the preset conditions.
本申请实施例通过对待处理图像进行Blur处理,基于处理前后的图片,确定待提亮的mask区域,并基于原待处理图像的直方图分布的均匀程度,确定用于对mask区域进行提亮处理的第一区域,基于该第一曲线,对待提亮的mask区域进行提亮处理,从而能够有效提亮人脸图像中的暗部区域,如斑点、伤疤等区域,该处理不会对人脸增提进行提亮,因此不会伤害人脸的立体结构,且无需利用AI算法,对设备性能的占用和开销均较小,实现了在保持人脸结构立体的情况下,实现对瑕疵部分亮度的均匀化,提高了磨皮效果。In this embodiment of the present application, by performing Blur processing on the image to be processed, based on the pictures before and after processing, the mask area to be brightened is determined, and based on the uniformity of the distribution of the histogram of the original image to be processed, the mask area used for brightening processing is determined Based on the first curve, the mask area to be brightened is brightened, so that the dark areas in the face image, such as spots and scars, can be effectively brightened. It does not damage the three-dimensional structure of the face, and does not need to use AI algorithms, so it occupies less equipment performance and costs less, and realizes the brightness of the flawed part while maintaining the three-dimensional structure of the face. Homogenizes and improves the dermabrasion effect.
在本申请的一些实施例中,待处理图像包括N个第一像素,第一图像包括N个第二像素,N个第一像素与N个第二像素一一对应,N为正整数;In some embodiments of the present application, the image to be processed includes N first pixels, the first image includes N second pixels, the N first pixels are in one-to-one correspondence with the N second pixels, and N is a positive integer;
确定模块,还用于根据待处理图像,确定第一亮度值集合,第一亮度值集合包括N个第一像素的亮度值;根据第一图像,确定第二亮度值集合,第二亮度值集合包括N个第二像素的亮度值;The determining module is further configured to determine, according to the image to be processed, a first set of brightness values, where the first set of brightness values includes the brightness values of N first pixels; according to the first image, determine a second set of brightness values, the second set of brightness values Including the brightness values of the N second pixels;
生成模块,还用于根据第一亮度值集合和第二亮度值集合,生成第二图像。The generating module is further configured to generate a second image according to the first luminance value set and the second luminance value set.
在本申请实施例中,在确定第二图像,也即待提亮的mask区域时,可根据原始的待处理图像和第一图像的亮度差,来对待提亮的mask区域进行确定。In this embodiment of the present application, when determining the second image, that is, the mask area to be brightened, the mask area to be brightened may be determined according to the brightness difference between the original to-be-processed image and the first image.
具体地,第一图像是由待处理图像经Blur处理后得到,因此第一图像和第二图像中的像素点是一一对应的。其中,待处理图像中的像素记为第一像素,第一图像中的像素记为第二像素。Specifically, the first image is obtained by Blur processing the image to be processed, so the pixels in the first image and the second image are in one-to-one correspondence. The pixels in the image to be processed are denoted as first pixels, and the pixels in the first image are denoted as second pixels.
由于Blur处理能够在图像中产生高反差,即能够使图像中,亮的像素更亮,暗的像素更暗。其中,图像的亮度值,指的是图像中像素点的亮度值的集合,因此,原始的待处理图像的亮度值,即N个第一像素对应的N个第一亮度值的集合,同理,第一图像的亮度值,即N个第二像素对应的N个第二亮度值的集合。Because Blur processing can produce high contrast in the image, it can make bright pixels brighter and dark pixels darker in the image. Among them, the brightness value of the image refers to the set of brightness values of the pixels in the image. Therefore, the brightness value of the original image to be processed is the set of N first brightness values corresponding to the N first pixels. Similarly, , the luminance value of the first image, that is, the set of N second luminance values corresponding to the N second pixels.
通过第一亮度值集合和第二亮度值集合,能够得到待处理图像中的暗部区域,也即需要进行提亮处理的mask区域,也即上述第二图像。Through the first set of luminance values and the second set of luminance values, the dark area in the image to be processed, that is, the mask area that needs to be brightened, that is, the above-mentioned second image can be obtained.
本申请通过根据Blur处理前后的图像亮度,确定待提亮的mask区域,也即人脸图像中的脏污部分,针对该部分进行有针对性的提亮处理,能够在保证人脸图像整体立体结构的情况下,对底层瑕疵亮度进行提亮和均匀化,有效地提高了磨皮效果。In this application, the mask area to be brightened, that is, the dirty part in the face image, is determined according to the image brightness before and after Blur processing, and targeted brightening processing is performed on this part, which can ensure the overall three-dimensional structure of the face image. Under the circumstance, the brightness of the underlying flaws is brightened and homogenized, which effectively improves the microdermabrasion effect.
在本申请的一些实施例中,确定模块,还用于根据第一亮度值集合和第二亮度值集合的差值,确定第一差值集合;根据第一差值集合中,亮度值小于零的M个差值,确定对应的M个第一目标像素,M为小于N的正整数;处理模块,还用于在待处理图像中去除M个第一目标像素,得到第二图像。In some embodiments of the present application, the determining module is further configured to determine the first difference value set according to the difference between the first brightness value set and the second brightness value set; according to the first difference value set, the brightness value is less than zero The M difference values of , determine the corresponding M first target pixels, where M is a positive integer smaller than N; the processing module is also used to remove the M first target pixels in the to-be-processed image to obtain a second image.
在本申请实施例中,第一亮度值集合,即待处理图像中,N个第一像素的亮度值的集合。同理,第二亮度值集合,是第一图像中,N个第二像素的亮度值的集合。其中,像素点的亮度值即像素值,其范围是[0,255]。In this embodiment of the present application, the first set of luminance values is a set of luminance values of N first pixels in the image to be processed. Similarly, the second set of luminance values is a set of luminance values of N second pixels in the first image. Among them, the brightness value of the pixel point is the pixel value, and its range is [0, 255].
计算第一亮度值集合与第二亮度值集合时,将对应的第一像素的亮度值,减去对应的第二像素的亮度值,得到N个差值,这N个差值的集合,即上述第一差值集合。When calculating the first brightness value set and the second brightness value set, the brightness value of the corresponding first pixel is subtracted from the brightness value of the corresponding second pixel to obtain N difference values. The set of N difference values is The above-mentioned first set of difference values.
由于第一图像是在原始的待处理图像的基础上,经过Blur处理后得到的图像,其N个第二像素中,亮的像素变得更亮,也即亮度值提高,暗的像素变得更案,也即亮度值减少。因此,在第一图像中,“亮”的像素的亮度值变得更高,而“暗”的像素的亮度值变得更低。Since the first image is an image obtained by Blur processing on the basis of the original image to be processed, among the N second pixels, the bright pixels become brighter, that is, the brightness value increases, and the dark pixels become brighter. Change the case, that is, the brightness value is reduced. Thus, in the first image, the luminance values of "bright" pixels become higher, and the luminance values of "dark" pixels become lower.
因此,在计算第一亮度值集合与第二亮度值集合的差值时,由于第一图像中,“亮”的像素的亮度值变大了,因此会大于原始的待处理图像中对应像素的亮度值,也就是说,对于“亮”的像素,差值会小于零。Therefore, when calculating the difference between the first set of brightness values and the second set of brightness values, since the brightness values of the "bright" pixels in the first image become larger, they will be larger than the corresponding pixels in the original image to be processed. Brightness value, that is, for "bright" pixels, the difference will be less than zero.
同理,在第二图像中,“暗”的像素的亮度值变小了,因此会小于原始的待处理图像中对应像素的亮度值,也就是说,对于“暗”的像素,差值会大于零。Similarly, in the second image, the brightness value of the "dark" pixels is smaller, so it will be smaller than the brightness value of the corresponding pixels in the original image to be processed, that is to say, for the "dark" pixels, the difference will be Greater than zero.
因此,在得到第一亮度值集合与第二亮度值集合的第一差值集合后,在其中确定亮度值小于零的M个差值,也就相当于得到了待处理图像中的M个“亮”像素,这M个亮像素是不需要提亮处理的,正常人脸的像素,而剩下的N-M个像素,则是人脸图像中,需要提亮的“脏污”部分。Therefore, after obtaining the first set of difference values between the first set of luminance values and the second set of luminance values, M difference values with luminance values less than zero are determined in it, which is equivalent to obtaining M "" Bright" pixels, these M bright pixels do not need to be brightened, the pixels of normal faces, and the remaining N-M pixels are the "dirty" parts of the face image that need to be brightened.
在待处理图像中,去除M个亮像素后,得到仅包含需要提亮的N-M个暗像素,即得到了第二图像。基于第一曲线对第二图像中的暗像素进行调亮处理,即相当于进行了“加深”处理,能够有效去除人脸图像中的脏污部分,同时不会对正常像素进行调整,保证了人脸的立体结构,提高了磨皮效果。In the image to be processed, after removing M bright pixels, only N-M dark pixels that need to be brightened are obtained, that is, a second image is obtained. Brightening the dark pixels in the second image based on the first curve is equivalent to "deepening" processing, which can effectively remove the dirty part in the face image without adjusting the normal pixels, ensuring that The three-dimensional structure of the human face improves the effect of microdermabrasion.
在本申请的一些实施例中,确定模块,还用于在处理后的第二图像不满足预设条件的情况下,根据直方图分布,确定对应的第二曲线,其中,第二曲线用于提高或降低第一目标区域的亮度值,预设条件包括处理后的第二图像的强度值小于预设阈值;In some embodiments of the present application, the determining module is further configured to determine a corresponding second curve according to the histogram distribution when the processed second image does not meet the preset condition, wherein the second curve is used for Increase or decrease the brightness value of the first target area, the preset condition includes that the intensity value of the processed second image is less than a preset threshold;
处理模块,还用于对处理后的第二图像进行模糊化处理,得到第三图像;The processing module is further used for blurring the processed second image to obtain a third image;
确定模块,还用于根据第二图像,确定第三亮度值集合;根据第三图像,确定第四亮度值集合;根据第三亮度值集合和第四亮度值集合的差值,确定第二差值集合;根据第二差值集合中,亮度值大于零的O个差值,确定对应的O个第二目标像素,O为小于N的正整数;The determining module is further configured to determine a third brightness value set according to the second image; determine a fourth brightness value set according to the third image; determine a second difference according to the difference between the third brightness value set and the fourth brightness value set value set; according to the second difference value set, O difference values whose brightness value is greater than zero, determine the corresponding O second target pixels, and O is a positive integer less than N;
处理模块,还用于在处理后的第二图像中,去除O个第二目标像素,得到第四图像;基于第二图像处理第四图像;将处理后的第四图像更新为待处理图像,并再次执行对待处理图像进行模糊化处理的步骤。The processing module is further configured to remove 0 second target pixels in the processed second image to obtain a fourth image; process the fourth image based on the second image; update the processed fourth image to an image to be processed, And execute the step of blurring the image to be processed again.
在本申请实施例中,预设条件,指的是第二图像的强度值小于预设阈值。其中,第二图像的强度值,指的是经第一曲线提亮后,第二图像中每一个像素的像素值的集合。如果在经过第一曲线提亮后,第二图像中的每一个像素的像素值,均小于预设的像素值阈值,即上述预设阈值。In the embodiment of the present application, the preset condition refers to that the intensity value of the second image is smaller than the preset threshold. The intensity value of the second image refers to a set of pixel values of each pixel in the second image after being brightened by the first curve. If after the first curve is highlighted, the pixel value of each pixel in the second image is smaller than the preset pixel value threshold, that is, the above-mentioned preset threshold.
能够理解的是,像素值的取值范围是0至255,预设阈值的取值范围也在0至255之间,可根据实际需求自由设置。It can be understood that the value range of the pixel value is 0 to 255, and the value range of the preset threshold is also between 0 and 255, which can be freely set according to actual needs.
如果在经过第一曲线提亮后,第二图像没有满足预设条件,则进一步根据待处理图像的直方图分布的均匀程度,结合预设的经验映射关系,确定对应的第二曲线,该第二曲线具体用于降低待提亮处理的mask区域的亮度的曲线。If the second image does not meet the preset conditions after the first curve is highlighted, the corresponding second curve is determined according to the uniformity of the distribution of the histogram of the image to be processed and the preset empirical mapping relationship. The second curve is specifically used to reduce the brightness of the mask area to be brightened.
在得到第二曲线后,进一步对第二图像进行再次的模糊化处理,即Blur处理,得到处理后的第三图像,其中,Blur处理的处理面积可以是待处理图像中,人脸部分面积的四分之一。进行Blur处理后,得到与待处理图像对应的、模糊化的第三图像。After the second curve is obtained, the second image is further subjected to blurring processing, namely Blur processing, to obtain a processed third image, wherein the processing area of the Blur processing can be the area of the face part in the image to be processed. quarter. After performing the Blur processing, a blurred third image corresponding to the image to be processed is obtained.
进一步地,与确定待处理图像和第一图像的亮度值相同,确定第二图像的第三亮度值集合,和第三图像的第四亮度值集合。其中,相较于第二图像,第三图像中,“亮”的像素的亮度值变得更高,而“暗”的像素的亮度值变得更低。Further, in the same way as determining the brightness values of the image to be processed and the first image, a third brightness value set of the second image and a fourth brightness value set of the third image are determined. Wherein, compared with the second image, in the third image, the brightness value of the "bright" pixels becomes higher, and the brightness value of the "dark" pixels becomes lower.
因此,计算第三亮度值集合和第四亮度值集合的差,得到第二差值集合后,在其中确定亮度值大于零的O个差值,也就相当于得到了待处理图像中的M个“暗”像素,这暗个亮像素是需要提亮处理的,人脸图像中,需要提亮的“脏污”部分。Therefore, after calculating the difference between the third set of luminance values and the fourth set of luminance values, and after obtaining the second set of difference values, determine O difference values with luminance values greater than zero in it, which is equivalent to obtaining M in the image to be processed. This dark and bright pixel needs to be brightened. In the face image, the "dirty" part that needs to be brightened.
在第二图像中,去除这O个差值对应的第二目标像素,即得到需要压暗亮度的mask区域,即第四图像,通过第二曲线,对第四图像进行再次的LUT映射操作处理,从而拉暗mask区域,即相当于进行了“减淡”处理。In the second image, remove the second target pixels corresponding to the 0 differences, that is, obtain the mask area that needs to be darkened, that is, the fourth image, and perform the LUT mapping operation processing again on the fourth image through the second curve , so as to darken the mask area, which is equivalent to "dodge" processing.
通过“减淡”处理后的第四图像,作为新的待处理图像,直至最终处理后得到的第二图像满足预设条件后,确定磨破结束。The fourth image processed by "lightening" is regarded as a new to-be-processed image, until the second image obtained after final processing satisfies the preset condition, it is determined that the abrasion is over.
本申请实施例能够有效提亮人脸图像中的暗部区域,如斑点、伤疤等区域,该处理不会对人脸增提进行提亮,因此不会伤害人脸的立体结构,且无需利用AI算法,对设备性能的占用和开销均较小,实现了在保持人脸结构立体的情况下,实现对瑕疵部分亮度的均匀化,提高了磨皮效果。The embodiments of the present application can effectively brighten the dark areas in the face image, such as spots, scars and other areas, the processing will not enhance the face enhancement and brighten, so the three-dimensional structure of the face will not be damaged, and AI does not need to be used The algorithm, which occupies less equipment performance and costs less, realizes the uniformity of the brightness of the flawed part while maintaining the three-dimensional structure of the face, and improves the effect of skin resurfacing.
在本申请的一些实施例中,图像处理装置还包括:In some embodiments of the present application, the image processing apparatus further includes:
获取模块,还用于获取预设遮罩,预设遮罩用于使第二图像的第二目标区域的亮度值保持不变;an acquisition module, further configured to acquire a preset mask, where the preset mask is used to keep the brightness value of the second target area of the second image unchanged;
处理模块,还用于通过预设遮罩处理第二目标区域。The processing module is further configured to process the second target area through a preset mask.
在本申请实施例中,在基于第一曲线对第二图像进行提亮,或基于第二图像对第二图像进行拉暗时,获取预设遮罩,该预设遮罩为五官保护mask,用于对人脸的五官区域进行保护,从而避免将人脸的五官误判为人脸脏污进行提亮,能够保留人脸五官细节。In the embodiment of the present application, when the second image is brightened based on the first curve, or the second image is darkened based on the second image, a preset mask is obtained, and the preset mask is a facial features protection mask, It is used to protect the facial features of the human face, so as to avoid misjudging the facial features of the human face as dirty and brighten them, and to preserve the facial features of the human face.
具体地,在通过预设遮罩处理第二图像的目标区域,也即五官区域后,五官区域内的亮度值在预设遮罩的保护下,不会收到第一曲线和第二曲线的影响,因此人脸五官不会收到磨皮算法的影响,能够准确还原五官细节,保证磨皮效果。Specifically, after the target area of the second image, that is, the facial features area, is processed through the preset mask, the brightness values in the facial features area will not receive the first curve and the second curve under the protection of the preset mask. Therefore, the facial features of the face will not be affected by the microdermabrasion algorithm, and the details of the facial features can be accurately restored to ensure the microdermabrasion effect.
在本申请的一些实施例中,处理模块,还用于通过第二图像,对原始图像进行处理,得到处理后的目标图像。在本申请实施例中,在输出第二图像,作为磨皮后的mask区域后,通过该mask区域与原始图像,也即最初的人脸图像进行处理,从而提亮人脸图像中的暗部区域,如斑点、伤疤等区域,得到磨皮美颜后的人脸图像。该过程不会对人脸增提进行提亮,因此不会伤害人脸的立体结构,且无需利用AI算法,对设备性能的占用和开销均较小,实现了在保持人脸结构立体的情况下,实现对瑕疵部分亮度的均匀化,提高了磨皮效果。In some embodiments of the present application, the processing module is further configured to process the original image by using the second image to obtain the processed target image. In the embodiment of the present application, after outputting the second image as the mask area after dermabrasion, the mask area is processed with the original image, that is, the original face image, so as to brighten the dark area in the face image , such as spots, scars and other areas, and get the face image after microdermabrasion. This process will not brighten the face enhancement, so it will not damage the three-dimensional structure of the face, and does not need to use AI algorithms, the occupation and cost of equipment performance are small, and the three-dimensional structure of the face is maintained. It achieves the uniformity of the brightness of the flawed part and improves the effect of microdermabrasion.
本申请实施例中的图像处理装置可以是电子设备,也也可以是电子设备中的部件,例如集成电路或芯片。该电子设备可以是终端,也可以为除终端之外的其他设备。示例性的,电子设备可以为手机、平板电脑、笔记本电脑、掌上电脑、车载电子设备、移动上网装置(Mobile Internet Device,MID)、增强现实(augmented reality,AR)/虚拟现实(virtual reality,VR)设备、机器人、可穿戴设备、超级移动个人计算机(ultra-mobilepersonal computer,UMPC)、上网本或者个人数字助理(personal digital assistant,PDA)等,还可以为服务器、网络附属存储器(Network Attached Storage,NAS)、个人计算机(personal computer,PC)、电视机(television,TV)、柜员机或者自助机等,本申请实施例不作具体限定。The image processing apparatus in this embodiment of the present application may be an electronic device, or may be a component in the electronic device, such as an integrated circuit or a chip. The electronic device may be a terminal, or may be other devices other than the terminal. Exemplarily, the electronic device may be a mobile phone, a tablet computer, a notebook computer, a PDA, a vehicle electronic device, a Mobile Internet Device (MID), an augmented reality (AR)/virtual reality (VR) ) devices, robots, wearable devices, ultra-mobile personal computers (UMPCs), netbooks or personal digital assistants (PDAs), etc., and can also be servers, network attached storages (NASs) ), personal computer (personal computer, PC), television (television, TV), teller machine or self-service machine, etc., which are not specifically limited in the embodiments of the present application.
本申请实施例中的图像处理装置可以为具有操作系统的装置。该操作系统可以为安卓(Android)操作系统,可以为iOS操作系统,还可以为其他可能的操作系统,本申请实施例不作具体限定。The image processing apparatus in this embodiment of the present application may be an apparatus having 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 the embodiments of the present application.
本申请实施例提供的图像处理装置能够实现上述方法实施例实现的各个过程,为避免重复,这里不再赘述。The image processing apparatus provided in this embodiment of the present application can implement each process implemented in the foregoing method embodiment, and to avoid repetition, details are not described herein again.
可选地,本申请实施例还提供一种电子设备,图4示出了根据本申请实施例的电子设备的结构框图,如图4所示,电子设备400包括处理器402,存储器404,存储在存储器404上并可在所述处理器402上运行的程序或指令,该程序或指令被处理器402执行时实现上述方法实施例的各个过程,且能达到相同的技术效果,为避免重复,这里不再赘述。Optionally, an embodiment of the present application further provides an electronic device. FIG. 4 shows a structural block diagram of an electronic device according to an embodiment of the present application. As shown in FIG. 4 , the
需要说明的是,本申请实施例中的电子设备包括上述所述的移动电子设备和非移动电子设备。It should be noted that the electronic devices in the embodiments of the present application include the aforementioned mobile electronic devices and non-mobile electronic devices.
图5为实现本申请实施例的一种电子设备的硬件结构示意图。FIG. 5 is a schematic diagram of a hardware structure of an electronic device implementing an embodiment of the present application.
该电子设备500包括但不限于:射频单元501、网络模块502、音频输出单元503、输入单元504、传感器505、显示单元506、用户输入单元507、接口单元508、存储器509、以及处理器510等部件。The
本领域技术人员可以理解,电子设备500还可以包括给各个部件供电的电源(比如电池),电源可以通过电源管理系统与处理器510逻辑相连,从而通过电源管理系统实现管理充电、放电、以及功耗管理等功能。图5中示出的电子设备结构并不构成对电子设备的限定,电子设备可以包括比图示更多或更少的部件,或者组合某些部件,或者不同的部件布置,在此不再赘述。Those skilled in the art can understand that the
其中,处理器510用于获取原始图像;Wherein, the
建立原始图像对应的图像金字塔;将图像金字塔的低频图,确定为待处理图像;Establish an image pyramid corresponding to the original image; determine the low-frequency map of the image pyramid as the image to be processed;
对待处理图像进行模糊化处理,得到第一图像;Blur the image to be processed to obtain a first image;
根据待处理图像和第一图像,生成第二图像;generating a second image according to the to-be-processed image and the first image;
根据待处理图像的直方图分布,确定对应的第一曲线,其中,第一曲线用于提高或降低第二图像中第一目标区域的亮度值;Determine a corresponding first curve according to the histogram distribution of the image to be processed, wherein the first curve is used to increase or decrease the brightness value of the first target area in the second image;
基于第一曲线处理第二图像;processing the second image based on the first curve;
在处理后的第二图像满足预设条件的情况下,输出处理后的第二图像。In the case that the processed second image satisfies the preset condition, the processed second image is output.
本申请实施例通过对待处理图像进行Blur处理,基于处理前后的图片,确定待提亮的mask区域,并基于原待处理图像的直方图分布的均匀程度,确定用于对mask区域进行提亮处理的第一区域,基于该第一曲线,对待提亮的mask区域进行提亮处理,从而能够有效提亮人脸图像中的暗部区域,如斑点、伤疤等区域,该处理不会对人脸增提进行提亮,因此不会伤害人脸的立体结构,且无需利用AI算法,对设备性能的占用和开销均较小,实现了在保持人脸结构立体的情况下,实现对瑕疵部分亮度的均匀化,提高了磨皮效果。In this embodiment of the present application, by performing Blur processing on the image to be processed, based on the pictures before and after processing, the mask area to be brightened is determined, and based on the uniformity of the distribution of the histogram of the original image to be processed, the mask area used for brightening processing is determined Based on the first curve, the mask area to be brightened is brightened, so that the dark areas in the face image, such as spots and scars, can be effectively brightened. It does not damage the three-dimensional structure of the face, and does not need to use AI algorithms, so it occupies less equipment performance and costs less, and realizes the brightness of the flawed part while maintaining the three-dimensional structure of the face. Homogenizes and improves the dermabrasion effect.
可选地,待处理图像包括N个第一像素,第一图像包括N个第二像素,N个第一像素与N个第二像素一一对应,N为正整数;Optionally, the image to be processed includes N first pixels, the first image includes N second pixels, the N first pixels are in one-to-one correspondence with the N second pixels, and N is a positive integer;
处理器510,还用于根据待处理图像,确定第一亮度值集合,第一亮度值集合包括N个第一像素的亮度值;The
根据第一图像,确定第二亮度值集合,第二亮度值集合包括N个第二像素的亮度值;determining, according to the first image, a second set of luminance values, where the second set of luminance values includes luminance values of N second pixels;
根据第一亮度值集合和第二亮度值集合,生成第二图像。A second image is generated from the first set of luminance values and the second set of luminance values.
申请通过根据Blur处理前后的图像亮度,确定待提亮的mask区域,也即人脸图像中的脏污部分,针对该部分进行有针对性的提亮处理,能够在保证人脸图像整体立体结构的情况下,对底层瑕疵亮度进行提亮和均匀化,有效地提高了磨皮效果。According to the image brightness before and after Blur processing, the application determines the mask area to be brightened, that is, the dirty part in the face image, and performs targeted brightening processing on this part, which can ensure the overall three-dimensional structure of the face image. It brightens and homogenizes the brightness of the underlying flaws, effectively improving the effect of microdermabrasion.
可选地,处理器510,还用于根据第一亮度值集合和第二亮度值集合的差值,确定第一差值集合;Optionally, the
根据第一差值集合中,亮度值小于零的M个差值,确定对应的M个第一目标像素,M为小于N的正整数;According to the M difference values whose luminance values are less than zero in the first difference value set, the corresponding M first target pixels are determined, where M is a positive integer less than N;
在待处理图像中去除M个第一目标像素,得到第二图像。The M first target pixels are removed from the to-be-processed image to obtain a second image.
本申请实施例能够有效去除人脸图像中的脏污部分,同时不会对正常像素进行调整,保证了人脸的立体结构,提高了磨皮效果。The embodiments of the present application can effectively remove the dirty part in the face image, and at the same time, the normal pixels will not be adjusted, thus ensuring the three-dimensional structure of the face and improving the effect of microdermabrasion.
可选地,处理器510,还用于在处理后的第二图像不满足预设条件的情况下,根据直方图分布,确定对应的第二曲线,其中,第二曲线用于提高或降低第一目标区域的亮度值,预设条件处理后的包括第二图像的强度值小于预设阈值;Optionally, the
对处理后的第二图像进行模糊化处理,得到第三图像;blurring the processed second image to obtain a third image;
根据第二图像,确定第三亮度值集合;According to the second image, determine a third set of brightness values;
根据第三图像,确定第四亮度值集合;According to the third image, determine a fourth set of brightness values;
根据第三亮度值集合和第四亮度值集合的差值,确定第二差值集合;determining a second difference set according to the difference between the third set of luminance values and the fourth set of luminance values;
根据第二差值集合中,亮度值大于零的O个差值,确定对应的O个第二目标像素,O为小于N的正整数;According to the second difference set, O difference values whose brightness values are greater than zero are determined to correspond to O second target pixels, where O is a positive integer less than N;
在处理后的第二图像中,去除O个第二目标像素,得到第四图像;In the processed second image, remove 0 second target pixels to obtain a fourth image;
基于第二曲线处理第四图像;processing the fourth image based on the second curve;
将处理后的第四图像更新为待处理图像,并再次执行对待处理图像进行模糊化处理的步骤。The processed fourth image is updated to the image to be processed, and the step of blurring the image to be processed is performed again.
本申请实施例能够有效提亮人脸图像中的暗部区域,如斑点、伤疤等区域,该处理不会对人脸增提进行提亮,因此不会伤害人脸的立体结构,且无需利用AI算法,对设备性能的占用和开销均较小,实现了在保持人脸结构立体的情况下,实现对瑕疵部分亮度的均匀化,提高了磨皮效果。The embodiments of the present application can effectively brighten the dark areas in the face image, such as spots, scars and other areas, the processing will not enhance the face enhancement and brighten, so the three-dimensional structure of the face will not be damaged, and AI does not need to be used The algorithm, which occupies less equipment performance and costs less, realizes the uniformity of the brightness of the flawed part while maintaining the three-dimensional structure of the face, and improves the effect of skin resurfacing.
可选地,处理器510,还用于获取预设遮罩,预设遮罩用于使第二图像的第二目标区域的亮度值保持不变;Optionally, the
通过预设遮罩处理第二目标区域。The second target area is processed by a preset mask.
本申请实施例通过预设遮罩处理第二图像的目标区域,也即五官区域,五官区域内的亮度值在预设遮罩的保护下,不会收到第一曲线和第二曲线的影响,因此人脸五官不会收到磨皮算法的影响,能够准确还原五官细节,保证磨皮效果。In this embodiment of the present application, a preset mask is used to process the target area of the second image, that is, the facial features area. Under the protection of the preset mask, the brightness value in the facial features area will not be affected by the first curve and the second curve. , so the facial features of the face will not be affected by the microdermabrasion algorithm, and the details of the facial features can be accurately restored to ensure the microdermabrasion effect.
可选地,处理器510,还用于通过第二图像,对原始图像进行处理,得到处理后的目标图像。Optionally, the
本申请实施例在输出第二图像,作为磨皮后的mask区域后,通过该mask区域与原始图像,也即最初的人脸图像进行处理,从而提亮人脸图像中的暗部区域,如斑点、伤疤等区域,得到磨皮美颜后的人脸图像。该过程不会对人脸增提进行提亮,因此不会伤害人脸的立体结构,且无需利用AI算法,对设备性能的占用和开销均较小,实现了在保持人脸结构立体的情况下,实现对瑕疵部分亮度的均匀化,提高了磨皮效果。In the embodiment of the present application, after outputting the second image as the mask area after skin grinding, the mask area is processed with the original image, that is, the original face image, so as to brighten the dark areas in the face image, such as spots , scars and other areas to obtain the face image after microdermabrasion and beautification. This process will not brighten the face enhancement, so it will not damage the three-dimensional structure of the face, and does not need to use AI algorithms, the occupation and cost of equipment performance are small, and the three-dimensional structure of the face is maintained. It achieves the uniformity of the brightness of the flawed part and improves the effect of microdermabrasion.
应理解的是,本申请实施例中,输入单元504可以包括图形处理器(GraphicsProcessing Unit,GPU)5041和麦克风5042,图形处理器5041对在视频捕获模式或图像捕获模式中由图像捕获装置(如摄像头)获得的静态图片或视频的图像数据进行处理。显示单元506可包括显示面板5061,可以采用液晶显示器、有机发光二极管等形式来配置显示面板5061。用户输入单元507包括触控面板5071以及其他输入设备5072中的至少一种。触控面板5071,也称为触摸屏。触控面板5071可包括触摸检测装置和触摸控制器两个部分。其他输入设备5072可以包括但不限于物理键盘、功能键(比如音量控制按键、开关按键等)、轨迹球、鼠标、操作杆,在此不再赘述。It should be understood that, in this embodiment of the present application, the
存储器509可用于存储软件程序以及各种数据。存储器509可主要包括存储程序或指令的第一存储区和存储数据的第二存储区,其中,第一存储区可存储操作系统、至少一个功能所需的应用程序或指令(比如声音播放功能、图像播放功能等)等。此外,存储器509可以包括易失性存储器或非易失性存储器,或者,存储器509可以包括易失性和非易失性存储器两者。其中,非易失性存储器可以是只读存储器(Read-Only Memory,ROM)、可编程只读存储器(Programmable ROM,PROM)、可擦除可编程只读存储器(Erasable PROM,EPROM)、电可擦除可编程只读存储器(Electrically EPROM,EEPROM)或闪存。易失性存储器可以是随机存取存储器(Random Access Memory,RAM),静态随机存取存储器(Static RAM,SRAM)、动态随机存取存储器(Dynamic RAM,DRAM)、同步动态随机存取存储器(Synchronous DRAM,SDRAM)、双倍数据速率同步动态随机存取存储器(Double Data Rate SDRAM,DDRSDRAM)、增强型同步动态随机存取存储器(Enhanced SDRAM,ESDRAM)、同步连接动态随机存取存储器(Synch link DRAM,SLDRAM)和直接内存总线随机存取存储器(Direct Rambus RAM,DRRAM)。本申请实施例中的存储器509包括但不限于这些和任意其它适合类型的存储器。The
处理器510可包括一个或多个处理单元;可选的,处理器510集成应用处理器和调制解调处理器,其中,应用处理器主要处理涉及操作系统、用户界面和应用程序等的操作,调制解调处理器主要处理无线通信信号,如基带处理器。可以理解的是,上述调制解调处理器也可以不集成到处理器510中。The
本申请实施例还提供一种可读存储介质,所述可读存储介质上存储有程序或指令,该程序或指令被处理器执行时实现上述方法实施例的各个过程,且能达到相同的技术效果,为避免重复,这里不再赘述。Embodiments of the present application further provide a readable storage medium, where a program or an instruction is stored on the readable storage medium, and when the program or instruction is executed by a processor, each process of the foregoing method embodiments can be implemented, and the same technology can be achieved The effect, in order to avoid repetition, is not repeated here.
其中,所述处理器为上述实施例中所述的电子设备中的处理器。所述可读存储介质,包括计算机可读存储介质,如计算机只读存储器(Read-Only Memory,ROM)、随机存取存储器(Random Access Memory,RAM)、磁碟或者光盘等。Wherein, the processor is the processor in the electronic device described in the foregoing embodiments. The readable storage medium includes a computer-readable storage medium, such as a computer read-only memory (Read-Only Memory, ROM), a random access memory (Random Access Memory, RAM), a magnetic disk or an optical disk, and the like.
本申请实施例另提供了一种芯片,所述芯片包括处理器和通信接口,所述通信接口和所述处理器耦合,所述处理器用于运行程序或指令,实现上述方法实施例的各个过程,且能达到相同的技术效果,为避免重复,这里不再赘述。An embodiment of the present application further provides a chip, where the chip includes a processor and a communication interface, the communication interface is coupled to the processor, and the processor is configured to run a program or an instruction to implement each process of the foregoing method embodiments , and can achieve the same technical effect, in order to avoid repetition, it is not repeated here.
应理解,本申请实施例提到的芯片还可以称为系统级芯片、系统芯片、芯片系统或片上系统芯片等。It should be understood that the chip mentioned in the embodiments of the present application may also be referred to as a system-on-chip, a system-on-chip, a system-on-a-chip, or a system-on-a-chip, or the like.
本申请实施例提供一种计算机程序产品,该程序产品被存储在存储介质中,该程序产品被至少一个处理器执行以实现如上述图像处理方法实施例的各个过程,且能达到相同的技术效果,为避免重复,这里不再赘述。The embodiments of the present application provide a computer program product, the program product is stored in a storage medium, and the program product is executed by at least one processor to implement the various processes in the above image processing method embodiments, and can achieve the same technical effect , in order to avoid repetition, it will not be repeated here.
需要说明的是,在本文中,术语“包括”、“包含”或者其任何其他变体意在涵盖非排他性的包含,从而使得包括一系列要素的过程、方法、物品或者装置不仅包括那些要素,而且还包括没有明确列出的其他要素,或者是还包括为这种过程、方法、物品或者装置所固有的要素。在没有更多限制的情况下,由语句“包括一个……”限定的要素,并不排除在包括该要素的过程、方法、物品或者装置中还存在另外的相同要素。此外,需要指出的是,本申请实施方式中的方法和装置的范围不限按示出或讨论的顺序来执行功能,还可包括根据所涉及的功能按基本同时的方式或按相反的顺序来执行功能,例如,可以按不同于所描述的次序来执行所描述的方法,并且还可以添加、省去、或组合各种步骤。另外,参照某些示例所描述的特征可在其他示例中被组合。It should be noted that, herein, the terms "comprising", "comprising" or any other variation thereof are intended to encompass non-exclusive inclusion, such that a process, method, article or device comprising a series of elements includes not only those elements, It also includes other elements not expressly listed or inherent to such a process, method, article or apparatus. Without further limitation, an element qualified by the phrase "comprising a..." does not preclude the presence of additional identical elements in a process, method, article or apparatus that includes the element. Furthermore, it should be noted that the scope of the methods and apparatus in the embodiments of the present application is not limited to performing the functions in the order shown or discussed, but may also include performing the functions in a substantially simultaneous manner or in the reverse order depending on the functions involved. To perform functions, 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 some examples may be combined in other examples.
通过以上的实施方式的描述,本领域的技术人员可以清楚地了解到上述实施例方法可借助软件加必需的通用硬件平台的方式来实现,当然也可以通过硬件,但很多情况下前者是更佳的实施方式。基于这样的理解,本申请的技术方案本质上或者说对现有技术做出贡献的部分可以以计算机软件产品的形式体现出来,该计算机软件产品存储在一个存储介质(如ROM/RAM、磁碟、光盘)中,包括若干指令用以使得一台终端(可以是手机,计算机,服务器,或者网络设备等)执行本申请各个实施例所述的方法。From 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 hardware platform, and of course hardware can also be used, but in many cases the former is better implementation. Based on this understanding, the technical solutions of the present application can be embodied in the form of computer software products that are essentially or contribute to the prior art, and the computer software products are stored in a storage medium (such as ROM/RAM, magnetic disk , CD), including several instructions to make a terminal (which may be a mobile phone, a computer, a server, or a network device, etc.) execute the methods described in the 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 embodiments, which are merely illustrative rather than restrictive. Under the inspiration of this application, without departing from the scope of protection of the purpose of this application and the claims, many forms can be made, which all fall within the protection of this application.
Claims (10)
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202210164195.8A CN114529474B (en) | 2022-02-22 | 2022-02-22 | Image processing method and processing device, electronic device and readable storage medium |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202210164195.8A CN114529474B (en) | 2022-02-22 | 2022-02-22 | Image processing method and processing device, electronic device and readable storage medium |
Publications (2)
Publication Number | Publication Date |
---|---|
CN114529474A true CN114529474A (en) | 2022-05-24 |
CN114529474B CN114529474B (en) | 2025-03-18 |
Family
ID=81625655
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202210164195.8A Active CN114529474B (en) | 2022-02-22 | 2022-02-22 | Image processing method and processing device, electronic device and readable storage medium |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN114529474B (en) |
Citations (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20040101207A1 (en) * | 2002-11-27 | 2004-05-27 | General Electric Company | Method and system for improving contrast using multi-resolution contrast based dynamic range management |
CN110232670A (en) * | 2019-06-19 | 2019-09-13 | 重庆大学 | A method of the image visual effect enhancing based on low-and high-frequency separation |
CN113409204A (en) * | 2021-06-10 | 2021-09-17 | Oppo广东移动通信有限公司 | Method and device for optimizing image to be processed, storage medium and electronic equipment |
-
2022
- 2022-02-22 CN CN202210164195.8A patent/CN114529474B/en active Active
Patent Citations (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20040101207A1 (en) * | 2002-11-27 | 2004-05-27 | General Electric Company | Method and system for improving contrast using multi-resolution contrast based dynamic range management |
CN110232670A (en) * | 2019-06-19 | 2019-09-13 | 重庆大学 | A method of the image visual effect enhancing based on low-and high-frequency separation |
CN113409204A (en) * | 2021-06-10 | 2021-09-17 | Oppo广东移动通信有限公司 | Method and device for optimizing image to be processed, storage medium and electronic equipment |
Non-Patent Citations (1)
Title |
---|
李庆忠 等: "基于小波变换的低照度图像自适应增强算法", 《中国激光》, vol. 42, no. 2, 28 February 2015 (2015-02-28), pages 0209001 - 1 * |
Also Published As
Publication number | Publication date |
---|---|
CN114529474B (en) | 2025-03-18 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN113168038B (en) | Method and device for displaying image | |
US8311360B2 (en) | Shadow remover | |
CN112967207B (en) | Image processing method and device, electronic equipment and storage medium | |
CN112767281A (en) | Image ghost eliminating method, device, electronic equipment and storage medium | |
CN114119432B (en) | Image processing method, device, electronic device and storage medium | |
CN112837251A (en) | Image processing method and device | |
CN112367486B (en) | Video processing method and device | |
CN101533511B (en) | Background image updating method and device thereof | |
CN110473156B (en) | Image information processing method and device, storage medium and electronic equipment | |
CN111835937A (en) | Image processing method and device and electronic equipment | |
CN115082350A (en) | Stroboscopic image processing method, device, electronic device and readable storage medium | |
CN113284063A (en) | Image processing method, image processing apparatus, electronic device, and readable storage medium | |
CN114529474A (en) | Image processing method and processing device, electronic device and readable storage medium | |
WO2022042502A1 (en) | Beautifying function enabling method and apparatus, and electronic device | |
CN116862782A (en) | Image optimization method, device, electronic equipment and storage medium | |
CN117011124A (en) | Gain map generation method and device, electronic equipment and medium | |
CN114979479A (en) | Shooting method and device thereof | |
CN114299014A (en) | Image processing architecture, method, electronic device and storage medium | |
CN116612046B (en) | Image processing method and device | |
Chen et al. | An efficient reconfigurable architecture design and implementation of image contrast enhancement algorithm | |
Zhu | Low-light image enhancement based on LAB color space | |
CN117793513A (en) | Video processing method and device | |
Shiau et al. | An Adaptive backlight Dimming with the Edge Enhancement Technique | |
CN112581394B (en) | Image processing method, device, equipment and medium | |
CN119031250A (en) | Image processing method, device and electronic equipment |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
GR01 | Patent grant | ||
GR01 | Patent grant |