Image processing method, device, electronic device and storage medium

By identifying the areas in the landing page that do not need to change colors and performing color mapping on other areas to generate target images, the problem of single display of the landing page image and accuracy of color changing is solved, intelligent color matching is realized, and the display effect and ease of operation are improved. .

CN114676360BActive Publication Date: 2024-09-17TENCENT TECHNOLOGY (SHENZHEN) CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202210295315.8
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-03-23
Publication Date
2024-09-17
Estimated Expiration
2042-03-23

AI Technical Summary

Technical Problem

The image display method on the landing page is single, the display effect is poor, and there is a lack of intelligent color matching derivative services. This causes the publisher to manually operate the image retouching application when modifying the image, which increases the difficulty of the operation and may lead to poor color change accuracy and effect.

Method used

Provide an image processing method that identifies areas in the image that do not require color change, only performs color mapping on other areas, generates target images, realizes intelligent color matching, avoids manual operation by users, and ensures the accuracy and effect of color change.

Benefits of technology

It enriches the display method of images associated with content items, improves the display effect, simplifies the image processing process, and ensures the accuracy and effect of color change. It is suitable for landing page design of content items such as advertisements and promotional videos.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114676360B
    Figure CN114676360B
Patent Text Reader

Abstract

The present application discloses an image processing method, device, electronic device and storage medium, and belongs to the field of computer technology. The method includes: obtaining at least one original image associated with a content item; identifying a first area in the at least one original image; performing color mapping on pixel points in a second area other than the first area in the at least one original image to obtain at least one target image associated with the content item. The present application maintains the color of the first area in the original image unchanged during the color change process, and only performs color mapping on the second area, so that the target image obtained by the color change is a color scheme derived from the original image, which greatly enriches the display mode of the image associated with the content item and improves the display effect of the image associated with the content item. In particular, for advertising content items, it has great practical significance in the interactive design of advertising landing pages.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of computer technology, and in particular to an image processing method, device, electronic device and storage medium. Background Art

[0002] At present, when publishers deliver content items on some platforms, a type of landing page for the content items is involved. The landing page is also called a landing page or a guide page. It refers to a UI (User Interface) interface that is further opened and presented to the user after the user clicks on the delivered content item. This UI interface usually displays the extended content of the clicked content item, such as the details of an item, the promotional content of an activity, etc.

[0003] In the UI design for the above-mentioned landing page, the publisher is usually required to prepare various images that need to be displayed in the landing page (such as posters, detail pictures, model pictures, product pictures, etc.), and then display each image in the landing page according to the preset layout or layout. However, the display method of the images contained in the landing page is relatively simple and the display effect is poor. Summary of the invention

[0004] The embodiments of the present application provide an image processing method, device, electronic device and storage medium, which can enrich the display mode of images associated with content items and improve the display effect of images associated with content items. The technical solution is as follows:

[0005] In one aspect, an image processing method is provided, the method comprising:

[0006] obtaining at least one original image associated with the content item;

[0007] Identifying a first area in the at least one original image, where the first area refers to an area in the original image that does not require color change;

[0008] Color mapping is performed on pixel points of a second area other than the first area in the at least one original image to obtain at least one target image associated with the content item, wherein the target image is the original image after keeping the color of the first area unchanged and changing the color of the second area.

[0009] In one aspect, an image processing device is provided, the device comprising:

[0010] An acquisition module, configured to acquire at least one original image associated with a content item;

[0011] An identification module, used for identifying a first area in the at least one original image, where the first area refers to an area in the original image that does not need to change color;

[0012] A mapping module is used to perform color mapping on pixel points in a second area other than the first area in the at least one original image to obtain at least one target image associated with the content item, wherein the target image is the original image after keeping the color of the first area unchanged and changing the color of the second area.

[0013] In a possible implementation, the identification module includes:

[0014] A detection unit, used to perform target detection on any original image to obtain a candidate region in the original image;

[0015] a classification unit, configured to input the candidate area into a color-changing classification model, and output a color-changing detection result through the color-changing classification model, wherein the color-changing classification model is used to detect whether the candidate area needs to be changed in color;

[0016] A first determining unit is configured to determine a candidate region where the color change detection result indicates that no color change is required as the first region.

[0017] In one possible implementation, the detection unit is used to:

[0018] Rectangle detection is performed on the original image, and the detected rectangular area is determined as the candidate area.

[0019] In a possible implementation, the identification module includes:

[0020] A first recognition unit, configured to perform object recognition on any original image to obtain an object recognition result, wherein the object recognition result indicates whether the original image contains a target object;

[0021] A second determining unit is configured to determine, when the object recognition result indicates that the original image contains the target object, a region where the target object is located as the first region.

[0022] In a possible implementation manner, the second determining unit is configured to:

[0023] Performing object segmentation on the original image to obtain a mask image for identifying the target object;

[0024] Based on the mask image, the first area where the target object is located is determined.

[0025] In a possible implementation manner, the mapping module includes:

[0026] an assignment unit, configured to assign, in the at least one original image, pixel points in the first area to target pixel values, so as to obtain at least one first image;

[0027] A second recognition unit, configured to obtain at least one main color tone based on the at least one first image recognition, wherein the main color tone represents a color distribution tendency of pixels in the at least one first image;

[0028] A mapping unit, configured to perform color mapping on pixels in the at least one first image to obtain at least one second image;

[0029] The assignment unit is further used to assign, in the at least one second image, pixel points located in the first area to pixel values ​​of pixel points at corresponding positions in the corresponding original image, so as to obtain the at least one target image.

[0030] In a possible implementation manner, the second identification unit is used to:

[0031] Stitching the at least one first image to obtain a stitched image;

[0032] Clustering the pixels in the stitched image based on the color vectors of the pixels to obtain at least one color cluster;

[0033] A cluster center of the at least one color cluster is determined as the at least one main hue.

[0034] In a possible implementation manner, the mapping unit is used to:

[0035] Converting the at least one first image from a red-green-blue (RGB) color space to a hue-saturation-value (HSV) color space;

[0036] For any main color, in the HSV color space, the saturation S and brightness V of the main color are kept unchanged, and the hue H of the main color is modified to obtain a color-changing hue corresponding to the main color;

[0037] Based on the main color tone mapping relationship between the main color tone and the color change color tone, a color mapping relationship at the pixel level is determined, wherein the color mapping relationship represents the corresponding relationship between different pixel values ​​before and after the color change;

[0038] Based on the color mapping relationship, pixel values ​​of pixels in the at least one first image are mapped to obtain the at least one second image.

[0039] In a possible implementation, the hue difference between any two primary hues is equal to the hue difference between the corresponding two color-changing hues.

[0040] In one possible implementation, the device further includes:

[0041] A determination module, configured to determine a white area in the at least one original image, wherein a difference between a pixel value of a pixel point in the white area and a white value is less than a target threshold;

[0042] The assignment unit is further configured to assign, in the at least one second image, pixel points located in the white area to pixel values ​​of pixel points at corresponding positions in the corresponding original image.

[0043] On the one hand, an electronic device is provided, which includes one or more processors and one or more memories, wherein the one or more memories store at least one computer program, and the at least one computer program is loaded and executed by the one or more processors to implement the image processing method as described above.

[0044] On the one hand, a storage medium is provided, in which at least one computer program is stored. The at least one computer program is loaded and executed by a processor to implement the above-mentioned image processing method.

[0045] In one aspect, a computer program product or a computer program is provided, wherein the computer program product or the computer program comprises one or more program codes, wherein the one or more program codes are stored in a computer-readable storage medium. One or more processors of an electronic device can read the one or more program codes from the computer-readable storage medium, and the one or more processors execute the one or more program codes, so that the electronic device can perform the above-mentioned image processing method.

[0046] The beneficial effects brought by the technical solution provided by the embodiment of the present application include at least:

[0047] By keeping the color of the first area unchanged during the color changing process for the original image associated with the content item and only performing color mapping on the second area, the target image obtained by the color change is another color scheme derived from the original image. This color scheme does not require the user to manually operate the photo editing application, and can intelligently identify the first area that cannot be changed in color and ensure that the color of the first area remains unchanged before and after the color change. This greatly enriches the display method of the images associated with the content items while ensuring the accuracy and effect of the color change, and improves the display effect of the images associated with the content items. BRIEF DESCRIPTION OF THE DRAWINGS

[0048] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.

[0049] Figure 1 It is a schematic diagram of an implementation environment of an image processing method provided in an embodiment of the present application;

[0050] Figure 2 is a flow chart of an image processing method provided by an embodiment of the present application;

[0051] Figure 3 is a flow chart of an image processing method provided by an embodiment of the present application;

[0052] Figure 4 is a principle flow chart of an image processing method provided in an embodiment of the present application;

[0053] Figure 5 It is a principle flow chart of a preprocessing module provided in an embodiment of the present application;

[0054] Figure 6 It is a principle flow chart of a post-processing module provided in an embodiment of the present application;

[0055] Figure 7 is a structural schematic diagram of an image processing device provided in an embodiment of the present application;

[0056] Figure 8 is a schematic diagram of the structure of a terminal provided in an embodiment of the present application;

[0057] Fig. 9 It is a structural schematic diagram of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION

[0058] In order to make the objectives, technical solutions and advantages of the present application clearer, the implementation methods of the present application will be further described in detail below in conjunction with the accompanying drawings.

[0059] In this application, the terms "first", "second", etc. are used to distinguish identical or similar items with substantially the same effects and functions. It should be understood that there is no logical or temporal dependency between "first", "second", and "nth", nor is there any limitation on quantity and execution order.

[0060] In the present application, the term "at least one" means one or more, and the meaning of "plurality" means two or more. For example, a plurality of first positions means two or more first positions.

[0061] In this application, the term "including at least one of A or B" refers to the following situations: including only A, including only B, and including both A and B.

[0062] The user-related information (including but not limited to device information, personal information, behavior information, etc.), data (including but not limited to data used for analysis, stored data, displayed data, etc.) and signals involved in this application, when applied to specific products or technologies in the manner of the embodiments of this application, are all permitted, agreed, authorized by the user or fully authorized by all parties, and the collection, use and processing of relevant information, data and signals must comply with the relevant laws, regulations and standards of the relevant countries and regions. For example, the original images associated with the content items involved in this application are all obtained with full authorization.

[0063] Artificial Intelligence (AI) is the theory, method, technology and application system that uses digital computers or machines controlled by digital computers to simulate, extend and expand human intelligence, perceive the environment, acquire knowledge and use knowledge to obtain the best results. In other words, artificial intelligence is a comprehensive technology in computer science that attempts to understand the essence of intelligence and produce a new intelligent machine that can respond in a similar way to human intelligence. Artificial intelligence is to study the design principles and implementation methods of various intelligent machines so that machines have the functions of perception, reasoning and decision-making.

[0064] Artificial intelligence technology is a comprehensive discipline that covers a wide range of fields, including both hardware-level and software-level technologies. The basic technologies of artificial intelligence generally include sensors, dedicated artificial intelligence chips, cloud computing, distributed storage, big data processing technology, operation / interaction systems, mechatronics and other technologies. Artificial intelligence software technology mainly includes computer vision technology, speech processing technology, natural language processing technology, and machine learning / deep learning.

