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

By using color histograms and structural similarity in image processing to extract image features, the problem of low image processing efficiency in the existing technology is solved and efficient similar image search is achieved.

CN118570499APending Publication Date: 2024-08-30GUANGZHOU BOGUAN TELECOMM TECH LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202410670993.7
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-05-27
Publication Date
2024-08-30

AI Technical Summary

Technical Problem

Similar image search methods used by existing deep learning models for image processing require a large amount of training data and high computing resources, resulting in low image processing efficiency.

Method used

By obtaining the pixel information of the image to be processed in the target color space, constructing a color histogram, extracting color features, and combining structural similarity to achieve accurate image search.

Benefits of technology

It reduces the cost of similar image search, improves image processing efficiency, and achieves accurate similar image search.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118570499A
    Figure CN118570499A
Patent Text Reader

Abstract

The embodiment of the invention discloses an image processing method and device, a computer readable storage medium and electronic equipment. The method comprises the following steps: acquiring first pixel information of a pixel point of a to-be-processed image in a target color space; constructing a color histogram of the to-be-processed image according to the first pixel information; processing the color histogram based on a corresponding relation between the color histogram and the image region to obtain a first color feature of the to-be-processed image; acquiring second pixel information and second color features of the candidate image in the target color space; calculating the color similarity between the to-be-processed image and the candidate image based on the first color feature and the second color feature; calculating the structural similarity between the to-be-processed image and the candidate image according to the first pixel information and the second pixel information; and based on the color similarity and the structure similarity, determining a target image similar to the to-be-processed image in the candidate images. In this way, accurate searching of similar images is achieved with low cost, and the image processing efficiency is improved.
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, computer-readable storage medium and electronic device. Background Art

[0002] With the rapid development of computers, similar image search technology is being used more and more widely. Similar image search technology is a technology that uses computer vision and machine learning algorithms to analyze the visual features and content of images to find other images similar to a specified image. In existing image processing methods, deep learning models such as convolutional neural networks are often used to extract features from images, thereby identifying similar images based on the similarity between the extracted image features.

[0003] In the process of research and practice of existing technologies, it was found that the existing image processing methods that use deep learning models to characterize images require a large amount of training data and high computing resources, and the cost of searching for similar images is high, which makes the image processing efficiency poor. Summary of the invention

[0004] The embodiments of the present application provide an image processing method, apparatus, computer-readable storage medium, and electronic device, which can achieve accurate search for similar images at a relatively low cost, thereby improving image processing efficiency.

[0005] The present application provides an image processing method, including:

[0006] Obtain the first pixel information of each pixel of the image to be processed in the target color space;

[0007] constructing at least one color histogram of the image to be processed according to the first pixel information, each color histogram corresponding to at least a partial image area of ​​the image to be processed;

[0008] Based on the correspondence between the color histogram and the image area, determining the processing logic of the color histogram, and processing the color histogram based on the processing logic to obtain a first color feature of the image to be processed;

[0009] Acquire second pixel information and second color features of the candidate image in the target color space;

[0010] Calculating the color similarity between the image to be processed and the candidate image based on the first color feature and the second color feature;

[0011] Calculating the structural similarity between the image to be processed and the candidate image according to the first pixel information and the second pixel information;

[0012] Based on the color similarity and the structural similarity, a target image similar to the image to be processed is determined from among the candidate images.

[0013] Accordingly, an embodiment of the present application provides an image processing device, including:

[0014] A first acquisition unit, used to acquire first pixel information of each pixel of the image to be processed in the target color space;

[0015] A construction unit, configured to construct at least one color histogram of the image to be processed according to the first pixel information, each color histogram corresponding to at least a partial image area of ​​the image to be processed;

[0016] A feature extraction unit, configured to determine a processing logic for the color histogram based on a correspondence between the color histogram and the image region, and process the color histogram based on the processing logic to obtain a first color feature of the image to be processed;

[0017] A second acquisition unit, used to acquire second pixel information and second color features of the candidate image in the target color space;

[0018] A first calculation unit, configured to calculate a color similarity between the image to be processed and the candidate image based on the first color feature and the second color feature;

[0019] A second calculation unit, configured to calculate a structural similarity between the image to be processed and the candidate image according to the first pixel information and the second pixel information;

[0020] A determination unit is used to determine a target image similar to the image to be processed from the candidate images based on the color similarity and the structural similarity.

[0021] In addition, an embodiment of the present application further provides a computer-readable storage medium, which stores a computer program, and the computer program is suitable for loading by a processor to execute the steps in any image processing method provided in the embodiment of the present application.

[0022] In addition, the embodiment of the present application further provides an image processing system, which includes an image input module, a search parameter setting module, an image feature extraction module, a data storage module, a similarity calculation module, an image retrieval module, and a search result display module, including:

[0023] The image input module obtains the image to be processed input by the user;

[0024] The search parameter setting module obtains the search parameters corresponding to the image to be processed;

[0025] The image feature extraction module obtains first pixel information of each pixel of the image to be processed in the target color space, constructs at least one color histogram of the image to be processed according to the first pixel information, and extracts a first color feature of the image to be processed;

[0026] The data storage module obtains second pixel information and second color features of the candidate image in the target color space;

[0027] The similarity calculation module calculates the color similarity between the image to be processed and the candidate image based on the first color feature and the second color feature, calculates the structural similarity between the image to be processed and the candidate image according to the first pixel information and the second pixel information, and calculates the target similarity between the candidate image and the image to be processed based on the color similarity and the structural similarity;

[0028] The image retrieval module selects a target image similar to the image to be processed from the candidate images based on the search parameters corresponding to the image to be processed and the target similarity;

[0029] The search result display module displays the search results of the image to be processed based on the search parameters, and the search results include the target image and the target similarity corresponding to the target image.

[0030] In addition, an embodiment of the present application also provides an electronic device, including a processor and a memory, wherein the memory stores an application program, and the processor is used to run the application program in the memory to implement the image processing method provided in the embodiment of the present application.

[0031] An embodiment of the present application also provides a computer program product, which includes a computer program, and the computer program is stored in a computer-readable storage medium; when a processor of an electronic device reads the computer program from the computer-readable storage medium, the processor executes the computer program, so that the electronic device performs the steps in the image processing method provided in the embodiment of the present application.

[0032] The embodiment of the present application obtains the first pixel information of each pixel point of the image to be processed in the target color space; constructs at least one color histogram of the image to be processed according to the first pixel information, and each color histogram corresponds to at least a part of the image area of ​​the image to be processed; determines the processing logic of the color histogram based on the correspondence between the color histogram and the image area, and processes the color histogram based on the processing logic to obtain the first color feature of the image to be processed; obtains the second pixel information and the second color feature of the candidate image in the target color space; calculates the color similarity between the image to be processed and the candidate image based on the first color feature and the second color feature; calculates the structural similarity between the image to be processed and the candidate image based on the first pixel information and the second pixel information; and determines a target image similar to the image to be processed in the candidate image based on the color similarity and the structural similarity. In this way, by constructing at least one color histogram of the image to be processed, the first color feature of the image to be processed is extracted from the color histogram according to the correspondence between the color histogram and the image area of ​​the image to be processed, and then the color similarity between the image to be processed and the candidate image is calculated according to the first color feature and the first color feature of the candidate image, and the structural similarity between the image to be processed and the candidate image is calculated, so that according to the color similarity and the structural similarity, a target image similar to the image to be processed is determined in the candidate image, so that the color histogram is used to characterize the image, and the similarity between images is measured in combination with the color similarity and the structural similarity, so that accurate search for similar images at a lower cost can be achieved, thereby improving image processing efficiency. BRIEF DESCRIPTION OF THE DRAWINGS

[0033] 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 those skilled in the art, other drawings can be obtained based on these drawings without creative work.

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

[0035] Figure 2 It is a flowchart of an image processing method provided in an embodiment of the present application;

[0036] Figure 3 is a schematic diagram of an image search interface of an image processing method provided in an embodiment of the present application;

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

[0038] Figure 5 is a schematic diagram of the framework of the image processing system provided in an embodiment of the present application;

[0039] Figure 6 It is a schematic diagram of the structure of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION

[0040] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by those skilled in the art without creative work are within the scope of protection of this application.

[0041] The embodiments of the present application provide an image processing method, device, computer-readable storage medium and electronic device. The image processing device can be integrated in an electronic device, which can be a server or a terminal.

[0042] Among them, the server can be an independent physical server, or a server cluster or distributed system composed of multiple physical servers, or a cloud server that provides cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, network acceleration services (Content Delivery Network, CDN), and basic cloud computing services such as big data and artificial intelligence platforms. Terminals may include but are not limited to mobile phones, computers, intelligent voice interaction devices, smart home appliances, vehicle-mounted terminals, aircraft, etc. Terminals and servers can be directly or indirectly connected via wired or wireless communications, and this application does not limit this.

[0043] See also Figure 1 , taking the image processing device integrated into an electronic device as an example, Figure 1A schematic diagram of an implementation scenario of the image processing method provided in an embodiment of the present application, wherein the electronic device can be a terminal or a server, and the electronic device can obtain first pixel information of each pixel point of the image to be processed in the target color space; construct at least one color histogram of the image to be processed according to the first pixel information, and each color histogram corresponds to at least a part of the image area of ​​the image to be processed; based on the correspondence between the color histogram and the image area, determine the processing logic of the color histogram, and process the color histogram based on the processing logic to obtain the first color feature of the image to be processed; obtain second pixel information and second color feature of the candidate image in the target color space; based on the first color feature and the second color feature, calculate the color similarity between the image to be processed and the candidate image; based on the first pixel information and the second pixel information, calculate the structural similarity between the image to be processed and the candidate image; based on the color similarity and the structural similarity, determine a target image similar to the image to be processed in the candidate image.

[0044] It should be noted that Figure 1 The implementation environment scenario diagram of the image processing method shown is only an example. The implementation environment scenario of the image processing method described in the embodiment of the present application is to more clearly illustrate the technical solution of the embodiment of the present application, and does not constitute a limitation on the technical solution provided by the embodiment of the present application. It is known to those skilled in the art that with the evolution of data processing and the emergence of new business scenarios, the technical solution provided by the present application is also applicable to similar technical problems.

[0045] The solutions provided by the embodiments of the present application are specifically described by the following embodiments. It should be noted that the description order of the following embodiments is not intended to limit the preferred order of the embodiments.

[0046] This embodiment will be described from the perspective of an image processing device. The image processing device may be integrated into an electronic device. The electronic device may be a terminal and / or a server, and this application does not limit this.

[0047] See also Figure 2 , Figure 2 : is a flow chart of an image processing method provided in an embodiment of the present application. The image processing method comprises:

[0048] In step 101, first pixel information of each pixel of the image to be processed in the target color space is obtained.

