WO2023051664A1 - 一种图像处理方法及装置 - Google Patents
一种图像处理方法及装置 Download PDFInfo
- Publication number
- WO2023051664A1 WO2023051664A1 PCT/CN2022/122446 CN2022122446W WO2023051664A1 WO 2023051664 A1 WO2023051664 A1 WO 2023051664A1 CN 2022122446 W CN2022122446 W CN 2022122446W WO 2023051664 A1 WO2023051664 A1 WO 2023051664A1
- Authority
- WO
- WIPO (PCT)
- Prior art keywords
- image
- processed
- color
- area
- feature
- 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.)
- Ceased
Links
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T11/00—Two-dimensional [2D] image generation
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T7/00—Image analysis
- G06T7/90—Determination of colour characteristics
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06V—IMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
- G06V10/00—Arrangements for image or video recognition or understanding
- G06V10/40—Extraction of image or video features
- G06V10/56—Extraction of image or video features relating to colour
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06V—IMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
- G06V10/00—Arrangements for image or video recognition or understanding
- G06V10/70—Arrangements for image or video recognition or understanding using pattern recognition or machine learning
- G06V10/762—Arrangements for image or video recognition or understanding using pattern recognition or machine learning using clustering, e.g. of similar faces in social networks
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06V—IMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
- G06V10/00—Arrangements for image or video recognition or understanding
- G06V10/70—Arrangements for image or video recognition or understanding using pattern recognition or machine learning
- G06V10/764—Arrangements for image or video recognition or understanding using pattern recognition or machine learning using classification, e.g. of video objects
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06V—IMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
- G06V40/00—Recognition of biometric, human-related or animal-related patterns in image or video data
- G06V40/10—Human or animal bodies, e.g. vehicle occupants or pedestrians; Body parts, e.g. hands
- G06V40/16—Human faces, e.g. facial parts, sketches or expressions
Definitions
- the present invention relates to the technical field of image processing, in particular to an image processing method and device.
- Image toning technology is a technology for image style conversion. Appropriate toning can often play a role in creating a good atmosphere, so image toning has always been one of the research hotspots in the field of image processing.
- An image toning scheme commonly used in the prior art is: the user manually adjusts color parameters such as the color gamut, contrast, and brightness of the image based on experience, and checks the toned image to feel whether the toned image meets expectations If the toning effect does not meet the expected toning effect, the image will be re-graded until the style of the toned image meets the expected toning effect.
- the image toning scheme in the prior art requires the user to manually adjust the color of the image based on experience. However, even for experienced users, it is difficult to adjust the image to an image that meets the expected effect in a short time. As a result, for users with less experience, it is likely that the image cannot be adjusted to meet the expected effect. Therefore, the image adjustment scheme in the prior art is time-consuming and laborious, and the efficiency is low.
- the present invention provides an image processing method and device, which are used to solve the problems of time-consuming, labor-intensive, and low-efficiency image color correction schemes in the prior art.
- an embodiment of the present invention provides an image processing method, including:
- the to-be-processed image is toned according to the toning scheme, and a target image corresponding to the to-be-processed image is acquired.
- the analyzing the image to be processed and acquiring the emotional features of the image to be processed includes:
- the expression type of the human face in the image to be processed is obtained;
- the emotional feature of the image to be processed is acquired according to the expression type.
- the acquisition of the expression type of the face in the image to be processed according to the image data corresponding to the face area includes:
- the expression type of the human face in the image to be processed is obtained;
- the expression recognition model is a model obtained by training a preset network model through sample data, and the sample data includes a plurality of sample face images and the expression types corresponding to each of the sample face images.
- the analyzing the image to be processed and obtaining the tone feature of the image to be processed includes:
- the hue feature of the image to be processed is acquired according to the main color of each image area.
- the determining the main color of each image area according to the color of the pixels in each image area includes:
- the colors of the pixels in the target image area are clustered into N color clusters, the target image area is any image area in the at least one image area, and N is an integer greater than 1;
- the target color cluster is the color cluster containing the largest number of colors among the N color clusters
- the at least one image area includes: a lip area and a cheek area;
- the obtaining the tone feature of the image to be processed according to the main color of each image area includes:
- the makeup tone feature of the image to be processed is acquired according to the difference.
- the at least one image area includes: a clothing area
- the obtaining the tone feature of the image to be processed according to the main color of each image area includes:
- the clothing tone feature of the image to be processed is acquired.
- the at least one image area includes: a background area;
- the obtaining the tone feature of the image to be processed according to the main color of each image area includes:
- the background tone feature of the image to be processed is acquired.
- the acquiring the color scheme corresponding to the emotional feature and the tone feature includes:
- the color toning scheme of the image to be processed is acquired, and the preset corresponding relationship includes a corresponding relationship between the image category and the color toning scheme.
- an image processing device including:
- An analysis unit configured to analyze the image to be processed, and obtain the emotional characteristics and tone characteristics of the image to be processed
- a processing unit configured to acquire a color scheme corresponding to the emotional feature and the tone feature
- a toning unit configured to perform toning on the image to be processed according to the toning scheme, and acquire a target image corresponding to the image to be processed.
- the analysis unit is specifically configured to determine the face area of the image to be processed based on face detection technology; obtain the face area according to the image data corresponding to the face area The expression type of the human face in the image to be processed; and the emotional feature of the image to be processed is acquired according to the expression type.
- the analysis unit is specifically configured to acquire the expression type of the face in the image to be processed according to the image data corresponding to the face area and the expression recognition model;
- the expression recognition model is a model obtained by training a preset network model through sample data, and the sample data includes a plurality of sample face images and the expression types corresponding to each of the sample face images.
- the analysis unit is specifically configured to divide the image to be processed into at least one image area; determine the main Color: Acquiring the tone feature of the image to be processed according to the main color of each image area.
- the analysis unit is specifically configured to cluster the colors of the pixels in the target image area into N color clusters based on a preset clustering algorithm, and the target image area For any image area in the at least one image area, N is an integer greater than 1; determine the target color cluster, the target color cluster is the color cluster with the largest number of colors contained in the N color clusters; The central color of the target color cluster is determined as the main color of the target image area.
- the at least one image area includes: a lip area and a cheek area;
- the analysis unit is specifically configured to respectively convert the main color of the lip area and the main color of the cheek area into colors in the HSV color space, acquire the first color and the second color; acquire the color of the first color The difference between the hue value and the hue value of the second color; acquiring the makeup tone feature of the image to be processed according to the difference.
- the at least one image area includes: a clothing area
- the analysis unit is specifically configured to acquire the clothing tone feature of the image to be processed according to the color range to which the main color of the clothing area belongs.
- the at least one image area includes: a background area;
- the analysis unit is specifically configured to acquire the background tone feature of the image to be processed according to the color range to which the main color of the background area belongs.
- the processing unit is specifically configured to classify the image to be processed based on a support vector machine, the emotion feature, and the hue feature, and acquire the image to be processed the image category; according to the image category and a preset correspondence, acquire the toning scheme of the image to be processed, and the preset correspondence includes the correspondence between the image category and the toning scheme.
- an embodiment of the present invention provides an electronic device, including: a memory and a processor, the memory is used to store a computer program; the processor is used to enable the electronic device to implement the first The image processing method described in any optional implementation manner of the aspect or the first aspect.
- an embodiment of the present invention provides a computer-readable storage medium.
- the computing device implements the first aspect or any optional implementation manner of the first aspect. The image processing method described above.
- an embodiment of the present invention provides a computer program product.
- the computer program product runs on a computer, the computer implements the first aspect or any optional implementation manner of the first aspect. image processing method.
- the image processing method provided by the embodiment of the present invention firstly analyzes the image to be processed, acquires the emotional feature and tone feature of the image to be processed, and then acquires the emotional feature and the tone feature corresponding to the color tone of the image. Toning scheme, and toning the image to be processed according to the toning scheme, so as to obtain a target image corresponding to the image to be processed.
- the embodiments of the present invention can improve the efficiency of image toning, and solve the problems of time-consuming, laborious and inefficient manual image toning.
- FIG. 1 is a flowchart of steps of an image processing method provided by an embodiment of the present invention
- FIG. 2 is a schematic diagram of an image processing device provided by an embodiment of the present invention.
- FIG. 3 is a schematic diagram of a hardware structure of an electronic device provided by an embodiment of the present invention.
- words such as “exemplary” or “for example” are used as examples, illustrations or illustrations. Any embodiment or design solution described as “exemplary” or “for example” in the embodiments of the present invention shall not be construed as being more preferred or more advantageous than other embodiments or design solutions. Rather, the use of words such as “exemplary” or “such as” is intended to present related concepts in a concrete manner.
- the meaning of "plurality” refers to two or more.
- the embodiment of the present invention provides an image processing method, as shown in FIG. 1, the image processing method includes the following steps:
- the emotional feature of the image to be processed refers to the emotion shown by the image semantics of the image to be processed.
- the emotions shown by the image semantics of the image to be processed may include: anger, contempt, disgust, fear, happiness, sadness, surprise, etc.
- the emotional characteristics of the image to be processed may be shown by the image semantics of the image to be processed The characteristics corresponding to the emotions.
- the tone feature of the image to be processed in the embodiment of the present invention refers to the color tendency of the image to be processed.
- the image to be processed can be taken as a whole, and the overall color tendency of the image to be processed can be obtained as the tone feature of the image to be processed, or the image to be processed can be divided into multiple image regions , and obtain the color tendency of each image region separately, and obtain the tone feature of the image to be processed according to the color tendency of each image region.
- the image to be processed can be divided into face area, clothing area, and background area, and the color tendencies of the face area, clothing area, and background area are obtained respectively, and the color tendencies of the face area, clothing area, and background area are obtained Get the hue features of the image to be processed.
- the color palette scheme in this embodiment of the present invention may include: a color mapping color card for mapping each color value in the image to be processed to a corresponding mapped color value.
- the corresponding relationship between the emotional feature, the color tone feature and the color scheme can be established in advance, and the corresponding relationship can be searched according to the emotional feature and the color color feature, so as to obtain the emotional feature and the The color scheme corresponding to the hue feature.
- the emotional feature of the image to be processed is emotional feature 1
- the tone feature of the image to be processed is tone feature 3
- the implementation of color-grading the to-be-processed image according to the to-be-processed image, and obtaining the target image corresponding to the to-be-processed image may include:
- the mapped colors of the dots generate the target image corresponding to the processed image.
- the image processing method provided by the embodiment of the present invention first analyzes the image to be processed, acquires the emotional feature and tone feature of the image to be processed, and then acquires the emotional feature and the tone feature corresponding to the image toning. Toning scheme, and toning the image to be processed according to the toning scheme, so as to obtain a target image corresponding to the image to be processed. Since the image processing method provided by the embodiment of the present invention can analyze the emotional characteristics and tone characteristics of the image to be processed, and automatically color the image to be processed according to the color matching scheme corresponding to the emotional characteristics and tone characteristics of the image to be processed, Therefore, the embodiments of the present invention can improve the efficiency of image toning, and solve the problems of time-consuming, laborious and inefficient manual image toning.
- the implementation of analyzing the image to be processed in the above step S11 and obtaining the emotional characteristics of the image to be processed may include the following steps a to c:
- Step a Determine the face area of the image to be processed based on face detection technology.
- the face detection technology in the embodiment of the present invention is to use a certain strategy to search for any given image to determine whether it contains a human face, and return the human face if it contains a human face.
- the location and size of the technique is to use a certain strategy to search for any given image to determine whether it contains a human face, and return the human face if it contains a human face.
- the image to be processed in the embodiment of the present invention includes at least one face image.
- the image to be processed includes multiple face images, the area of each face image may be obtained, and the area where the face with the largest area is located is used as the face area of the image to be processed.
- the face area of the image to be processed may be the area enclosed by the edges of the face in the image to be processed, or the area within the face detection frame in the image to be processed.
- Step b According to the image data corresponding to the face area, the expression type of the face in the image to be processed is acquired.
- the implementation of the above step b (obtaining the expression type of the face in the image to be processed according to the image data corresponding to the face area) may include:
- the expression type of the human face in the image to be processed is obtained;
- the expression recognition model is a model obtained by training a preset network model through sample data, and the sample data includes a plurality of sample face images and the expression types corresponding to each of the sample face images.
- the sample data in the embodiment of the present invention may be the FER2013 facial expression data set.
- the Fer2013 facial expression dataset consists of 35886 facial expression pictures, including 28708 training pictures, 3589 public verification pictures (PublicTest) and 3589 private verification pictures (PrivateTest).
- the size is fixed at 48 ⁇ 48 grayscale images, there are 7 types of expressions, corresponding to the number labels 0-6, and the labels corresponding to the specific expression types are as follows:
- facial expression types is a model obtained by training a preset network model through the FER2013 facial expression data set
- the image to be processed is obtained according to the image data corresponding to the face area and the expression recognition model
- the implementation of facial expression types in includes:
- the type is anger, when the output of the expression recognition model is 1, it is determined that the expression type of the face in the image to be processed is disgusting, and when the output of the expression recognition model is 2, it is determined that the face in the image to be processed is
- the expression type is fear, when the output of the expression recognition model is 3, it is determined that the expression type of the face in the image to be processed is happy, and when the output of the expression recognition model is 4, it is determined that the expression type of the face in the image to be processed is 4
- the facial expression type is sad, when the output of the expression recognition model is 5, it is determined that the facial expression type of the human face in the image to be processed is surprised, and when the output of the facial expression recognition model is 6, it is determined that the image to be processed is The expression type of the face in is peaceful.
- Step c acquiring the emotional features of the image to be processed according to the expression type.
- the corresponding relationship between expression types and emotional features can be preset, and the emotional features of the image to be processed can be obtained according to the corresponding relationship between expression types and emotional features.
- the corresponding relationship between preset expression types and emotional characteristics is: angry-1; disgust-2; fear-3; happy-4; sad-5; surprise-6; It can be determined that the emotional feature of the image to be processed is 2, and when the expression type is sad, the emotional feature of the image to be processed can be determined to be 5.
- the tone characteristics of the image to be processed include at least one of the following:
- the background tone feature of the image to be processed is the background tone feature of the image to be processed.
- the tone feature of the image to be processed may include: one or more items of the tone feature of makeup of the image to be processed, the tone feature of clothing of the image to be processed, and the tone feature of the background of the image to be processed.
- analyzing the image to be processed in the above-mentioned step S11, and obtaining the tone feature of the image to be processed includes the following steps 1 to 3:
- Step 1 Segment the image to be processed into at least one image region.
- the tone features of the image to be processed include: the tone feature of makeup of the image to be processed, the tone feature of clothing of the image to be processed, and the tone feature of the background of the image to be processed
- the The processing for segmenting an image into at least one image region includes:
- the image to be processed is divided into lip area, cheek area, clothing area and background area.
- the lip area and the cheek area in the image to be processed can be determined by the key point positioning technology of the face, and the image segmentation algorithm based on the threshold value, the image segmentation algorithm based on the region, the image segmentation algorithm based on the edge, etc. can be segmented
- the clothing area in the image to be processed, and other areas in the image to be processed except the lip area, the cheek area, and the clothing area are determined as the background area of the image to be processed.
- Step 2. Determine the main color of each image area according to the colors of the pixels in each image area.
- the above step 2 (determining the main color of each image area according to the color of the pixels in each image area) includes the following steps 21 to 23:
- Step 21 Cluster the colors of the pixels in the target image area into N color clusters based on a preset clustering algorithm.
- the target image area is any image area in the at least one image area, and N is an integer greater than 1.
- the preset clustering algorithm in the embodiment of the present invention is a K-means clustering (K-means) algorithm.
- the process of clustering the colors of the pixels in the target image area into N color clusters through the K-means clustering algorithm may include: traversing all the pixels in the target image area by calling the get_color module in the image processing (Python Imaging Library) library color; create N color clusters, and randomly set or estimate the center color of each color cluster; cluster the color of each pixel into the color cluster closest to the center color Euclidean distance, and update each The central color value of the color cluster repeatedly clusters the color of each pixel into the color cluster closest to the central color Euclidean distance, and updates the central color value of each color cluster until each color cluster converges.
- K-means K-means clustering
- Step 22 determine the target color cluster.
- the target color cluster is the color cluster containing the largest number of colors among the N color clusters.
- Step 23 Determine the central color of the target color cluster as the main color of the target image area.
- the lip area, cheek area, clothing area and background area of the image to be processed are sequentially used as the target image area in the above embodiment, thereby obtaining the main color of the lip area, the main color of the cheek area, the main color of the clothing area and the background The primary color of the region.
- Step 3 Obtain the tone feature of the image to be processed according to the main color of each image area.
- the at least one image area includes: a lip area and a cheek area.
- step 3 (acquiring the tone feature of the image to be processed according to the main color of each image area) includes:
- the makeup tone feature of the image to be processed is acquired according to the difference.
- the HSV color space is a color space that expresses colors by means of hue (Hue), saturation (Saturation) and lightness (Value).
- converting the main color of the lip area and the main color of the cheek area into colors in the HSV color space, and obtaining the first color and the second color include: converting the lip area The main color of the main color and the main color of the cheek area are converted into light signals, the first light signal and the second light signal are obtained, the first light signal and the second light signal are converted into colors in the HSV color space, and the first color is obtained and a second color.
- the first color is C(H1, S1, Y1) and the first color is C(H2, S2, Y2), then the difference between the hue value of the first color and the hue value of the second color is H1 -H2.
- the at least one image area includes: a clothing area.
- step 3 (acquiring the tone feature of the image to be processed according to the main color of each image area) includes:
- the clothing tone feature of the image to be processed is acquired.
- the colors in the color space can be divided into a first color range corresponding to cool tones and a second color range corresponding to warm tones, and when the main color of the clothing area belongs to the first color range, the determination of the to-be The clothing tone feature of the image to be processed is a cool tone, and when the main color of the clothing area belongs to the second color range, it is determined that the clothing tone feature of the image to be processed is a warm tone.
- the at least one image area includes: a background area.
- step 3 (acquiring the tone feature of the image to be processed according to the main color of each image area) includes:
- the background tone feature of the image to be processed is acquired.
- the colors in the color space can be divided into a first color range corresponding to cool tones and a second color range corresponding to warm tones, and when the main color of the clothing area belongs to the first color range, determine the image to be processed
- the background tone feature of the image is a cool tone
- the main color of the clothing area belongs to the second color range it is determined that the background tone feature of the image to be processed is a warm tone.
- step S12 obtaining the color matching scheme corresponding to the emotional feature and the tone feature
- steps I and II the following steps I and II:
- Step 1 Classify the image to be processed based on a support vector machine (Support Vector Machine, SVM), the emotional feature and the tone feature, and obtain the image category of the image to be processed.
- SVM Support Vector Machine
- the support vector machine is a classification algorithm based on supervised learning.
- the decision boundary of the support vector machine is the maximum-margin hyperplane (maximum-margin hyperplane) solved for the learning samples.
- the weights of emotional features and tonal features can be determined according to the emotional features and tonal features of the sample image and the category of the sample image.
- Image class for processing images the weights of emotional features and tonal features of the sample image and the category of the sample image.
- Step II according to the image category and the preset corresponding relationship, acquire the color palette scheme of the image to be processed.
- the preset corresponding relationship includes the corresponding relationship between the image category and the color scheme.
- the embodiment of the present invention also provides an image processing device, the device embodiment corresponds to the aforementioned method embodiment, for the sake of easy reading, this device embodiment does not implement the aforementioned method
- the image processing apparatus in this embodiment can correspondingly implement all the content in the foregoing method embodiments.
- FIG. 2 is a schematic structural diagram of the image processing device. As shown in FIG. 2 , the image processing device 200 includes:
- An analysis unit 21 configured to analyze the image to be processed, and obtain the emotional characteristics and tone characteristics of the image to be processed
- a processing unit 22 configured to acquire a color scheme corresponding to the emotional feature and the tone feature
- the toning unit 23 is configured to perform toning on the image to be processed according to the toning scheme, and acquire a target image corresponding to the image to be processed.
- the analysis unit 21 is specifically configured to determine the face area of the image to be processed based on the face detection technology; according to the image data corresponding to the face area, obtain The expression type of the human face in the image to be processed; acquiring the emotional feature of the image to be processed according to the expression type.
- the analysis unit 21 is specifically configured to acquire the expression type of the face in the image to be processed according to the image data corresponding to the face area and the expression recognition model ;
- the expression recognition model is a model obtained by training a preset network model through sample data, and the sample data includes a plurality of sample face images and the expression types corresponding to each of the sample face images.
- the analysis unit 21 is specifically configured to divide the image to be processed into at least one image area; determine the color of each image area according to the color of the pixel in each image area main color: acquiring the tone feature of the image to be processed according to the main color of each image area.
- the analysis unit 21 is specifically configured to cluster the colors of the pixels in the target image region into N color clusters based on a preset clustering algorithm, and the target image
- the area is any image area in the at least one image area, and N is an integer greater than 1; determine the target color cluster, and the target color cluster is the color cluster containing the largest number of colors among the N color clusters;
- the central color of the target color cluster is determined as the main color of the target image area.
- the at least one image area includes: a lip area and a cheek area;
- the analysis unit 21 is specifically configured to respectively convert the main color of the lip area and the main color of the cheek area into colors in the HSV color space, acquire a first color and a second color; acquire the first color The difference between the hue value of the second color and the hue value of the second color; acquiring the makeup tone feature of the image to be processed according to the difference.
- the at least one image area includes: a clothing area
- the analysis unit 21 is specifically configured to acquire the clothing tone feature of the image to be processed according to the color range to which the main color of the clothing area belongs.
- the at least one image area includes: a background area;
- the analysis unit 21 is specifically configured to acquire the background tone feature of the image to be processed according to the color range to which the main color of the background area belongs.
- the processing unit 22 is specifically configured to classify the image to be processed based on the support vector machine, the emotional feature, and the hue feature, and obtain the image to be processed
- the image category of the image according to the image category and a preset correspondence, acquire the color palette scheme of the image to be processed, and the preset correspondence relationship includes the correspondence relationship between the image category and the color palette scheme.
- the image processing apparatus provided in this embodiment can execute the image processing method provided in the foregoing method embodiment, and its implementation principle and technical effect are similar, and details are not repeated here.
- FIG. 3 is a schematic structural diagram of an electronic device provided by an embodiment of the present invention.
- the electronic device provided by this embodiment includes: a memory 31 and a processor 32, the memory 31 is used to store computer programs; the processing The device 32 is configured to execute the image processing method provided by the above-mentioned embodiments when calling a computer program.
- an embodiment of the present invention also provides a computer-readable storage medium, on which a computer program is stored, and when the computer program is executed by a processor, the computing device implements the above-mentioned embodiment provided image processing methods.
- an embodiment of the present invention further provides a computer program product, which enables the computing device to implement the image processing method provided in the above-mentioned embodiments when the computer program product is run on a computer.
- the embodiments of the present invention may be provided as methods, systems, or computer program products. Accordingly, the present invention can take the form of an entirely hardware embodiment, an entirely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, the present invention may take the form of a computer program product embodied on one or more computer-usable storage media having computer-usable program code embodied therein.
- the processor can be a central processing unit (Central Processing Unit, CPU), or other general-purpose processors, digital signal processors (Digital Signal Processor, DSP), application specific integrated circuits (Application Specific Integrated Circuit, ASIC), off-the-shelf programmable Field-Programmable Gate Array (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc.
- a general-purpose processor may be a microprocessor, or the processor may be any conventional processor, or the like.
- Memory may include non-permanent storage in computer readable media, in the form of random access memory (RAM) and/or nonvolatile memory such as read only memory (ROM) or flash RAM.
- RAM random access memory
- ROM read only memory
- flash RAM flash random access memory
- Computer-readable media includes both volatile and non-volatile, removable and non-removable storage media.
- the storage medium may store information by any method or technology, and the information may be computer-readable instructions, data structures, program modules, or other data.
- Examples of computer storage media include, but are not limited to, phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read only memory (ROM), Electrically Erasable Programmable Read-Only Memory (EEPROM), Flash memory or other memory technology, Compact Disc Read-Only Memory (CD-ROM), Digital Versatile Disc (DVD) or other optical storage, A magnetic tape cartridge, disk storage or other magnetic storage device or any other non-transmission medium that can be used to store information that can be accessed by a computing device.
- computer readable media excludes transitory computer readable media, such as modulated data signals and carrier waves.
Landscapes
- Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Physics & Mathematics (AREA)
- Multimedia (AREA)
- Computer Vision & Pattern Recognition (AREA)
- Health & Medical Sciences (AREA)
- General Health & Medical Sciences (AREA)
- Computing Systems (AREA)
- Software Systems (AREA)
- Medical Informatics (AREA)
- Evolutionary Computation (AREA)
- Databases & Information Systems (AREA)
- Artificial Intelligence (AREA)
- Oral & Maxillofacial Surgery (AREA)
- Human Computer Interaction (AREA)
- Image Analysis (AREA)
- Image Processing (AREA)
Abstract
一种图像处理方法及装置,涉及图像处理技术领域。该方法包括:对待处理图像进行分析,获取所述待处理图像的情绪特征和色调特征(S11);获取所述情绪特征和所述色调特征对应的调色方案(S12);根据所述调色方案对所述待处理图像进行调色,获取所述待处理图像对应的目标图像(S13)。
Description
本申请要求于2021年09月30日提交中国专利局、申请号为202111162184.8、申请名称为“一种图像处理方法及装置”的中国专利申请的优先权,其全部内容通过引用结合在本申请中。
本发明涉及图像处理技术领域,尤其涉及一种图像处理方法及装置。
图像调色技术是一种对图像进行风格转换的技术。恰当的调色往往能起到很好的氛围营造作用,因此图像调色一直是图像处理领域的研究热点之一。
现有技术中普遍使用的一种图像调色方案为:用户基于经验手动调节图像的色域、对比度、亮度等颜色参数,并查看调色后的图像,以感受调色后的图像是否符合预期的调色效果,若不符合预期的调色效果,则重新对图像进行调色,直到调色后的图像的风格符合预期的调色效果。如上所述,现有技术中的图像调色方案需要用户基于经验手动调节图像的颜色,然而即使对于经验较为丰富的用户,也很难在短时间内将图像调色为符合预期效果的图像,以至于对于经验较少的用户,很可能根本无法将图像调色为符合预期效果的图像,因此现有技术中的图像调色方案费时费力,效率低下。
发明内容
有鉴于此,本发明提供了一种图像处理方法及装置,用于解决现有技术中的图像调色方案费时费力,效率低下的问题。
为了实现上述目的,本发明实施例提供技术方案如下:
第一方面,本发明的实施例提供了一种图像处理方法,包括:
对待处理图像进行分析,获取所述待处理图像的情绪特征和色调特征;
获取所述情绪特征和所述色调特征对应的调色方案;
根据所述调色方案对所述待处理图像进行调色,获取所述待处理图像对应的目标图像。
作为本发明实施例一种可选的实施方式,所述对待处理图像进行分析,获取所述待处理图像的情绪特征,包括:
基于人脸检测技术确定所述待处理图像的人脸区域;
根据所述人脸区域对应的图像数据,获取所述待处理图像中的人脸的表情类型;
根据所述表情类型获取所述待处理图像的情绪特征。
作为本发明实施例一种可选的实施方式,所述根据所述人脸区域对应的图像数据,获取所述待处理图像中的人脸的表情类型,包括:
根据所述人脸区域对应的图像数据和表情识别模型,获取所述待处理图像中的人脸的表情类型;
其中,所述表情识别模型为通过样本数据对预设网络模型进行训练获取的模型,所述 样本数据包括多个样本人脸图像以及各个所述样本人脸图像对应的表情类型。
作为本发明实施例一种可选的实施方式,所述对待处理图像进行分析,获取所述待处理图像的色调特征,包括:
将所述待处理图像分割为至少一个图像区域;
根据各个图像区域中的像素点的颜色确定各个图像区域的主颜色;
根据各个图像区域的主颜色获取所述待处理图像的色调特征。
作为本发明实施例一种可选的实施方式,所述根据各个图像区域中的像素点的颜色确定各个图像区域的主颜色,包括:
基于预设聚类算法将目标图像区域中的像素点的颜色聚类为N个颜色簇,所述目标图像区域为所述至少一个图像区域中的任一图像区域,N为大于1的整数;
确定目标颜色簇,所述目标颜色簇为所述N个颜色簇中包含颜色的数量最多的颜色簇;
将所述目标颜色簇的中心颜色,确定为所述目标图像区域的主颜色。
作为本发明实施例一种可选的实施方式,所述至少一个图像区域包括:嘴唇区域和脸颊区域;
所述根据各个图像区域的主颜色获取所述待处理图像的色调特征,包括:
分别将所述嘴唇区域的主颜色和所述脸颊区域的主颜色转换为HSV颜色空间中的颜色,获取第一颜色和第二颜色;
获取所述第一颜色的色相值与所述第二颜色的色相值的差值;
根据所述差值获取所述待处理图像的妆容色调特征。
作为本发明实施例一种可选的实施方式,所述至少一个图像区域包括:服装区域;
所述根据各个图像区域的主颜色获取所述待处理图像的色调特征,包括:
根据所述服装区域的主颜色所属的颜色范围,获取所述待处理图像的服装色调特征。
作为本发明实施例一种可选的实施方式,所述至少一个图像区域包括:背景区域;
所述根据各个图像区域的主颜色获取所述待处理图像的色调特征,包括:
根据所述背景区域的主颜色所属的颜色范围,获取所述待处理图像的背景色调特征。
作为本发明实施例一种可选的实施方式,所述获取所述情绪特征和所述色调特征对应的调色方案,包括:
基于支持向量机、所述情绪特征以及所述色调特征对所述待处理图像进行分类,获取所述待处理图像的图像类别;
根据所述图像类别和预设对应关系,获取所述待处理图像的调色方案,所述预设对应关系包括所述图像类别和所述调色方案的对应关系。
第二方面,本发明的实施例提供了一种图像处理装置,包括:
分析单元,用于对待处理图像进行分析,获取所述待处理图像的情绪特征和色调特征;
处理单元,用于获取所述情绪特征和所述色调特征对应的调色方案;
调色单元,用于根据所述调色方案对所述待处理图像进行调色,获取所述待处理图像对应的目标图像。
作为本发明实施例一种可选的实施方式,所述分析单元,具体用于基于人脸检测技术确定所述待处理图像的人脸区域;根据所述人脸区域对应的图像数据,获取所述待处理图 像中的人脸的表情类型;根据所述表情类型获取所述待处理图像的情绪特征。
作为本发明实施例一种可选的实施方式,所述分析单元,具体用于根据所述人脸区域对应的图像数据和表情识别模型,获取所述待处理图像中的人脸的表情类型;
其中,所述表情识别模型为通过样本数据对预设网络模型进行训练获取的模型,所述样本数据包括多个样本人脸图像以及各个所述样本人脸图像对应的表情类型。
作为本发明实施例一种可选的实施方式,所述分析单元,具体用于将所述待处理图像分割为至少一个图像区域;根据各个图像区域中的像素点的颜色确定各个图像区域的主颜色;根据各个图像区域的主颜色获取所述待处理图像的色调特征。
作为本发明实施例一种可选的实施方式,所述分析单元,具体用于基于预设聚类算法将目标图像区域中的像素点的颜色聚类为N个颜色簇,所述目标图像区域为所述至少一个图像区域中的任一图像区域,N为大于1的整数;确定目标颜色簇,所述目标颜色簇为所述N个颜色簇中包含颜色的数量最多的颜色簇;将所述目标颜色簇的中心颜色,确定为所述目标图像区域的主颜色。
作为本发明实施例一种可选的实施方式,所述至少一个图像区域包括:嘴唇区域和脸颊区域;
所述分析单元,具体用于分别将所述嘴唇区域的主颜色和所述脸颊区域的主颜色转换为HSV颜色空间中的颜色,获取第一颜色和第二颜色;获取所述第一颜色的色相值与所述第二颜色的色相值的差值;根据所述差值获取所述待处理图像的妆容色调特征。
作为本发明实施例一种可选的实施方式,所述至少一个图像区域包括:服装区域;
所述分析单元,具体用于根据所述服装区域的主颜色所属的颜色范围,获取所述待处理图像的服装色调特征。
作为本发明实施例一种可选的实施方式,所述至少一个图像区域包括:背景区域;
所述分析单元,具体用于根据所述背景区域的主颜色所属的颜色范围,获取所述待处理图像的背景色调特征。
作为本发明实施例一种可选的实施方式,所述处理单元,具体用于基于支持向量机、所述情绪特征以及所述色调特征对所述待处理图像进行分类,获取所述待处理图像的图像类别;根据所述图像类别和预设对应关系,获取所述待处理图像的调色方案,所述预设对应关系包括所述图像类别和所述调色方案的对应关系。
第三方面,本发明实施例提供了一种电子设备,包括:存储器和处理器,所述存储器用于存储计算机程序;所述处理器用于在调用计算机程序时,使得所述电子设备实现第一方面或第一方面任一种可选的实施方式所述的图像处理方法。
第四方面,本发明实施例提供一种计算机可读存储介质,当所述计算机程序被计算设备执行时,使得所述计算设备实现第一方面或第一方面任一种可选的实施方式所述的图像处理方法。
第五方面,本发明实施例提供一种计算机程序产品,当所述计算机程序产品在计算机上运行时,使得所述计算机实现第一方面或第一方面任一种可选的实施方式所述的图像处理方法。
本发明实施例提供的图像处理方法在对图像进行调色时,首先对待处理图像进行分析, 获取所述待处理图像的情绪特征和色调特征,然后获取所述情绪特征和所述色调特征对应的调色方案,并根据所述调色方案对所述待处理图像进行调色,以获取所述待处理图像对应的目标图像。由于本发明实施例提供的图像处理方法可以分析待处理图像的情绪特征和色调特征,并根据待处理图像的情绪特征和色调特征对应的调色方案自动对对所述待处理图像进行调色,因此本发明实施例可以提高图像的调色效率,解决人工对图像进行调色费时费力,效率低下的问题。
此处的附图被并入说明书中并构成本说明书的一部分,示出了符合本发明的实施例,并与说明书一起用于解释本发明的原理。
为了更清楚地说明本发明实施例或现有技术中的技术方案,下面将对实施例或现有技术描述中所需要使用的附图作简单地介绍,显而易见地,对于本领域普通技术人员而言,在不付出创造性劳动性的前提下,还可以根据这些附图获得其他的附图。
图1为本发明实施例提供的图像处理方法的步骤流程图;
图2本发明实施例提供的图像处理装置的示意图;
图3本发明实施例提供的电子设备的硬件结构示意图。
为了能够更清楚地理解本发明的上述目的、特征和优点,下面将对本发明的方案进行进一步描述。需要说明的是,在不冲突的情况下,本发明的实施例及实施例中的特征可以相互组合。
在下面的描述中阐述了很多具体细节以便于充分理解本发明,但本发明还可以采用其他不同于在此描述的方式来实施;显然,说明书中的实施例只是本发明的一部分实施例,而不是全部的实施例。
在本发明实施例中,“示例性的”或者“例如”等词用于表示作例子、例证或说明。本发明实施例中被描述为“示例性的”或者“例如”的任何实施例或设计方案不应被解释为比其它实施例或设计方案更优选或更具优势。确切而言,使用“示例性的”或者“例如”等词旨在以具体方式呈现相关概念。此外,在本发明实施例的描述中,除非另有说明,“多个”的含义是指两个或两个以上。
本发明实施例提供了一种图像处理方法,参照图1所示,该图像处理方法包括如下步骤:
S11、对待处理图像进行分析,获取所述待处理图像的情绪特征和色调特征。
在本发明实施例中,待处理图像的情绪特征是指待处理图像的图像语义所表现出的情绪。示例性的,待处理图像的图像语义所表现出的情绪可以包括:愤怒、轻蔑、厌恶、恐惧、快乐、悲伤、惊讶等,待处理图像的情绪特征可以为待处理图像的图像语义所表现出的情绪对应的特征。
本发明实施例中的待处理图像的色调特征是指待处理图像的色彩倾向。此外,在分析 待处理图像的色调特征时,可以将待处理图像为作为一个整体,获取待处理图像的总体色彩倾向作为待处理图像的色调特征,也可以将待处理图像分割为多个图像区域,并分别获取每一个图像区域的色彩倾向,以及根据每一个图像区域的色彩倾向获取待处理图像的色调特征。示例性的,可以将待处理图像分割为人脸区域、服装区域以及背景区域,并分别获取人脸区域、服装区域以及背景区域的色彩倾向,以及根据人脸区域、服装区域以及背景区域的色彩倾向获取待处理图像的色调特征。
S12、获取所述情绪特征和所述色调特征对应的调色方案。
示例性的,本发明实施例中的调色方案可以包括:用于将待处理图像中的各个颜色值映射为对应的映射颜色值的颜色映射色卡。
可选的,可以预先建立所述情绪特征、所述色调特征以及调色方案的对应关系,并根据所述情绪特征和所述色调特征查找所述对应关系,以获取所述情绪特征和所述色调特征对应的调色方案。
示例性的,情绪特征、色调特征以及调色方案的对应关系可以如下表1所示:
表1
在上述表1的基础上,若所述待处理图像的情绪特征为情绪特征1,所述待处理图像的色调特征为色调特征3,则确定所述情绪特征和所述色调特征对应的调色方案为调色方案3。
S13、根据所述调色方案对所述待处理图像进行调色,获取所述待处理图像对应的目标图像。
示例性的,根据所述调色方案对所述待处理图像进行调色,获取所述待处理图像对应的目标图像的实现方式可以包括:
提取所述待处理图像中各个像素点的颜色,根据所述情绪特征和所述色调特征对应的调色方案调节待处理图像的各个像素点的颜色,获取各像素点的映射颜色,根据各像素点的映射颜色生成所述处理图像对应的目标图像。
本发明实施例提供的图像处理方法在对图像进行调色时,首先对待处理图像进行分析,获取所述待处理图像的情绪特征和色调特征,然后获取所述情绪特征和所述色调特征对应 的调色方案,并根据所述调色方案对所述待处理图像进行调色,以获取所述待处理图像对应的目标图像。由于本发明实施例提供的图像处理方法可以分析待处理图像的情绪特征和色调特征,并根据待处理图像的情绪特征和色调特征对应的调色方案自动对对所述待处理图像进行调色,因此本发明实施例可以提高图像的调色效率,解决人工对图像进行调色费时费力,效率低下的问题。
作为本发明实施例一种可选的实施方式,上述步骤S11中对待处理图像进行分析,获取所述待处理图像的情绪特征的实现方式可以包括如下步骤a至步骤c:
步骤a、基于人脸检测技术确定所述待处理图像的人脸区域。
具体的,本发明实施例中的人脸检测技术是对于任意一副给定的图像,采用一定的策略对其进行搜索以确定其中是否含有人脸,以及在含有人脸的情况下返回人脸的位置和大小的技术。
需要说明的是,本发明实施例中的待处理图像包括至少一个人脸图像。在待处理图像包括多个人脸图像时,可以获取每一个人脸图像的面积,并将面积最大的人脸所在的区域作为所述待处理图像的人脸区域。
可选的,待处理图像的人脸区域可以为待处理图像中的人脸边缘所围合形成的区域,也可以为待处理图像中的人脸检测框内的区域。
步骤b、根据所述人脸区域对应的图像数据,获取所述待处理图像中的人脸的表情类型。
作为本发明实施例一种可选的实施方式,上述步骤b(根据所述人脸区域对应的图像数据,获取所述待处理图像中的人脸的表情类型)的实现方式可以包括:
根据所述人脸区域对应的图像数据和表情识别模型,获取所述待处理图像中的人脸的表情类型;
其中,所述表情识别模型为通过样本数据对预设网络模型进行训练获取的模型,所述样本数据包括多个样本人脸图像以及各个所述样本人脸图像对应的表情类型。
示例性的,本发明实施例中的样本数据可以为FER2013人脸表情数据集。具体的,Fer2013人脸表情数据集由35886张人脸表情图片组成,其中,测试图(Training)28708张,公共验证图(PublicTest)和私有验证图(PrivateTest)各3589张,每张图片是由大小固定为48×48的灰度图像组成,共有7种表情类型,分别对应于数字标签0-6,具体表情类型对应的标签如下:
0-生气(anger);
1-厌恶(disgust);
2-恐惧(fear);
3-开心(happy);
4-伤心(sad);
5-惊讶(surprised);
6-平和(normal)。
进一步的,当所述表情识别模型为通过FER2013人脸表情数据集对预设网络模型进行训练获取的模型时,根据所述人脸区域对应的图像数据和表情识别模型,获取所述待处理 图像中的人脸的表情类型的实现方式包括:
将所述人脸区域对应的图像数据处理为48×48的灰度图像;
将处理后的人脸区域对应的图像数据输入所述表情识别模型,并获取所述表情识别模型的输出,当表情识别模型的输出为0时,确定所述待处理图像中的人脸的表情类型为生气,当表情识别模型的输出为1时,确定所述待处理图像中的人脸的表情类型为厌恶,当表情识别模型的输出为2时,确定所述待处理图像中的人脸的表情类型为恐惧,当表情识别模型的输出为3时,确定所述待处理图像中的人脸的表情类型为开心,当表情识别模型的输出为4时,确定所述待处理图像中的人脸的表情类型为伤心,当表情识别模型的输出为5时,确定所述待处理图像中的人脸的表情类型为惊讶,当表情识别模型的输出为6时,确定所述待处理图像中的人脸的表情类型为平和。
步骤c、根据所述表情类型获取所述待处理图像的情绪特征。
可选的,可以预设置表情类型与情绪特征的对应关系,并根据表情类型与情绪特征的对应关系获取待处理图像的情绪特征。例如:预设置表情类型与情绪特征的对应关系为:生气-1;厌恶-2;恐惧-3;开心-4;伤心-5;惊讶-6;平和-7,则当表情类型为厌恶时,可以确定待处理图像的情绪特征为2,当表情类型为伤心时,可以确定待处理图像的情绪特征为5。
作为本发明实施例一种可选的实施方式,所述待处理图像的色调特征包括以下至少一项:
所述待处理图像的妆容色调特征;
所述待处理图像的服装色调特征;
所述待处理图像的背景色调特征。
即,所述待处理图像的色调特征可以包括:所述待处理图像的妆容色调特征、所述待处理图像的服装色调特征以及所述待处理图像的背景色调特征中的一项或多项。
进一步的,上述步骤S11中对待处理图像进行分析,获取所述待处理图像的色调特征,包括如下步骤1至步骤3:
步骤1、将所述待处理图像分割为至少一个图像区域。
示例性的,当所述待处理图像的色调特征包括:所述待处理图像的妆容色调特征、所述待处理图像的服装色调特征以及所述待处理图像的背景色调特征时,将所述待处理图像分割为至少一个图像区域包括:
将所述待处理图像分割为嘴唇区域、脸颊区域、服饰区域以及背景区域。
示例性的,可以通过人脸关键点定位技术确定待处理图像中的嘴唇区域和脸颊区域,通过基于阈值的图像分割算法、基于区域的图像分割算法、基于边缘的图像分割算法等图像分割算法分割所述待处理图像中的服饰区域,并将所述待处理图像中除嘴唇区域、脸颊区域、服饰区域以外的其它区域确定为所述待处理图像的背景区域。
步骤2、根据各个图像区域中的像素点的颜色确定各个图像区域的主颜色。
作为本发明实施例一种可选的实施方式,上步骤2(根据各个图像区域中的像素点的颜色确定各个图像区域的主颜色),包括如下步骤21至23:
步骤21、基于预设聚类算法将目标图像区域中的像素点的颜色聚类为N个颜色簇。
其中,所述目标图像区域为所述至少一个图像区域中的任一图像区域,N为大于1的整数。
可选的,本发明实施例中的预设聚类算法为K均值聚类(K-means)算法。通过K均值聚类算法将目标图像区域中的像素点的颜色聚类为N个颜色簇的过程可以包括:通过图像处理(Python Imaging Library)库中的调用get_color模块遍历目标图像区域中所有像素点的颜色;创建N个颜色簇,并随机设置或预估每一个颜色簇的中心颜色;将每一个像素点的颜色聚类到与中心颜色欧几里得距离最近的颜色簇中,并更新各个颜色簇的中心颜色值,重复将每一个像素点的颜色聚类到与中心颜色欧几里得距离最近的颜色簇中,并更新各个颜色簇的中心颜色值直至各个颜色簇均收敛。
步骤22、确定目标颜色簇。
其中,所述目标颜色簇为所述N个颜色簇中包含颜色的数量最多的颜色簇。
步骤23、将所述目标颜色簇的中心颜色,确定为所述目标图像区域的主颜色。
依次将所述待处理图像的嘴唇区域、脸颊区域、服饰区域以及背景区域作为上述实施例中的目标图像区域,从而获取嘴唇区域的主颜色、脸颊区域的主颜色、服饰区域的主颜色以及背景区域的主颜色。
步骤3、根据各个图像区域的主颜色获取所述待处理图像的色调特征。
进一步可选的,所述至少一个图像区域包括:嘴唇区域和脸颊区域。
上述步骤3(所述根据各个图像区域的主颜色获取所述待处理图像的色调特征)的实现方式包括:
分别将所述嘴唇区域的主颜色和所述脸颊区域的主颜色转换为HSV颜色空间中的颜色,获取第一颜色和第二颜色;
获取所述第一颜色的色相值与所述第二颜色的色相值的差值;
根据所述差值获取所述待处理图像的妆容色调特征。
具体的,HSV颜色空间是一种通过色相(Hue)、饱和度(Saturation)和明度(Value)表示颜色的颜色空间。可选的,分别将所述嘴唇区域的主颜色和所述脸颊区域的主颜色转换为HSV颜色空间中的颜色,获取第一颜色和第二颜色的实现方式包括:将分别将所述嘴唇区域的主颜色和所述脸颊区域的主颜色转换为光信号,获取第一光信号和第二光信号,将第一光信号和第二光信号转换为HSV颜色空间中的颜色,获取第一颜色和第二颜色。
设:第一颜色为C(H1,S1,Y1)第一颜色为C(H2,S2,Y2),则所述第一颜色的色相值与所述第二颜色的色相值的差值为H1-H2。
进一步可选的,所述至少一个图像区域包括:服装区域。
上述步骤3(所述根据各个图像区域的主颜色获取所述待处理图像的色调特征)的实现方式包括:
根据所述服装区域的主颜色所属的颜色范围,获取所述待处理图像的服装色调特征。
示例性的,可以将颜色空间中的颜色分为冷色调对应的第一颜色范围和暖色调对应的第二颜色范围,当所述服装区域的主颜色所属第一颜色范围时,确定所述待处理图像的服装色调特征为冷色调,当所述服装区域的主颜色所属第二颜色范围时,确定所述待处理图像的服装色调特征为暖色调。
进一步可选的,所述至少一个图像区域包括:背景区域。
上述步骤3(所述根据各个图像区域的主颜色获取所述待处理图像的色调特征)的实现方式包括:
根据所述背景区域的主颜色所属的颜色范围,获取所述待处理图像的背景色调特征。
同样,可以将颜色空间中的颜色分为冷色调对应的第一颜色范围和暖色调对应的第二颜色范围,当所述服装区域的主颜色所属第一颜色范围时,确定所述待处理图像的背景色调特征为冷色调,当所述服装区域的主颜色所属第二颜色范围时,确定所述待处理图像的背景色调特征为暖色调。
作为本发明实施例一种可选的实施方式,上述步骤S12(获取所述情绪特征和所述色调特征对应的调色方案)的实现方式包括如下步骤Ⅰ和步骤Ⅱ:
步骤Ⅰ、基于支持向量机(Support Vector Machine,SVM)、所述情绪特征以及所述色调特征对所述待处理图像进行分类,获取所述待处理图像的图像类别。
具体的,支持向量机是一中按监督学习(supervised learning)分类算法。支持向量机的决策边界是对学习样本求解的最大边距超平面(maximum-margin hyperplane)。
实际操作中可以根据样本图像的情绪特征和色调特征以及样本图像的类别确定情绪特征和色调特征的权重,在获取待处理图像的情绪特征和色调特征后,根据情绪特征和色调特征的权重预测待处理图像的图像类别。
步骤Ⅱ、根据所述图像类别和预设对应关系,获取所述待处理图像的调色方案。
其中,所述预设对应关系包括所述图像类别和所述调色方案的对应关系。
基于同一发明构思,作为对上述方法的实现,本发明实施例还提供了一种图像处理装置,该装置实施例与前述方法实施例对应,为便于阅读,本装置实施例不再对前述方法实施例中的细节内容进行逐一赘述,但应当明确,本实施例中的图像处理装置能够对应实现前述方法实施例中的全部内容。
本发明实施例提供了一种图像处理装置,图2为该图像处理装置的结构示意图,如图2所示,该图像处理装置200包括:
分析单元21,用于对待处理图像进行分析,获取所述待处理图像的情绪特征和色调特征;
处理单元22,用于获取所述情绪特征和所述色调特征对应的调色方案;
调色单元23,用于根据所述调色方案对所述待处理图像进行调色,获取所述待处理图像对应的目标图像。
作为本发明实施例一种可选的实施方式,所述分析单元21,具体用于基于人脸检测技术确定所述待处理图像的人脸区域;根据所述人脸区域对应的图像数据,获取所述待处理图像中的人脸的表情类型;根据所述表情类型获取所述待处理图像的情绪特征。
作为本发明实施例一种可选的实施方式,所述分析单元21,具体用于根据所述人脸区域对应的图像数据和表情识别模型,获取所述待处理图像中的人脸的表情类型;
其中,所述表情识别模型为通过样本数据对预设网络模型进行训练获取的模型,所述样本数据包括多个样本人脸图像以及各个所述样本人脸图像对应的表情类型。
作为本发明实施例一种可选的实施方式,所述分析单元21,具体用于将所述待处理图 像分割为至少一个图像区域;根据各个图像区域中的像素点的颜色确定各个图像区域的主颜色;根据各个图像区域的主颜色获取所述待处理图像的色调特征。
作为本发明实施例一种可选的实施方式,所述分析单元21,具体用于基于预设聚类算法将目标图像区域中的像素点的颜色聚类为N个颜色簇,所述目标图像区域为所述至少一个图像区域中的任一图像区域,N为大于1的整数;确定目标颜色簇,所述目标颜色簇为所述N个颜色簇中包含颜色的数量最多的颜色簇;将所述目标颜色簇的中心颜色,确定为所述目标图像区域的主颜色。
作为本发明实施例一种可选的实施方式,所述至少一个图像区域包括:嘴唇区域和脸颊区域;
所述分析单元21,具体用于分别将所述嘴唇区域的主颜色和所述脸颊区域的主颜色转换为HSV颜色空间中的颜色,获取第一颜色和第二颜色;获取所述第一颜色的色相值与所述第二颜色的色相值的差值;根据所述差值获取所述待处理图像的妆容色调特征。
作为本发明实施例一种可选的实施方式,所述至少一个图像区域包括:服装区域;
所述分析单元21,具体用于根据所述服装区域的主颜色所属的颜色范围,获取所述待处理图像的服装色调特征。
作为本发明实施例一种可选的实施方式,所述至少一个图像区域包括:背景区域;
所述分析单元21,具体用于根据所述背景区域的主颜色所属的颜色范围,获取所述待处理图像的背景色调特征。
作为本发明实施例一种可选的实施方式,所述处理单元22,具体用于基于支持向量机、所述情绪特征以及所述色调特征对所述待处理图像进行分类,获取所述待处理图像的图像类别;根据所述图像类别和预设对应关系,获取所述待处理图像的调色方案,所述预设对应关系包括所述图像类别和所述调色方案的对应关系。
本实施例提供的图像处理装置可以执行上述方法实施例提供的图像处理方法,其实现原理与技术效果类似,此处不再赘述。
基于同一发明构思,本发明实施例还提供了一种电子设备。图3为本发明实施例提供的电子设备的结构示意图,如图3所示,本实施例提供的电子设备包括:存储器31和处理器32,所述存储器31用于存储计算机程序;所述处理器32用于在调用计算机程序时执行上述实施例提供的图像处理方法。
基于同一发明构思,本发明实施例还提供了一种计算机可读存储介质,该计算机可读存储介质上存储有计算机程序,当计算机程序被处理器执行时,使得所述计算设备实现上述实施例提供的图像处理方法。
基于同一发明构思,本发明实施例还提供了一种计算机程序产品,当所述计算机程序产品在计算机上运行时,使得所述计算设备实现上述实施例提供的图像处理方法。
本领域技术人员应明白,本发明的实施例可提供为方法、系统、或计算机程序产品。因此,本发明可采用完全硬件实施例、完全软件实施例、或结合软件和硬件方面的实施例的形式。而且,本发明可采用在一个或多个其中包含有计算机可用程序代码的计算机可用存储介质上实施的计算机程序产品的形式。
处理器可以是中央处理单元(Central Processing Unit,CPU),还可以是其他通用处理器、 数字信号处理器(Digital Signal Processor,DSP)、专用集成电路(Application Specific Integrated Circuit,ASIC)、现成可编程门阵列(Field-Programmable Gate Array,FPGA)或者其他可编程逻辑器件、分立门或者晶体管逻辑器件、分立硬件组件等。通用处理器可以是微处理器或者该处理器也可以是任何常规的处理器等。
存储器可能包括计算机可读介质中的非永久性存储器,随机存取存储器(RAM)和/或非易失性内存等形式,如只读存储器(ROM)或闪存(flash RAM)。存储器是计算机可读介质的示例。
计算机可读介质包括永久性和非永久性、可移动和非可移动存储介质。存储介质可以由任何方法或技术来实现信息存储,信息可以是计算机可读指令、数据结构、程序的模块或其他数据。计算机的存储介质的例子包括,但不限于相变内存(PRAM)、静态随机存取存储器(SRAM)、动态随机存取存储器(DRAM)、其他类型的随机存取存储器(RAM)、只读存储器(ROM)、电可擦除可编程只读存储器(EEPROM)、快闪记忆体或其他内存技术、只读光盘只读存储器(CD-ROM)、数字多功能光盘(DVD)或其他光学存储、磁盒式磁带,磁盘存储或其他磁性存储设备或任何其他非传输介质,可用于存储可以被计算设备访问的信息。根据本文中的界定,计算机可读介质不包括暂存电脑可读媒体(transitory media),如调制的数据信号和载波。
最后应说明的是:以上各实施例仅用以说明本发明的技术方案,而非对其限制;尽管参照前述各实施例对本发明进行了详细的说明,本领域的普通技术人员应当理解:其依然可以对前述各实施例所记载的技术方案进行修改,或者对其中部分或者全部技术特征进行等同替换;而这些修改或者替换,并不使相应技术方案的本质脱离本发明各实施例技术方案的范围。
Claims (13)
- 一种图像处理方法,其特征在于,包括:对待处理图像进行分析,获取所述待处理图像的情绪特征和色调特征;获取所述情绪特征和所述色调特征对应的调色方案;根据所述调色方案对所述待处理图像进行调色,获取所述待处理图像对应的目标图像。
- 根据权利要求1所述的方法,其特征在于,所述对待处理图像进行分析,获取所述待处理图像的情绪特征,包括:基于人脸检测技术确定所述待处理图像的人脸区域;根据所述人脸区域对应的图像数据,获取所述待处理图像中的人脸的表情类型;根据所述表情类型获取所述待处理图像的情绪特征。
- 根据权利要求2所述的方法,其特征在于,所述根据所述人脸区域对应的图像数据,获取所述待处理图像中的人脸的表情类型,包括:根据所述人脸区域对应的图像数据和表情识别模型,获取所述待处理图像中的人脸的表情类型;其中,所述表情识别模型为通过样本数据对预设网络模型进行训练获取的模型,所述样本数据包括多个样本人脸图像以及各个所述样本人脸图像对应的表情类型。
- 根据权利要求1所述的方法,其特征在于,所述对待处理图像进行分析,获取所述待处理图像的色调特征,包括:将所述待处理图像分割为至少一个图像区域;根据各个图像区域中的像素点的颜色确定各个图像区域的主颜色;根据各个图像区域的主颜色获取所述待处理图像的色调特征。
- 根据权利要求4所述的方法,其特征在于,所述根据各个图像区域中的像素点的颜色确定各个图像区域的主颜色,包括:基于预设聚类算法将目标图像区域中的像素点的颜色聚类为N个颜色簇,所述目标图像区域为所述至少一个图像区域中的任一图像区域,N为大于1的整数;确定目标颜色簇,所述目标颜色簇为所述N个颜色簇中包含颜色的数量最多的颜色簇;将所述目标颜色簇的中心颜色,确定为所述目标图像区域的主颜色。
- 根据权利要求4所述的方法,其特征在于,所述至少一个图像区域包括:嘴唇区域和脸颊区域;所述根据各个图像区域的主颜色获取所述待处理图像的色调特征,包括:分别将所述嘴唇区域的主颜色和所述脸颊区域的主颜色转换为色相饱和度亮度HSV颜色空间中的颜色,获取第一颜色和第二颜色;获取所述第一颜色的色相值与所述第二颜色的色相值的差值;根据所述差值获取所述待处理图像的妆容色调特征。
- 根据权利要求4所述的方法,其特征在于,所述至少一个图像区域包括:服装区域;所述根据各个图像区域的主颜色获取所述待处理图像的色调特征,包括:根据所述服装区域的主颜色所属的颜色范围,获取所述待处理图像的服装色调特征。
- 根据权利要求4所述的方法,其特征在于,所述至少一个图像区域包括:背景区域;所述根据各个图像区域的主颜色获取所述待处理图像的色调特征,包括:根据所述背景区域的主颜色所属的颜色范围,获取所述待处理图像的背景色调特征。
- 根据权利要求1-8任一项所述的方法,其特征在于,所述获取所述情绪特征和所述色调特征对应的调色方案,包括:基于支持向量机SVM、所述情绪特征以及所述色调特征对所述待处理图像进行分类,获取所述待处理图像的图像类别;根据所述图像类别和预设对应关系,获取所述待处理图像的调色方案,所述预设对应关系包括所述图像类别和所述调色方案的对应关系。
- 一种图像处理装置,其特征在于,包括:分析单元,用于对待处理图像进行分析,获取所述待处理图像的情绪特征和色调特征;处理单元,用于获取所述情绪特征和所述色调特征对应的调色方案;调色单元,用于根据所述调色方案对所述待处理图像进行调色,获取所述待处理图像对应的目标图像。
- 一种电子设备,其特征在于,包括:存储器和处理器,所述存储器用于存储计算机程序;所述处理器用于在执行所述计算机程序时,使得所述电子设备实现权利要求1-9任一项所述的图像处理方法。
- 一种计算机可读存储介质,其特征在于,所述计算机可读存储介质上存储有计算机程序,当所述计算机程序被计算设备执行时,使得所述计算设备实现权利要求1-9任一项所述的图像处理方法。
- 一种计算机程序产品,其特征在于,当所述计算机程序产品在计算机上运行时,使得所述计算机实现如权利要求1-9任一项所述的图像处理方法。
Applications Claiming Priority (2)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CN202111162184.8A CN115908597A (zh) | 2021-09-30 | 2021-09-30 | 一种图像处理方法及装置 |
| CN202111162184.8 | 2021-09-30 |
Publications (1)
| Publication Number | Publication Date |
|---|---|
| WO2023051664A1 true WO2023051664A1 (zh) | 2023-04-06 |
Family
ID=85744918
Family Applications (1)
| Application Number | Title | Priority Date | Filing Date |
|---|---|---|---|
| PCT/CN2022/122446 Ceased WO2023051664A1 (zh) | 2021-09-30 | 2022-09-29 | 一种图像处理方法及装置 |
Country Status (2)
| Country | Link |
|---|---|
| CN (1) | CN115908597A (zh) |
| WO (1) | WO2023051664A1 (zh) |
Cited By (1)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN116824675A (zh) * | 2023-07-06 | 2023-09-29 | 咪咕文化科技有限公司 | 一种图像处理方法、装置及可读存储介质 |
Citations (7)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN105551499A (zh) * | 2015-12-14 | 2016-05-04 | 渤海大学 | 面向语音与面部表情信号的情感可视化方法 |
| CN108537749A (zh) * | 2018-03-29 | 2018-09-14 | 广东欧珀移动通信有限公司 | 图像处理方法、装置、移动终端及计算机可读存储介质 |
| CN108765264A (zh) * | 2018-05-21 | 2018-11-06 | 深圳市梦网科技发展有限公司 | 图像美颜方法、装置、设备及存储介质 |
| CN109660728A (zh) * | 2018-12-29 | 2019-04-19 | 维沃移动通信有限公司 | 一种拍照方法及装置 |
| CN109785227A (zh) * | 2018-12-29 | 2019-05-21 | 天津大学 | 基于卷积神经网络的人脸情感颜色迁移方法 |
| CN110377380A (zh) * | 2019-06-21 | 2019-10-25 | 深圳壹账通智能科技有限公司 | 主题色调调整方法、装置、设备和计算机可读存储介质 |
| US10871884B1 (en) * | 2018-03-09 | 2020-12-22 | Amazon Technologies, Inc. | Product image characteristic detection and manipulation |
-
2021
- 2021-09-30 CN CN202111162184.8A patent/CN115908597A/zh active Pending
-
2022
- 2022-09-29 WO PCT/CN2022/122446 patent/WO2023051664A1/zh not_active Ceased
Patent Citations (7)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN105551499A (zh) * | 2015-12-14 | 2016-05-04 | 渤海大学 | 面向语音与面部表情信号的情感可视化方法 |
| US10871884B1 (en) * | 2018-03-09 | 2020-12-22 | Amazon Technologies, Inc. | Product image characteristic detection and manipulation |
| CN108537749A (zh) * | 2018-03-29 | 2018-09-14 | 广东欧珀移动通信有限公司 | 图像处理方法、装置、移动终端及计算机可读存储介质 |
| CN108765264A (zh) * | 2018-05-21 | 2018-11-06 | 深圳市梦网科技发展有限公司 | 图像美颜方法、装置、设备及存储介质 |
| CN109660728A (zh) * | 2018-12-29 | 2019-04-19 | 维沃移动通信有限公司 | 一种拍照方法及装置 |
| CN109785227A (zh) * | 2018-12-29 | 2019-05-21 | 天津大学 | 基于卷积神经网络的人脸情感颜色迁移方法 |
| CN110377380A (zh) * | 2019-06-21 | 2019-10-25 | 深圳壹账通智能科技有限公司 | 主题色调调整方法、装置、设备和计算机可读存储介质 |
Cited By (1)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN116824675A (zh) * | 2023-07-06 | 2023-09-29 | 咪咕文化科技有限公司 | 一种图像处理方法、装置及可读存储介质 |
Also Published As
| Publication number | Publication date |
|---|---|
| CN115908597A (zh) | 2023-04-04 |
Similar Documents
| Publication | Publication Date | Title |
|---|---|---|
| Zhang et al. | Improved clustering algorithms for image segmentation based on non-local information and back projection | |
| US9536293B2 (en) | Image assessment using deep convolutional neural networks | |
| US9953425B2 (en) | Learning image categorization using related attributes | |
| US9594977B2 (en) | Automatically selecting example stylized images for image stylization operations based on semantic content | |
| US8792728B2 (en) | Near-duplicate image detection | |
| CN105184763B (zh) | 图像处理方法和装置 | |
| US8787659B2 (en) | Automatic adaptation to image processing pipeline | |
| US8666148B2 (en) | Image adjustment | |
| WO2023284608A1 (zh) | 字符识别模型生成方法、装置、计算机设备和存储介质 | |
| US12430724B2 (en) | Autonomously removing scan marks from digital documents utilizing content-aware filters | |
| WO2021098861A1 (zh) | 识别文本的方法、装置、识别设备和存储介质 | |
| WO2023088174A1 (zh) | 目标检测方法及装置 | |
| WO2021051527A1 (zh) | 基于图像分割的文字定位方法、装置、设备及存储介质 | |
| CN101727582B (zh) | 文档图像二值化方法及其装置,以及文档图像处理器 | |
| KR101981284B1 (ko) | 이미지 처리 장치 및 방법 | |
| WO2022073516A1 (zh) | 生成图像的方法、装置、电子设备及介质 | |
| CN106874917A (zh) | 一种基于Harris角点的显著性目标检测方法 | |
| Hanif et al. | Blind bleed-through removal in color ancient manuscripts | |
| WO2023051664A1 (zh) | 一种图像处理方法及装置 | |
| CN106940877B (zh) | 图像处理装置及方法 | |
| US12165299B2 (en) | Enhancing light text in scanned documents while preserving document fidelity | |
| CN111444876A (zh) | 一种图文处理方法、系统以及计算机可读存储介质 | |
| WO2020083344A1 (zh) | 关联确定方法和装置、推荐方法和装置、电子设备、计算机可读存储介质 | |
| US20250259308A1 (en) | Segmenting images for vector graphics reconstruction | |
| CN113269198B (zh) | 纹样处理方法、电子设备及可读存储介质 |
Legal Events
| Date | Code | Title | Description |
|---|---|---|---|
| 121 | Ep: the epo has been informed by wipo that ep was designated in this application |
Ref document number: 22875047 Country of ref document: EP Kind code of ref document: A1 |
|
| NENP | Non-entry into the national phase |
Ref country code: DE |
|
| 32PN | Ep: public notification in the ep bulletin as address of the adressee cannot be established |
Free format text: NOTING OF LOSS OF RIGHTS PURSUANT TO RULE 112(1) EPC (EPO FORM 1205A DATED 05/07/2024) |
|
| 122 | Ep: pct application non-entry in european phase |
Ref document number: 22875047 Country of ref document: EP Kind code of ref document: A1 |
