Image processing method and device and electronic equipment

By clustering the pixel values ​​of each pixel point in the image until the clustering categories of the target object and other objects are completely different, the problem of inaccurate color extraction in the prior art is solved, and accurate color feature extraction and reduced labor costs are achieved.

CN119832094APending Publication Date: 2025-04-15SHENZHEN LINGYUN VISION TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411717537.X
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-11-27
Publication Date
2025-04-15

AI Technical Summary

Technical Problem

In the prior art, the extraction effect of the color extraction tool depends on the experience of the operator, resulting in inaccurate determination of the color characteristics of the target object.

Method used

The color characteristics of the target object are obtained by clustering the pixel values ​​of each pixel point in the image until the clustering categories of the target object and other objects are completely different.

Benefits of technology

The color characteristics of the target object are determined more accurately, reducing the dependence on the professionalism of the operator and reducing labor costs.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119832094A_ABST
    Figure CN119832094A_ABST
Patent Text Reader

Abstract

The invention discloses an image processing method and device and electronic equipment, and belongs to the technical field of image processing. The method comprises the steps of performing at least one clustering on each pixel point according to a pixel value of each pixel point in a first image until at least one first clustering category where a target object in the first image is located and at least one second clustering category where other objects in the first image are located belong to completely different clustering categories; and obtaining color features of the target object according to the pixel value of each pixel point in the first clustering category. According to the embodiment of the invention, the color feature of the target object can be accurately determined. In addition, the professionality of operators is not limited, and the labor cost is reduced.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

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

[0002] The color extraction tool is a program used to identify and extract color features from images. It can be widely used in the field of industrial inspection to detect the area, perimeter and location of target objects, etc.

[0003] The extraction effect of the color extraction tool in the related technology is highly dependent on the operator's experience. The operator is required to manually select sampling points and use the color features of the manual sampling points as the color features of the target object. This method has high requirements on the operator's experience and it is easy to have inaccurate determination of the color features of the target object. Summary of the invention

[0004] The present application aims to solve at least one of the technical problems existing in the related art. To this end, the present application proposes an image processing method, device and electronic device, which can more accurately determine the color characteristics of a target object.

[0005] In a first aspect, the present application provides an image processing method, the method comprising:

[0006] Clustering each pixel at least once according to a pixel value of each pixel in the first image until at least one first cluster category where the target object in the first image belongs and at least one second cluster category where other objects belong belong to completely different cluster categories;

[0007] The color feature of the target object is obtained according to the pixel value of each pixel in the first cluster category.

[0008] According to the image processing method of the present application, each pixel is clustered at least once according to the pixel value of each pixel in the first image, until at least one first cluster category where the target object in the first image is located and at least one second cluster category where other objects are located belong to completely different cluster categories, and the color features of the target object are obtained according to the pixel values ​​of each pixel in the first cluster category. Compared to using the color features of artificial sampling points as the color features of the target object, the present application determines at least one first cluster cluster corresponding to the target object, that is, accurately determines each pixel included in the target object, and then obtains the color features of the target object according to the pixel values ​​of each pixel in the first cluster category, and can more accurately determine the color features of the target object. In addition, the professionalism of the operator is not restricted, which reduces the labor cost.

[0009] According to an embodiment of the present application, clustering each pixel point at least once according to the pixel value of each pixel point in the first image includes:

[0010] Clustering each pixel in the first image according to the number of clusters of this clustering and the pixel value of each pixel in the first image to obtain at least one cluster category corresponding to this clustering;

[0011] Set different cluster colors for each cluster category;

[0012] Displaying a first interface; the first interface includes a first control and a second image of the same size as the first image, the color of each pixel in the second image is the cluster color corresponding to the pixel at the same position in the first image, and the first control is used to represent that at least one color corresponding to the target object and at least one color corresponding to other objects are completely different colors;

[0013] In response to acquiring a trigger operation on the first control, it is determined to stop clustering.

[0014] According to an embodiment of the present application, the first interface further includes a second control; the second control is used to indicate that at least one color corresponding to the target object and at least one color corresponding to other objects have a common color;

[0015] After displaying the first interface, the method further includes:

[0016] In response to obtaining a trigger operation on the second control, obtaining the number of clusters for the next clustering according to the number of clusters of the current clustering and the target value;

[0017] Among them, the number of clusters in the next clustering is greater than the number of clusters in this clustering.

[0018] According to an embodiment of the present application, after setting different cluster colors for each cluster category, the method further includes:

[0019] Create a mapping relationship between cluster categories and corresponding cluster colors;

[0020] Before obtaining the color feature of the target object according to the pixel value of each pixel point in the first cluster category, the method further includes:

[0021] In response to obtaining a user's selection operation on at least one color in the second image, determining the color selected by the user;