[0049] Wherein, the image to be processed may be an image to be searched for similar images, the first pixel information may be pixel information of a pixel in the image to be processed, the pixel information may be a pixel value of a pixel in the image under a target color space, and the target color space may be a CIELab color space. The CIELab color space may be composed of three parts: brightness (L) and two color channels (a and b), wherein the brightness L represents the lightness of the color, and a and b represent the chromaticity of the color, wherein a represents from green to red, and b represents from blue to yellow. The CIELab color space is closer to the perception of human vision, can better simulate the perception of color differences by the human eye, and is more suitable for the analysis of color features, thereby being helpful in better extracting color information that conforms to the visual perception of the human eye and improving the accuracy of image feature extraction.

[0050] When the image to be processed is an image in RGB (a color space) format, the image to be processed can be converted from the RGB color space to the CIELab color space, thereby obtaining the image to be processed in the CIELab format.

[0051] There are many ways to convert the image to be processed from the RGB color space to the CIELab color space. For example, the relevant functions in the image processing library (such as OpenCV) can be used to convert the image to be processed from the RGB color space to the CIELab color space, so that the image to be processed in the target color space can be converted into a numerical matrix. In this numerical matrix, each row represents a pixel point, and each column represents the value of a pixel point in each color channel (L, a, b). Therefore, each pixel point is composed of three numerical values, so that the pixel value of the pixel point of the image to be processed in the target color space can be obtained, that is, the first pixel information.

[0052] In step 102, at least one color histogram of the image to be processed is constructed according to the first pixel information.

[0053] Each color histogram may correspond to at least a portion of the image area to be processed. The color histogram may describe the proportion of different colors in the entire image, and may be a method of characterizing an image, which captures the color information of the image while ignoring the spatial information, making them very suitable for application scenarios that do not require high spatial details of the image but need to consider color distribution differences.

[0054] Optionally, the color histogram can be a color histogram of the image to be processed in the target color space, that is, one image to be processed corresponds to one color histogram. Furthermore, the color histogram can also be a color histogram corresponding to each color channel of the image to be processed in the target color space, that is, one image to be processed can correspond to color histograms under three color channels. In addition, the color histogram can also be a color histogram of a partial image area of ​​the image to be processed in the target color space, that is, one image area in the image to be processed corresponds to one color histogram, or one image area in the image to be processed corresponds to a color histogram under each color channel, etc.

[0055] Among them, there may be multiple ways to construct at least one color histogram of the image to be processed based on the first pixel information. For example, when the color histogram corresponds to the entire area of ​​the image to be processed, the second color interval of each color channel in the target color space can be determined, and based on the first pixel information, the pixel points in the image to be processed that match each second color interval are counted to obtain the number of second pixel points matching each second color interval, and the color histogram of the image to be processed is determined based on the second color interval and the number of second pixel points.

[0056] Among them, the color channels under the target color space may include an L channel, an a channel and a b channel, the second color interval may be an interval of channel values ​​under each color channel, the second number of pixels may be the number of pixels matched by each second color interval, and when the pixel value of a pixel point in each color channel falls within the range of a second color interval in the corresponding color channel, the second color interval may be considered to match the pixel point.

[0057] Among them, there can be many ways to determine the second color interval of each color channel in the target color space. For example, it can be determined how many color intervals each color channel (L, a, b) will be divided into. For example, each color channel can be divided into 5 color intervals, or it can be divided into 10, 15 color intervals, etc. The specific number of intervals can be set according to actual needs, and the embodiment of the present application is not limited here. Then, the value range of each color channel can be calculated and divided by the number of intervals to determine the width of each second color interval. For example, since the value range of the L channel is 0-100, when it is divided into 5 color intervals, the 5 second color intervals can be obtained, namely [0-20], [21-40], [41-60], [61-80] and [81-100]. For the a channel and the b channel, since their value range is -128 to 127, the a and b channels can be divided into 5 second color intervals: [-128, -78], [-77, -27], [-26, 24], [25, 75] and [76, 127].

[0058] After determining the second color interval of each color channel in the target color space, the pixel points in the image to be processed that match the second color intervals can be counted based on the first pixel information to obtain the number of second pixel points that match the second color intervals. There can be multiple ways to count the pixel points in the image to be processed that match the second color intervals based on the first pixel information to obtain the number of second pixel points that match the second color intervals. For example, the pixel value of the pixel point of the image to be processed in each color channel can be determined based on the first pixel information, so that the value of each pixel point in the image to be processed in each color channel can be compared with each second color interval of the corresponding color channel to obtain the pixel points that fall in each second color interval, so that the number of second pixel points that match each second color interval can be counted. For example, assuming that there are pixels (18, -100, 111), pixels (25, 88, 112), pixels (36, 20, 90), and pixels (90, 44, 120) in the image to be processed in the target color space, among which, among the three pixel values ​​of the pixel points, the first value represents the value of the pixel value of the pixel point in the L channel, the second value represents the value of the pixel value of the pixel point in the a channel, and the third value represents the value of the pixel value of the pixel point in the b channel. At the same time, it can be assumed that the L, a, and b color channels are all divided into five second color intervals, so that it can be counted that in the L color channel, the first second color interval [0-20 ] has a matching pixel point, namely, pixel point (18, 100, 111); the second color interval [21-40] has two matching pixels points, namely, pixel point (25, 88, 112) and pixel point (36, 20, 90); the second color interval [41-60] has 0 matching pixels points; the second color interval [61-80] has 0 matching pixels points; the second color interval [81-100] has 1 matching pixel point, namely, pixel point (90, 44, 120); thus, the number of second pixels points in each second color interval under the L channel can be counted; similarly, the number of second pixels points in each second color interval under the a channel and the b channel can be counted.

[0059] In a specific embodiment, a histogram array with a length equal to the number of intervals can be created for each color channel, and the initial value of each element can be set to 0. Each pixel in the image to be processed in the target color space is traversed, the CIELab value of the pixel is read, and it is determined in which second color interval of the corresponding color channel the pixel value of the pixel in each color channel falls. Then, the interval index of the corresponding color channel is increased by 1, so that the number of occurrences of the pixel in the image to be processed in the second color interval can be accumulated in the histogram, and the number of second pixels corresponding to each second color interval in each color channel can be obtained. For example, assuming that there are pixels (18, -100, 111), pixels (25, 88, 112), pixels (36, 20, 90) and pixels (90, 44, 120) in the image to be processed in the target color space, assuming that the L, a, and b color channels are all divided into five second color intervals, it can be counted that in the L color channel, there is a pixel matching the first second color interval [0-20], that is, the pixel (18, 10 0, 111), there are two matching pixels in the second color interval [21-40], namely, pixel (25, 88, 112) and pixel (36, 20, 90), there are 0 matching pixels in the second color interval [41-60], there are 0 matching pixels in the second color interval [61-80], and there is 1 matching pixel in the second color interval [81-100], namely, pixel (90, 44, 120). Based on this, we can The number of second pixels matching each second color interval of the L color channel is used to determine the color histogram corresponding to the L color channel, wherein the second color interval is the horizontal axis and the number of second pixels is the vertical axis. Similarly, the number of second pixels corresponding to the a color channel in the second color intervals [-128, -78], [-77, -27], [-26, 24], [25, 75] and [76, 127] can be determined to be 1, 0, 1, 1 and 1, respectively. Therefore, the color histogram corresponding to the a color channel of the image to be processed can be constructed based on the number of second pixels matching the a color channel in each second color interval. Similarly, the number of second pixels of the b color channel in each second color interval can be counted. Therefore, the color histogram corresponding to the b color channel of the image to be processed can be constructed based on the number of second pixels matching the b color channel in each second color interval. In this way, the color histogram of the image to be processed under the three color channels of L, a and b can be constructed.

[0060] Optionally, for the process of constructing a color histogram of the image to be processed based on the first pixel information, at least one color histogram of the image to be processed may be constructed based on the first pixel information, or the first pixel information may be processed in the form of constructing a color histogram without constructing a color histogram in a physical form.

[0061] Optionally, there may be multiple ways to construct at least one color histogram of the image to be processed based on the first pixel information. For example, the image to be processed may be divided into multiple image regions, multiple first color intervals of each color channel in the target color space may be determined, and based on the first pixel information, the pixel points in the image region under each color channel that match the first color intervals may be counted to obtain the number of first pixel points that match the image region in each color interval, and based on the first color interval under each color channel and the corresponding number of first pixel points, the color histogram of the image region under each color channel may be determined.

[0062] The image area may be a portion of the area divided in the image to be processed, the first color interval may be an interval of channel values ​​under each color channel, and optionally, the range of the first color interval may be the same as or different from the range of the second color interval, which may be set according to actual needs. The first number of pixels may be the number of pixels matched by each first color interval, and when the pixel value of a pixel falls within the range of a first color interval in the corresponding color channel in the value of each color channel, the first color interval may be considered to match the pixel.

[0063] In this way, by dividing the image to be processed into multiple image regions, a color histogram of each image region in each color channel is constructed, and the image to be processed is characterized based on these color histograms, which can more accurately characterize the image to be processed, thereby improving the accuracy of image feature extraction.

[0064] There are many ways to divide the image to be processed into multiple image areas. For example, a sliding window algorithm can be used to divide the image to be processed into multiple image areas. For example, the window size can be defined, for example, 5x5 pixels, so that the defined window can be started from the upper left corner of the image to be processed and slid to the lower right corner of the image in the order of rows and columns, covering the entire image to be processed, thereby dividing the image into multiple image areas.

[0065] Among them, there can be many ways to divide the image to be processed into multiple image areas. For example, the image area may include a first image area and a second image area, so that the foreground image and the background image can be identified in the image to be processed, the foreground image is divided into areas to obtain multiple first image areas of the foreground image, and the background image is divided into areas to obtain multiple second image areas of the background image.

[0066] Among them, the first image area can be an image area divided out from the foreground image of the image to be processed, the second image area can be an image area divided out from the background image of the image to be processed, the foreground image can be an image in the foreground part of the image to be processed, and the background image can be an image in the background part of the image to be processed.

[0067] In this way, by dividing the image to be processed into multiple image areas in the background image and multiple image areas in the foreground image, color histograms of each image area in the foreground image and each image area in the background image in each color channel are constructed, and the image to be processed is characterized based on these color histograms. The image content of the image to be processed can be distinguished into a foreground part and a background part, so that the image to be processed can be more accurately characterized by the foreground part and the color histogram and the color histogram of the background part, avoiding interference between the foreground and the background, thereby improving the accuracy of image feature extraction.