[0065] Computer vision technology (CV) is a science that studies how to make machines "see". To put it more specifically, it refers to machine vision such as using cameras and computers to replace human eyes to identify and measure targets, and further perform graphic processing to make computer processing into images that are more suitable for human eye observation or transmission to instruments for detection. As a scientific discipline, computer vision studies related theories and technologies, and attempts to establish an artificial intelligence system that can obtain information from images or multi-dimensional data. Computer vision technology usually includes image processing, image recognition, image semantic understanding, image retrieval, OCR (Optical Character Recognition), video processing, video semantic understanding, video content / behavior recognition, three-dimensional object reconstruction, 3D technology, virtual reality, augmented reality, simultaneous positioning and map construction, etc.

[0066] With the research and advancement of artificial intelligence technology, artificial intelligence technology has been studied and applied in many fields, such as common smart homes, smart wearable devices, virtual assistants, smart speakers, smart marketing, unmanned driving, automatic driving, drones, robots, smart medical care, smart customer service, etc. I believe that with the development of technology, artificial intelligence technology will be applied in more fields and play an increasingly important role.

[0067] The solution provided in the embodiment of the present application involves artificial intelligence technologies such as target detection and image classification in images. The following will explain the terms involved in the embodiment of the present application:

[0068] Landing Page: Also known as landing page or guide page, it refers to the UI interface (such as a web page) that is further opened and presented to users after potential users click on online advertisements, search engine search results, promotional emails, etc. Landing pages usually display extended content of the goods or services pointed to by the clicked advertisements, search result links, promotional emails, etc., such as details of the goods or services, posters, model pictures, product pictures, promotional pictures, etc.

[0069] Gaussian Blur: Also known as Gaussian smoothing, it is an image smoothing technique that is usually used to reduce image noise and reduce the level of detail. The visual effect of an image smoothed by Gaussian blur technology is like observing the image through a frosted glass, which is significantly different from the bokeh effect of the lens out-of-focus imaging and the effect in ordinary lighting shadows. Gaussian smoothing is also used in the preprocessing stage of computer vision algorithms to enhance the image effect at different scales. From a mathematical point of view, the Gaussian blur process of an image is to convolve the image with the normal distribution. Since the normal distribution is also called the Gaussian distribution, this technique is called Gaussian blur. Since the Fourier transform of the Gaussian function is another Gaussian function, the Gaussian blur is a low-pass filter for the image.

[0070] Contour Detection: refers to the process of extracting the target contour in a digital image containing the target and background, ignoring the texture of the background and the target as well as the influence of noise interference, and using certain techniques and methods. Contour detection is an important basis of target detection technology.

[0071] Object Detection: The task of object detection is to find all the objects of interest in the image and determine their positions, which is one of the core issues in the field of computer vision. The objects of interest involved in the embodiments of the present application refer to the rectangular areas in the original image. Object detection for rectangular areas is referred to as rectangular detection. Usually, the detected rectangular areas are represented by rectangular frames.

[0072] Object recognition: The task of object recognition is to identify whether an image contains a certain type of specified object (such as facial recognition, object recognition, etc.). Due to the different appearances, shapes and postures of various objects, coupled with the interference of factors such as illumination and occlusion during imaging, object recognition has always been the most challenging problem in the field of computer vision. The embodiment of the present application involves a given type of target object, identifying the original image, and determining whether the original image contains the target object.

[0073] Image segmentation refers to representing an image as a collection of physically meaningful connected regions, that is, marking and locating the target and background in the image respectively based on the prior knowledge of the target (i.e., foreground) and the background, and separating the target from the background or other pseudo-targets. The embodiment of the present application involves, when the object recognition result indicates that the original image contains the target object, using image segmentation technology to finely segment the target object from the original image to obtain a mask image for identifying the target object.

[0074] Clustering: refers to the process of classifying and organizing data members that are similar in some aspects in a data set. Clustering is a technology for discovering this internal structure. Clustering algorithm is a well-known algorithm in unsupervised learning. The embodiment of the present application relates to a data set composed of color vectors of multiple pixels in an image. The data members in this data set are all color vectors of a pixel. The clustering process refers to the process of classifying and organizing pixels with similar color vectors, that is, pixels with similar colors. The result obtained based on color vector clustering is called a color cluster. In other words, a color cluster refers to a subset composed of each color vector clustered to the current cluster.

[0075] K-Means Clustering: An iterative clustering analysis algorithm, whose steps include: randomly selecting K pixels as the initial cluster centers in the data set composed of the color vectors of each pixel in the image, then calculating the distance between each color vector and each cluster center, and assigning each color vector to the cluster center with the closest distance. The color vectors assigned to the same cluster center represent a color cluster. For any color cluster, every time all color vectors are assigned, the cluster center of the current color cluster will be recalculated based on the color vectors in the cluster. The above process will be repeated until a certain termination clustering condition is met. Termination clustering conditions include but are not limited to: no (or a minimum number of) color vectors are reassigned to different color clusters; or no (or a minimum number of) color clusters The cluster center changes again; or, the sum of squared errors is locally minimized, etc.

[0076] RGB color space: Any color in the RGB color space can be obtained by using the changes in the three color channels of red (Red, R), green (Green, G), and blue (Blue, B) and their superposition. In other words, any color can be represented by a three-dimensional color vector [R, G, B]. The RGB color space, also known as the RGB color mode, is a color standard in the industry. This color standard includes almost all colors that can be perceived by human vision and is one of the most widely used color systems.

[0077] HSV color space: Any color in the HSV color space can be obtained by using the changes in the three channels of hue, saturation, and value and their superposition. In other words, any color can be represented by a three-dimensional color vector [H, S, V]. The HSV color space is also called the Hexcone Model, which was created by AR Smith in 1978 based on the intuitive characteristics of color. It is also called the Hexcone Model.

[0078] LAB color space: a color model developed by CIE (International Commission On Illumination). Any color in nature can be expressed in the LAB color space. The LAB color space is larger than the RGB color space, so any color in the RGB color space can be mapped in the LAB color space. In addition, the LAB color space describes human visual perception in a digital way and is independent of the device, so it makes up for the deficiency that the RGB color model must rely on the color characteristics of the device. In the LAB color space, any color can be represented by a three-dimensional color vector [L, a, b]. L represents the brightness of the color, a positive number represents red, and a negative number represents green, and b positive numbers represent yellow, and negative numbers represent blue.

[0079] The following describes the system architecture of the embodiment of the present application.

[0080] Figure 1 Schematic diagram of an implementation environment of an image processing method provided in an embodiment of the present application. Figure 1 , the implementation environment includes a terminal 101 and a server 102:

[0081] The terminal 101 is used to provide a color derivation service for images associated with content items. The color derivation service means that, given one or more images and the number N of color schemes, the machine automatically derives N color schemes for each given image, where N is an integer greater than or equal to 1. An application supporting image processing is installed and run on the terminal 101. Optionally, the application includes at least one of a browser application, a web page creation application, an advertisement creation application, a photo editing application, a camera application, an audio and video application, a short video application, a live broadcast application, an instant messaging application, a content sharing application, or a social application.

[0082] Schematically, the above application is embedded with program code for processing images, so that when the user inputs at least one original image and specifies the number of color schemes N, the terminal 101 can run the above program code to derive N color schemes for each original image, that is, output N color-changed target images for each original image.

[0083] The terminal 101 and the server 102 are connected via a wired network or a wireless network.

[0084] The server 102 is an electronic device for providing background services for the above-mentioned application, and the server 102 includes: at least one of a single server, multiple servers, a cloud computing platform, or a virtualization center. Optionally, the server 102 undertakes the main image processing work, and the terminal 101 undertakes the secondary image processing work; or, the server 102 undertakes the secondary image processing work, and the terminal 101 undertakes the main image processing work; or, the terminal 101 and the server 102 use a distributed computing architecture to collaboratively perform image processing work.

[0085] Optionally, server 102 is an independent physical server, or a server cluster or distributed system composed of multiple physical servers, or a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, CDN (Content Delivery Network), and big data and artificial intelligence platforms.

[0086] In some embodiments, the terminal 101 independently executes the image processing method, which can reduce the computing load of the server 102 and avoid occupying the processing resources of the server 102 during the image processing. At this time, the terminal 101 will call the program code embedded in the local application to perform the image processing task.

[0087] In some embodiments, the terminal 101 cooperates with the server 102 to execute the image processing method through information interaction, that is, after acquiring at least one original image, the terminal 101 responds to the user's triggering operation on the intelligent color matching option, inputs a number N of color matching schemes, and sends a color matching instruction carrying the at least one original image and the number N of color matching schemes to the server 102. The server 102 responds to the color matching instruction and, for each original image, after identifying the first area that does not need to be changed in color, only changes the color of the pixels in the second area N times, and can obtain N target images. The above operation is repeated until all the original images are traversed, and finally N derived color matching schemes can be obtained, each color matching scheme contains at least one target image corresponding to the at least one original image. The server returns the N color matching schemes to the terminal 101, and the terminal 101 can visualize the N color matching schemes to facilitate the user to select which color matching schemes need to be launched. At this time, part of the image processing work can be migrated to the server 102 to maintain higher system performance on the terminal.

[0088] Optionally, the terminal 101 generally refers to one of a plurality of terminals, and the device type of the terminal 101 includes, but is not limited to: a vehicle-mounted terminal, a television, a smart phone, a smart speaker, a smart watch, a tablet computer, an intelligent voice interaction device, a smart home appliance, an aircraft, an e-book reader, an MP3 (Moving Picture Experts Group Audio Layer III, Moving Picture Experts Group Audio Layer 3) player, an MP4 (Moving Picture Experts Group Audio Layer IV, Moving Picture Experts Group Audio Layer 4) player, a laptop computer or a desktop computer. In the following embodiments, the terminal includes a smart phone for example.

[0089] Those skilled in the art will appreciate that the number of the terminals 101 may be more or less. For example, there may be only one terminal 101, or there may be dozens or hundreds of terminals 101, or a greater number. The embodiment of the present disclosure does not limit the number and device type of the terminals 101.

[0090] At present, when publishers deliver content items on some platforms, a type of landing page for the content items is involved. The landing page is also called a landing page or a guide page. It refers to a UI (User Interface) interface that is further opened and presented to the user after the user clicks on the delivered content item. This UI interface usually displays the extended content of the clicked content item, such as the details of an item, the promotional content of an activity, etc.

[0091] In the UI design for the above landing page, the publisher is usually required to prepare various images that need to be displayed in the landing page (such as posters, detail pictures, model pictures, product pictures, etc.), and then display each image in the landing page according to the preset typesetting or layout. However, the display method of the images contained in the landing page is relatively simple and the display effect is poor. In addition, there is no production platform for landing pages that can provide color matching derivative services for landing pages. If the publisher wants to change the color of the image in the landing page, it can only import the image into the photo editing application and modify the pixel value of each pixel in the image to achieve the overall color change of the image. On the one hand, the technical threshold of the photo editing application is high, which is not friendly to non-professionals and greatly increases the difficulty of operation. On the other hand, for landing pages with complex structures, not all areas need to be changed in color, such as some product detail pictures, detail pictures, model pictures, real photos, etc. If the color of the product is changed, it will deceive consumers that the picture and the real object are inconsistent, so the accuracy and effect of the color change are very poor.