[0022] According to the mapping relationship between cluster categories and cluster colors, determine the cluster category corresponding to the color selected by the user;

[0023] It is determined that the cluster category corresponding to the color selected by the user is the first cluster category corresponding to the target object.

[0024] According to one embodiment of the present application, after obtaining the color feature of the target object, the method further includes:

[0025] Acquire a third image; the third image includes the target object;

[0026] The target object in the third image is determined according to the color feature of the target object.

[0027] According to one embodiment of the present application, the pixel value includes a plurality of color channels;

[0028] According to the pixel value of each pixel point in the first cluster category, the color feature of the target object is obtained, including:

[0029] Determine the mean and variance of all pixels in the first cluster category in each color channel;

[0030] The color characteristics of the target object are determined based on the mean and variance of each color channel.

[0031] According to an embodiment of the present application, the color feature is a channel range corresponding to each color channel;

[0032] According to the mean and variance of each color channel, the color characteristics of the target object are determined, including:

[0033] For each color channel, the maximum value and the minimum value of the channel range of each color channel are determined respectively according to the mean value, the variance and the target coefficient of the color channel.

[0034] In a second aspect, the present application provides an image processing device, the device comprising:

[0035] A first processing module, configured to cluster each pixel at least once according to a pixel value of each pixel in the first image, until at least one first cluster category where the target object in the first image belongs and at least one second cluster category where other objects belong belong to completely different cluster categories;

[0036] The second processing module is used to obtain the color feature of the target object according to the pixel value of each pixel point in the first cluster category.

[0037] According to the image processing device of the present application, each pixel is clustered at least once according to the pixel value of each pixel in the first image, until at least one first cluster category where the target object in the first image is located and at least one second cluster category where other objects are located belong to completely different cluster categories, and the color features of the target object are obtained according to the pixel values ​​of each pixel in the first cluster category. Compared with using the color features of artificial sampling points as the color features of the target object, the present application determines at least one first clustering cluster corresponding to the target object, that is, accurately determines each pixel included in the target object, and then obtains the color features of the target object according to the pixel values ​​of each pixel in the first cluster category, and can more accurately determine the color features of the target object. In addition, the professionalism of the operator is not restricted, which reduces the labor cost.

[0038] In a third aspect, the present application provides an electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the computer program, the image processing method provided in the first aspect is implemented.

[0039] In a fourth aspect, the present application provides a non-transitory computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the image processing method provided in the first aspect above.

[0040] In a fifth aspect, the present application provides a chip, the chip comprising a processor and a communication interface, the communication interface and the processor are coupled, and the processor is used to run programs or instructions to implement the image processing method provided in the first aspect.

[0041] In a sixth aspect, the present application provides a computer program product, including a computer program, which, when executed by a processor, implements the image processing method provided in the first aspect above.

[0042] The above one or more technical solutions in the embodiments of the present application have at least one of the following technical effects:

[0043] By clustering each pixel at least once according to the pixel value of each pixel in the first image, until at least one first cluster category where the target object in the first image is located and at least one second cluster category where other objects are located belong to completely different cluster categories, the color features of the target object are obtained according to the pixel values ​​of each pixel in the first cluster category. Compared to using the color features of artificial sampling points as the color features of the target object, the present application determines at least one first clustering cluster corresponding to the target object, that is, accurately determines each pixel included in the target object, and then obtains the color features of the target object according to the pixel values ​​of each pixel in the first cluster category, so that the color features of the target object can be determined more accurately. In addition, the professionalism of the operator is not restricted, which reduces the labor cost.

[0044] Additional aspects and advantages of the present application will be given in part in the description below, and in part will become apparent from the description below, or will be learned through the practice of the present application. BRIEF DESCRIPTION OF THE DRAWINGS

[0045] The above and / or additional aspects and advantages of the present application will become apparent and easily understood from the description of the embodiments in conjunction with the following drawings, in which:

[0046] Figure 1 This is one of the flowcharts of the image processing method provided in the embodiment of the present application;

[0047] Figure 2 is a schematic diagram of a first interface provided in an embodiment of the present application;

[0048] Figure 3 This is the second flowchart of the image processing method provided in the embodiment of the present application;

[0049] Figure 4 is a schematic diagram of determining a target object in a third image provided by an embodiment of the present application;

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

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

[0052] The following will be combined with the drawings in the embodiments of the present application to clearly describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are part of the embodiments of the present application, rather than all the embodiments. All other embodiments obtained by ordinary technicians in this field based on the embodiments in the present application belong to the scope of protection of this application.

[0053] The terms "first", "second", etc. in the specification and claims of the present application are used to distinguish similar objects, and are not used to describe a specific order or sequence. It should be understood that the data used in this way can be interchangeable under appropriate circumstances, so that the embodiments of the present application can be implemented in an order other than those illustrated or described here, and the objects distinguished by "first", "second", etc. are generally of one type, and the number of objects is not limited. For example, the first object can be one or more. In addition, "and / or" in the specification and claims represents at least one of the connected objects, and the character " / " generally indicates that the objects associated with each other are in an "or" relationship.