[0068] Optionally, the color histogram may include a color histogram of each color channel of the image to be processed in the target color space, and a color histogram of each color channel of each image region in the image to be processed in the target color space. Thus, by dividing the image to be processed into a plurality of image regions, a color histogram of each image region in each color channel and a color histogram of the entire region of the image to be processed in each color channel are constructed, and the image to be processed is characterized based on these color histograms, which may include global color information and local color information of the image to be processed, so that the image to be processed can be more accurately characterized based on the global color information and the local color information, thereby improving the accuracy of image feature extraction.

[0069] In step 103, based on the correspondence between the color histogram and the image area, a processing logic for the color histogram is determined, and the color histogram is processed based on the processing logic to obtain a first color feature of the image to be processed.

[0070] The processing logic may be logic for processing a color histogram, and is used to extract color features of the image to be processed. The first color feature may be a color feature of the image to be processed, and the color feature may be information characterizing color distribution of the image to be processed.

[0071] Among them, based on the correspondence between the color histogram and the image area, the processing logic of the color histogram is determined, and the color histogram is processed based on the processing logic. There are many ways to obtain the first color feature of the image to be processed. For example, if the correspondence between the color histogram and the image area is that the color histogram corresponds to the entire image area of ​​the image to be processed, the color histogram is feature transformed to obtain the first color feature of the image to be processed.

[0072] There are many ways to perform feature conversion on the color histogram to obtain the first color feature of the image to be processed. For example, the number of pixels matching each color interval in each color histogram can be obtained, and based on the number of pixels matching each color interval, the color histogram of each color channel is converted into a vector, and then the vectors corresponding to each color channel are spliced ​​to obtain the first color feature of the image to be processed.

[0073] Specifically, the color histogram of each color channel can be converted into a vector. For example, if the L color channel has 5 color intervals, then the vector converted from its color histogram can be an array containing 5 elements. For example, assuming that in the color histogram of the L channel, the number of pixels matched in the first color interval is 0, the number of pixels matched in the second color interval is 2, the number of pixels matched in the third color interval is 1, the number of pixels matched in the fourth color interval is 1, and the number of pixels matched in the fifth color interval is 1, then the vector corresponding to the color histogram can be expressed as [0,2,1,1,1].

[0074] Next, the vectors of each color channel can be merged into a multidimensional array, which will be used as the first color feature of the image to be processed. For example, assuming that the vector of the L channel is [0,2,1,1,1], the vector of the a channel is [1,1,2,1,1], and the vector of the b channel is [0,1,3,1,1], then the merged first color feature can be a 15-dimensional array (because 5 color intervals * 3 color channels = 15), and the merged first color feature can be expressed as [0,2,1,1,1,1,1,2,1,1,0,1,3,1,1].

[0075] Optionally, based on the correspondence between the color histogram and the image area, a processing logic for the color histogram is determined, and the color histogram is processed based on the processing logic. There may be multiple ways to obtain the first color feature of the image to be processed. For example, there are multiple color histograms. If the correspondence between the color histogram and the image area is that the image areas corresponding to at least two color histograms are different, feature extraction is performed on the color histogram of each image area to obtain an initial color feature of each image area, processing is performed based on the initial color feature of each image area to obtain at least one key color feature in the image to be processed, and feature mapping is performed on the initial color feature based on the key color feature to obtain the first color feature of the image to be processed.

[0076] Among them, the initial color feature can be information that characterizes the color distribution of the image area, and the key color feature can be information that indicates the key color category in the image to be processed. The key color category can indicate the representative colors in the image to be processed. For example, it can be a color category such as red, blue, yellow, etc. of a certain color value. In this way, the first color feature obtained based on the key color feature characterizes the color distribution of the image to be processed, which can make the distinction between different colors in the image to be processed higher and the difference of the same color smaller, so that the representative colors in the image to be processed can be characterized.

[0077] There are many ways to extract features from the color histogram of each image area and obtain the initial color features of each image area. For example, the number of pixels matching each color interval in the color histogram of each image area can be obtained, and based on the number of pixels matching each color interval, the color histogram of each color channel is converted into a vector, and then the vectors corresponding to each color channel are spliced ​​to obtain the initial color features of each image area.

[0078] After extracting features from the color histogram of each image region and obtaining the initial color features of each image region, processing can be performed based on the initial color features of each image region to obtain at least one key color feature in the image to be processed. There are multiple ways to perform processing based on the initial color features of each image region to obtain at least one key color feature in the image to be processed. For example, the local sensitive mapping (LDA) technology can be used to perform processing based on the initial color features of each image region to obtain at least one key color feature in the image to be processed. The LDA technology is a statistical technology used for dimensionality reduction and classification analysis. It can find the best projection direction so that the data has the best category separability in the new feature space. Therefore, based on extracting the key color categories in the image to be processed by the LDA technology, the image can be accurately characterized.

[0079] Specifically, the intra-class scatter matrix of each image area can be calculated based on the initial color features and the number of pixels in the image area, and the inter-class scatter matrix of the image area can be calculated based on the initial color features and the number of image areas. Based on the intra-class scatter matrix and the inter-class scatter matrix, at least one key color feature in the image to be processed can be determined.

[0080] Among them, the number of pixels can be the number of pixels contained in the image area, the intra-class scatter matrix can be information describing the similarity of pixel values ​​of pixel points in the image area, the number of areas can be the number of image areas divided in the image to be processed, and the inter-class scatter matrix can be information describing the difference in pixel values ​​of pixel points between image areas.

[0081] There are many ways to calculate the intra-class scatter matrix of each image region based on the initial color features and the number of pixels in the image region. For example, the intra-class scatter matrix of each image region can be calculated using the following formula:

[0082]

[0083] Among them, S w It can be expressed as the intra-class scatter matrix of an image region, N can be expressed as the number of pixels contained in the image region, X i It can be expressed as the initial color feature of the i-th image region, It can represent all X i The mean vector of , that is, the mean of the initial color features of all image regions, T can be expressed as the transposed symbol.

[0084] There are many ways to calculate the inter-class scatter matrix of the image region based on the initial color features and the number of regions of the image region. For example, the inter-class scatter matrix between the image regions can be calculated using the following formula:

[0085]

[0086] Among them, S B It can be expressed as the inter-class divergence matrix between all image regions, M can be expressed as the number of image regions divided by the image to be processed, X k It can represent the initial color feature of the kth image region, π k It can represent the prior probability of the image area. It can represent the mean of the initial color features of all image regions, and T can be expressed as the transposed symbol.

[0087] Among them, there are many ways to determine at least one key color feature in the image to be processed based on the intra-class scatter matrix and the inter-class scatter matrix. For example, the eigenvector and the corresponding eigenvalue of the new feature space can be calculated first, and at least one target eigenvector can be determined in the eigenvector based on the eigenvalue, and at least one key color feature in the image to be processed can be determined based on the target eigenvector.

[0088] The new feature space may be a feature space determined by key color features, the feature vector may be a direction vector of the new feature space, the feature value may be a value corresponding to the feature vector, and the number of key color features may be set according to actual needs.

[0089] Among them, the following formula can be used to calculate the eigenvector and corresponding eigenvalue of the new feature space:

[0090] S w-1 S R ω=λω

[0091] Among them, ω can be expressed as the direction vector of the new feature space, and λ can be expressed as the eigenvalue corresponding to ω.

[0092] There are many ways to determine at least one target feature vector in a feature vector based on the eigenvalue. For example, the feature vectors can be sorted from large to small according to the eigenvalue, so that the top several feature vectors can be determined as target feature vectors according to the required number of target feature vectors.

[0093] There are many ways to determine at least one key color feature in the image to be processed based on the target feature vector. For example, the initial color feature of each image area can be projected into a new feature space composed of key color features. The first color feature after projection can be expressed as:

[0094] z=S w -1 / 2 S B 1 / 2 x

[0095] Wherein, z may represent the first color feature corresponding to the image to be processed, x may represent the initial color feature, and z may represent the first color feature obtained after projecting x into the new feature space.

[0096] Optionally, when the image area includes a first image area and a second image area, the step of identifying at least one key color category in the image to be processed based on the initial color features of each image area may include: identifying at least one first key color feature in the foreground image based on the first initial color features of each first image area, and identifying at least one second key color feature in the background image based on the second initial color features of each second image area.

[0097] Correspondingly, the step of performing feature mapping on the initial color features based on the key color categories to obtain the first color features of the image to be processed may include: performing feature mapping on the first initial color features based on the first key color features to obtain the foreground color features of the foreground image, performing feature mapping on the second initial color features based on the second key color features to obtain the background color features of the background image, and performing feature fusion on the foreground color features and the background color features to obtain the first color features of the image to be processed.

[0098] Among them, the first initial color feature may be the initial color feature corresponding to the first image area, the first key color feature may be the key color feature corresponding to the first image area, the second initial color feature may be the initial color feature corresponding to the second image area, and the second key color feature may be the key color feature corresponding to the first image area. The foreground color feature may be information representing the foreground image of the image to be processed based on the first key color feature, and may be used to indicate information with distinguishing and representative colors in the foreground image of the image to be processed. The background color feature may be information representing the background image of the image to be processed based on the second key color feature, and may be used to indicate information with representative colors in the background image of the image to be processed.

[0099] There are many ways to fuse the foreground color features and the background color features to obtain the first color features of the image to be processed. For example, the foreground color features and the background color features can be spliced ​​to obtain the first color features of the image to be processed. The weights of the foreground color features and the background color features can also be determined, and the foreground color features and the background color features can be weighted according to the weights. The weighted results can then be spliced ​​to obtain the first color features of the image to be processed.

[0100] In this way, by using the foreground color feature to characterize the foreground image in the image to be processed, the distinction between different colors in the foreground image can be higher, and the difference between the same color can be smaller, so that the key color in the foreground image can be characterized, thereby more accurately characterizing the foreground image. By using the background color feature to characterize the background image in the image to be processed, the distinction between different colors in the background image can be higher, and the difference between the same color can be smaller, so that the key color in the background image can be characterized, thereby more accurately characterizing the background image. By combining the foreground color feature and the background color feature, the representative and key colors in the image to be processed can be characterized, thereby improving the accuracy of image characterization.

[0101] In step 104, second pixel information and second color features of the candidate image in the target color space are obtained.

[0102] The candidate image may be a candidate image, and an image similar to the image to be processed may be searched in the candidate image. The second pixel information may be a pixel value of a pixel point of the candidate image in a target color space, and the second color feature may be information characterizing the color distribution of the candidate image, and the second color feature may be used to characterize the candidate image.

[0103] Among them, the method for extracting the second color feature can be the same as the method for extracting the first color feature, and the embodiment of the present application will not be repeated here.

[0104] In step 105, the color similarity between the image to be processed and the candidate image is calculated based on the first color feature and the second color feature.

[0105] The color similarity may be information for measuring the similarity in color distribution between the image to be processed and the candidate image.