[0092] In view of this, the embodiment of the present application provides an image processing method, which can design intelligent color matching derivative services for content items such as advertisements, promotional videos, and promotional links, so as to automatically derive landing pages of content items produced for the publisher using multiple new color schemes, so that the original landing pages and the landing pages with new color schemes have rich color distribution, improve the display mode of the image in the landing page, and optimize the display effect. In addition, this image processing method can keep the first area of ​​the landing page that should not be changed in color from being changed, such as the first area of ​​photos, products, models, etc., and keep the color unchanged during the color change process, so as to avoid information transmission errors in the image of the landing page before and after the color change, avoid showing consumers inaccurate introduction pictures of products or services, and maintain a high color change accuracy and good color change effect.

[0093] Figure 2 is a flow chart of an image processing method provided by an embodiment of the present application. Figure 2 This embodiment is executed by an electronic device and is described by taking the electronic device as a terminal as an example. This embodiment includes:

[0094] 201. A terminal obtains at least one original image associated with a content item.

[0095] The content items involved in the embodiments of the present application refer to information items used to carry specific content. The specific content includes goods, services, notifications, announcements, information, etc. to be exposed. For example, the content items are various advertisements, promotional videos, promotional links, announcement messages, search engine search results, marketing emails, etc. The embodiments of the present application do not specifically limit the content items.

[0096] The original image involved in the embodiment of the present application refers to an image associated with a content item. Optionally, the original image is an image produced by the publisher for display on the landing page of the content item, or the original image is an image contained in the content item itself, and the embodiment of the present application does not specifically limit this. Schematically, the original image can be configured into different contents based on the business needs of the publisher. For example, when the content item is a product advertisement, the landing page refers to the product details page, and the original image includes a product display picture, a model trial picture, a product specification picture, etc. For another example, when the content item is a promotion link of an APP (Application), the landing page is the APP promotion page, and the original image includes the APP icon, the APP introduction picture, the APP evaluation picture, etc. The embodiment of the present application does not specifically limit the original image.

[0097] In some embodiments, a user starts an application that supports image processing on a terminal, displays an image editing interface in the application, and imports at least one original image associated with a content item into the image editing interface. Optionally, the original image is a separately produced image, and a plurality of separately produced images are combined in a landing page to present extended content of the content item. Alternatively, the original image is a video frame selected from a video associated with the content item, and these selected video frames are key frames or non-key frames. The embodiments of the present application do not specifically limit the type of the original image.

[0098] In some embodiments, the original image is an image captured by calling a camera component locally on the terminal, or the original image is an image obtained by processing an image captured locally, or the original image is an image transmitted from other terminals or computer-readable storage media, or the original image is an image pre-stored in a local database, or the original image is an image downloaded from the cloud. The embodiments of the present application do not specifically limit the source of the original image.

[0099] In some embodiments, after the user imports at least one of the above-mentioned original images in the image editing interface, a trigger operation is performed on the smart color matching option provided in the image editing interface, triggering the entry into the following step 202, and the smart color matching option is used to change the color of a partial area of ​​each input original image to obtain a target image after the color is changed.

[0100] 202. The terminal identifies a first area in the at least one original image, where the first area refers to an area in the original image that does not need to change color.

[0101] The first area refers to an area in the original image that does not need to change color, so the first area is also called a non-color-changing area. In other words, the first area represents an area that does not need to change color during the color-changing process.

[0102] Optionally, the first area includes at least one of the following: a rectangular area in the original image that does not require color change. In other words, since areas that cannot be changed in color, such as product display images and model trial images, are usually made into rectangular areas, the first area that does not require color change can be selected from the rectangular areas; or, the target object in the original image. In other words, for the target object associated with the content item (such as the product, item, model, spokesperson, etc. associated with the content item), there is no need to change the color of the target object. Therefore, the target object can be segmented out from the original image and the segmented target object can be used as the first area that does not require color change.

[0103] In some embodiments, when the first area includes a rectangular area in the original image that does not need to change color, the terminal performs rectangle detection on the original image to obtain one or more rectangular areas in the original image, and then inputs the rectangular area into a rectangle classifier (a color change classification model). The rectangle classifier is used to determine whether the input rectangular area needs to be changed in color. Then, the rectangular area indicated by the rectangle classifier as not needing to be changed in color is determined as the first area. Optionally, the rectangle classifier is a binary classification model used to determine whether the input rectangular area needs to be changed in color.

[0104] In some embodiments, when the first area contains the target object in the original image, the terminal performs object recognition on the original image to determine whether the original image contains the target object. Then, when the original image contains the target object, the terminal performs object segmentation on the original image and determines the area where the segmented target object is located as the first area.

[0105] In some embodiments, when the first area includes both a rectangular area that does not need to change color and a target object, the rectangular area indicated by the rectangle classifier as not needing to change color and the area where the segmented target object is located are both determined as the first area. In other words, the first area is the union of the rectangular area that does not need to change color and the target object. The embodiment of the present application does not specifically limit the first area.

[0106] 203. The terminal performs color mapping on pixel points in a second area other than the first area in the at least one original image to obtain at least one target image associated with the content item, where the target image is the original image after keeping the color of the first area unchanged and changing the color of the second area.

[0107] In some embodiments, after the first area that does not need to be changed in color is determined through the above step 202, each original image can be divided into a first area and a second area, and the second area refers to the area in the original image other than the first area. Then, for each original image, color mapping is performed only on the pixels in the second area, and the color of the pixels in the first area is kept unchanged, so that the target image corresponding to the original image can be obtained, and the above operation is repeated until the target image corresponding to each original image is obtained. At this time, at least one target image corresponding to the at least one original image can be obtained, and these target images constitute a derived color scheme. If the number N of color schemes indicated by the user is greater than 1, then only N times of the above step 203 need to be performed to perform N different color mappings, and N color schemes can be obtained. The color mapping process will be described in detail in the next embodiment, and will not be repeated here.

[0108] Furthermore, after obtaining N color schemes, the terminal can display the initial scheme composed of the at least one original image and the N color schemes derived from machine intelligence in the image editing interface, so that the user can choose which color schemes to sample and use in the landing page. For example, the user can choose the initial scheme or some or all of the N color schemes to use. In this way, when the content item is delivered, any consumer who clicks on the content item and enters the landing page will use a certain color scheme randomly. Alternatively, with the full authorization and separate consent of the consumer, the consumer's color preference analysis will obtain the color scheme that is most compatible with the consumer, so as to provide a rich and personalized landing page display scheme, and prompt the display effect of the image associated with the landing page.

[0109] All the above optional technical solutions can be arbitrarily combined to form optional embodiments of the present disclosure, and will not be described in detail here.

[0110] The method provided in the embodiment of the present application, for the original image associated with the content item, keeps the color of the first area unchanged during the color changing process, and only performs color mapping on the second area, so that the target image obtained by the color change is another color scheme derived from the original image. This color scheme does not require the user to manually operate the photo editing application, and can intelligently identify the first area that cannot be changed in color and ensure that the color of the first area remains unchanged before and after the color change. Therefore, while ensuring the accuracy and effect of the color change, the display method of the image associated with the content item is greatly enriched, and the display effect of the image associated with the content item is improved.

[0111] In the previous embodiment, the processing flow of automatically generating a target image with a changed color based on an original image is briefly introduced. In the embodiment of the present application, the processing flow of the above-mentioned intelligent color change will be described in detail. Figure 3is a flow chart of an image processing method provided by an embodiment of the present application. Figure 3 This embodiment is executed by an electronic device and is described by taking the electronic device as a terminal as an example. This embodiment includes:

[0112] 301. A terminal obtains at least one original image associated with a content item.

[0113] The above step 301 is similar to the above step 201 and will not be described in detail here.

[0114] 302. The terminal identifies a first area in the at least one original image, where the first area refers to an area in the original image that does not need to change color.

[0115] The first area refers to an area in the original image that does not need to change color, so the first area is also called a non-color-changing area. In other words, the first area represents an area that does not need to change color during the color-changing process.

[0116] Optionally, the first area includes at least one of the following: a candidate area in the original image that does not require color change, in other words, since areas that cannot be changed in color, such as product display images and model trial images, can be detected as targets, the first area that does not require color change can be selected from the candidate area; or, a target object in the original image, in other words, for the target object associated with the content item (such as the product, item, model, spokesperson, etc. associated with the content item), there is no need to change the color of the target object, so the target object can be segmented out from the original image and the segmented target object can be used as the first area that does not require color change.

[0117] The following will introduce the recognition method of the first area for different situations where two first areas, namely, a candidate area that does not need to change color and an area where a target object is located, are detected.

[0118] Case 1: Candidate areas that do not need to change color

[0119] In some embodiments, when the first area includes candidate areas that do not require color change, for any original image of the at least one original image, the terminal performs target detection on the original image to obtain the candidate area in the original image. In other words, one or more candidate areas can be determined from the original image through target detection. Some of these candidate areas can be changed in color, while some do not. A subsequent color change classification model is required to identify the candidate areas that do not require color change as the first area.

[0120] In some embodiments, since candidate areas that cannot be changed in color, such as product display images and model trial images, are usually made into rectangular areas in the UI interface associated with the content item, such as the landing page or the display page, the above-mentioned target detection process may refer to the process of detecting the rectangular area. In other words, the terminal performs rectangular detection on the original image and determines the detected rectangular area as the candidate area.

[0121] In some embodiments, the terminal performs rectangle detection in the following manner: 1) performing Gaussian blur on the original image to obtain a blurred image; 2) binarizing the blurred image to obtain a binary image; 3) detecting the contour contained in the binary image, and performing polygonal approximation on the detected contour; 4) when the approximated polygon is a convex quadrilateral and the angle between adjacent sides meets the target condition, it is determined that the rectangular area is detected.

[0122] Optionally, when acquiring a blurred image, in addition to using the Gaussian blur method, mean blur, median blur, bilateral blur, etc. can also be used to smooth the original image to obtain the blurred image. The embodiment of the present application does not specifically limit the blur method.

[0123] Optionally, when acquiring a binary image, the Otsu method (OTSU) algorithm is used to perform a binary segmentation threshold on the blurred image. The OTSU algorithm is also called the maximum inter-class variance method. After the image is binarized and segmented according to the threshold obtained by the OTSU algorithm, the inter-class variance of the foreground and background images is the largest. The OTSU algorithm is considered to be the best algorithm for selecting the image binary segmentation threshold. It is simple to calculate and is not affected by the image brightness and contrast. Therefore, it has been widely used in digital image processing. The OTSU algorithm divides the image into two parts, the background and the foreground, according to the grayscale characteristics of the image. Because the variance is a measure of the uniformity of the grayscale distribution, the larger the inter-class variance between the background and the foreground, the greater the difference between the two parts of the image. When part of the foreground is wrongly divided into the background or part of the background is wrongly divided into the foreground, the difference between the two parts will become smaller. Therefore, the segmentation that maximizes the inter-class variance means that the probability of misclassification is minimized.

[0124] Schematically, the segmentation threshold of the blurred image is calculated by the OTSU algorithm. Then, for each pixel in the blurred image, if the pixel value of the pixel is greater than the segmentation threshold, the pixel value of the pixel is set to 1, and if the pixel value of the pixel is less than the segmentation threshold, the pixel value of the pixel is set to 0, so that a binary image can be obtained, and the pixel value of each pixel in the binary image is either 1 or 0.

[0125] Optionally, contour detection is performed on the binary image to obtain a contour feature map of the binary image, and polygon approximation is performed on the contour feature map. In other words, polygons are used to approximate the contours in the contour feature map, and each polygon obtained by approximation can be determined.