[0054] The image processing method, image processing device, electronic device and readable storage medium provided in the embodiments of the present application are described in detail below with reference to the accompanying drawings through specific embodiments and their application scenarios.

[0055] The image processing method may be applied to a terminal, and may be specifically executed by hardware or software (such as a color extraction tool) in the terminal.

[0056] The image processing method provided in the embodiment of the present application may be executed by an electronic device or a functional module or functional entity in the electronic device that can implement the image processing method. The electronic devices mentioned in the embodiment of the present application include but are not limited to mobile phones, tablet computers, computers, cameras, and wearable devices. The image processing method provided in the embodiment of the present application is described below using the electronic device as an example of the execution subject.

[0057] like Figure 1 As shown, the image processing method includes: step 110 and step 120.

[0058] Step 110 , clustering each pixel at least once according to the pixel value of each pixel in the first image until at least one first cluster category where the target object in the first image belongs and at least one second cluster category where other objects belong belong to completely different cluster categories.

[0059] In the embodiment of the present application, the target object and other objects in the first image may be a person, an animal, an area, etc., without limitation. Other objects refer to any object other than the target object. In the first image, other images may be regarded as the "background" of the target object.

[0060] In the first image, the target object includes at least one pixel point, and the other objects also include at least one pixel point. The difference in pixel values ​​between the target object and the other objects is greater than a target difference, and the target difference is a preset threshold.

[0061] The number of target objects can be one or more, and there is no restriction on this.

[0062] In order to accurately distinguish the target object from other objects, the embodiment of the present application clusters each pixel at least once according to the pixel value of each pixel in the first image, and each clustering can obtain multiple cluster categories.

[0063] The detailed process of each clustering includes the following steps:

[0064] For this clustering, for each pixel, determine the pixel distance between the pixel and each cluster center of this clustering, and divide the pixel into the cluster category corresponding to the minimum pixel distance, thereby obtaining at least one cluster category corresponding to this clustering;

[0065] The number of clusters in each clustering process can be selected manually or set by the program. The number of clusters determines the granularity of pixel classification. The more clusters are selected, the finer the color range covered by each cluster category. The number of clusters should be determined according to the goal of fine color extraction.

[0066] Each initial cluster center of the first clustering process is characterized by a combination of the maximum value of the component of any color channel of all pixels, the minimum value of the component of any color channel, and the average value of the component of any color channel, thereby making the distance between each cluster center relatively far.

[0067] It is understandable that in each clustering process, the program can determine the cluster category to which any pixel point belongs or determine the individual pixels contained in each cluster category, but the program does not know which specific cluster categories or pixels the target object contains based on the various cluster categories in the current clustering results. However, for the user, the user can know whether each pixel point belongs to the target object, but does not know the cluster category to which each pixel point belongs.

[0068] In order to make the user clearly aware of the cluster category to which each pixel point belongs, the embodiment of the present application sets different cluster colors for each cluster category, and displays the clustering results to the user through the second image.

[0069] Cluster color refers to the color set for each cluster category. In each clustering process, different cluster categories correspond to different cluster colors. For example, if four cluster categories are obtained in a clustering process, red, blue, green, and yellow cluster colors can be set for each cluster category.

[0070] In the embodiment of the present application, the second image and the first image have the same size, and the color of each pixel in the second image is the cluster color corresponding to the pixel at the same position in the first image, that is, the second image contains color blocks, and color blocks with the same color belong to the same cluster category.

[0071] The user may observe the at least one color corresponding to the target object to determine whether the at least one color corresponding to the target object has a common color with the at least one color corresponding to other objects.

[0072] If yes, it means that the clustering results obtained in this clustering do not meet the requirements. In this case, the user can trigger the second control, which is used to indicate that at least one color corresponding to the target object and at least one color corresponding to other objects have a common color. After obtaining the trigger operation on the second control, the program updates the number of clusters of this clustering to obtain the number of clusters for the next clustering. The number of clusters for the next clustering is greater than the number of clusters for this clustering, that is, the number of clusters has been added, and re-clustering is performed based on the clustering data of the next clustering.

[0073] If not, it means that the clustering results obtained by this clustering meet the requirements. In this case, the user can trigger the first control, which is used to indicate that at least one color corresponding to the target object and at least one color corresponding to other objects are completely different colors. After obtaining the trigger operation of the first control, the program determines to stop clustering.

[0074] After stopping clustering, the user can select at least a color from the second image, thereby informing the program of at least one first cluster category to which the target object corresponds.

[0075] Step 120: Obtain color features of the target object according to the pixel value of each pixel in the first cluster category.