[0106] Among them, based on the first color feature and the second color feature, there can be multiple ways to calculate the color similarity between the image to be processed and the candidate image. For example, the first distance norm corresponding to the first color feature and the second distance norm corresponding to the second color feature can be calculated, the first color feature is normalized based on the first distance norm to obtain the first target color feature, and the second color feature is normalized based on the second distance norm to obtain the second target color feature, and the cosine distance between the first target color feature and the second target color feature is calculated to obtain the color similarity between the image to be processed and the candidate image.

[0107] The first distance norm may be information indicating the length of the first color feature, the second distance norm may be information indicating the length of the second color feature, the first target color feature may be a feature obtained by normalizing the first color feature, and the second target color feature may be a feature obtained by normalizing the second color feature. Thus, by normalizing the first color feature and the second color feature, the first color feature and the second color feature may be standardized so that their lengths are 1, so as to eliminate the influence of the image size when comparing the similarities of different images, and improve the accuracy of similar image search.

[0108] Optionally, the Euclidean norm can be used to calculate the first distance norm corresponding to the first color feature and the second distance norm corresponding to the second color feature, so that the first color feature can be normalized based on the first distance norm to obtain the first target color feature, and the second color feature can be normalized based on the second distance norm to obtain the second target color feature.

[0109] For example, the calculation process of the first distance norm can be expressed as

[0110]

[0111] Among them, ||v||2 can be expressed as the first distance norm of the first color feature, which can also be called the Euclidean norm (i.e., L2 norm), v can represent a first color feature, V n It can be represented as the nth element in the first color feature, where n is the dimension of the first color feature.

[0112]

[0113] Among them, v normalized It can be expressed as the normalized result of the first color feature, that is, the first target color feature.

[0114] Optionally, the similarity between the color histogram of the first color feature and the color histogram of the second color feature can be calculated by a cross histogram method, so as to obtain the color similarity between the first color feature and the second color feature. Calculating the cross histogram can be to count the number of times the two color histograms appear together in each color interval, so that statistical parameters such as contrast and homogeneity can be extracted from the cross histogram. Contrast can be a statistical parameter for measuring the color contrast of two images, which can be calculated by comparing the frequencies of different color intervals in the color histogram. Homogeneity can be a statistical parameter for measuring the uniformity of the color distribution of the two images, which can be determined by counting the consistency of the color distribution in the color histogram.

[0115] In one embodiment, the color histogram of the image to be processed may include the color histogram of each color channel of the image to be processed in the target color space, and the color histogram of each color channel of each image region in the image to be processed in the target color space. At this time, the first color feature corresponding to each color histogram may be spliced ​​to obtain the first color feature corresponding to the image to be processed. In this way, based on the first color feature, the image to be processed may be comprehensively characterized in combination with the global color information and local color information of the image to be processed, thereby improving the accuracy of image representation and further improving the accuracy of similar image search.

[0116] In step 106, the structural similarity between the image to be processed and the candidate image is calculated based on the first pixel information and the second pixel information.

[0117] Among them, the structural similarity can be used to measure the structural similarity between the image to be processed and the candidate image. Since the color similarity can only represent the similarity of the images in color and ignores the similarity in structure, the structural similarity can be used to consider the local structural information of the image and evaluate the similarity of structural features such as edges, textures and shapes in the image. Therefore, based on color similarity and structural similarity, images similar to the image to be processed can be more accurately screened out from the candidate images, thereby improving the accuracy of similar image search.

[0118] There are multiple ways to calculate the structural similarity between the image to be processed and the candidate image based on the first pixel information and the second pixel information. For example, the structural similarity index can be used to calculate the structural similarity between the image to be processed and the candidate image. The structural similarity index (SSIM) can be an indicator to measure the similarity between two images. It takes into account the three dimensions of brightness, contrast and structure. In the actual calculation process, the color image will be converted into a grayscale image, so the color information will be lost and the spatial information will be retained. SSIM can provide a comprehensive similarity score that reflects the similarity of the image in visual structure. When calculating the structural similarity, the pixel values ​​of the pixels in the image to be processed and the candidate image are the grayscale values ​​in the grayscale state.

[0119] Specifically, the structural index information of the image to be processed and the candidate image in at least one structural comparison dimension can be calculated based on the first pixel information and the second pixel information; and the structural similarity between the image to be processed and the candidate image can be calculated based on the structural index information in each structural comparison dimension.

[0120] The structural comparison dimension may be a dimension for comparing the structure of an image, and the structural comparison dimension may include at least one dimension of brightness, contrast, and global image difference, the brightness may be information indicating the brightness of an image, the contrast may be information indicating the severity of the light and dark changes of an image, and the global image difference may be information indicating the structural information of an image. The structural index information may be index information used to measure the similarity between the image to be processed and the candidate image under the structural comparison dimension.

[0121] Among them, there can be multiple ways to calculate the structural indicator information of the image to be processed and the candidate image in at least one structural contrast dimension based on the first pixel information and the second pixel information. For example, assuming that the structural contrast dimension can include brightness, contrast and global image difference, the first pixel mean and the first pixel standard deviation of the pixel value of the image to be processed can be calculated based on the first pixel information, and the second pixel mean and the second pixel standard deviation of the pixel value of the candidate image can be calculated based on the second pixel information. According to the first pixel information and the second pixel information, the pixel covariance between the image to be processed and the candidate image is calculated.

[0122] Among them, the first pixel mean can be structural indicator information characterizing the brightness of the image to be processed, the first pixel standard deviation can be structural indicator information characterizing the contrast of the image to be processed, the second pixel mean can be structural indicator information characterizing the brightness of the candidate image, the second pixel standard deviation can be structural indicator information characterizing the contrast of the candidate image, and the pixel covariance can be structural indicator information measuring the global image difference between the image to be processed and the candidate image.

[0123] Among them, the calculation process of the first pixel mean can be expressed as

[0124]

[0125] Among them, μ x It can be expressed as the first pixel mean of the image to be processed, where N can be expressed as the number of pixels contained in the image to be processed, and X i can be the pixel value of the pixel point of the image to be processed. Similarly, the second pixel mean of the candidate image can be calculated as μ y .

[0126] The calculation process of the first pixel standard deviation can be expressed as

[0127]

[0128] Among them, σ x The first pixel standard deviation of the pixel value of the image to be processed is represented by , where N can be represented by the number of pixels contained in the image to be processed. Similarly, the second pixel standard deviation of the candidate image can be calculated as σ y .

[0129] The calculation process of the pixel covariance between the image to be processed and the candidate image can be expressed as

[0130]

[0131] Among them, σ xy It can be expressed as the pixel covariance between the pixel values ​​of the image to be processed and the candidate image, where N can be expressed as the number of pixels contained in the image to be processed and the candidate image.

[0132] After calculating the structural indicator information of the image to be processed and the candidate image in at least one structural comparison dimension according to the first pixel information and the second pixel information, the structural similarity between the image to be processed and the candidate image can be calculated based on the structural indicator information in each structural comparison dimension. There are many ways to calculate the structural similarity between the image to be processed and the candidate image based on the structural indicator information in each structural comparison dimension. For example, the structural similarity between the image to be processed and the candidate image can be calculated based on the first pixel mean, the second pixel mean, the first pixel standard deviation, the second pixel standard deviation and the pixel covariance. For example, the structural similarity between the image to be processed and the candidate image can be calculated using the following formula:

[0133]

[0134] Among them, SSIM(x, y) can be expressed as the structural similarity between the image to be processed and the candidate image, that is, the structural similarity index (SSIM), x can be expressed as the image to be processed, y can be expressed as the candidate image, c1 and c2 can be constants added to avoid the denominator being zero.

[0135] In step 107, based on the color similarity and the structural similarity, a target image similar to the image to be processed is determined from the candidate images.

[0136] The target image may be an image similar to the image to be processed.

[0137] Among them, based on color similarity and structural similarity, there are many ways to determine the target image similar to the image to be processed in the candidate images. For example, a first weight corresponding to the color similarity and a second weight corresponding to the structural similarity can be obtained, so that the color similarity can be weighted according to the first weight to obtain the weighted color similarity, and the structural similarity can be weighted according to the second weight to obtain the weighted structural similarity, and the weighted color similarity and the weighted structural similarity are summed to obtain the target similarity between the image to be processed and the candidate image. The target similarity can be information characterizing the degree of similarity between the image to be processed and the candidate image determined based on the color similarity and the structural similarity, so that the candidate image with the highest target similarity can be determined as the target image similar to the image to be processed. In this way, based on the color similarity and the structural similarity to measure the similarity between the image to be processed and the candidate image, the embodiment of the present application can accurately capture the color information and structural information of the image, and improve the accuracy of similar image retrieval.

[0138] Optionally, a target image similar to the image to be processed can be retrieved through an image retrieval tool, which can be a tool for searching similar images developed based on the image processing method provided in the embodiment of the present application. Specifically, through the image retrieval tool, an input image to be processed and search parameters for the image to be processed can be obtained, and the search parameters include an expected similarity, which is the similarity between the similar image to be searched and the image to be processed.

[0139] Among them, the search parameter can be a parameter determined by the user for adjusting the search results. For example, assuming that the user inputs an expected similarity of 0.8, indicating that the user hopes to search for images with a similarity greater than 0.8 with the image to be processed, the target image with a similarity greater than 0.8 with the image to be processed can be searched through the image retrieval tool. Suppose the user inputs an expected similarity of 0.7, indicating that the user hopes to search for images with a similarity greater than 0.7 with the image to be processed, the target image with a similarity greater than 0.7 with the image to be processed can be searched through the image retrieval tool. The expected similarity can be input by the user or selected by the user, and the specific input method is not limited in the embodiment of the present application.

[0140] Correspondingly, the step of determining a target image similar to the image to be processed from candidate images based on color similarity and structural similarity may include: calculating the target similarity between the candidate image and the image to be processed based on color similarity and structural similarity; screening out images whose target similarity is greater than an expected similarity from the candidate images as target images similar to the image to be processed; and displaying search results of the image to be processed based on search parameters, the search results including the target image and the target similarity corresponding to the target image, and the arrangement order of the target images in the search results is determined based on the target similarity.

[0141] Among them, the target similarity can be the similarity between the candidate image and the image to be processed determined based on color similarity and structural similarity. The search result can be the result obtained by the image retrieval tool searching for images similar to the image to be processed in the candidate images according to the search parameters. Optionally, the search results can be displayed in a list. In the search results, the higher the target similarity, the higher the ranking order of the corresponding target image in the search results, and the lower the target similarity, the lower the ranking order of the corresponding target image in the search results, so that the user can preferentially see the target image that is more similar to the image to be processed.