[0126] Optionally, for any approximated polygon, if the polygon is a quadrilateral and a convex polygon, and the angle between adjacent sides meets the target condition, it is determined that a rectangular area approximated by a convex quadrilateral is detected.

[0127] Optionally, the target condition refers to that the angle difference between the angle between adjacent sides and 90 degrees is less than an angle threshold, and the angle threshold is any value greater than 0, for example, the angle threshold is 5 degrees, 10 degrees or other values, or, the target condition refers to that the absolute value of the cosine difference between the cosine value of the angle between adjacent sides and 0 (the cosine value of 90 degrees is 0) is less than a cosine threshold, and the cosine threshold is any value greater than or equal to 0 and less than or equal to 1, for example, the cosine threshold is 0.1, 0.2 or other values. The embodiments of the present application do not specifically limit this.

[0128] In some embodiments, it is determined whether each polygon obtained by approximation is a convex quadrilateral and whether the angle between adjacent sides meets the target conditions. After traversing the approximated polygons, each rectangular area contained in the original image can be obtained.

[0129] It should be noted that the above steps 1)-4) of rectangle detection can all be implemented using functions or code logic encapsulated in the Open CV code library.

[0130] In other embodiments, the terminal performs rectangle detection in the following manner: input the original image into a rectangle detection model, extract edge features of the original image through multiple hidden layers included in the rectangle detection model, determine whether the original image contains a rectangular area through the edge features, and output the detected rectangular area if the original image contains a rectangular area. Schematically, the detected rectangular area is identified in the original image, or the detected rectangular area is subtracted from the original image and the subtracted rectangular area is output, or only the position coordinates of the detected rectangular area are output. The embodiment of the present application does not specifically limit the representation method of the rectangular area. Optionally, the rectangle detection model is any image processing model based on deep learning, the rectangle detection model is trained based on positive sample images containing rectangular areas and negative sample images that do not contain rectangular areas, the rectangle detection model is used to detect whether the input image contains a rectangular area, and if the input image contains a rectangular area, the detected rectangular area is also output. Optionally, the model structure of the rectangle detection model includes but is not limited to: DNN (Deep Neural Networks) model, CNN (Convolutional Neural Networks) model, MLP (Multi-Layer Perception) model, etc. The embodiment of the present application does not specifically limit the model structure of the rectangle detection model.

[0131] Schematically, each detected rectangular area is represented by the coordinates of the upper left corner vertex (x, y) of the rectangular area and the width w and height h of the rectangular area. In other words, a four-tuple of {x, y, w, h} is used to represent the position coordinates of each rectangular area in the original image.

[0132] Optionally, the rectangular area can be represented by the coordinates of the lower right corner vertex, the width and height of the rectangular area, or by the coordinates of the lower left corner vertex, the width and height of the rectangular area, or by the coordinates of the upper right corner vertex, the width and height of the rectangular area. The embodiment of the present application does not specifically limit the representation method of the position coordinates of the rectangular area.

[0133] In some embodiments, for any detected candidate area, the candidate area is input into a color change classification model, and a color change detection result is output through the color change classification model. The color change detection result is used to characterize whether the input candidate area needs to be changed in color. The color change classification model is used to detect whether the input candidate area needs to be changed in color. The color change classification model is trained based on a pre-marked first area that does not need to be changed in color and a second area that needs to be changed in color.

[0134] Optionally, the color-changing classification model is a binary classification model, and the candidate area is input into the color-changing classification model, and the image features of the candidate area are extracted by the color-changing classification model, and the image features are used to predict the matching probability P of the candidate area being the first area that does not need to change color. When the matching probability P is greater than or equal to the matching threshold P', the output color-changing detection result indicates that the candidate area does not need to change color (for example, the output classification label "no color change"); when the matching probability P is less than the matching threshold P', the output color-changing detection result indicates that the candidate area needs to change color (for example, the output classification label "color change").

[0135] Optionally, the model structure of the above-mentioned color-changing classification model includes but is not limited to: ResNet101 (residual network 101) model, ResNet50 model, ResNet152 model, logistic regression model, decision tree model, support vector machine (SVM), naive Bayes model, etc. The embodiment of the present application does not specifically limit the model structure of the color-changing classification model.

[0136] Schematically, when any detected candidate area is a rectangular area, the above-mentioned color change classification model is provided as a rectangular classifier, and the rectangular classifier is used to detect whether the input rectangular area needs to change color. For example, the rectangular classifier is used to perform a binary classification detection of "color change" / "no color change". For the input rectangular area, after image feature extraction and matching probability prediction by the rectangular classifier, the classification label predicted for the rectangular area is output. For example, when the classification label "color change" is output, the color change detection result of the rectangular area is determined to require color change. When the classification label "no color change" is output, the color change detection result of the rectangular area is determined to not require color change.

[0137] In some embodiments, based on the color change detection results of each candidate area by the above-mentioned color change classification model, the terminal determines the candidate area where the color change detection result indicates that no color change is required as the first area. For example, the rectangular area where the color change detection result indicates that no color change is required is determined as the first area. Of course, in addition to the rectangular area, the candidate area can also be a circular area, an irregular area, etc. The embodiment of the present application does not specifically limit the shape of the candidate area.

[0138] Case 2: The area where the target object is located

[0139] In some embodiments, when the first area includes the area where the target object is located, for any original image of the at least one original image, the terminal performs object recognition on the original image to obtain an object recognition result, which characterizes whether the original image contains the target object, that is, the above-mentioned object recognition is only a process of determining whether the original image contains the target object, and is not a process of finely identifying the area where the target object is located.

[0140] In some embodiments, the target objects include but are not limited to: faces, designated objects, designated people, designated buildings, designated animals, designated plants, designated virtual images, etc. The embodiments of the present application do not specifically limit the types of target objects.

[0141] In some embodiments, the terminal inputs the original image into the object recognition model, extracts the deep features associated with the object type in the original image through the object recognition model, analyzes whether the target object is contained in the original image through the deep features, and obtains the object recognition result. Schematically, when the target object includes a face, the terminal inputs the original image into the facial recognition model, performs facial recognition on the original image through the facial recognition model, and outputs a facial recognition result, which indicates whether the original image contains the face of any object; when the target object includes a cat, the terminal inputs the original image into the object recognition model, performs object recognition on the original image through the object recognition model, and outputs an object recognition result, which indicates whether the original image contains a cat.

[0142] The above object recognition process can also be regarded as an image binary classification process, that is, the original image is subjected to a binary classification detection of "containing the target object" / "not containing the target object" through the object recognition model. At this time, the object recognition model is trained as a binary classification model for detecting whether the input image contains the target object. Usually, different object recognition models are trained for different target objects. Schematically, for the target object "face", the RetinaFace model is used for facial recognition.

[0143] In some embodiments, when the object recognition result indicates that the original image contains the target object, the terminal performs object segmentation on the original image to obtain a mask image for identifying the target object. Optionally, the mask image is a binary image, in which pixels with a pixel value of 1 (called foreground pixels) represent the area where the target object is located, and pixels with a pixel value of 0 (called background pixels) represent the area where the target object is not located. Optionally, the mask image is a color image, which is segmented into multiple connected areas in the color image, each connected area represents a segmented object, and the same color is used to fill the connected areas where the same object is located. For example, when green is used to represent the target object, the area composed of green pixels in the mask image represents the area where the target object is located.

[0144] In some embodiments, the terminal inputs the original image into the object segmentation model, performs segmentation processing on the original image through the object segmentation model, and outputs a mask image for identifying the target object. Optionally, the model architecture of the object segmentation model includes but is not limited to: MODNet model, watershed algorithm, Fully Convolutional Networks (FCN) model, etc. The embodiment of the present application does not specifically limit the model architecture of the object segmentation model.

[0145] In some embodiments, the mask image can be used to find out which pixels are located in the region where the target object is located, so that the first region where the target object is located can be determined based on the mask image. Schematically, for each target object, a mask image is used to characterize the region where the target object is located.

[0146] In the above process, when the object recognition result indicates that the original image contains the target object, the area where the target object is located is determined as the first area. This ensures that after the specific target object is specified, the area where the target object is located can be accurately identified from the original image, and the area where the target object is located is not changed in color. It can be flexibly applied to business needs of ensuring that different objects do not change in color. For example, when the content item points to a water cup of a product, the target object is set to the water cup. In this way, the area where each water cup is located can be identified from the original image as the first area, and it is ensured that these water cups will not be changed in color during the processing.

[0147] 303. The terminal assigns pixel points in the first area as target pixel values ​​in the at least one original image to obtain at least one first image.

[0148] In some embodiments, since the pixels in the first area do not need to participate in the color changing algorithm, the terminal can assign the pixels in the first area to the target pixel values ​​in each original image to obtain at least one first image.

[0149] By assigning the pixels in the first area to the target pixel values, the interference in identifying the main color tone in the subsequent step 306 can be reduced. In other words, if the pixels in the first area are not assigned to the target pixel values, the color vectors of the pixels in the first area will also participate in the clustering process based on the color vectors of the pixels, so that the color vectors of the pixels in the first area that do not participate in the color change affect the identification of the main color tone in the second area that needs to participate in the color change. Therefore, by assigning the pixels in the first area to the target pixel values, it can be ensured that the pixels that do not participate in the color change have the same pixel value (target pixel value) and therefore have the same color vector, and thus will be clustered into the same color cluster. By excluding this color cluster when screening the main color tone, the interference of the pixels in the first area on the identification of the main color tone can be greatly reduced.

[0150] In one example, each pixel in the first area is assigned a white pixel value (255, 255, 255), or the target pixel value may also be a black pixel value (0, 0, 0), or other colors. The embodiment of the present application does not specifically limit the target pixel value.

[0151] In some embodiments, when the first area includes a rectangular area that does not need to change color, all pixels in the rectangular area are assigned target pixel values. When the first area includes the area where the target object is located, the position coordinates of the pixels in the area where the target object is located can be determined based on the mask image, so that the pixels at corresponding positions are found in the original image based on the position coordinates, and the pixels at corresponding positions are assigned target pixel values. For example, when the mask image is a binary image and the pixels with a value of 1 represent the area where the target object is located, the position coordinates of all pixels with a value of 1 are found, and the pixels at corresponding positions are found in the original image based on the position coordinates, and the pixels at corresponding positions are assigned target pixel values.

[0152] In some embodiments, the terminal may not execute the above step 303, that is, not assign values ​​to the pixels in the first area of ​​the original image. In this case, it is only necessary to exclude the pixels in the first area when filtering the main color tone. The embodiment of the present application does not specifically limit this.

[0153] 304. The terminal stitches the at least one first image to obtain a stitched image.

[0154] In some embodiments, the terminal splices the at least one first image horizontally or vertically, or performs splicing in a multi-grid form, to obtain a spliced ​​image. The embodiment of the present application does not specifically limit the typesetting method during splicing. For example, the spliced ​​image is obtained by splicing in a vertical manner.

[0155] In some embodiments, since the first images may have inconsistent sizes, it is necessary to adjust the first images to the same width before they can be spliced ​​vertically to obtain the spliced ​​image, or to adjust the first images to the same height before they can be spliced ​​horizontally to obtain the spliced ​​image, or to adjust the first images to the same width and height before they can be spliced ​​in the form of multiple grids (such as 4 grids, 9 grids) to obtain the spliced ​​image. That is, before splicing, the first images can be resized to meet the splicing requirements and then spliced ​​to obtain the spliced ​​image. The embodiments of the present application do not specifically limit this.