[0076] After determining at least one first clustering category corresponding to the target object, the embodiment of the present application needs to determine the color features of the target object. The color features of the target object may refer to the mean and variance of each pixel point contained in the target object, or may refer to the target color range corresponding to each pixel point contained in the target object, without limitation.

[0077] When the color feature is represented by a mean and a variance, the mean and the variance of the pixels included in the first target object may be determined according to the pixel value of each pixel in the first cluster category.

[0078] When the color feature is represented by a target color range, the minimum value and the maximum value of the target color range corresponding to the included pixel points may be determined according to the mean and the variance.

[0079] The embodiment of the present application clusters each pixel at least once according to the pixel value of each pixel in the first image, until at least one first cluster category in which the target object in the first image is located and at least one second cluster category in which other objects are located belong to completely different cluster categories, and obtains the color features of the target object according to the pixel values ​​of each pixel in the first cluster category. Compared to using the color features of artificial sampling points as the color features of the target object, the present application determines at least one first cluster cluster corresponding to the target object, that is, accurately determines each pixel included in the target object, and then obtains the color features of the target object according to the pixel values ​​of each pixel in the first cluster category, and can more accurately determine the color features of the target object. In addition, the professionalism of the operator is not restricted, which reduces the labor cost.

[0080] In some embodiments, clustering each pixel point at least once according to the pixel value of each pixel point in the first image includes:

[0081] Clustering each pixel in the first image according to the number of clusters of this clustering and the pixel value of each pixel in the first image to obtain at least one cluster category corresponding to this clustering;

[0082] Set different cluster colors for each cluster category;

[0083] Displaying a first interface; the first interface includes a first control and a second image of the same size as the first image, the color of each pixel in the second image is the cluster color corresponding to the pixel at the same position in the first image, and the first control is used to represent that at least one color corresponding to the target object and at least one color corresponding to other objects are completely different colors;

[0084] In response to acquiring a trigger operation on the first control, it is determined to stop clustering.

[0085] In some embodiments, the first interface further includes a second control; the second control is used to indicate that at least one color corresponding to the target object and at least one color corresponding to other objects have a common color;

[0086] After displaying the first interface, the method further includes:

[0087] In response to obtaining a trigger operation on the second control, obtaining the number of clusters for the next clustering according to the number of clusters of the current clustering and the target value;

[0088] Among them, the number of clusters in the next clustering is greater than the number of clusters in this clustering.

[0089] In each clustering process of the embodiment of the present application, each pixel in the first image is clustered according to the number of clusters of this clustering and the pixel value of each pixel in the first image to obtain at least one cluster category corresponding to this clustering, and a different cluster color is set for each cluster category.

[0090] In order to make the user clearly aware of the cluster category to which each pixel belongs, a first interface is displayed; the first interface includes a first control and a second image of the same size as the first image, the color of each pixel in the second image is the cluster color corresponding to the pixel at the same position in the first image, and the first control is used to represent that at least one color corresponding to the target object and at least one color corresponding to other objects are completely different colors;

[0091] like Figure 2 As shown, an embodiment of the present application provides a schematic diagram of a first interface, wherein the first interface includes a second image, the second image and the first image are of the same size, the second image includes multiple color blocks, each color block corresponds to a color, wherein color block A is color 1, color block B is color 2, color block C is color 3, and color block D is color 4, each color block corresponds to at least one pixel, and the color of each pixel in the second image is the cluster color corresponding to the pixel at the same position in the first image.

[0092] In addition, the first image also includes a first control "Clustering Stop" and a second control "Reclustering". The first control "Clustering Stop" is used to characterize that at least one color corresponding to the target object and at least one color corresponding to other objects are completely different colors; the second control "Reclustering" is used to characterize that at least one color corresponding to the target object and at least one color corresponding to other objects have a common color.

[0093] The user can compare the first image and the second image. When the user determines that at least one color corresponding to the target object and at least one color corresponding to other objects are completely different colors, that is, when the user determines that different cluster colors cover the target object and other objects, the user triggers the first control "Cluster Stop".

[0094] When the user determines that at least one color corresponding to the target object and at least one color corresponding to other objects have a common color, that is, when it is determined that there is at least one cluster color covering both the target object and other objects, the user triggers the second control "re-clustering".

[0095] In the case of a trigger operation on the second control, in response to obtaining the trigger operation on the second control, the number of clusters for the next clustering is obtained according to the number of clusters of this clustering and the target value. The target value can be a preset threshold value, which can be set according to actual conditions, such as 1 (adding one cluster category at a time). The sum of the number of clusters of this clustering and the target value can be used as the number of clusters for the next clustering.

[0096] In some embodiments, after setting different cluster colors for each cluster category, the method further includes:

[0097] Create a mapping relationship between cluster categories and corresponding cluster colors;

[0098] Before obtaining the color feature of the target object according to the pixel value of each pixel point in the first cluster category, the method further includes:

[0099] In response to obtaining a user's selection operation on at least one color in the second image, determining the color selected by the user;

[0100] According to the mapping relationship between cluster categories and cluster colors, determine the cluster category corresponding to the color selected by the user;

[0101] It is determined that the cluster category corresponding to the color selected by the user is the first cluster category corresponding to the target object.

[0102] After setting different cluster colors for each cluster category, the embodiment of the present application further creates a mapping relationship between each cluster category and the corresponding cluster color.

[0103] After determining to stop clustering and before obtaining the color features of the target object according to the pixel values ​​of each pixel point in the first cluster category, it is necessary to determine at least one first cluster cluster corresponding to the target object. Specifically, the user may be prompted to select at least one color corresponding to the target object from the second image, and after obtaining the user's selection operation on at least one color in the second image, the color selected by the user is determined, and further, according to the mapping relationship between the cluster category and the cluster color, the cluster category corresponding to the color selected by the user is determined, and the cluster category corresponding to the color selected by the user is the first cluster category corresponding to the target object.

[0104] In some embodiments, the pixel value includes a plurality of color channels;

[0105] According to the pixel value of each pixel point in the first cluster category, the color feature of the target object is obtained, including:

[0106] Determine the mean and variance of all pixels in the first cluster category in each color channel;

[0107] The color characteristics of the target object are determined based on the mean and variance of each color channel.

[0108] The pixel value of a pixel point includes multiple color channels. The multiple color channels can be RGB color channels, namely R (Red) channel, G (Green) channel and B (Blue) channel; the multiple color channels can also be HSV color channels, namely H (Hue) channel, S (Saturation) channel and V (Value) channel, or other standard channels, without limitation.

[0109] After determining the first cluster category, the mean and variance of the pixels in each color channel in all the first cluster categories can be determined. Assuming that the multiple color channels are RGB color channels, the pixel value of each pixel can be represented as (R, G, B). According to the R channel value of each pixel, the mean R_mean of all pixels in the R channel, the mean G_mean of the G channel, and the mean B_mean of the B channel can be determined, that is, the mean of the pixel value is represented as (R_mean, G_mean, B_mean).

[0110] Furthermore, the variance R_std of the R channel is determined according to the R channel value of each pixel and the mean R_mean of the R channel, the variance G_std of the G channel is determined according to the G channel value of each pixel and the mean G_mean of the G channel, and the variance B_std of the B channel is determined according to the B channel value of each pixel and the mean B_mean of the B channel. The variance of the pixel value can be represented as (R_std, G_std, B_std).

[0111] The color characteristics of the target object can be determined based on the mean and variance of each color channel.

[0112] In some embodiments, the color feature is a channel range corresponding to each color channel;

[0113] According to the mean and variance of each color channel, the color characteristics of the target object are determined, including:

[0114] For each color channel, the maximum value and the minimum value of the channel range of each color channel are determined respectively according to the mean value, the variance and the target coefficient of the color channel.

[0115] The target coefficient k is a preset threshold value, usually a constant, usually taking a value of 1 or 2, indicating the required range width.

[0116] The maximum value of the channel range of the R color channel can be represented as R_mean+k*R_std, and the minimum value can be represented as R_mean-k*R_std, respectively. The channel range of the R color channel is R_range=[R_mean-k*R_std, R_mean+k*R_std];

[0117] The maximum value of the channel range of the G color channel can be represented as G_mean+k*G_std, and the minimum value can be represented as G_mean-k*G_std, respectively. The channel range of the G color channel G_range=[G_mean-k*G_std, G_mean+k*G_std];

[0118] The maximum value of the channel range of the B color channel can be represented as B_mean+k*B_std, and the minimum value can be represented as B_mean-k*B_std. The channel range of the B color channel is B_range=[B_mean-k*B_std, B_mean+k*B_std].

[0119] like Figure 3 As shown, the present application embodiment provides a flowchart of an image processing method, comprising the following steps:

[0120] Step 301, acquiring a first image;

[0121] Step 302: In this clustering process, cluster each pixel in the first image according to the number of clusters in this clustering and the pixel value of each pixel in the first image to obtain at least one cluster category corresponding to this clustering;

[0122] Step 303, setting different cluster colors for each cluster category;

[0123] Step 304, creating a mapping relationship between cluster categories and corresponding cluster colors;

[0124] Step 305, displaying a first interface; the first interface includes a first control and a second image of the same size as the first image, the color of each pixel in the second image is the cluster color corresponding to the pixel at the same position in the first image, and the first control is used to represent that at least one color corresponding to the target object and at least one color corresponding to other objects are completely different colors;