[0142] In one embodiment, please refer to Figure 3 , Figure 3It is a schematic diagram of an image search interface of an image processing method provided in an embodiment of the present application. An image retrieval tool developed based on the image processing method provided in an embodiment of the present application can provide an image search interface. The image search interface can include an image upload area for processing, an image preview area for processing, a similarity adjustment area, an image search result display area, and a target image preview area. Among them, the image to be processed upload area can be an area for uploading images to be processed, and the image to be processed for similar image search can be uploaded by dragging a file or clicking on the image to be processed upload area. The image to be processed preview area can be an area for previewing images to be processed. After uploading the image to be processed through the image to be processed upload area, the image to be processed can be displayed in the image to be processed preview area. The similarity adjustment area can be an area for adjusting the similarity, and the adjusted similarity is the similarity between the searched target image and the image to be processed. For example, when the similarity set in the similarity adjustment area is 0.8, the target image searched is an image with a similarity of 0.8 to the image to be processed. When the similarity set in the similarity adjustment area is 0.8-1, the target image searched is an image with a similarity greater than or equal to 0.8 to the image to be processed, etc. The image search result display area can be an area for displaying similar image search results. The search results of similar images can be displayed in the form of a list. The list can include information such as a picture thumbnail, file name, path, and similarity score of each search result. The target image preview area can be an area for previewing the target image. The user can click on the result displayed in the image search result display area to display the target image corresponding to the search result clicked by the user in the target image preview area. In this way, based on the image search interface provided in the embodiment of the present application, the user can upload the image to be processed and set the search parameters, so that when the user submits a search request based on the image search interface, the system can extract the color features of the uploaded image to be processed based on the image processing method provided in the embodiment of the present application, and query the relevant information of the candidate image stored in the database through the index structure, calculate the similarity between the image to be processed and the candidate image, so as to search for a target image similar to the image to be processed in the candidate image based on the similarity, and display the search result in the image search result display area, thereby improving the convenience and accuracy of image search, and thus improving the efficiency of image search.

[0143] As can be seen from the above, the embodiment of the present application obtains the first pixel information of each pixel point of the image to be processed in the target color space; constructs at least one color histogram of the image to be processed based on the first pixel information, and each color histogram corresponds to at least a part of the image area of ​​the image to be processed; based on the correspondence between the color histogram and the image area, determines the processing logic of the color histogram, and processes the color histogram based on the processing logic to obtain the first color feature of the image to be processed; obtains the second pixel information and the second color feature of the candidate image in the target color space; based on the first color feature and the second color feature, calculates the color similarity between the image to be processed and the candidate image; based on the first pixel information and the second pixel information, calculates the structural similarity between the image to be processed and the candidate image; based on the color similarity and the structural similarity, determines the target image similar to the image to be processed in the candidate image. In this way, by constructing at least one color histogram of the image to be processed, the first color feature of the image to be processed is extracted from the color histogram according to the correspondence between the color histogram and the image area of ​​the image to be processed, and then the color similarity between the image to be processed and the candidate image is calculated according to the first color feature and the first color feature of the candidate image, and the structural similarity between the image to be processed and the candidate image is calculated, so that according to the color similarity and the structural similarity, a target image similar to the image to be processed is determined in the candidate image, so that the color histogram is used to characterize the image, and the similarity between images is measured in combination with the color similarity and the structural similarity, so that accurate search for similar images at a lower cost can be achieved, thereby improving image processing efficiency.

[0144] In order to better implement the above method, an embodiment of the present invention further provides an image processing device, which can be integrated in an electronic device, and the electronic device can be a terminal and / or a server.

[0145] For example, Figure 4 As shown, it is a schematic diagram of the structure of the image processing device provided in an embodiment of the present application. The image processing device may include a first acquisition unit 201, a construction unit 202, a feature extraction unit 203, a second acquisition unit 204, a first calculation unit 205, a second calculation unit 206 and a determination unit 207, as follows:

[0146] The first acquisition unit 201 is used to acquire first pixel information of each pixel of the image to be processed in the target color space;

[0147] A construction unit 202, configured to construct at least one color histogram of the image to be processed according to the first pixel information, each color histogram corresponding to at least a partial image area of ​​the image to be processed;

[0148] The feature extraction unit 203 is used to determine the processing logic of the color histogram based on the corresponding relationship between the color histogram and the image area, and process the color histogram based on the processing logic to obtain a first color feature of the image to be processed;

[0149] A second acquisition unit 204 is used to acquire second pixel information and second color features of the candidate image in the target color space;

[0150] A first calculation unit 205, configured to calculate the color similarity between the image to be processed and the candidate image based on the first color feature and the second color feature;

[0151] A second calculation unit 206, configured to calculate the structural similarity between the image to be processed and the candidate image according to the first pixel information and the second pixel information;

[0152] The determination unit 207 is used to determine a target image similar to the image to be processed from the candidate images based on the color similarity and the structure similarity.

[0153] In some embodiments, there are multiple color histograms, and the feature extraction unit 203 includes:

[0154] An image region feature extraction subunit, configured to extract features from the color histograms of the image regions to obtain initial color features of the image regions if the correspondence between the color histograms and the image regions is that the image regions corresponding to at least two color histograms are different;

[0155] A key color feature extraction subunit, used for processing based on the initial color features of each image region to obtain at least one key color feature in the image to be processed;

[0156] The feature mapping subunit is used to perform feature mapping on the initial color feature based on the key color feature to obtain the first color feature of the image to be processed.

[0157] In some embodiments, the construction unit 202 includes:

[0158] A region division subunit, used for dividing the image to be processed into a plurality of image regions;

[0159] A first color interval determination subunit, used to determine a plurality of first color intervals of each color channel in a target color space;

[0160] A first pixel counting subunit is used to count the pixel points matching each first color interval in the image region under each color channel based on the first pixel information, so as to obtain the number of first pixel points matching each color interval in the image region;

[0161] The first histogram determination subunit is used to determine the color histogram of the image area under each color channel based on the first color interval and the corresponding first pixel number under each color channel.

[0162] In some embodiments, the image area includes a first image area and a second image area, and the area division subunit is used to:

[0163] Identify a foreground image and a background image in an image to be processed;

[0164] Performing region division on the foreground image to obtain a plurality of first image regions of the foreground image, and performing region division on the background image to obtain a plurality of second image regions of the background image;

[0165] Key color feature extraction subunit, used to:

[0166] identifying at least one first key color feature in the foreground image based on the first initial color feature of each first image region, and identifying at least one second key color feature in the background image based on the second initial color feature of each second image region;

[0167] Feature mapping subunit, used for;

[0168] Performing feature mapping on the first initial color feature based on the first key color feature to obtain a foreground color feature of the foreground image;

[0169] Performing feature mapping on the second initial color feature based on the second key color feature to obtain a background color feature of the background image;

[0170] The foreground color feature and the background color feature are fused to obtain the first color feature of the image to be processed.

[0171] In some embodiments, the image region includes all image regions in the image to be processed, and the feature extraction unit 203 is used to:

[0172] If the corresponding relationship between the color histogram and the image area is that the color histogram corresponds to the entire image area of ​​the image to be processed, the color histogram is subjected to feature conversion to obtain a first color feature of the image to be processed.

[0173] In some embodiments, the construction unit 202 is used to:

[0174] A second color interval determination subunit, used to determine a second color interval of each color channel in a target color space;

[0175] A second pixel counting subunit is used to count the pixel points matching each second color interval in the image to be processed based on the first pixel information, so as to obtain the number of second pixel points matching each second color interval;

[0176] The second histogram determination subunit is used to determine the color histogram of the image to be processed based on the second color interval and the second number of pixels.

[0177] In some embodiments, the second computing unit 206 is configured to:

[0178] A structure index calculation subunit, configured to calculate structure index information of the image to be processed and the candidate image in at least one structure comparison dimension according to the first pixel information and the second pixel information, where the structure comparison dimension includes at least one dimension of brightness, contrast, and global difference of the image;

[0179] The structural similarity calculation subunit is used to calculate the structural similarity between the image to be processed and the candidate image based on the structural indicator information under each structural comparison dimension.

[0180] In some embodiments, the first computing unit 205 is configured to:

[0181] Calculating a first distance norm corresponding to the first color feature and a second distance norm corresponding to the second color feature;

[0182] Normalizing the first color feature based on the first distance norm to obtain a first target color feature, and normalizing the second color feature based on the second distance norm to obtain a second target color feature;

[0183] The cosine distance between the first target color feature and the second target color feature is calculated to obtain the color similarity between the image to be processed and the candidate image.

[0184] In some embodiments, the image processing apparatus further includes:

[0185] A data acquisition unit, used to acquire an input image to be processed and a search parameter for the image to be processed, wherein the search parameter includes an expected similarity, and the expected similarity is a similarity between a similar image to be searched and the image to be processed;

[0186] The determining unit 207 is used to:

[0187] Calculating the target similarity between the candidate image and the image to be processed based on the color similarity and the structural similarity;

[0188] Screening out images whose target similarity is greater than the expected similarity from the candidate images as target images similar to the image to be processed;

[0189] The search results of the image to be processed based on the search parameters are displayed, the search results including the target image and the target similarity corresponding to the target image, and the arrangement order of the target image in the search results is determined based on the target similarity.

[0190] In specific implementation, the above units can be implemented as independent entities, or can be arbitrarily combined to be implemented as the same or several entities. The specific implementation of the above units can refer to the previous method embodiments, which will not be repeated here.

[0191] As can be seen from the above, the embodiment of the present application obtains the first pixel information of each pixel of the image to be processed in the target color space through the first acquisition unit 201; the construction unit 202 constructs at least one color histogram of the image to be processed according to the first pixel information, and each color histogram corresponds to at least a part of the image area of ​​the image to be processed; the feature extraction unit 203 determines the processing logic of the color histogram based on the correspondence between the color histogram and the image area, and processes the color histogram based on the processing logic to obtain the first color feature of the image to be processed; the second acquisition unit 204 obtains the second pixel information and the second color feature of the candidate image in the target color space; the first calculation unit 205 calculates the color similarity between the image to be processed and the candidate image based on the first color feature and the second color feature; the second calculation unit 206 calculates the structural similarity between the image to be processed and the candidate image according to the first pixel information and the second pixel information; the determination unit 207 determines the target image similar to the image to be processed in the candidate image based on the color similarity and the structural similarity. In this way, by constructing at least one color histogram of the image to be processed, the first color feature of the image to be processed is extracted from the color histogram according to the correspondence between the color histogram and the image area of ​​the image to be processed, and then the color similarity between the image to be processed and the candidate image is calculated according to the first color feature and the first color feature of the candidate image, and the structural similarity between the image to be processed and the candidate image is calculated, so that according to the color similarity and the structural similarity, a target image similar to the image to be processed is determined in the candidate image, so that the color histogram is used to characterize the image, and the similarity between images is measured in combination with the color similarity and the structural similarity, so that accurate search for similar images at a lower cost can be achieved, thereby improving image processing efficiency.