[0156] 305. The terminal clusters the pixels in the spliced ​​image based on the color vectors of the pixels to obtain at least one color cluster.

[0157] In some embodiments, the terminal forms a data set with the color vectors of the multiple pixels in the stitched image, and uses a clustering algorithm to cluster the color vectors of the multiple pixels in the data set, i.e., to ensure that color vectors with similar color vectors, i.e., color vectors with close distances, are classified into the same color cluster. When clustering is stopped, at least one color cluster formed by the clustering of the color vectors of the multiple pixels in the stitched image can be obtained.

[0158] In some embodiments, any pixel in the data set uses a (R, G, B) three-dimensional vector to represent the color vector of the pixel. In the clustering process, a K-means (K-Means) clustering algorithm, a K-nearest neighbor (KNN) clustering algorithm, or other clustering models based on deep learning can be used. The embodiments of the present application do not specifically limit the clustering algorithm used.

[0159] Schematically, the K-Means clustering algorithm is used as an example to illustrate that, in a data set composed of color vectors of multiple pixels in a spliced ​​image, K (K>1) color vectors of pixels are randomly selected as the initial K cluster centers; then, for the color vector of any pixel in the data set, the distance between the color vector of the pixel and the color vectors of the K cluster centers is calculated (for example, the Euclidean distance is calculated), and the color vector of the pixel is assigned to the cluster center closest to it. The color vectors assigned to the same cluster center represent a color cluster. After all color vectors in the data set are assigned, for any color cluster, an average vector needs to be recalculated as a new cluster center based on the color vectors belonging to the color cluster. The above operations of grouping color vectors and updating cluster centers are continuously performed until the termination condition of clustering is met, and clustering is stopped. The K groups of clusters when clustering is stopped are the candidate K color clusters. Optionally, the clustering termination condition includes but is not limited to: no (or a minimum number) of color vectors are reallocated to different color clusters; or, no (or a minimum number) of the clustering centers of the color clusters change again; or, the sum of squared errors is locally minimized, etc. The clustering termination condition may be any one of the above or a combination of at least two of them. The embodiment of the present application does not specifically limit the clustering termination condition.

[0160] In some embodiments, when the K-Means clustering algorithm stops clustering, it will output K candidate color clusters. Optionally, all the K color clusters are put into the following step 306 to obtain the main color tone. Optionally, not all the K color clusters need to participate in the following step 306 to obtain the main color tone. For example, since the pixels in the first area are all assigned to the target pixel value, it is necessary to exclude the color cluster where the target pixel value is located from the candidate K color clusters. For example, when the target pixel value is a white pixel value (255, 255, 255), it is necessary to delete the color cluster where the white pixel value is located from the K color clusters. For example, from the K-1 color clusters where the target pixel value is excluded, these K-1 color clusters are sorted from large to small according to the number of color vectors contained, and the color cluster at the top of the sorting is selected. I color clusters are put into the following step 306 to obtain the main color tone, where I is an integer greater than or equal to 1 and less than or equal to K-1. In other words, from the K-1 candidate color clusters, some color clusters containing a small number of color vectors are filtered out. The goal is to filter out color clusters with a small coloring area (which means a small number of corresponding pixels and thus a small number of color vectors) to ensure that the color clusters that ultimately participate in the selection of the main color tone are color clusters with a large number of color vectors clustered together. These are the main colors that constitute the stitched image.

[0161] Optionally, only after excluding the color cluster where the target pixel value is located among the K candidate color clusters, the remaining K-1 color clusters are put into the following step 306, or, the K candidate color clusters are directly sorted from large to small according to the number of pixels they contain, and the top M color clusters are selected and put into the following step 306, where M is an integer greater than or equal to 1 and less than or equal to K.

[0162] Optionally, if the terminal does not execute the step of filling the target pixel values ​​into the pixels in the first area in the above step 303, the terminal can delete the pixels in the first area when initially constructing a data set consisting of multiple pixels of the stitched image, thereby ensuring that the color vectors of the pixels in the first area do not participate in the color clustering process.

[0163] 306. The terminal determines the cluster center of the at least one color cluster as at least one main color tone of the stitched image, where the main color tone represents a color distribution tendency of pixels in the stitched image.

[0164] Among them, since the main color tone represents the color distribution tendency of the pixels in the spliced ​​image, and the spliced ​​image is obtained by splicing at least one first image, in other words, the main color tone represents the color distribution tendency of the pixels in the at least one first image.

[0165] In some embodiments, the terminal uses the average vector of the color vectors of each pixel contained in each color cluster as the clustering center of the color cluster, which also represents a main color tone of the stitched image. Performing the above operations on at least one color cluster can obtain at least one main color tone. Since the main color tone will be used to generate the color mapping relationship used in the color mapping in the following step 307, the main color tone is equivalent to a "palette" in the color changing process.

[0166] In the above steps 304-306, a possible implementation method is provided for the terminal to obtain at least one main color tone based on the at least one first image recognition. Optionally, the terminal does not execute the above step 304, and there is no need to splice the first images. At this time, the color vectors of multiple pixels in the second area of ​​each first image are used to form a data set for clustering, and at least one main color tone can also be identified. The embodiment of the present application does not specifically limit whether the main color tone recognition is performed after splicing.

[0167] 307. The terminal performs color mapping on the pixel points in the spliced ​​image to obtain a color-changed image, and cuts the color-changed image to obtain at least one second image corresponding to each of the at least one first image.

[0168] Since the stitched image is obtained by stitching at least one first image, and at least one second image is obtained by cutting the color-changing image, the above step 307 is equivalent to the terminal performing color mapping on the pixels in the at least one first image to obtain at least one second image. Optionally, if the first images are not stitched when the main color tone is identified, then there is no stitched image, and the corresponding second image can be obtained by directly mapping the first images one by one in the subsequent process, without cutting the color-changing image obtained by mapping the stitched image to obtain each second image. Optionally, even if the first images are stitched to obtain the stitched image when the main color tone is identified, after the main color tone is identified, the first images can still be directly mapped one by one to obtain the corresponding second image, that is, the stitched image is only used to identify the main color tone and does not participate in the color mapping process. At this time, there is no need for additional cutting processing, which can simplify the image processing process. The embodiment of the present application does not specifically limit this.

[0169] In some embodiments, the terminal performs color mapping through the following steps 3071-3075:

[0170] 3071. The terminal converts the stitched image from the red-green-blue RGB color space to the hue-saturation-brightness HSV color space.

[0171] In some embodiments, since the RGB color space and the HSV color space essentially represent the same color using different color models, for any pixel in the stitched image, the pixel value of the pixel can be converted from the RGB color space to the HSV color space.

[0172] Since the stitched image is obtained by stitching at least one first image, the above step 3071 is equivalent to converting at least one first image from the RGB color space to the HSV color space. Optionally, if the stitched image is not obtained in the main color tone identification stage, then in this step 3071, at least one first image is directly converted from the RGB color space to the HSV color space. The embodiment of the present application does not specifically limit this.

[0173] 3072. For any main hue, the terminal keeps the saturation S and brightness V of the main hue unchanged in the HSV color space, modifies the hue H of the main hue, and obtains a color-changing hue corresponding to the main hue.

[0174] In some embodiments, for each main hue, in the HSV color space, since the color change goal is to only change the hue H without modifying the saturation S and brightness V, the saturation S and brightness V of the main hue can be kept unchanged, and the hue H of the main hue is modified to obtain the color-changed hue corresponding to the main hue.

[0175] In some embodiments, the hue sampling function in the HSV color space is configured based on the number N of color schemes that the user wants to generate for this intelligent color matching, so that for any i-th (1≤i≤N) color scheme, it is only necessary to substitute the value of i into the hue sampling function to uniformly sample the corresponding color-changing hue in the value range [0,360] of the hue H according to the number N of color schemes.

[0176] In the above process, by using the same hue sampling function to modify the hue H for each main hue to obtain the corresponding color-changing hue, it is possible to ensure that the hue difference between different main hues before and after the modification remains unchanged. In other words, the hue difference between any two main hues is equal to the hue difference between the corresponding two color-changing hues. This ensures that colors with hues that are too close will not appear in the final target image, avoiding the disadvantage of not being able to see the image clearly due to too small hue difference after the color change.

[0177] In some embodiments, the tone sampling function is expressed as follows:

[0178] Hn=(Ho+i·s)%360

[0179]

[0180] Among them, H o Represents the main color, H n Represents the main color H o The corresponding color change hue, i represents the serial number of the i-th color scheme (also represents the i-th color mapping of the original image), N represents the total number of color schemes, s is the parameter calculated based on N, and % represents the use of (H o +i·s) remainder of 360.

[0181] 3073. The terminal determines a color mapping relationship at a pixel level based on a main color tone mapping relationship between the main color tone and the color change color tone, where the color mapping relationship represents a corresponding relationship between different pixel values ​​before and after the color change.

[0182] In some embodiments, since a corresponding color-changing hue is found for each main hue in the HSV color space, there is a main hue mapping relationship between each main hue and each corresponding color-changing hue. Based on the main hue mapping relationship, a pixel-level color mapping relationship can be constructed. In other words, when there are 5 main hues, a color mapping relationship for each color throughout the entire color space can be constructed based on the main hue mapping relationship between the 5 main hues and the 5 color-changing hues.

[0183] In some embodiments, the stitched image is converted from the HSV color space to the LAB color space again. Since the LAB color space is larger than the RGB color space, this means that any point (any color) in the RGB color space can find a corresponding mapping point in the LAB color space. Therefore, when the color mapping relationship is constructed based on the main color tone mapping relationship in the LAB color space by bilinear interpolation or trilinear interpolation, the color-changing image obtained by mapping the pixel values ​​of each pixel point in the LAB color space through the following step 3074 can be converted back from the LAB color space to the RGB color space based on higher color-changing accuracy and better color-changing effect. Schematically, the Palette-based Photo Recoloring algorithm is used to construct the color mapping relationship based on the main color tone mapping relationship. The embodiment of the present application does not specifically limit the method of constructing the color mapping relationship.

[0184] In some embodiments, the color mapping relationship can also be constructed directly in the RGB color space based on the main color tone mapping relationship, or in the HSV color space based on the main color tone mapping relationship. The embodiments of the present application do not specifically limit whether to convert to the LAB color space to achieve color mapping.

[0185] 3074. The terminal maps the pixel values ​​of the pixels in the spliced ​​image based on the color mapping relationship to obtain a color-changed image.

[0186] In some embodiments, since the color mapping relationship represents the correspondence between different pixel values ​​before and after color change, for any pixel point in the stitched image, the color mapping relationship can be used to find the pixel value of the pixel point after the color change corresponding to the pixel value of the pixel point, and the pixel value after the color change is assigned to the pixel point at the corresponding position in the color-changed image. By repeating the above operation, a color-changed image in which color mapping is performed on each pixel point can be obtained.

[0187] 3075. The terminal cuts the color-changing image to obtain the at least one second image corresponding to each of the at least one first image.

[0188] In some embodiments, since the color change only changes the pixel value of the pixel point but does not change the size and position of the first image, it can be known that the first image before the color change and the second image after the color change have the same size and position. The terminal cuts the color-changed image based on the size and position of each first image to obtain the second image corresponding to each first image.