[0125] Step 306, determining whether the first control is triggered, if so, executing step 307; if not, executing step 308;

[0126] Step 307, determine to stop clustering; execute step 309;

[0127] Step 308, in response to obtaining the trigger operation on the second control, obtaining the number of clusters for the next clustering according to the number of clusters of this clustering and the target value; executing step 302;

[0128] Step 309, in response to obtaining a user's selection operation on at least one color in the second image, determining the color selected by the user;

[0129] Step 310, determining the cluster category corresponding to the color selected by the user according to the mapping relationship between the cluster category and the cluster color;

[0130] Step 311, determining that the cluster category corresponding to the color selected by the user is the first cluster category corresponding to the target object;

[0131] Step 312, determining the mean and variance of all pixels in the first cluster category in each color channel;

[0132] Step 313: determine the color features of the target object according to the mean and variance of each color channel.

[0133] The detailed execution process of step 301 to step 313 is shown in the above embodiment and will not be described again here.

[0134] In some embodiments, after obtaining the color feature of the target object, the method further includes:

[0135] Acquire a third image; the third image includes the target object and other objects;

[0136] The target object in the third image is determined according to the color feature of the target object.

[0137] After obtaining the color features of the target object, the embodiment of the present application can extract the target object in the third image that also contains the target object according to the color features corresponding to the target object.

[0138] like Figure 4 As shown, an embodiment of the present application provides a schematic diagram for determining a target object in a third image, where the "white" portion in the image is the target object, and the other "shadow" portions except the target object are the "background portions" of the target object.

[0139] The image processing method provided in the embodiment of the present application can be executed by an image processing device. In the embodiment of the present application, an image processing device executing the image processing method is taken as an example to illustrate the image processing device provided in the embodiment of the present application.

[0140] The embodiment of the present application also provides an image processing device.

[0141] like Figure 5As shown, the image processing device includes: a first processing module 510 and a second processing module 520.

[0142] A first processing module 510, configured to cluster each pixel at least once according to a pixel value of each pixel in the first image, until at least one first cluster category where the target object in the first image belongs and at least one second cluster category where other objects belong belong to completely different cluster categories;

[0143] The second processing module 520 is used to obtain the color feature of the target object according to the pixel value of each pixel point in the first cluster category.

[0144] According to the image processing device provided by the embodiment of the present application, each pixel point is clustered at least once according to the pixel value of each pixel point in the first image, until at least one first clustering category where the target object in the first image is located and at least one second clustering category where other objects are located belong to completely different clustering categories, and the color features of the target object are obtained according to the pixel values ​​of each pixel point in the first clustering category. Compared with using the color features of artificial sampling points as the color features of the target object, the present application determines at least one first clustering cluster corresponding to the target object, that is, accurately determines each pixel point contained in the target object, and then obtains the color features of the target object according to the pixel values ​​of each pixel point in the first clustering category, so that the color features of the target object can be determined more accurately. In addition, the professionalism of the operator is not restricted, which reduces the labor cost.

[0145] In some embodiments, the first processing module 510 includes:

[0146] A first processing submodule, configured to cluster each pixel in the first image according to the number of clusters of this clustering and the pixel value of each pixel in the first image, and obtain at least one cluster category corresponding to this clustering;

[0147] The second processing submodule is used to set different cluster colors for each cluster category;

[0148] A display module, used to display a first interface; the first interface includes a first control and a second image of the same size as the first image, the color of each pixel in the second image is the cluster color corresponding to the pixel at the same position in the first image, and the first control is used to represent that at least one color corresponding to the target object and at least one color corresponding to other objects are completely different colors;

[0149] The fourth processing submodule is used to determine to stop clustering in response to obtaining a trigger operation on the first control.

[0150] In some embodiments, the first interface further includes a second control; the second control is used to indicate that at least one color corresponding to the target object and at least one color corresponding to other objects have a common color;

[0151] The fourth processing submodule is further specifically configured to obtain the number of clusters for the next clustering according to the number of clusters for the current clustering and the target value in response to obtaining the trigger operation for the second control;

[0152] Among them, the number of clusters in the next clustering is greater than the number of clusters in this clustering.

[0153] In some embodiments, the second processing submodule is further used to create a mapping relationship between cluster categories and corresponding cluster colors;

[0154] The image processing device also includes:

[0155] The third processing module is used for:

[0156] In response to obtaining a user's selection operation on at least one color in the second image, determining the color selected by the user;

[0157] According to the mapping relationship between cluster categories and cluster colors, determine the cluster category corresponding to the color selected by the user;

[0158] It is determined that the cluster category corresponding to the color selected by the user is the first cluster category corresponding to the target object.

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

[0160] The fourth processing module is used for:

[0161] Acquire a third image; the third image includes the target object;

[0162] The target object in the third image is determined according to the color feature of the target object.