[0192] Accordingly, the embodiment of the present invention further provides an image processing system, including an image input module, a search parameter setting module, an image feature extraction module, a data storage module, a similarity calculation module, an image retrieval module, and a search result display module. The image processing device can be integrated into the modules included in the image processing system. The image processing device is any device provided in the embodiment of the present application. For details, please refer to the description of the embodiment of the above device. For example, please refer to Figure 5 , Figure 5 : is a schematic diagram of the framework of the image processing system provided in an embodiment of the present application. The system framework of the image processing system may include:

[0193] The image input module obtains the image to be processed input by the user;

[0194] The search parameter setting module obtains the search parameters corresponding to the image to be processed;

[0195] The image feature extraction module obtains first pixel information of each pixel of the image to be processed in the target color space, constructs at least one color histogram of the image to be processed according to the first pixel information, and extracts a first color feature of the image to be processed;

[0196] The data storage module obtains the second pixel information and the second color feature of the candidate image in the target color space;

[0197] The similarity calculation module calculates the color similarity between the image to be processed and the candidate image based on the first color feature and the second color feature, calculates the structural similarity between the image to be processed and the candidate image according to the first pixel information and the second pixel information, and calculates the target similarity between the candidate image and the image to be processed based on the color similarity and the structural similarity;

[0198] The image retrieval module selects target images similar to the image to be processed from the candidate images based on the search parameters corresponding to the image to be processed and the target similarity;

[0199] The search result display module displays the search results of the image to be processed based on the search parameters, and the search results include the target image and the target similarity corresponding to the target image.

[0200] The specific implementation of the above operations can be found in the previous embodiments, which will not be described in detail here.

[0201] Since the image processing system can include any image processing device provided in the embodiments of the present invention, the beneficial effects that can be achieved by any image processing device provided in the embodiments of the present invention can be achieved. Please refer to the previous embodiments for details, which will not be repeated here.

[0202] The present application also provides an electronic device, such as Figure 6As shown, it shows a schematic diagram of the structure of an electronic device involved in an embodiment of the present application, and the electronic device may be a terminal and / or a server. Specifically:

[0203] The electronic device 300 includes a processor 301 having one or more processing cores, a memory 302 having one or more computer-readable storage media, and a computer program stored in the memory 302 and executable on the processor. The processor 301 is electrically connected to the memory 302. Those skilled in the art will appreciate that the electronic device structure shown in the figure does not constitute a limitation on the electronic device, and may include more or fewer components than shown in the figure, or combine certain components, or arrange the components differently.

[0204] The processor 301 is the control center of the electronic device 300. It uses various interfaces and lines to connect various parts of the entire electronic device 300, executes various functions of the electronic device 300 and processes data by running or loading software programs and / or modules stored in the memory 302, and calling data stored in the memory 302, thereby monitoring the electronic device 300 as a whole.

[0205] In the embodiment of the present application, the processor 301 in the electronic device 300 will load instructions corresponding to the processes of one or more application programs into the memory 302 according to the following steps, and the processor 301 will run the application programs stored in the memory 302 to implement various functions:

[0206] A first acquisition unit, used to acquire first pixel information of each pixel of the image to be processed in the target color space;

[0207] A construction unit, configured to construct at least one color histogram of the image to be processed according to the first pixel information, each color histogram corresponding to at least a partial image area of ​​the image to be processed;

[0208] A feature extraction unit, used to determine a processing logic for the color histogram based on a correspondence between the color histogram and the image area, and to process the color histogram based on the processing logic to obtain a first color feature of the image to be processed;

[0209] A second acquisition unit, used to acquire second pixel information and second color features of the candidate image in the target color space;

[0210] A first calculation unit, configured to calculate a color similarity between the image to be processed and the candidate image based on the first color feature and the second color feature;

[0211] A second calculation unit, used for calculating the structural similarity between the image to be processed and the candidate image according to the first pixel information and the second pixel information;

[0212] The determination unit is used to determine a target image similar to the image to be processed from the candidate images based on color similarity and structural similarity.

[0213] In some embodiments, there are multiple color histograms, and based on the corresponding relationship between the color histogram and the image area, determining the processing logic for the color histogram, and processing the color histogram based on the processing logic to obtain the first color feature of the image to be processed includes:

[0214] If the correspondence between the color histogram and the image area is that the image areas corresponding to at least two color histograms are different, feature extraction is performed on the color histogram of each image area to obtain an initial color feature of each image area;

[0215] Processing is performed based on the initial color features of each image region to obtain at least one key color feature in the image to be processed;

[0216] Feature mapping is performed on the initial color feature based on the key color feature to obtain the first color feature of the image to be processed.

[0217] In some embodiments, constructing at least one color histogram of the image to be processed according to the first pixel information includes:

[0218] Dividing the image to be processed into a plurality of image regions;

[0219] Determine a plurality of first color intervals of each color channel in a target color space;

[0220] Based on the first pixel information, counting the pixel points in the image region under each color channel that match each first color interval, to obtain the number of first pixel points in the image region that match each color interval;

[0221] Based on the first color interval and the corresponding first pixel number in each color channel, a color histogram of the image area in each color channel is determined.

[0222] In some embodiments, the image region includes a first image region and a second image region, and the image to be processed is divided into a plurality of image regions, including:

[0223] Identify a foreground image and a background image in an image to be processed;

[0224] Performing region division on the foreground image to obtain a plurality of first image regions of the foreground image, and performing region division on the background image to obtain a plurality of second image regions of the background image;

[0225] Processing is performed based on the initial color features of each image region to obtain at least one key color feature in the image to be processed, including:

[0226] identifying at least one first key color feature in the foreground image based on the first initial color feature of each first image region, and identifying at least one second key color feature in the background image based on the second initial color feature of each second image region;

[0227] Performing feature mapping on the initial color feature based on the key color feature to obtain the first color feature of the image to be processed includes:

[0228] Performing feature mapping on the first initial color feature based on the first key color feature to obtain a foreground color feature of the foreground image;

[0229] Performing feature mapping on the second initial color feature based on the second key color feature to obtain a background color feature of the background image;

[0230] The foreground color feature and the background color feature are fused to obtain the first color feature of the image to be processed.

[0231] In some embodiments, the image area includes all image areas in the image to be processed, and based on the corresponding relationship between the color histogram and the image area, determining the processing logic for the color histogram, and processing the color histogram based on the processing logic to obtain the first color feature of the image to be processed includes:

[0232] If the corresponding relationship between the color histogram and the image area is that the color histogram corresponds to the entire image area of ​​the image to be processed, the color histogram is subjected to feature conversion to obtain a first color feature of the image to be processed.

[0233] In some embodiments, constructing at least one color histogram of the image to be processed according to the first pixel information includes:

[0234] Determine a second color interval of each color channel in the target color space;

[0235] Based on the first pixel information, counting the pixel points in the image to be processed that match each second color interval, to obtain the number of second pixel points that match each second color interval;

[0236] A color histogram of the image to be processed is determined based on the second color interval and the second number of pixels.

[0237] In some embodiments, calculating the structural similarity between the image to be processed and the candidate image according to the first pixel information and the second pixel information includes:

[0238] Calculating structural index information of the image to be processed and the candidate image in at least one structural comparison dimension according to the first pixel information and the second pixel information, where the structural comparison dimension includes at least one dimension of brightness, contrast, and global difference of the image;

[0239] Based on the structural indicator information under each structural comparison dimension, the structural similarity between the image to be processed and the candidate image is calculated.

[0240] In some embodiments, calculating the color similarity between the image to be processed and the candidate image based on the first color feature and the second color feature includes:

[0241] Calculating a first distance norm corresponding to the first color feature and a second distance norm corresponding to the second color feature;

[0242] Normalizing the first color feature based on the first distance norm to obtain a first target color feature, and normalizing the second color feature based on the second distance norm to obtain a second target color feature;

[0243] The cosine distance between the first target color feature and the second target color feature is calculated to obtain the color similarity between the image to be processed and the candidate image.

[0244] In some embodiments, the image processing method provided by the embodiments of the present application further includes:

[0245] Obtaining an input image to be processed and a search parameter for the image to be processed, wherein the search parameter includes an expected similarity, and the expected similarity is the similarity between the similar image to be searched and the image to be processed;

[0246] Based on color similarity and structural similarity, a target image similar to the image to be processed is determined from the candidate images, including:

[0247] Calculate the target similarity between the candidate image and the image to be processed based on color similarity and structural similarity;

[0248] Screen out images whose target similarity is greater than the expected similarity from the candidate images as target images similar to the image to be processed;

[0249] The search results of the image to be processed based on the search parameters are displayed, the search results include the target image and the target similarity corresponding to the target image, and the arrangement order of the target image in the search results is determined based on the target similarity.

[0250] This solution can be achieved by obtaining the first pixel information of each pixel point of the image to be processed in the target color space; constructing at least one color histogram of the image to be processed based on the first pixel information, each color histogram corresponding to at least a part of the image area of ​​the image to be processed; determining the processing logic of the color histogram based on the correspondence between the color histogram and the image area, and processing the color histogram based on the processing logic to obtain the first color feature of the image to be processed; obtaining the second pixel information and the second color feature of the candidate image in the target color space; calculating the color similarity between the image to be processed and the candidate image based on the first color feature and the second color feature; calculating the structural similarity between the image to be processed and the candidate image based on the first pixel information and the second pixel information; and determining a target image similar to the image to be processed in the candidate image based on the color similarity and the structural similarity. In this way, by constructing at least one color histogram of the image to be processed, the first color feature of the image to be processed is extracted from the color histogram according to the correspondence between the color histogram and the image area of ​​the image to be processed, and then the color similarity between the image to be processed and the candidate image is calculated according to the first color feature and the first color feature of the candidate image, and the structural similarity between the image to be processed and the candidate image is calculated, so that according to the color similarity and the structural similarity, a target image similar to the image to be processed is determined in the candidate image, so that the color histogram is used to characterize the image, and the similarity between images is measured in combination with the color similarity and the structural similarity, so that accurate search for similar images at a lower cost can be achieved, thereby improving image processing efficiency.

[0251] The specific implementation of the above operations can be found in the previous embodiments, which will not be described in detail here.

[0252] Optional, such as Figure 6 As shown, the electronic device 300 further includes: a touch screen 303, a radio frequency circuit 304, an audio circuit 305, an input unit 306, and a power supply 307. The processor 301 is electrically connected to the touch screen 303, the radio frequency circuit 304, the audio circuit 305, the input unit 306, and the power supply 307, respectively. Those skilled in the art can understand that Figure 6 The electronic device structure shown in the figure does not constitute a limitation of the electronic device, and may include more or less components than shown in the figure, or combine certain components, or arrange the components differently.