[0189] Since the stitched image is obtained by stitching at least one first image, and at least one second image is obtained by cutting the color-changing image, the above steps 3074-3075 are equivalent to the terminal mapping the pixel points in the at least one first image based on the color mapping relationship to obtain at least one second image.

[0190] 308. The terminal assigns pixel values ​​of pixels located in the first area in the at least one second image to pixel values ​​of pixels at corresponding positions in the corresponding original image, and obtains at least one target image associated with the content item, where the target image is the original image after keeping the color of the first area unchanged and changing the color of the second area.

[0191] In some embodiments, each second image has a uniquely corresponding first image and a uniquely corresponding original image, that is, the original image, the first image and the second image have a one-to-one correspondence. For each second image, the terminal assigns any pixel point in the first area of ​​the second image to the pixel value of the pixel point at the corresponding position in the original image. The above operation is repeated multiple times to obtain a target image associated with the content item. This ensures that in the target image, only the second area is changed in color, while the color of the first area remains unchanged.

[0192] In some embodiments, when the first area includes a rectangular area that does not require color change, the terminal can find the pixel values ​​and position coordinates of the pixel points included in the rectangular area that does not require color change in the original image based on the quadruple {x, y, w, h} of each rectangular area. For any pixel point P included in the rectangular area that does not require color change, based on the position coordinates of the pixel point P, the terminal can find the pixel point P' with the same position coordinates in the second image, and then assign the pixel value of the pixel point P in the original image to the pixel point P' at the same position in the second image, so as to ensure that the color of any pixel point P' in the rectangular area that does not require color change will not be modified in the target image.

[0193] In some embodiments, when the first area includes the area where the target object is located, the terminal can find the pixel values ​​and position coordinates of the pixels contained in the area where the target object is located based on the mask image, and for any pixel point P contained in the area where the target object is located, based on the position coordinates of the pixel point P, the terminal can find the pixel point P' with the same position coordinates in the second image, and then assign the pixel value of the pixel point P in the original image to the pixel point P' at the same position in the second image, so as to ensure that the color of any pixel point P' in the area where the target object is located will not be modified in the target image.

[0194] In the above steps 303-308, a possible implementation method is provided for color mapping the pixel points of the second area other than the first area in the at least one original image to obtain at least one target image associated with the content item, that is, after first identifying the first area, the color of the entire image is changed, and then the pixel values ​​of the pixel points in the first area are assigned from the original image to the target image. Optionally, when changing the color, only the second area may be changed in color, so that there is no need to perform the above-mentioned assignment operation, which can simplify the image processing process.

[0195] In some embodiments, since there are often some white areas in the original images associated with the content items, these white areas are usually used as the background of the landing page or display page. In some business needs, there is a requirement that the white areas do not change color to ensure that the background color is always a comfortable and easy-to-view white. In response to the above business needs, a white area is determined in the at least one original image, and the difference between the pixel value of the pixel point in the white area and the white value is less than the target threshold, where the target threshold is any value greater than or equal to 0. For example, for each original image, the pixels in the original image are traversed. If the pixel value of any pixel point is between (240, 240, 240) and (255, 255, 255), that is, the difference between the three channels of RGB is less than the target threshold of 15, then the current pixel point is determined to belong to the white area. The above operation is repeated to determine all the pixels belonging to the white area in the original image. Then, based on a method similar to the above step 308, after the white area is identified for each original image, in the second image corresponding to the original image, the pixel points located in the white area are assigned the pixel values ​​of the pixel points at the corresponding position in the corresponding original image, thereby ensuring that the white area will not change color and being able to flexibly adapt to different business needs. It should be noted that when there are other requirements such as the red area will not change color, the blue area will not change color, etc., performing similar operations can also ensure that any specified color will not change during the color change process, which has extremely high controllability.

[0196] All the above optional technical solutions can be arbitrarily combined to form optional embodiments of the present disclosure, and will not be described in detail here.

[0197] The method provided in the embodiment of the present application, for the original image associated with the content item, keeps the color of the first area unchanged during the color changing process, and only performs color mapping on the second area, so that the target image obtained by the color change is another color scheme derived from the original image. This color scheme does not require the user to manually operate the photo editing application, and can intelligently identify the first area that cannot be changed in color and ensure that the color of the first area remains unchanged before and after the color change. Therefore, while ensuring the accuracy and effect of the color change, the display method of the image associated with the content item is greatly enriched, and the display effect of the image associated with the content item is improved.

[0198] In the above embodiment, the detailed implementation of each step of the image processing method is introduced in detail. In the embodiment of the present application, taking the user inputting two original images (original images 1 and 2) as an example, it is introduced how to intelligently match the colors of the two original images to derive the corresponding two target images.

[0199] Figure 4 is a principle flow chart of an image processing method provided in an embodiment of the present application, such as Figure 4 As shown, the original image 1 and the original image 2 are respectively input into the preprocessing module 401, and the preprocessed image 1 and the preprocessed image 2 are respectively output, wherein the preprocessing module 401 is used to identify the first area in the original image that does not need to change color, and fill the first area with white. For example, the first area includes a rectangular area with no color change and a target object. At this time, for the rectangular area with no color change, the preprocessing module 401 also needs to output a four-tuple {x, y, w, h} used to represent the position coordinates of the rectangular area with no color change, wherein (x, y) represents the coordinates of the upper left corner vertex of the rectangular area with no color change, and w and h represent the width and height of the rectangular area with no color change, respectively; in addition, for the target object, the preprocessing module 401 also needs to output a mask image Mask used to identify the area where the target object is located.

[0200] Next, the preprocessed image 1 and the preprocessed image 2 output by the preprocessing module 401 are spliced ​​to obtain a spliced ​​image, and the spliced ​​image is input into the main color recognition module 402. The main color recognition module 402 is used to identify at least one main color in the spliced ​​image through a clustering method based on a color vector, for example, to identify 5 main colors.

[0201] Next, at least one main color tone identified by the main color tone identification module 402 is input to the color scheme generation module 403 , and the color scheme generation module 403 is used to change each main color tone to obtain a changed color tone.

[0202] Next, the stitched image, at least one main color tone identified by the main color tone identification module 402, and at least one color change tone generated by the color scheme generation module 403 are converted into the LAB color space and then input into the color change algorithm module 404. In the color change algorithm module 404, each pixel in the stitched image is color mapped in the LAB color space to output a color change image.

[0203] Next, the color-changed image is cut to obtain color-changed image 1 and color-changed image 2, the original image 1 and the color-changed image 1 are input into the post-processing module 405, and the white area, the non-color-changed rectangular area and the target object are pasted from the original image 1 into the color-changed image 1 through the post-processing module 405 to obtain the target image 1. Similarly, the original image 2 and the color-changed image 2 are input into the post-processing module 405, and the white area, the non-color-changed rectangular area and the target object are pasted from the original image 2 into the color-changed image 2 through the post-processing module 405 to obtain the target image 2.

[0204] Next, we will focus on the above Figure 4 The preprocessing module 401 in FIG.

[0205] Figure 5 is a principle flow chart of a preprocessing module provided in an embodiment of the present application, such as Figure 5 As shown, in the preprocessing module 401, for any input original image, a first area that does not need to change color will be identified through two-way detection. In one bypass, all candidate rectangular areas in the original image are detected by the rectangle detection module 4011. Each candidate rectangular area detected by the rectangle detection module 4011 will be sent to the rectangle classifier 4012 for binary classification of "color change" / "no color change". For the rectangular area whose color change detection result is "no color change", the four-tuple {x, y, w, h} parameters of the rectangular area without color change are output; in another bypass, the object recognition module 4013 is used to identify the original image. Whether it contains the target object, an object recognition result is obtained. When the object recognition result indicates that the original image contains the target object, the original image is input into the object segmentation module 4014 to segment the target object in the original image. At this time, a mask image Mask for identifying the target object will be output. Then, the non-color-changing rectangular area and the target object both belong to the non-color-changing area (i.e., the first area), and the first area is filled with white. Then the preprocessing module 401 outputs the preprocessed image in which the first area is filled with white, as well as the four-tuple {x, y, w, h} of each non-color-changing rectangular area, and the mask image Mask of each target object.

[0206] Next, we will focus on the above Figure 4 The post-processing module 405 in FIG.

[0207] Figure 6 is a principle flow chart of a post-processing module provided in an embodiment of the present application, such as Figure 6 As shown, in the post-processing module 405, for any input original image and the corresponding color-changed image, it is also necessary to obtain the quaternary groups {x, y, w, h} of each non-color-changed rectangular area in the original image and the mask image Mask of each target object, and both the quaternary groups and the mask parameters can be provided by the pre-processing module 401. Then, for the original image, the quaternary groups {x, y, w, h} of each non-color-changed rectangular area are used to obtain the corresponding non-color-changed rectangular areas from the original image. At the same time, the mask image Mask of each target object is used to obtain the corresponding target object from the original image. In addition, the white area in the original image needs to be calculated. Then, the white area, the non-color-changed rectangular area and the target object are all pasted to the corresponding positions of the color-changed image to obtain the final output target image.

[0208] In an embodiment of the present application, the provided image processing method can be applied to the production process of various UI interfaces related to content items, for example, it can be applied to the production process of advertising landing pages. By using this image processing method, it is possible to intelligently, automatically and quickly derive N color schemes for an initial scheme containing at least one original image given by a landing page, and provide users with the option of which color schemes can be used for formal delivery, so that users can select appropriate color schemes according to business needs, publish and apply them to the corresponding advertising landing pages, enriching the display methods and display effects of the advertising landing pages, saving the time cost and production cost of the advertising landing pages, and improving the human-computer interaction efficiency of the production process.

[0209] Figure 7 is a schematic diagram of the structure of an image processing device provided in an embodiment of the present application, such as Figure 7 As shown, the device comprises:

[0210] An acquisition module 701 is used to acquire at least one original image associated with a content item;

[0211] An identification module 702 is used to identify a first area in the at least one original image, where the first area refers to an area in the original image that does not need to be changed in color;

[0212] The mapping module 703 is used to perform color mapping on the pixel points of the second area except the first area in the at least one original image to obtain at least one target image associated with the content item, and the target image is the original image after keeping the color of the first area unchanged and changing the color of the second area.

[0213] The device provided in the embodiment of the present application, for the original image associated with the content item, keeps the color of the first area unchanged during the color changing process, and only performs color mapping on the second area, so that the target image obtained by the color change is another color scheme derived from the original image. This color scheme does not require the user to manually operate the photo editing application, and can intelligently identify the first area that cannot be changed in color and ensure that the color of the first area remains unchanged before and after the color change. Therefore, while ensuring the accuracy and effect of the color change, the display method of the image associated with the content item is greatly enriched, and the display effect of the image associated with the content item is improved.

[0214] In one possible implementation, based on Figure 7 The identification module 702 comprises:

[0215] A detection unit, used to perform target detection on any original image to obtain a candidate region in the original image;

[0216] A classification unit, used for inputting the candidate area into a color-changing classification model, and outputting a color-changing detection result through the color-changing classification model, wherein the color-changing classification model is used for detecting whether the candidate area needs to be changed in color;

[0217] The first determining unit is configured to determine the candidate region where the color change detection result indicates that no color change is required as the first region.

[0218] In one possible implementation, the detection unit is used to:

[0219] Rectangle detection is performed on the original image, and the detected rectangular area is determined as the candidate area.

[0220] In one possible implementation, based on Figure 7 The identification module 702 comprises:

[0221] A first recognition unit is used to perform object recognition on any original image to obtain an object recognition result, wherein the object recognition result indicates whether the original image contains a target object;

[0222] The second determining unit is configured to determine, when the object recognition result indicates that the original image contains the target object, a region where the target object is located as the first region.

[0223] In a possible implementation manner, the second determining unit is used to:

[0224] Performing object segmentation on the original image to obtain a mask image for identifying the target object;

[0225] Based on the mask image, the first area where the target object is located is determined.

[0226] In one possible implementation, based on Figure 7 The mapping module 703 comprises:

[0227] An assignment unit, configured to assign, in the at least one original image, pixel points in the first area to target pixel values ​​to obtain at least one first image;

[0228] A second recognition unit is used to obtain at least one main color tone based on the at least one first image recognition, where the main color tone represents the color distribution tendency of pixel points in the at least one first image;

[0229] A mapping unit, configured to perform color mapping on pixels in the at least one first image to obtain at least one second image;

[0230] The assignment unit is also used to assign, in the at least one second image, pixel points located in the first area to pixel values ​​of pixel points at corresponding positions in the corresponding original image, so as to obtain the at least one target image.

[0231] In a possible implementation manner, the second identification unit is used to:

[0232] Stitching the at least one first image to obtain a stitched image;

[0233] Clustering the pixel points in the spliced ​​image based on the color vector of the pixel points to obtain at least one color cluster;

[0234] A cluster center of the at least one color cluster is determined as the at least one main hue.

[0235] In a possible implementation manner, the mapping unit is used to:

[0236] Converting the at least one first image from a red-green-blue (RGB) color space to a hue-saturation-value (HSV) color space;

[0237] For any main color, in the HSV color space, the saturation S and brightness V of the main color are kept unchanged, and the hue H of the main color is modified to obtain the color-changing hue corresponding to the main color;

[0238] Based on the main color tone mapping relationship between the main color tone and the color change color tone, a color mapping relationship at the pixel level is determined, where the color mapping relationship represents the corresponding relationship between different pixel values ​​before and after the color change;

[0239] Based on the color mapping relationship, the pixel values ​​of the pixels in the at least one first image are mapped to obtain the at least one second image.

[0240] In a possible implementation, the hue difference between any two primary hues is equal to the hue difference between the corresponding two color-changing hues.

[0241] In one possible implementation, based on Figure 7 The device is composed of:

[0242] A determination module, configured to determine a white area in the at least one original image, wherein a difference between a pixel value of a pixel point in the white area and a white value is less than a target threshold;

[0243] The assignment unit is further used to assign, in the at least one second image, pixel points located in the white area to pixel values ​​of pixel points at corresponding positions in the corresponding original image.

[0244] All the above optional technical solutions can be arbitrarily combined to form optional embodiments of the present disclosure, and will not be described in detail here.

[0245] It should be noted that: the image processing device provided in the above embodiment only uses the division of the above functional modules as an example to illustrate when processing images. In actual applications, the above functions can be assigned to different functional modules as needed, that is, the internal structure of the electronic device is divided into different functional modules to complete all or part of the functions described above. In addition, the image processing device provided in the above embodiment and the image processing method embodiment belong to the same concept. The specific implementation process is detailed in the image processing method embodiment, which will not be repeated here.

[0246] Figure 8 is a schematic diagram of the structure of a terminal provided in an embodiment of the present application, such as Figure 8 As shown, terminal 800 is an exemplary description of an electronic device. Optionally, the device type of terminal 800 includes: a smart phone, a tablet computer, an MP3 player (Moving Picture Experts Group Audio Layer III, Moving Picture Experts Group Audio Layer 3), an MP4 (Moving Picture Experts Group Audio Layer IV, Moving Picture Experts Group Audio Layer 4) player, a laptop or a desktop computer. Terminal 800 may also be called a user device, a portable terminal, a laptop terminal, a desktop terminal, and other names.

[0247] Typically, the terminal 800 includes a processor 801 and a memory 802 .

[0248] Optionally, the processor 801 includes one or more processing cores, such as a 4-core processor, an 8-core processor, etc. Optionally, the processor 801 is implemented in at least one hardware form of DSP (Digital Signal Processing), FPGA (Field-Programmable Gate Array), and PLA (Programmable Logic Array). In some embodiments, the processor 801 includes a main processor and a coprocessor. The main processor is a processor for processing data in the awake state, also known as a CPU (Central Processing Unit); the coprocessor is a low-power processor for processing data in the standby state. In some embodiments, the processor 801 is integrated with a GPU (Graphics Processing Unit), which is responsible for rendering and drawing the content to be displayed on the display screen. In some embodiments, the processor 801 also includes an AI (Artificial Intelligence) processor, which is used to process computing operations related to machine learning.

[0249] In some embodiments, the memory 802 includes one or more computer-readable storage media, and optionally, the computer-readable storage medium is non-transitory. Optionally, the memory 802 also includes a high-speed random access memory, and a non-volatile memory, such as one or more disk storage devices, flash memory storage devices. In some embodiments, the non-transitory computer-readable storage medium in the memory 802 is used to store at least one program code, and the at least one program code is used to be executed by the processor 801 to implement the image processing method provided in each embodiment of the present application.

[0250] In some embodiments, the terminal 800 may further optionally include: a peripheral device interface 803 and at least one peripheral device. The processor 801, the memory 802 and the peripheral device interface 803 may be connected via a bus or a signal line. Each peripheral device may be connected to the peripheral device interface 803 via a bus, a signal line or a circuit board. Specifically, the peripheral device includes: at least one of a radio frequency circuit 804, a display screen 805, a camera assembly 806, an audio circuit 807 and a power supply 808.

[0251] The peripheral device interface 803 may be used to connect at least one peripheral device related to I / O (Input / Output) to the processor 801 and the memory 802. In some embodiments, the processor 801, the memory 802, and the peripheral device interface 803 are integrated on the same chip or circuit board; in some other embodiments, any one or two of the processor 801, the memory 802, and the peripheral device interface 803 are implemented on a separate chip or circuit board, which is not limited in this embodiment.

[0252] The radio frequency circuit 804 is used to receive and transmit RF (Radio Frequency) signals, also known as electromagnetic signals. The radio frequency circuit 804 communicates with communication networks and other communication devices through electromagnetic signals. The radio frequency circuit 804 converts electrical signals into electromagnetic signals for transmission, or converts received electromagnetic signals into electrical signals. Optionally, the radio frequency circuit 804 includes: an antenna system, an RF transceiver, one or more amplifiers, a tuner, an oscillator, a digital signal processor, a codec chipset, a user identity module card, and the like. Optionally, the radio frequency circuit 804 communicates with other terminals through at least one wireless communication protocol. The wireless communication protocol includes, but is not limited to: a metropolitan area network, various generations of mobile communication networks (2G, 3G, 4G and 5G), a wireless local area network and / or a WiFi (Wireless Fidelity) network. In some embodiments, the radio frequency circuit 804 also includes circuits related to NFC (Near Field Communication), which is not limited in this application.

[0253] The display screen 805 is used to display a UI (User Interface). Optionally, the UI includes graphics, text, icons, videos, and any combination thereof. When the display screen 805 is a touch display screen, the display screen 805 also has the ability to collect touch signals on the surface or above the surface of the display screen 805. The touch signal can be input to the processor 801 as a control signal for processing. Optionally, the display screen 805 is also used to provide virtual buttons and / or virtual keyboards, also known as soft buttons and / or soft keyboards. In some embodiments, the display screen 805 is one, and the front panel of the terminal 800 is set; in other embodiments, the display screen 805 is at least two, which are respectively set on different surfaces of the terminal 800 or are folded; in some other embodiments, the display screen 805 is a flexible display screen, which is set on the curved surface or folded surface of the terminal 800. Even, optionally, the display screen 805 is set to a non-rectangular irregular shape, that is, a special-shaped screen. Optionally, the display screen 805 is made of materials such as LCD (Liquid Crystal Display) and OLED (Organic Light-Emitting Diode).

[0254] The camera assembly 806 is used to capture images or videos. Optionally, the camera assembly 806 includes a front camera and a rear camera. Typically, the front camera is arranged on the front panel of the terminal, and the rear camera is arranged on the back of the terminal. In some embodiments, there are at least two rear cameras, which are any one of a main camera, a depth of field camera, a wide-angle camera, and a telephoto camera, so as to realize the fusion of the main camera and the depth of field camera to realize the background blur function, the fusion of the main camera and the wide-angle camera to realize the panoramic shooting and VR (Virtual Reality) shooting function or other fusion shooting functions. In some embodiments, the camera assembly 806 also includes a flash. Optionally, the flash is a monochrome temperature flash, or a dual-color temperature flash. A dual-color temperature flash refers to a combination of a warm light flash and a cold light flash, which is used for light compensation at different color temperatures.

[0255] In some embodiments, the audio circuit 807 includes a microphone and a speaker. The microphone is used to collect sound waves from the user and the environment, and convert the sound waves into electrical signals and input them into the processor 801 for processing, or input them into the radio frequency circuit 804 to achieve voice communication. For the purpose of stereo acquisition or noise reduction, there are multiple microphones, which are respectively arranged at different parts of the terminal 800. Optionally, the microphone is an array microphone or an omnidirectional acquisition microphone. The speaker is used to convert the electrical signal from the processor 801 or the radio frequency circuit 804 into sound waves. Optionally, the speaker is a traditional film speaker, or a piezoelectric ceramic speaker. When the speaker is a piezoelectric ceramic speaker, it can not only convert the electrical signal into sound waves audible to humans, but also convert the electrical signal into sound waves inaudible to humans for purposes such as ranging. In some embodiments, the audio circuit 807 also includes a headphone jack.

[0256] The power supply 808 is used to power various components in the terminal 800. Optionally, the power supply 808 is an alternating current, a direct current, a disposable battery, or a rechargeable battery. When the power supply 808 includes a rechargeable battery, the rechargeable battery supports wired charging or wireless charging. The rechargeable battery is also used to support fast charging technology.

[0257] In some embodiments, the terminal 800 further includes one or more sensors 810 . The one or more sensors 810 include, but are not limited to: an acceleration sensor 811 , a gyroscope sensor 812 , a pressure sensor 813 , an optical sensor 814 , and a proximity sensor 815 .

[0258] In some embodiments, the acceleration sensor 811 detects the magnitude of acceleration on the three coordinate axes of the coordinate system established by the terminal 800. For example, the acceleration sensor 811 is used to detect the components of gravity acceleration on the three coordinate axes. Optionally, the processor 801 controls the display screen 805 to display the user interface in a horizontal view or a vertical view according to the gravity acceleration signal collected by the acceleration sensor 811. The acceleration sensor 811 is also used to collect motion data of games or users.

[0259] In some embodiments, the gyroscope sensor 812 detects the body direction and rotation angle of the terminal 800, and the gyroscope sensor 812 cooperates with the acceleration sensor 811 to collect the user's 3D actions on the terminal 800. The processor 801 implements the following functions based on the data collected by the gyroscope sensor 812: motion sensing (such as changing the UI according to the user's tilt operation), image stabilization during shooting, game control, and inertial navigation.