[0163] In some embodiments, the pixel value includes a plurality of color channels;

[0164] The second processing module 520 is specifically used to: determine the mean and variance of all pixel points in the first cluster category in each color channel;

[0165] The color characteristics of the target object are determined based on the mean and variance of each color channel.

[0166] In some embodiments, the color feature is a channel range corresponding to each color channel;

[0167] The second processing module 520 is further specifically configured to: for each color channel, determine the maximum value and the minimum value of the channel range of each color channel according to the mean value, the variance and the target coefficient of the color channel.

[0168] The image processing device in the embodiment of the present application can be an electronic device, or a component in the electronic device, such as an integrated circuit or a chip. The electronic device can be a terminal, or other devices other than a terminal. Exemplarily, the electronic device can be a mobile phone, a tablet computer, a laptop computer, a PDA, a vehicle-mounted electronic device, a mobile Internet device (Mobile Internet Device, MID), an augmented reality (augmented reality, AR) / virtual reality (virtual reality, VR) device, a robot, a wearable device, an ultra-mobile personal computer (ultra-mobile personal computer, UMPC), a netbook or a personal digital assistant (personal digital assistant, PDA), etc., and can also be a server, a network attached storage (Network Attached Storage, NAS), a personal computer (personal computer, PC), a television (television, TV), a teller machine or a self-service machine, etc., which is not specifically limited in the embodiment of the present application.

[0169] The image processing device in the embodiment of the present application may be a device having an operating system. The operating system may be a Microsoft (Windows) operating system, an Android (Android) operating system, an IOS operating system, or other possible operating systems, which are not specifically limited in the embodiment of the present application.

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

[0171] In the embodiments of the present application, the term "module" or "unit" refers to a computer program or a part of a computer program with a predetermined function, and works together with other related parts to achieve a predetermined goal, and can be implemented in whole or in part by using software, hardware (such as processing circuits or memories) or a combination thereof. Similarly, a processor (or multiple processors or memories) can be used to implement one or more modules or units. In addition, each module or unit can be a part of an overall module or unit that includes the function of the module or unit.

[0172] In some embodiments, Figure 6As shown, an embodiment of the present application also provides an electronic device 600, including a processor 601, a memory 602, and a computer program stored in the memory 602 and executable on the processor 601. When the program is executed by the processor 601, each process of the above-mentioned image processing method embodiment is implemented, and the same technical effect can be achieved. To avoid repetition, it will not be described here.

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

[0174] The electronic device package may include but is not limited to mobile terminals such as mobile phones, laptop computers, digital broadcast receivers, PDAs (personal digital assistants), PADs (tablet computers), PMPs (portable multimedia players), vehicle-mounted terminals (such as vehicle-mounted navigation terminals), etc., and fixed terminals such as digital TVs, desktop computers, etc. Figure 6 The electronic device shown is only an example and should not bring any limitation to the functions and scope of use of the embodiments of the present disclosure.

[0175] The memory 602 may be a ROM (Read Only Memory) or other types of static storage devices that can store static information and instructions, a RAM (Random Access Memory) or other types of dynamic storage devices that can store information and instructions, or an EEPROM (Electrically Erasable Programmable Read Only Memory), a CD-ROM (Compact Disc Read Only Memory) or other optical disk storage, optical disk storage (including compressed optical disk, laser disk, optical disk, digital versatile disk, Blu-ray disk, etc.), magnetic disk storage media, other magnetic storage devices, or any other medium that can be used to carry or store computer programs and can be read by a computer, without limitation herein.

[0176] The memory 602 is used to store the computer program for executing the embodiment of the present application, and the execution is controlled by the memory 602. The memory 602 is used to execute the computer program stored in the memory 602 to implement the steps shown in the above method embodiment.

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

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

[0179] It should be noted that the computer-readable medium mentioned above in the present disclosure may be a computer-readable signal medium or a computer-readable medium or any combination of the above two. The computer-readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared or semiconductor system, device or device, or any combination of the above. More specific examples of computer-readable storage media may include, but are not limited to: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In the present disclosure, a computer-readable storage medium may be any tangible medium containing or storing a program that can be used by or in combination with an instruction execution system, device or device. In the present disclosure, a computer-readable signal medium may include a data signal propagated in a baseband or as part of a carrier wave, which carries a computer-readable program code. This propagated data signal may take a variety of forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the above. The computer readable signal medium may also be any computer readable medium other than a computer readable storage medium, which may send, propagate or transmit a program for use by or in conjunction with an instruction execution system, apparatus or device. The program code contained on the computer readable medium may be transmitted using any suitable medium, including but not limited to: wires, optical cables, RF (radio frequency), etc., or any suitable combination of the above.

[0180] An embodiment of the present application also provides a computer program product, including a computer program, which implements the above-mentioned image processing method when executed by a processor.

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

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

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