[0253] The touch display screen 303 can be used to display a graphical user interface and receive operation instructions generated by the user acting on the graphical user interface. The touch display screen 303 may include a display panel and a touch panel. Among them, the display panel can be used to display information input by the user or information provided to the user and various graphical user interfaces of the electronic device, and these graphical user interfaces can be composed of graphics, text, icons, videos and any combination thereof. Optionally, the display panel can be configured in the form of a liquid crystal display (LCD, Liquid Crystal Display), an organic light-emitting diode (OLED, Organic Light-Emitting Diode) and the like. The touch panel can be used to collect the user's touch operation on or near it (such as the user uses any suitable object or attachment such as a finger, a stylus, etc. on the touch panel or near the touch panel), and generate corresponding operation instructions, and the operation instructions execute corresponding programs. Optionally, the touch panel may include two parts: a touch detection device and a touch controller. Among them, the touch detection device detects the user's touch direction, detects the signal brought by the touch operation, and transmits the signal to the touch controller; the touch controller receives the touch information from the touch detection device, converts it into the touch point coordinates, and then sends it to the processor 301, and can receive the command sent by the processor 301 and execute it. The touch panel can cover the display panel. When the touch panel detects a touch operation on or near it, it is transmitted to the processor 301 to determine the type of touch event, and then the processor 301 provides a corresponding visual output on the display panel according to the type of touch event. In an embodiment of the present application, the touch panel and the display panel can be integrated into the touch display screen 303 to realize the input and output functions. However, in some embodiments, the touch panel and the touch panel can be used as two independent components to realize the input and output functions. That is, the touch display screen 303 can also be used as a part of the input unit 306 to realize the input function.

[0254] The radio frequency circuit 304 may be used to send and receive radio frequency signals, so as to establish wireless communication with a network device or other electronic devices through wireless communication, and to send and receive signals with the network device or other electronic devices.

[0255] The audio circuit 305 can be used to provide an audio interface between the user and the electronic device through a speaker and a microphone. The audio circuit 305 can transmit the electrical signal converted from the received audio data to the speaker, which is converted into a sound signal for output; on the other hand, the microphone converts the collected sound signal into an electrical signal, which is received by the audio circuit 305 and converted into audio data, and then the audio data is output to the processor 301 for processing, and then sent to another electronic device through the radio frequency circuit 304, or the audio data is output to the memory 302 for further processing. The audio circuit 305 may also include an earplug jack to provide communication between an external headset and the electronic device.

[0256] The input unit 306 may be used to receive input numbers, character information or user feature information (such as fingerprint, iris, facial information, etc.), and generate keyboard, mouse, joystick, optical or trackball signal input related to user settings and function control.

[0257] The power supply 307 is used to supply power to various components of the electronic device 300. Optionally, the power supply 307 can be logically connected to the processor 301 through a power management system, so that the power management system can manage charging, discharging, and power consumption. The power supply 307 can also include one or more DC or AC power supplies, recharging systems, power failure detection circuits, power converters or inverters, power status indicators, and other arbitrary components.

[0258] although Figure 6 Not shown, the electronic device 300 may also include a camera, a sensor, a wireless fidelity module, a Bluetooth module, etc., which will not be described in detail here.

[0259] In the above embodiments, the description of each embodiment has its own emphasis. For parts not described in detail in a certain embodiment, please refer to the relevant description of other embodiments. It should be noted that the electronic device provided in the embodiment of the present application and the image processing method in the above embodiment belong to the same concept. The specific implementation process is detailed in the above method embodiment and will not be repeated here.

[0260] As can be seen from the above, the electronic device provided by the embodiment of the present application can obtain the first pixel information of each pixel point of the image to be processed in the target color space; construct at least one color histogram of the image to be processed based on the first pixel information, and each color histogram corresponds to at least a part of the image area of ​​the image to be processed; based on the correspondence between the color histogram and the image area, determine the processing logic of the color histogram, and process the color histogram based on the processing logic to obtain the first color feature of the image to be processed; obtain the second pixel information and the second color feature of the candidate image in the target color space; based on the first color feature and the second color feature, calculate the color similarity between the image to be processed and the candidate image; based on the first pixel information and the second pixel information, calculate the structural similarity between the image to be processed and the candidate image; based on the color similarity and the structural similarity, determine the target image similar to the image to be processed in the candidate image. In this way, by constructing at least one color histogram of the image to be processed, the first color feature of the image to be processed is extracted from the color histogram according to the correspondence between the color histogram and the image area of ​​the image to be processed, and then the color similarity between the image to be processed and the candidate image is calculated according to the first color feature and the first color feature of the candidate image, and the structural similarity between the image to be processed and the candidate image is calculated, so that according to the color similarity and the structural similarity, a target image similar to the image to be processed is determined in the candidate image, so that the color histogram is used to characterize the image, and the similarity between images is measured in combination with the color similarity and the structural similarity, so that accurate search for similar images at a lower cost can be achieved, thereby improving image processing efficiency.

[0261] Those skilled in the art will appreciate that all or part of the steps in the various methods of the above embodiments may be completed by a computer program, or by controlling related hardware through a computer program. The computer program may be stored in a computer-readable storage medium and loaded and executed by a processor.

[0262] To this end, an embodiment of the present application provides a computer-readable storage medium, in which a computer program is stored, and the computer program can be loaded by a processor to execute the steps in any image processing method provided in the embodiment of the present application. For example, the computer program can execute the following steps:

[0263] A first acquisition unit, used to acquire first pixel information of each pixel of the image to be processed in the target color space;

[0264] A construction unit, configured to construct at least one color histogram of the image to be processed according to the first pixel information, each color histogram corresponding to at least a partial image area of ​​the image to be processed;

[0265] A feature extraction unit, used to determine a processing logic for the color histogram based on a correspondence between the color histogram and the image area, and to process the color histogram based on the processing logic to obtain a first color feature of the image to be processed;

[0266] A second acquisition unit, used to acquire second pixel information and second color features of the candidate image in the target color space;

[0267] A first calculation unit, configured to calculate a color similarity between the image to be processed and the candidate image based on the first color feature and the second color feature;

[0268] A second calculation unit, used for calculating the structural similarity between the image to be processed and the candidate image according to the first pixel information and the second pixel information;

[0269] The determination unit is used to determine a target image similar to the image to be processed from the candidate images based on color similarity and structural similarity.

[0270] In some embodiments, there are multiple color histograms, and based on the corresponding relationship between the color histogram and the image area, determining the processing logic for the color histogram, and processing the color histogram based on the processing logic to obtain the first color feature of the image to be processed includes:

[0271] If the correspondence between the color histogram and the image area is that the image areas corresponding to at least two color histograms are different, feature extraction is performed on the color histogram of each image area to obtain an initial color feature of each image area;

[0272] Processing is performed based on the initial color features of each image region to obtain at least one key color feature in the image to be processed;

[0273] Feature mapping is performed on the initial color feature based on the key color feature to obtain the first color feature of the image to be processed.

[0274] In some embodiments, constructing at least one color histogram of the image to be processed according to the first pixel information includes:

[0275] Dividing the image to be processed into a plurality of image regions;

[0276] Determine a plurality of first color intervals of each color channel in a target color space;

[0277] Based on the first pixel information, counting the pixel points in the image region under each color channel that match each first color interval, to obtain the number of first pixel points in the image region that match each color interval;

[0278] Based on the first color interval and the corresponding first pixel number in each color channel, a color histogram of the image area in each color channel is determined.

[0279] In some embodiments, the image region includes a first image region and a second image region, and the image to be processed is divided into a plurality of image regions, including:

[0280] Identify a foreground image and a background image in an image to be processed;

[0281] Performing region division on the foreground image to obtain a plurality of first image regions of the foreground image, and performing region division on the background image to obtain a plurality of second image regions of the background image;

[0282] Processing is performed based on the initial color features of each image region to obtain at least one key color feature in the image to be processed, including:

[0283] identifying at least one first key color feature in the foreground image based on the first initial color feature of each first image region, and identifying at least one second key color feature in the background image based on the second initial color feature of each second image region;

[0284] Performing feature mapping on the initial color feature based on the key color feature to obtain the first color feature of the image to be processed includes:

[0285] Performing feature mapping on the first initial color feature based on the first key color feature to obtain a foreground color feature of the foreground image;

[0286] Performing feature mapping on the second initial color feature based on the second key color feature to obtain a background color feature of the background image;

[0287] The foreground color feature and the background color feature are fused to obtain the first color feature of the image to be processed.

[0288] In some embodiments, the image area includes all image areas in the image to be processed, and based on the corresponding relationship between the color histogram and the image area, determining the processing logic for the color histogram, and processing the color histogram based on the processing logic to obtain the first color feature of the image to be processed includes:

[0289] If the corresponding relationship between the color histogram and the image area is that the color histogram corresponds to the entire image area of ​​the image to be processed, the color histogram is subjected to feature conversion to obtain a first color feature of the image to be processed.

[0290] In some embodiments, constructing at least one color histogram of the image to be processed according to the first pixel information includes:

[0291] Determine a second color interval of each color channel in the target color space;

[0292] Based on the first pixel information, counting the pixel points in the image to be processed that match each second color interval, to obtain the number of second pixel points that match each second color interval;

[0293] A color histogram of the image to be processed is determined based on the second color interval and the second number of pixels.

[0294] In some embodiments, calculating the structural similarity between the image to be processed and the candidate image according to the first pixel information and the second pixel information includes:

[0295] Calculating structural index information of the image to be processed and the candidate image in at least one structural comparison dimension according to the first pixel information and the second pixel information, where the structural comparison dimension includes at least one dimension of brightness, contrast, and global difference of the image;

[0296] Based on the structural indicator information under each structural comparison dimension, the structural similarity between the image to be processed and the candidate image is calculated.

[0297] In some embodiments, calculating the color similarity between the image to be processed and the candidate image based on the first color feature and the second color feature includes:

[0298] Calculating a first distance norm corresponding to the first color feature and a second distance norm corresponding to the second color feature;

[0299] Normalizing the first color feature based on the first distance norm to obtain a first target color feature, and normalizing the second color feature based on the second distance norm to obtain a second target color feature;

[0300] The cosine distance between the first target color feature and the second target color feature is calculated to obtain the color similarity between the image to be processed and the candidate image.

[0301] In some embodiments, the image processing method provided by the embodiments of the present application further includes:

[0302] Obtaining an input image to be processed and a search parameter for the image to be processed, wherein the search parameter includes an expected similarity, and the expected similarity is the similarity between the similar image to be searched and the image to be processed;