[0260] Optionally, the pressure sensor 813 is arranged on the side frame of the terminal 800 and / or the lower layer of the display screen 805. When the pressure sensor 813 is arranged on the side frame of the terminal 800, it can detect the user's holding signal of the terminal 800, and the processor 801 performs left and right hand recognition or shortcut operation according to the holding signal collected by the pressure sensor 813. When the pressure sensor 813 is arranged on the lower layer of the display screen 805, the processor 801 controls the operability controls on the UI interface according to the user's pressure operation on the display screen 805. The operability controls include at least one of a button control, a scroll bar control, an icon control, and a menu control.

[0261] The optical sensor 814 is used to collect the ambient light intensity. In one embodiment, the processor 801 controls the display brightness of the display screen 805 according to the ambient light intensity collected by the optical sensor 814. Specifically, when the ambient light intensity is high, the display brightness of the display screen 805 is increased; when the ambient light intensity is low, the display brightness of the display screen 805 is decreased. In another embodiment, the processor 801 also dynamically adjusts the shooting parameters of the camera assembly 806 according to the ambient light intensity collected by the optical sensor 814.

[0262] The proximity sensor 815, also called a distance sensor, is usually arranged on the front panel of the terminal 800. The proximity sensor 815 is used to collect the distance between the user and the front of the terminal 800. In one embodiment, when the proximity sensor 815 detects that the distance between the user and the front of the terminal 800 is gradually decreasing, the processor 801 controls the display screen 805 to switch from the screen-on state to the screen-off state; when the proximity sensor 815 detects that the distance between the user and the front of the terminal 800 is gradually increasing, the processor 801 controls the display screen 805 to switch from the screen-off state to the screen-on state.

[0263] Those skilled in the art will understand that Figure 8 The structure shown in the figure does not constitute a limitation on the terminal 800, and the terminal 800 may include more or less components than those shown in the figure, or combine some components, or adopt a different component arrangement.

[0264] Fig. 9It is a structural diagram of an electronic device provided in an embodiment of the present application. The electronic device 900 may have relatively large differences due to different configurations or performances. The electronic device 900 includes one or more processors (Central Processing Units, CPU) 901 and one or more memories 902, wherein the memory 902 stores at least one computer program, and the at least one computer program is loaded and executed by the one or more processors 901 to implement the image processing methods provided in the above-mentioned embodiments. Optionally, the electronic device 900 also has components such as a wired or wireless network interface, a keyboard, and an input and output interface for input and output. The electronic device 900 also includes other components for realizing device functions, which are not described here.

[0265] In an exemplary embodiment, a computer-readable storage medium is also provided, such as a memory including at least one computer program, and the at least one computer program can be executed by a processor in a terminal to complete the image processing method in each of the above embodiments. For example, the computer-readable storage medium includes ROM (Read-Only Memory), RAM (Random-Access Memory), CD-ROM (Compact Disc Read-Only Memory), magnetic tape, floppy disk, and optical data storage device.

[0266] In an exemplary embodiment, a computer program product or a computer program is also provided, including one or more program codes, which are stored in a computer-readable storage medium. One or more processors of an electronic device can read the one or more program codes from the computer-readable storage medium, and the one or more processors execute the one or more program codes, so that the electronic device can execute to complete the image processing method in the above embodiment.

[0267] A person of ordinary skill in the art will understand that all or part of the steps to implement the above embodiments can be completed by hardware, or can be completed by instructing related hardware through a program. Optionally, the program is stored in a computer-readable storage medium. Optionally, the above-mentioned storage medium is a read-only memory, a disk or an optical disk, etc.

[0268] The above description is only an optional embodiment of the present application and is not intended to limit the present application. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of the present application shall be included in the protection scope of the present application.

Claims

1. An image processing method, characterized in that: The method comprises: acquiring at least one original image associated with the content item; Identifying a first area in the at least one original image, where the first area refers to an area in the original image that does not require color change; In the at least one original image, assigning pixel points in the first area to target pixel values ​​to obtain at least one first image; Recognize and obtain at least one main color tone based on the at least one first image, where the main color tone represents a color distribution tendency of pixels in the at least one first image; Converting the at least one first image from a red-green-blue (RGB) color space to a hue-saturation-value (HSV) color space; For any main color, in the HSV color space, the saturation S and brightness V of the main color are kept unchanged, and the hue H of the main color is modified to obtain a color-changing hue corresponding to the main color; Based on the main color tone mapping relationship between the main color tone and the color change color tone, a color mapping relationship at the pixel level is determined, wherein the color mapping relationship represents the corresponding relationship between different pixel values ​​before and after the color change; Based on the color mapping relationship, mapping pixel values ​​of pixels in the at least one first image to obtain at least one second image; In the at least one second image, pixel points located in the first area are assigned pixel values ​​of pixel points at corresponding positions in the corresponding original image, so as to obtain at least one target image, wherein the target image is the original image after the color of the first area is kept unchanged and the color of the second area is changed, and the second area is the area of ​​the original image excluding the first area; The step of modifying the hue H of the main hue to obtain a color-changing hue corresponding to the main hue includes: Adding the product of the serial number of the color matching scheme and the scheme parameter to the hue H, wherein the scheme parameter is the ratio of 360 to N+1, and N is the number of the color matching schemes; The added sum is modulo 360 to obtain the color change hue corresponding to the main hue.

2. The method according to claim 1, characterized in that The identifying of a first area in the at least one original image, wherein the first area refers to an area in the original image that does not require color change, includes: Performing target detection on any original image to obtain a candidate region in the original image; Inputting the candidate area into a color change classification model, and outputting a color change detection result through the color change classification model, wherein the color change classification model is used to detect whether the candidate area needs to be changed in color; The candidate region indicated by the color change detection result as not needing color change is determined as the first region.

3. The method according to claim 2, characterized in that The target detection is performed on any original image to obtain the candidate region in the original image, which includes: Rectangle detection is performed on the original image, and the detected rectangular area is determined as the candidate area.

4. The method according to claim 1, characterized in that: The identifying of a first area in the at least one original image, wherein the first area refers to an area in the original image that does not require color change, includes: Performing object recognition on any original image to obtain an object recognition result, wherein the object recognition result indicates whether the original image contains a target object; When the object recognition result indicates that the original image contains a target object, the area where the target object is located is determined as the first area.

5. The method according to claim 4, characterized in that The determining the area where the target object is located as the first area comprises: Performing object segmentation on the original image to obtain a mask image for identifying the target object; Based on the mask image, the first area where the target object is located is determined.

6. The method according to claim 1, characterized in that The obtaining of at least one main color tone based on the at least one first image recognition comprises: Stitching the at least one first image to obtain a stitched image; Clustering the pixels in the stitched image based on the color vectors of the pixels to obtain at least one color cluster; A cluster center of the at least one color cluster is determined as the at least one main hue.

7. The method according to claim 1, characterized in that The hue difference between any two primary hues is equal to the hue difference between the corresponding two alternating hues.

8. The method according to claim 1, characterized in that The method further comprises: Determine a white area in the at least one original image, wherein a difference between a pixel value of a pixel point in the white area and a white value is less than a target threshold; In the at least one second image, pixel points located in the white area are assigned pixel values ​​of pixel points at corresponding positions in the corresponding original image.

9. An image processing device, characterized in that: The device comprises: An acquisition module, configured to acquire at least one original image associated with a content item; An identification module, used for identifying a first area in the at least one original image, where the first area refers to an area in the original image that does not need to change color; The mapping module includes an assignment unit, which is used to assign pixel points in the first area to target pixel values ​​in the at least one original image to obtain at least one first image; The mapping module includes a second recognition unit, which is used to obtain at least one main color tone based on the at least one first image recognition, and the main color tone represents the color distribution tendency of the pixel points in the at least one first image; The mapping module comprises a mapping unit, configured to convert the at least one first image from a red-green-blue (RGB) color space to a hue-saturation-value (HSV) color space; The mapping unit is further used for modifying the hue H of any main hue in the HSV color space while keeping the saturation S and brightness V of the main hue unchanged, so as to obtain a color-changing hue corresponding to the main hue; The mapping unit is further used to determine a color mapping relationship at the pixel level based on a main color tone mapping relationship between the main color tone and the color change color tone, wherein the color mapping relationship represents a corresponding relationship between different pixel values ​​before and after the color change; The mapping unit is further configured to map pixel values ​​of pixels in the at least one first image based on the color mapping relationship to obtain at least one second image; The assignment unit is further used to assign, in the at least one second image, pixel points located in the first area to pixel values ​​of pixel points at corresponding positions in the corresponding original image, so as to obtain at least one target image, wherein the target image is the original image after the color of the first area is kept unchanged and the color of the second area is changed, and the second area is the area of ​​the original image excluding the first area; The step of modifying the hue H of the main hue to obtain a color-changing hue corresponding to the main hue includes: Adding the product of the serial number of the color matching scheme and the scheme parameter to the hue H, wherein the scheme parameter is the ratio of 360 to N+1, and N is the number of the color matching schemes; The added sum is modulo 360 to obtain the color change hue corresponding to the main hue.

10. The device according to claim 9, characterized in that The identifying of a first area in the at least one original image, wherein the first area refers to an area in the original image that does not require color change, includes: Performing target detection on any original image to obtain a candidate region in the original image; Inputting the candidate area into a color change classification model, and outputting a color change detection result through the color change classification model, wherein the color change classification model is used to detect whether the candidate area needs to be changed in color; The candidate region indicated by the color change detection result as not needing color change is determined as the first region.

11. The device according to claim 10, characterized in that The target detection is performed on any original image to obtain the candidate region in the original image, which includes: Rectangle detection is performed on the original image, and the detected rectangular area is determined as the candidate area.

12. The device according to claim 9, characterized in that The identifying of a first area in the at least one original image, wherein the first area refers to an area in the original image that does not require color change, includes: Performing object recognition on any original image to obtain an object recognition result, wherein the object recognition result indicates whether the original image contains a target object; When the object recognition result indicates that the original image contains a target object, the area where the target object is located is determined as the first area.

13. The device according to claim 12, characterized in that The determining the area where the target object is located as the first area comprises: Performing object segmentation on the original image to obtain a mask image for identifying the target object; Based on the mask image, the first area where the target object is located is determined.

14. The device according to claim 9, characterized in that The obtaining of at least one main color tone based on the at least one first image recognition comprises: Stitching the at least one first image to obtain a stitched image; Clustering the pixels in the stitched image based on the color vectors of the pixels to obtain at least one color cluster; A cluster center of the at least one color cluster is determined as the at least one main hue.

15. The device according to claim 9, characterized in that The hue difference between any two primary hues is equal to the hue difference between the corresponding two alternating hues.

16. The device according to claim 9, characterized in that The device also includes: Determine a white area in the at least one original image, wherein a difference between a pixel value of a pixel point in the white area and a white value is less than a target threshold; In the at least one second image, pixel points located in the white area are assigned pixel values ​​of pixel points at corresponding positions in the corresponding original image.

17. An electronic device, characterized in that: The electronic device includes one or more processors and one or more memories, wherein at least one computer program is stored in the one or more memories, and the at least one computer program is loaded and executed by the one or more processors to implement the image processing method according to any one of claims 1 to 8.

18. A storage medium, characterized in that: The storage medium stores at least one computer program, and the at least one computer program is loaded and executed by the processor to implement the image processing method according to any one of claims 1 to 8.

19. A computer program product, characterized in that The computer program product comprises at least one computer program, and the at least one computer program is loaded and executed by a processor to implement the image processing method according to any one of claims 1 to 8.