[0184] It should be noted that, in this article, the term "comprises", "includes" or any other variant thereof is intended to cover non-exclusive inclusion, so that the process, method, article or device including a series of elements includes not only those elements, but also includes other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, the elements defined by the sentence "including one..." do not exclude the presence of other identical elements in the process, method, article or device including the element. In addition, it should be pointed out that the scope of the method and device in the embodiment of the present application is not limited to performing functions in the order shown or discussed, and may also include performing functions in a substantially simultaneous manner or in the opposite order according to the functions involved, for example, the described method may be performed in an order different from that described, and various steps may also be added, omitted, or combined. In addition, the features described with reference to certain examples may be combined in other examples.

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

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

[0187] In the description of this specification, the description with reference to the terms "one embodiment", "some embodiments", "illustrative embodiments", "examples", "specific examples", or "some examples" means that the specific features, structures, materials, or characteristics described in conjunction with the embodiment or example are included in at least one embodiment or example of the present application. In this specification, the schematic representation of the above terms does not necessarily refer to the same embodiment or example. Moreover, the specific features, structures, materials, or characteristics described may be combined in any one or more embodiments or examples in a suitable manner.

[0188] Although the embodiments of the present application have been shown and described, those skilled in the art will appreciate that various changes, modifications, substitutions and variations may be made to the embodiments without departing from the principles and spirit of the present application, and that the scope of the present application is defined by the claims and their equivalents.

Claims

1. An image processing method, characterized in that: include: Clustering each pixel at least once according to a pixel value of each pixel in the first image until at least one first cluster category where the target object in the first image belongs and at least one second cluster category where other objects belong belong to completely different cluster categories; The color feature of the target object is obtained according to the pixel value of each pixel in the first cluster category.

2. The image processing method according to claim 1, characterized in that: The clustering of each pixel point at least once according to the pixel value of each pixel point in the first image comprises: Clustering each pixel in the first image according to the number of clusters of this clustering and the pixel value of each pixel in the first image to obtain at least one cluster category corresponding to this clustering; Set different cluster colors for each cluster category; Displaying a first interface; the first interface includes a first control and a second image of the same size as the first image, the color of each pixel in the second image is the cluster color corresponding to the pixel at the same position in the first image, and the first control is used to represent that at least one color corresponding to the target object and at least one color corresponding to other objects are completely different colors; In response to obtaining a trigger operation on the first control, it is determined to stop clustering.

3. The image processing method according to claim 2, characterized in that: The first interface also includes a second control; the second control is used to indicate that at least one color corresponding to the target object and at least one color corresponding to other objects have a common color; After displaying the first interface, the method further includes: In response to obtaining a trigger operation on the second control, obtaining the number of clusters for the next clustering according to the number of clusters of the current clustering and the target value; The number of clusters in the next clustering is greater than the number of clusters in the current clustering.

4. The image processing method according to claim 2, characterized in that: After setting different cluster colors for each cluster category, the method further includes: Create a mapping relationship between cluster categories and corresponding cluster colors; Before obtaining the color feature of the target object according to the pixel value of each pixel point in the first cluster category, the method further includes: In response to obtaining a user's selection operation on at least one color in the second image, determining the color selected by the user; According to the mapping relationship between cluster categories and cluster colors, determine the cluster category corresponding to the color selected by the user; It is determined that the cluster category corresponding to the color selected by the user is the first cluster category corresponding to the target object.

5. The image processing method according to claim 1, characterized in that: After obtaining the color feature of the target object, the method further includes: Acquire a third image; the third image includes the target object; The target object in the third image is determined according to the color feature of the target object.

6. The image processing method according to any one of claims 1 to 5, characterized in that: The pixel value includes a plurality of color channels; The step of obtaining the color feature of the target object according to the pixel value of each pixel point in the first cluster category includes: Determine the mean and variance of all pixels in the first cluster category in each color channel; The color feature of the target object is determined according to the mean and the variance of each color channel.

7. The image processing method according to claim 6, characterized in that: The color feature corresponds to a channel range of each color channel; Determining the color feature of the target object according to the mean and the variance of each color channel includes: For each color channel, a maximum value and a minimum value of a channel range of each color channel are determined respectively according to the mean value, the variance and the target coefficient of the color channel.

8. An image processing device, characterized in that: include: A first processing module, configured to cluster each pixel at least once according to a pixel value of each pixel in the first image, until at least one first cluster category where the target object in the first image belongs and at least one second cluster category where other objects belong belong to completely different cluster categories; The second processing module is used to obtain the color feature of the target object according to the pixel value of each pixel point in the first cluster category.

9. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the program, the image processing method according to any one of claims 1 to 7 is implemented.

10. A non-transitory computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the image processing method according to any one of claims 1 to 7 is implemented.