[0303] Based on color similarity and structural similarity, a target image similar to the image to be processed is determined from the candidate images, including:

[0304] Calculate the target similarity between the candidate image and the image to be processed based on color similarity and structural similarity;

[0305] Screen out images whose target similarity is greater than the expected similarity from the candidate images as target images similar to the image to be processed;

[0306] The search results of the image to be processed based on the search parameters are displayed, the search results include the target image and the target similarity corresponding to the target image, and the arrangement order of the target image in the search results is determined based on the target similarity.

[0307] This solution can be achieved by obtaining the first pixel information of each pixel point of the image to be processed in the target color space; constructing at least one color histogram of the image to be processed based on the first pixel information, each color histogram corresponding to at least a part of the image area of ​​the image to be processed; determining the processing logic of the color histogram based on the correspondence between the color histogram and the image area, and processing the color histogram based on the processing logic to obtain the first color feature of the image to be processed; obtaining the second pixel information and the second color feature of the candidate image in the target color space; calculating the color similarity between the image to be processed and the candidate image based on the first color feature and the second color feature; calculating the structural similarity between the image to be processed and the candidate image based on the first pixel information and the second pixel information; and determining a target image similar to the image to be processed in the candidate image based on the color similarity and the structural similarity. In this way, by constructing at least one color histogram of the image to be processed, the first color feature of the image to be processed is extracted from the color histogram according to the correspondence between the color histogram and the image area of ​​the image to be processed, and then the color similarity between the image to be processed and the candidate image is calculated according to the first color feature and the first color feature of the candidate image, and the structural similarity between the image to be processed and the candidate image is calculated, so that according to the color similarity and the structural similarity, a target image similar to the image to be processed is determined in the candidate image, so that the color histogram is used to characterize the image, and the similarity between images is measured in combination with the color similarity and the structural similarity, so that accurate search for similar images at a lower cost can be achieved, thereby improving image processing efficiency.

[0308] The specific implementation of the above operations can be found in the previous embodiments, which will not be described in detail here.

[0309] The computer-readable storage medium may include: a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk, etc.

[0310] Since the computer program stored in the computer-readable storage medium can execute the steps in any image processing method provided in the embodiments of the present application, the beneficial effects that can be achieved by any image processing method provided in the embodiments of the present application can be achieved. Please refer to the previous embodiments for details and will not be repeated here.

[0311] Among them, according to one aspect of the present application, a computer program product is provided, which includes a computer program, and the computer program is stored in a computer-readable storage medium; when a processor of an electronic device reads the computer program from the computer-readable storage medium, the processor executes the computer program, so that the electronic device executes the methods provided in the various optional implementations provided in the above embodiments.

[0312] The above is a detailed introduction to an image processing method, device, computer-readable storage medium and electronic device provided in the embodiments of the present application. Specific examples are used in this article to illustrate the principles and implementation methods of the present application. The description of the above embodiments is only used to help understand the method of the present application and its core idea; at the same time, for technical personnel in this field, according to the idea of ​​the present application, there will be changes in the specific implementation method and application scope. In summary, the content of this specification should not be understood as a limitation on the present application.

Claims

1. An image processing method, characterized in that: include: Obtain the first pixel information of each pixel of the image to be processed in the target color space; constructing at least one color histogram of the image to be processed according to the first pixel information, each color histogram corresponding to at least a partial image area of ​​the image to be processed; Based on the correspondence between the color histogram and the image area, determining the processing logic of the color histogram, and processing the color histogram based on the processing logic to obtain a first color feature of the image to be processed; Acquire second pixel information and second color features of the candidate image in the target color space; Calculating the color similarity between the image to be processed and the candidate image based on the first color feature and the second color feature; Calculating the structural similarity between the image to be processed and the candidate image according to the first pixel information and the second pixel information; Based on the color similarity and the structural similarity, a target image similar to the image to be processed is determined from among the candidate images.

2. The image processing method according to claim 1, characterized in that: There are multiple color histograms, and based on the correspondence between the color histogram and the image area, determining the processing logic for the color histogram, and processing the color histogram based on the processing logic to obtain the first color feature of the image to be processed includes: If the correspondence between the color histogram and the image area is that the image areas corresponding to at least two color histograms are different, performing feature extraction on the color histogram of each image area to obtain an initial color feature of each image area; Processing is performed based on the initial color features of each image region to obtain at least one key color feature in the image to be processed; Feature mapping is performed on the initial color feature based on the key color feature to obtain a first color feature of the image to be processed.

3. The image processing method according to claim 2, characterized in that: The step of constructing at least one color histogram of the image to be processed according to the first pixel information includes: Dividing the image to be processed into a plurality of image regions; Determine a plurality of first color intervals for each color channel in the target color space; Based on the first pixel information, counting the pixel points in the image region in each color channel that match each first color interval, to obtain the number of first pixel points in the image region that match each color interval; Based on the first color interval and the corresponding first pixel number in each color channel, a color histogram of the image area in each color channel is determined.

4. The image processing method according to claim 3, characterized in that: The image region includes a first image region and a second image region, and dividing the image to be processed into a plurality of image regions includes: Identifying a foreground image and a background image in the image to be processed; Performing region division on the foreground image to obtain a plurality of first image regions of the foreground image, and performing region division on the background image to obtain a plurality of second image regions of the background image; The processing based on the initial color features of each image region to obtain at least one key color feature in the image to be processed includes: identifying at least one first key color feature in the foreground image based on the first initial color feature of each first image region, and identifying at least one second key color feature in the background image based on the second initial color feature of each second image region; The performing feature mapping on the initial color feature based on the key color feature to obtain the first color feature of the image to be processed includes: Performing feature mapping on the first initial color feature based on the first key color feature to obtain a foreground color feature of the foreground image; Performing feature mapping on the second initial color feature based on the second key color feature to obtain a background color feature of the background image; The foreground color feature and the background color feature are feature-fused to obtain a first color feature of the image to be processed.

5. The image processing method according to claim 1, wherein: The image region includes all image regions in the image to be processed, and the processing logic for the color histogram is determined based on the correspondence between the color histogram and the image region, and the color histogram is processed based on the processing logic to obtain a first color feature of the image to be processed, including: If the correspondence between the color histogram and the image area is that the color histogram corresponds to the entire image area of ​​the image to be processed, the color histogram is subjected to feature conversion to obtain a first color feature of the image to be processed.

6. The image processing method according to claim 5, characterized in that: The step of constructing at least one color histogram of the image to be processed according to the first pixel information includes: Determine a second color interval of each color channel in the target color space; Based on the first pixel information, counting the pixel points in the image to be processed that match each second color interval, to obtain the number of second pixel points that match each second color interval; A color histogram of the image to be processed is determined based on the second color interval and the second number of pixels.

7. The image processing method according to any one of claims 1 to 6, characterized in that: The calculating the structural similarity between the image to be processed and the candidate image according to the first pixel information and the second pixel information includes: Calculating structural index information of the image to be processed and the candidate image in at least one structural comparison dimension according to the first pixel information and the second pixel information, where the structural comparison dimension includes at least one dimension of brightness, contrast, and global image difference; Based on the structural indicator information under each of the structural comparison dimensions, the structural similarity between the image to be processed and the candidate image is calculated.

8. The image processing method according to any one of claims 1 to 6, characterized in that: The calculating the color similarity between the image to be processed and the candidate image based on the first color feature and the second color feature includes: Calculating a first distance norm corresponding to the first color feature and a second distance norm corresponding to the second color feature; Normalizing the first color feature based on the first distance norm to obtain a first target color feature, and normalizing the second color feature based on the second distance norm to obtain a second target color feature; The cosine distance between the first target color feature and the second target color feature is calculated to obtain the color similarity between the image to be processed and the candidate image.

9. The image processing method according to any one of claims 1 to 6, characterized in that: The method further comprises: Acquire an input image to be processed and a search parameter for the image to be processed, wherein the search parameter includes an expected similarity, and the expected similarity is the similarity between a similar image to be searched and the image to be processed; The step of determining a target image similar to the image to be processed from the candidate images based on the color similarity and the structural similarity includes: Calculating the target similarity between the candidate image and the image to be processed based on the color similarity and the structural similarity; Screening out images whose target similarity is greater than the expected similarity from the candidate images as target images similar to the image to be processed; The search results of the image to be processed based on the search parameters are displayed, the search results including the target image and the target similarity corresponding to the target image, and the arrangement order of the target image in the search results is determined based on the target similarity.

10. An image processing system, characterized in that: The image processing system includes an image input module, a search parameter setting module, an image feature extraction module, a data storage module, a similarity calculation module, an image retrieval module and a search result display module, including: The image input module obtains the image to be processed input by the user; The search parameter setting module obtains the search parameters corresponding to the image to be processed; The image feature extraction module obtains first pixel information of each pixel of the image to be processed in the target color space, constructs at least one color histogram of the image to be processed according to the first pixel information, and extracts a first color feature of the image to be processed; The data storage module obtains second pixel information and second color features of the candidate image in the target color space; The similarity calculation module calculates the color similarity between the image to be processed and the candidate image based on the first color feature and the second color feature, calculates the structural similarity between the image to be processed and the candidate image according to the first pixel information and the second pixel information, and calculates the target similarity between the candidate image and the image to be processed based on the color similarity and the structural similarity; The image retrieval module selects a target image similar to the image to be processed from the candidate images based on the search parameters corresponding to the image to be processed and the target similarity; The search result display module displays the search results of the image to be processed based on the search parameters, and the search results include the target image and the target similarity corresponding to the target image.

11. An image processing device, characterized in that: include: A first acquisition unit, used to acquire first pixel information of each pixel of the image to be processed in the target color space; A construction unit, configured to construct at least one color histogram of the image to be processed according to the first pixel information, each color histogram corresponding to at least a partial image area of ​​the image to be processed; A feature extraction unit, configured to determine a processing logic for the color histogram based on a correspondence between the color histogram and the image region, and process the color histogram based on the processing logic to obtain a first color feature of the image to be processed; A second acquisition unit, used to acquire second pixel information and second color features of the candidate image in the target color space; A first calculation unit, configured to calculate a color similarity between the image to be processed and the candidate image based on the first color feature and the second color feature; A second calculation unit, configured to calculate a structural similarity between the image to be processed and the candidate image according to the first pixel information and the second pixel information; A determination unit is used to determine a target image similar to the image to be processed from the candidate images based on the color similarity and the structural similarity.

12. An electronic device, characterized in that: It comprises a processor and a memory, wherein the memory stores a computer program, and when the computer program is executed by the processor, the processor executes the steps of any one of the methods of claims 1 to 9.

13. A computer-readable storage medium, characterized in that: It includes a computer program. When the computer program is run on an electronic device, the computer program is used to enable the electronic device to execute the steps of any method described in claims 1 to 9.