Subject object detection method, device, computer equipment and storage medium

By converting RGB images to HSV and employing clustering and voting methods, the method addresses the challenge of low accuracy in convolutional neural networks, enhancing subject object detection precision and robustness.

CN113920528BActive Publication Date: 2024-12-24SF TECH CO LTD
View PDF 3 Cites 0 Cited by

Patent Information

Application Number
CN202010651437.7
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2020-07-08
Publication Date
2024-12-24
Estimated Expiration
2040-07-08

AI Technical Summary

Technical Problem

Existing subject object detection methods based on convolutional neural networks require large amounts of training data, making it difficult to achieve strong generalization and result in low accuracy due to the diversity of subject object categories.

Method used

The method involves converting an RGB image into multiple HSV images of different sizes, determining feature vectors for each pixel, clustering these pixels using K-means, and resetting the HSV images to match the RGB image size, allowing for accurate detection by voting on pixel categories.

Benefits of technology

This approach enhances subject object detection accuracy by leveraging HSV color space features and clustering techniques, improving detection precision and robustness across varying image sizes.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN113920528B_ABST
    Figure CN113920528B_ABST
Patent Text Reader

Abstract

The present application relates to a subject object detection method, device, computer equipment and storage medium. The method comprises: obtaining multiple HSV images of different sizes; the multiple HSV images are obtained from the same RGB image; determining the feature vector corresponding to each pixel in each HSV image; clustering each pixel in each HSV image according to the corresponding feature vector to obtain the cluster category corresponding to each pixel; resetting each HSV image to a target image with the same size as the RGB image; obtaining the category of the corresponding pixel in the RGB image according to the cluster category corresponding to each pixel in each target image; extracting the foreground area corresponding to the subject object from the RGB image based on the category of each pixel in the RGB image. The use of this method can improve the detection accuracy of the subject object.
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 a subject object detection method, apparatus, computer equipment and storage medium. Background Art

[0002] With the continuous development of computer technology, Internet of Things technology and artificial intelligence technology, subject detection technology, as an important branch of computer vision, has been widely used in various fields such as logistics monitoring, product recommendation and new retail. The task of subject detection is to detect the subject object as the foreground from the background of the image. Due to the complexity of the foreground, how to detect the subject object from the image is a problem worthy of attention.

[0003] At present, subject object detection is usually performed based on convolutional neural networks. However, the subject object detection method based on convolutional neural networks requires the collection of a large amount of training data to train the convolutional neural network. Since the categories of subject objects in images are diverse, it is difficult to collect training data, and thus it is difficult to form a convolutional neural network with strong generalization ability, resulting in low subject object detection accuracy. Summary of the invention

[0004] Based on this, it is necessary to provide a subject object detection method, device, computer equipment and storage medium that can improve the accuracy of subject object detection in response to the above technical problems.

[0005] A subject object detection method, the method comprising:

[0006] Acquire multiple HSV images of different sizes; the multiple HSV images are obtained from the same RGB image;

[0007] Determine the eigenvector corresponding to each pixel in each HSV image;

[0008] Clustering each pixel in each HSV image according to the corresponding feature vector to obtain a clustering category corresponding to each pixel;

[0009] Reset each HSV image to a target image with the same size as the RGB image;

[0010] According to the clustering category corresponding to each pixel point in each of the target images, obtaining the category of the corresponding pixel point in the RGB image;

[0011] Based on the category of each pixel in the RGB image, a foreground area corresponding to the main object is extracted from the RGB image.

[0012] In one embodiment, the step of acquiring a plurality of HSV images of different sizes comprises:

[0013] Get RGB image;

[0014] Resetting the RGB image into a plurality of RGB sub-images of different sizes;

[0015] Convert each RGB sub-image to its corresponding HSV image.

[0016] In one embodiment, clustering each pixel in each HSV image according to the corresponding feature vector to obtain the cluster category corresponding to each pixel includes:

[0017] For each HSV image, according to the feature vector corresponding to each pixel point in the HSV image, binary clustering is performed on each pixel point in the HSV image according to the K-means clustering method to obtain the cluster category corresponding to each pixel point in the HSV image.

[0018] In one embodiment, obtaining the category of the corresponding pixel point in the RGB image according to the cluster category corresponding to each pixel point in each target image includes:

[0019] According to the clustering categories corresponding to the pixels at the same position in each of the target images, the categories of the pixels at the same position in the RGB image are voted to obtain the category of each pixel in the RGB image.

[0020] In one embodiment, determining the feature vector corresponding to each pixel in each HSV image includes:

[0021] For each pixel in each HSV image, the gradient distribution and the mean difference distribution are calculated for each color component.

[0022] Based on the gradient distribution and the mean difference distribution corresponding to each pixel point on each color component, a corresponding feature vector is obtained.

[0023] In one embodiment, the step of determining the gradient distribution corresponding to each pixel point on each color component includes:

[0024] For each HSV image, each pixel in the HSV image is taken as the central pixel in turn, and on each color component, the corresponding normalized difference is obtained based on each neighborhood pixel of the central pixel and the component value corresponding to the central pixel on the color component, and the gradient distribution of the central pixel on the color component is obtained based on the normalized difference.

[0025] In one embodiment, the step of determining the distribution of the mean difference value corresponding to each pixel point on each color component includes:

[0026] For each HSV image, on each color component, the corresponding component mean is obtained based on the component value of each pixel in the HSV image on the color component, and based on the component value of each pixel in the HSV image on the color component and the component mean, the corresponding mean difference distribution of each pixel on the color component is obtained.

[0027] A subject object detection device, the device comprising:

[0028] An acquisition module, used for acquiring a plurality of HSV images of different sizes; the plurality of HSV images are obtained from the same RGB image;

[0029] A determination module is used to determine the feature vector corresponding to each pixel in each HSV image;

[0030] A clustering module, used for clustering each pixel in each HSV image according to the corresponding feature vector to obtain a clustering category corresponding to each pixel;

[0031] A reset module, used for resetting each HSV image to a target image with the same size as the RGB image;

[0032] An obtaining module, used for obtaining the category of the corresponding pixel point in the RGB image according to the cluster category corresponding to each pixel point in each target image;

[0033] The extraction module is used to extract the foreground area corresponding to the main object from the RGB image based on the category of each pixel point in the RGB image.

[0034] A computer device includes a memory and a processor, wherein the memory stores a computer program, and the processor implements the steps in the above-mentioned method embodiments when executing the computer program.

[0035] A computer-readable storage medium stores a computer program, which implements the steps in the above-mentioned method embodiments when executed by a processor.

[0036] The above-mentioned subject object detection method, device, computer equipment and storage medium, for multiple HSV images obtained from the same RGB image and with different sizes, respectively determine the feature vector of each pixel in each HSV image in the HSV color space, cluster the feature vectors corresponding to each pixel in each HSV image to obtain the cluster category corresponding to each pixel, and reset each HSV image to a target image with the same size as the corresponding RGB image, and the cluster category corresponding to each pixel in each target image is determined by the cluster category corresponding to the corresponding pixel in the corresponding HSV image, thereby respectively determining the cluster category corresponding to each pixel in the same RGB image in multiple sizes in the HSV color space, and determining the category of each pixel in the RGB image based on the cluster category corresponding to each pixel in the RGB image at multiple sizes, and then detecting and extracting the subject object in the RGB image based on the category of each pixel in the RGB image, which can improve the detection accuracy of the subject object. BRIEF DESCRIPTION OF THE DRAWINGS

[0037] Figure 1 is a schematic diagram of a flow chart of a subject object detection method in an embodiment;

[0038] Figure 2 A schematic diagram of determining a foreground area in a corresponding RGB image through a voting mechanism based on respective prediction images of a plurality of HSV images in one embodiment;

[0039] Figure 3 is a schematic diagram of resetting an RGB image into a plurality of RGB sub-images of different sizes in one embodiment;

[0040] Figure 4 A schematic diagram of the structure of an HSV color space model in one embodiment;

[0041] Figure 5 A schematic diagram of a neighborhood feature block of a central pixel in one embodiment;

[0042] Figure 6 is a schematic diagram of the principle of a subject object detection method in an embodiment;

[0043] Figure 7 is a structural block diagram of a subject object detection device in one embodiment;

[0044] Figure 8 FIG. 4 is a diagram showing the internal structure of a computer device in one embodiment. DETAILED DESCRIPTION

[0045] In order to make the purpose, technical solution and advantages of the present application more clearly understood, the present application is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application.

[0046] In one embodiment, Figure 1 As shown, a subject object detection method is provided. This embodiment takes the method applied to a terminal as an example for illustration. It can be understood that the method can also be applied to a server, and can also be applied to a system including a terminal and a server, and is implemented through the interaction between the terminal and the server. In this embodiment, the method includes the following steps:

[0047] Step 102, obtaining a plurality of HSV images of different sizes; the plurality of HSV images are obtained from the same RGB image.

[0048] Among them, RGB image refers to an image represented by three channels or color components of R (red), G (green) and B (blue) in the RGB color space. HSV image refers to an image represented by three color components of H (Hue), S (Saturation) and V (Value) in the HSV color space. RGB image and HSV image can be converted to each other. RGB image can be converted to HSV image, and accordingly, HSV image can be converted to RGB image.

[0049] Specifically, when the subject object detection condition is met, the terminal obtains multiple HSV images of different sizes obtained by transforming the same RGB image. The subject object detection condition refers to the condition or basis for triggering the subject object detection operation, such as detecting the subject object detection trigger operation triggered by the user, and obtaining the RGB image of the subject object to be detected, etc., which is not specifically limited here.

[0050] In one embodiment, the terminal obtains an RGB image of the subject object to be detected, and processes the obtained RGB image to obtain multiple HSV images of different sizes. The terminal may reset the RGB image into multiple RGB sub-images of different sizes, and convert the multiple RGB sub-images into corresponding HSV images respectively. The terminal may also convert the RGB image into a corresponding HSV image, and reset the HSV image into multiple HSV images of different sizes.

[0051] In one embodiment, the terminal acquires RGB images through an image acquisition device. The image acquisition device is, for example, a camera or a webcam. The image acquisition device can be built into the terminal as a component, or can be connected to the terminal as an independent device. The image acquisition device and the terminal can communicate via wired or wireless means.

[0052] Step 104, determining the feature vector corresponding to each pixel in each HSV image.

[0053] The feature vector is a vector used to represent the feature information of a pixel point in the corresponding HSV image.

[0054] Specifically, after acquiring multiple HSV images of different sizes, the terminal determines the feature vector corresponding to each pixel in the HSV image based on the pixel value of each pixel in the HSV image. The pixel value of the pixel includes the component values ​​corresponding to the three color components of the pixel in the HSV color space.

[0055] In one embodiment, for each HSV image, the terminal calculates the corresponding HSV gradient distribution and HSV mean difference distribution for each pixel point distribution in the HSV image, and obtains the corresponding feature vector based on the HSV gradient distribution and the HSV mean difference distribution. The HSV gradient distribution includes the gradient distribution of the pixel point on each color component in the HSV color space, and the HSV mean difference distribution includes the mean difference distribution of the pixel point on each color component in the HSV color space. Each gradient distribution and mean difference distribution are respectively used as an eigenvalue in the feature vector. Thus, each pixel point corresponds to a 6-dimensional feature vector.

[0056] Step 106: cluster each pixel in each HSV image according to the corresponding feature vector to obtain a cluster category corresponding to each pixel.

[0057] The cluster category refers to the category to which the pixel points determined by clustering belong, and the cluster category may specifically include foreground pixel points and background pixel points.

[0058] Specifically, for each HSV image, after obtaining the feature vector corresponding to each pixel in the HSV image, the terminal clusters the pixels in the HSV image according to their respective corresponding feature vectors to obtain the clustering category corresponding to each pixel in the HSV image.

[0059] In one embodiment, for each HSV image, the terminal performs binary classification clustering on the pixels in the HSV image according to the feature vector of each pixel in the HSV image to obtain the cluster category corresponding to each pixel.

[0060] In one embodiment, for each HSV image, after obtaining the clustering category corresponding to each pixel point in the HSV image, the terminal can obtain a prediction map including a foreground area and a background area corresponding to the HSV image based on the clustering category of each pixel point in the HSV image.

[0061] In one embodiment, step 106 includes: for each HSV image, according to the feature vector corresponding to each pixel point in the HSV image, performing binary clustering on each pixel point in the HSV image according to the K-means clustering method to obtain the cluster category corresponding to each pixel point in the HSV image.

[0062] Among them, binary clustering refers to a clustering method with two clustering categories. Specifically, for each HSV image, after obtaining the feature vector corresponding to each pixel point in the HSV image, the terminal performs binary K-means clustering on each pixel point in the HSV image according to the feature vector corresponding to each pixel point in the HSV image, and obtains a binary clustering result, that is, obtains the clustering category corresponding to each pixel point in the HSV image. Based on the feature vector of each pixel point in the HSV image, the terminal clusters each pixel point according to the existing K-means clustering method, which will not be repeated here.

[0063] The terminal obtains the clustering category corresponding to each pixel point in the HSV image according to the above clustering method, that is, the pixels in the HSV image are clustered into two pixel point sets according to the above clustering method. Furthermore, the terminal respectively counts the number of edge pixels included in each of the two pixel point sets corresponding to the HSV image, and determines the pixel point set including a larger number of edge pixels as the pixel point set corresponding to the background area, that is, the clustering category of each pixel point in the pixel point set including a larger number of edge pixels is determined as a background pixel point, and the clustering category of each pixel point in the pixel point set including a smaller number of edge pixels is determined as a foreground pixel point. The edge pixel point in this embodiment refers to the pixel point at the edge of the HSV image. Specifically, whether each pixel point is an edge pixel point can be determined according to the pixel point position of each pixel point in the HSV image.

[0064] In the above embodiment, the terminal clusters each pixel in the HSV image into two pixel sets through a binary clustering method, so as to detect the background area and the foreground area from the HSV image based on the two pixel sets, and then extract the corresponding main object based on the foreground area.

[0065] Step 108, resetting each HSV image to a target image having the same size as the RGB image.

[0066] Specifically, the terminal resets each HSV image in a plurality of HSV images of different sizes to a target image having a size consistent with that of the corresponding RGB image. The terminal resets each HSV image to a target image having a size consistent with that of the corresponding RGB image according to the image size resetting method provided in one or more embodiments of the present application, which will not be described in detail here.

[0067] In one embodiment, when the terminal resets each HSV image to a target image having a size consistent with that of the corresponding RGB image, the cluster category corresponding to each pixel in the corresponding target image is determined according to the cluster category corresponding to each pixel in the HSV image. For example, if four pixels in the HSV image correspond to one pixel in the target image, the cluster category with a larger proportion among the four pixels is determined as the cluster category of the corresponding pixel in the target image.

[0068] Step 110, obtaining the category of the corresponding pixel in the RGB image according to the cluster category corresponding to each pixel in each target image.

[0069] Specifically, after obtaining the clustering category corresponding to each pixel in each target image, the terminal votes for the corresponding pixels in the multiple target images according to the clustering category corresponding to each pixel, and obtains the category corresponding to the corresponding pixel in the corresponding RGB image according to the voting result.

[0070] For example, if the voting result of the corresponding pixels in the multiple target images is that the proportion of pixels in the cluster category of foreground pixels in the multiple pixels is greater than or equal to the preset ratio threshold, the category of the corresponding pixel in the corresponding RGB image is determined as a foreground pixel, otherwise, the category of the corresponding pixel in the corresponding RGB image is determined as a background pixel. The pixel ratio refers to the ratio of the number of pixels in the cluster category of foreground pixels in the multiple pixels to the total number of pixels in the multiple pixels. The preset ratio threshold can be customized according to actual conditions, such as 0.7.

[0071] In one embodiment, step 110 includes: voting on the categories of the pixels at the same position in the RGB image according to the cluster categories corresponding to the pixels at the same position in each target image, to obtain the category of each pixel in the RGB image.

[0072] Specifically, the terminal synchronously traverses each pixel point in the multiple target images, that is, synchronously traverses the pixel points at the same position in the multiple target images, and votes for the multiple pixel points synchronously traversed and at the same position from the multiple target images according to the clustering category corresponding to each pixel point, and then determines the category of the pixel point at the same position in the corresponding RGB image according to the voting result, so as to vote for the category of the pixel point at the same position in the corresponding RGB image based on the clustering category corresponding to the multiple pixel points synchronously traversed and at the same position from the multiple target images, and obtain the category corresponding to each pixel point in the RGB image.

[0073] In one embodiment, when the voting results obtained based on the clustering categories corresponding to multiple pixel points simultaneously traversed from multiple target images and located at the same position are that the proportion of pixel points whose clustering category is foreground pixel points in the multiple pixel points is greater than or equal to a preset proportion threshold, the category of the pixel point at the same position in the corresponding RGB image is determined to be a foreground pixel point.

[0074] For example, suppose there are N HSV images of different sizes. According to the above method, the target images corresponding to the N HSV images can be obtained. The clustering categories corresponding to the pixels at the same position in the N target images are all used as the prediction results of the categories corresponding to the pixels at the same position in the corresponding RGB image. In this way, each pixel in the RGB image corresponds to N prediction categories. According to the above voting method, the N prediction categories corresponding to each pixel in the RGB image are voted, and the category of each pixel is determined according to the voting results. When the proportion of pixels belonging to foreground pixels in the N prediction categories corresponding to a certain pixel is greater than or equal to the preset ratio threshold, the category of the pixel is determined to be a foreground pixel, that is, the position of the pixel in the RGB image is determined to be a foreground pixel.

[0075] Figure 2 FIG. 1 is a schematic diagram showing a principle for determining a foreground area in a corresponding RGB image through a voting mechanism based on respective prediction images of multiple HSV images in one embodiment. Figure 2 As shown, after obtaining the prediction images corresponding to multiple HSV images of different sizes, the multiple prediction images are reset to target images with the same size as the corresponding RGB images, and the clustering categories corresponding to the pixels at the same position in the multiple target images are voted. If the voting result is that the pixel ratio of foreground pixels in the multiple pixels is greater than or equal to the preset ratio threshold, the category of the pixel at the same position in the corresponding RGB image is determined to be a foreground pixel. Thus, the category of each pixel in the RGB image can be determined in this way, so that the foreground area and the background can be distinguished from the RGB image according to the category of each pixel, so that the main object can be detected from the RGB image based on the foreground area. Figure 2 The area indicated by reference numeral 202 is the foreground area, and the area indicated by reference numeral 204 is the background area. Figure 2 Size shown 1 、size 2 、…、size m With size n They respectively represent one of the multiple prediction images of different sizes, and 0 and 1 are used to represent the background pixels and foreground pixels in the cluster category respectively.

[0076] Step 112: extracting a foreground area corresponding to the main object from the RGB image based on the category of each pixel in the RGB image.

[0077] Specifically, after the terminal determines the category of each pixel in the RGB image in the above manner, it determines the foreground area from the RGB image according to the categories corresponding to each pixel, and extracts the corresponding main object from the RGB image by extracting the foreground area, so as to realize the main object detection in the RGB image. It can be understood that the foreground area is an area composed of pixel points of the category of foreground pixel points in the RGB image, and correspondingly, the background area is an area composed of pixel points of the category of background pixel points in the RGB image.

[0078] The above-mentioned main object detection method, for multiple HSV images obtained from the same RGB image and with different sizes, determines the feature vector of each pixel in each HSV image in the HSV color space, clusters the feature vectors corresponding to each pixel in each HSV image to obtain the cluster category corresponding to each pixel, and resets each HSV image to a target image with the same size as the corresponding RGB image, and the cluster category corresponding to each pixel in each target image is determined by the cluster category corresponding to the corresponding pixel in the corresponding HSV image, thereby determining the cluster category corresponding to each pixel in the same RGB image in multiple sizes in the HSV color space, and determining the category of each pixel in the RGB image based on the cluster category corresponding to the pixel in the RGB image at multiple sizes, and then detecting and extracting the main object in the RGB image based on the category of each pixel in the RGB image, which can improve the detection accuracy of the main object.

[0079] In one embodiment, step 102 includes: acquiring an RGB image; resetting the RGB image into a plurality of RGB sub-images of different sizes; and converting each RGB sub-image into a corresponding HSV image.

[0080] The size of the image can be represented by the number of pixels in the image. For example, if the number of pixels on the long side and the short side of the image are 400 and 200 respectively, the size of the image is 400*200, where “*” represents multiplication.

[0081] Specifically, the terminal obtains an RGB image of the subject object to be detected, resets the size of the RGB image to obtain multiple RGB sub-images of different sizes, and converts each RGB sub-image into a corresponding HSV image to obtain multiple HSV images corresponding to the RGB image and of different sizes. The terminal converts each RGB sub-image into a corresponding HSV image according to an existing color space conversion method, which will not be repeated here.

[0082] In one embodiment, the terminal scales the size of the RGB image in a geometric scaling manner according to a preconfigured size scaling strategy to obtain multiple RGB sub-images of different sizes. The terminal scales the long side and the short side of the RGB image in equal proportions in a geometric scaling manner. The terminal also determines the scaling ratio of two adjacent RGB sub-images in a geometric scaling manner. The preconfigured size scaling strategy, for example, sets the number of long-side pixels of the RGB sub-image with the largest size, and sequentially determines the number of long-side pixels of each other RGB sub-image in a geometric scaling manner, and determines the number of short-side pixels of each RGB sub-image in a geometric scaling manner. Further, the number of RGB sub-images can be directly set, or the number of long-side pixels of the smallest RGB sub-image can be set, so as to determine the number of RGB sub-images in a geometric scaling manner based on the number of long-side pixels of the largest and smallest RGB sub-images.

[0083] When the terminal determines the number of short-side pixels of the RGB sub-image in geometric scaling based on the number of long-side pixels of the RGB sub-image, the long-side scaling ratio of the RGB sub-image is consistent with the short-side scaling ratio, and the long-side scaling ratio refers to the ratio of the number of long-side pixels of the RGB sub-image to the number of long-side pixels of the corresponding RGB image. Correspondingly, the short-side scaling ratio refers to the ratio of the number of short-side pixels of the RGB sub-image to the number of short-side pixels of the corresponding RGB image. When the terminal determines the number of long-side pixels of each other RGB sub-image in geometric scaling based on the number of long-side pixels of the largest RGB sub-image, the number of long-side pixels of any two adjacent RGB sub-images is in a preset ratio, such as 1.5.

[0084] For example, the number of pixels on the long side of the RGB sub-image with the largest size is set to 400, and the number of pixels on the long side of each other RGB sub-image is determined in descending order based on the number of pixels on the long side in a preset ratio. Assume that the preset ratio is 1.5, and also assume that the set number of RGB sub-images is 10, or the number of pixels on the long side of the RGB sub-image with the smallest size is greater than or equal to 40. If the RGB sub-image with the largest size is recorded as the first RGB sub-image, the number of pixels on the long side of the second RGB sub-image is 400 / 1.5, and the number of pixels on the long side of the third RGB sub-image is 400 / (1.5*1.5), and so on, until the number of pixels on the long side of each of the 10 RGB sub-images is obtained, or until the RGB sub-image with the smallest size and the number of pixels on the long side is greater than or equal to 40.

[0085] Based on the number of pixels on the long side of each RGB sub-image and the corresponding RGB image, and the number of pixels on the short side of the RGB image, the number of pixels on the short side of the RGB sub-image can be determined in a proportional scaling manner, thereby determining the size of each RGB sub-image. Further, for each RGB sub-image, based on the size of the RGB image and the RGB sub-image, and the pixel value of each pixel in the RGB image, the pixel value of each pixel in the RGB sub-image can be determined. If the RGB image is reduced to an RGB sub-image, it is necessary to perform pixel culling on the RGB image. If the RGB image is enlarged to an RGB sub-image, it is necessary to perform pixel filling on the RGB image. Both pixel filling and pixel culling can be achieved by linear interpolation or taking the average of adjacent pixels, which will not be listed here. Taking pixel culling as an example, if three pixels need to be removed from every four pixels in the RGB image, the pixel average of the four pixels can be used as the pixel value of the corresponding pixel in the RGB sub-image, and the pixel value of each pixel includes the component values ​​of three color components or channels.

[0086] Figure 3 FIG. 1 is a schematic diagram of resetting an RGB image into a plurality of RGB sub-images of different sizes in one embodiment. Figure 3 As shown, the RGB image is reset into multiple RGB sub-images of different sizes, such as Figure 3 Size shown 1 、size 2 、…、size m With size n The corresponding images.

[0087] In the above embodiment, multiple HSV images of different sizes are obtained based on the same RGB image, so that in the HSV color space, main object detection at different sizes can be implemented based on the multiple HSV images of different sizes, thereby obtaining detection results at different detection finenesses, so that the main object can be accurately extracted from the corresponding RGB image by combining the multiple detection results.

[0088] In one embodiment, step 104 includes: calculating the gradient distribution and the mean difference distribution for each pixel in each HSV image on each color component; and obtaining a corresponding feature vector based on the gradient distribution and the mean difference distribution corresponding to each pixel on each color component.

[0089] Specifically, for each HSV image, the terminal calculates the corresponding gradient distribution and mean difference distribution for each pixel in the HSV image on each color component in the HSV color space according to the component value of each pixel in the HSV image on the color component, and obtains the feature vector corresponding to the pixel based on the gradient distribution and mean difference distribution of each pixel on each color component.

[0090] In one embodiment, the gradient distribution of a pixel point can be understood as the gradient eigenvalue of the pixel point, and the gradient eigenvalue can be used to distinguish the object boundary or object boundary. The larger the gradient eigenvalue, the more likely it is the object boundary or object boundary. The mean difference distribution of a pixel point can be understood as the mean difference eigenvalue of the pixel point, and the mean difference eigenvalue can be used to determine the pixel points inside the boundary.

[0091] Figure 4 FIG. 1 is a schematic diagram of the structure of an HSV color space model in an embodiment. Figure 4 As shown in the figure, the HSV color space model includes three color components: H (Hue), S (Saturation) and V (Value). The hue is circularly symmetrically distributed, with a value range of 0° to 360°, a saturation value range of 0 to 1, and a value range of 0 to 1. Compared with the RGB color space model, the HSV color space model can more intuitively express the brightness, hue, and vividness of colors, facilitate the contrast between colors, and better express the boundary information of objects in the image. Therefore, the RGB image is converted into an HSV image so that the foreground and background can be better distinguished in the HSV color space.

[0092] In the above embodiment, the feature vector of each pixel in the HSV image is determined based on the gradient distribution and the mean difference distribution of each pixel in each color component, so that the foreground area and the background area in the HSV image can be clustered based on the feature vector of each pixel in the HSV image, that is, it can be determined whether each pixel is a foreground pixel or a background pixel.

[0093] In one embodiment, the step of determining the gradient distribution corresponding to each pixel on each color component includes: for each HSV image, taking each pixel in the HSV image as the central pixel in turn, and on each color component, obtaining a corresponding normalized difference based on each neighborhood pixel of the central pixel and the component value corresponding to the central pixel on the color component, and obtaining the gradient distribution of the central pixel on the color component based on the normalized difference.

[0094] Specifically, for each HSV image, the terminal takes each pixel in the HSV image as the central pixel in turn, and performs normalized difference processing on each color component with the component value of the current central pixel on the color component and the component value of each neighboring pixel of the central pixel on the color component, respectively, to obtain the normalized difference between the central pixel and each neighboring pixel on each color component, that is, to obtain multiple normalized differences corresponding to the central pixel on each color component. Furthermore, the terminal obtains the gradient distribution of the central pixel on each color component based on the multiple normalized differences corresponding to the current central pixel on each color component.

[0095] In one embodiment, for each central pixel in the HSV image, the terminal selects a preset number of neighboring pixels from the HSV image, and the preset number of neighboring pixels and the corresponding central pixel form a neighborhood feature block corresponding to the central pixel, and calculates the normalized difference between each central pixel and each neighboring pixel in the neighborhood feature block to which it belongs, on each color component. For the central pixel inside the HSV image, 8 neighboring pixels are taken to form a 3*3 neighborhood feature block, and for the central pixel at the edge of the HSV image, 5 neighborhood pixels or 3 neighborhood pixels are taken to form the corresponding neighborhood feature block.

[0096] Figure 5 FIG. 1 is a schematic diagram of a neighborhood feature block of a central pixel in an embodiment. Figure 5 As shown, the pixel at the center position is the center pixel, and the 8 pixels adjacent to the center pixel are the 8 neighborhood pixels of the center pixel. The center pixel and the corresponding 8 neighborhood pixels constitute a 3*3 neighborhood feature block.

[0097] In one embodiment, the terminal calculates the normalized difference between the central pixel and each neighboring pixel on each color component according to the following mapping relationship.

[0098] Hue diff =min(abs(C Hue -N Hue ),360-abs(C Hue -N Hue )) / 360

[0099] Saturation diff =abs(C Saturation -N Saturation )

[0100] Value diff =abs(C Value -N Value )

[0101] Among them, C Hue With N Hue Respectively represent the component values ​​of the central pixel and a single neighboring pixel in the color component of hue. diff Represents the normalized difference between the center pixel and a single neighboring pixel in the color component of hue, C Saturation With N Saturation Respectively represent the component values ​​of the central pixel and a single neighboring pixel on the color component of saturation. diff Represents the normalized difference between the central pixel and a single neighboring pixel in the color component of saturation, C Value With N Value Respectively represent the component values ​​of the central pixel and a single neighboring pixel in the color component of brightness Value. diff It represents the normalized difference between the central pixel and a single neighboring pixel in the color component of brightness Value. abs(*) means taking the absolute value of object *, and min(x,y) means taking the smaller value of x and y.

[0102] In one embodiment, after obtaining the multiple normalized difference values ​​corresponding to the central pixel on each color component, the terminal votes for the multiple normalized difference values ​​corresponding to the central pixel on each color component, and determines the gradient distribution of the central pixel on the color component according to the voting results. Specifically, the terminal divides the preset numerical interval into a preset number of equal parts, obtains the preset number of sub-intervals with the same interval length, and determines the index number of each sub-interval. Further, for each central pixel, the multiple normalized difference values ​​corresponding to the central pixel on each color component are voted in turn in the multiple sub-intervals, and when it is determined that the normalized difference value is in a certain sub-interval, the voting value of the sub-interval is increased by one, and when the voting of the multiple normalized difference values ​​on a single color component ends, the index number corresponding to the sub-interval with the highest voting value is determined as the gradient distribution of the central pixel on the color component. It can be understood that when there are multiple sub-intervals with the highest voting value, the largest index number among the multiple sub-intervals is determined as the gradient distribution of the central pixel on the corresponding color component.

[0103] The gradient distribution of each pixel on the three color components constitutes the 3D gradient vector corresponding to the pixel. The 3D gradient vector can be expressed as [Hue grad ,Saturation grad ,Value grad ], among which Hue grad ,Saturation grad ,Valuegrad Respectively represent the gradient distribution of the pixel in the color component of hue, saturation and lightness. Since the value range of each normalized difference is [0, 1], the preset value interval can be set to [0, 1]. The preset number can be customized, such as 20.

[0104] For example, assuming that the preset numerical interval is [0, 1] and the preset number is 20, the interval length of each subinterval is 0.05, and the index numbers of each subinterval are 1 to 20. Taking the central pixel with 8 neighboring pixels as an example, the 8 normalized difference values ​​corresponding to the central pixel on each color component can be determined in the above manner. Taking the hue color component as an example, the 8 normalized difference values ​​corresponding to the central pixel on the hue color component are voted in 20 subintervals in turn. Assuming that the voting results are: 3 normalized difference values ​​are in the subinterval with index number 2, 2 normalized difference values ​​are in the subinterval with index number 6, and the other 3 normalized difference values ​​are in three subintervals, it can be determined that the gradient distribution of the central pixel on the hue color component is 2.

[0105] In the above embodiment, based on the component values ​​of each pixel in the HSV image and each field pixel of the pixel on each color component, a plurality of normalized difference values ​​corresponding to the pixel on each color component are obtained respectively, and the gradient distribution of the pixel on the corresponding color component is determined based on the plurality of normalized difference values, so that the foreground and the background can be accurately distinguished from the HSV image based on the gradient distribution.

[0106] In one embodiment, the step of determining the mean difference value distribution corresponding to each pixel point on each color component includes: for each HSV image, on each color component, obtaining the corresponding component mean based on the component value of each pixel point in the HSV image on the color component, and obtaining the mean difference value distribution corresponding to each pixel point on the color component based on the component value and component mean of each pixel point in the HSV image on the color component.

[0107] Specifically, for each HSV image, the terminal calculates the component mean of the HSV image on each color component based on the component value of each pixel in the HSV image on the color component, and on each color component, according to the component value of each pixel in the HSV image on the color component and the component mean of the HSV image on the color component, obtains the corresponding mean difference value distribution of the pixel on the color component.

[0108] In one embodiment, for each HSV image, the terminal averages the component values ​​of each pixel in the HSV image on the color component according to the color component to obtain the corresponding component mean. The terminal can specifically calculate the component mean of the HSV image on each color component according to the following mapping relationship.

[0109]

[0110]

[0111]

[0112] Among them, Mean Hue , Mean Saturation , Mean Value Respectively represent the component means of the HSV image in the color component of hue, saturation and brightness. i,j , Saturation i,j ,Value i,j Respectively represent the component means of the hue, saturation and brightness of the pixel point in the i-th row and j-th column of the HSV image, respectively. pixel Represents the total number of pixels in the HSV image. They respectively represent the sum of the component values ​​of hue, saturation and brightness of each pixel in the HSV image within the range of the HSV image.

[0113] In one embodiment, on each color component, the terminal calculates the mean difference between the component value of each pixel point in the HSV image on the color component and the component mean value of the HSV image on the color component to obtain a corresponding mean difference value distribution. The terminal can specifically calculate the mean difference value distribution corresponding to each pixel point in the HSV image on each color component according to the following mapping relationship.

[0114] Hue Mean-sub =min(abs(C Hue -Mean Hue ),360-abs(C Hue -Mean Hue )) / 360

[0115] Saturation Mean-sub =abs(C Saturation -Mean Saturation )

[0116] Value Mean-sub =abs(C Value -Mean Value )

[0117] Among them, C Hue , C Saturation , C Value Respectively represent the component values ​​of the pixel points in the HSV image in the color component of hue, saturation and brightness, Mean Hue , Mean Saturation , Mean Value Respectively represent the component means of the HSV image in the color component of hue, saturation and brightness. Mean-sub , Saturation Mean-sub ,Value Mean-sub They represent the mean difference distribution of the hue, saturation and brightness of the pixels in the HSV image respectively. abs(*) means taking the absolute value of the object *, and min(x,y) means taking the smaller value of x and y.

[0118] It can be understood that the mean difference distribution of each pixel in the HSV image on the three color components constitutes the 3D mean difference vector corresponding to the pixel. The 3D mean difference vector can be expressed as [Hue Mean-sub ,Saturation Mean-sub ,Value Mean-sub ]. Furthermore, according to the mean difference vector and gradient vector corresponding to each pixel point, the 6-dimensional feature vector corresponding to the pixel point can be obtained. The 6-dimensional feature vector can be expressed as [Hue grad ,Saturation grad ,Value grad ,Hue Mean-sub ,Saturation Mean-sub ,Value Mean-sub ].

[0119] In the above embodiment, a corresponding component mean is obtained based on the component value of each pixel in the HSV image on each color component, and based on the component mean on each color component and the component value of each pixel, the mean difference value distribution of each pixel on the color component is determined, so that the foreground and background can be accurately distinguished from the HSV image based on the gradient distribution and the mean difference value distribution.

[0120] Figure 6 FIG. 1 is a schematic diagram showing the principle of a subject object detection method in an embodiment. Figure 6As shown, when the main object detection process starts, an RGB image is obtained, the RGB image is reset to multiple RGB sub-images of different sizes, each RGB sub-image is converted into an HSV image in the HSV color space, and the gradient distribution and the mean difference distribution of each pixel in each HSV image on each color component are calculated in the HSV color space. Based on the gradient distribution and the mean difference distribution corresponding to each pixel, a corresponding feature vector is obtained, and K-means clustering is performed on each pixel in each HSV image based on the feature vector to obtain the clustering category of each pixel. Each HSV image is reset to a target image with the same size as the RGB image, and the clustering categories of the pixels at the same position in the multiple target images are voted to obtain the category of each pixel in the corresponding RGB image, and then the foreground area and the background area in the RGB image are extracted based on the category of each pixel to realize the main object detection in the RGB image, and the detection process ends.

[0121] In the above embodiment, the RGB image is scaled to different sizes to obtain multiple RGB sub-images of different sizes, each RGB sub-image is transformed into a corresponding HSV image, and the HSV images of different sizes are subjected to the same distribution statistics and K-means clustering and other processing procedures to obtain a prediction map corresponding to each HSV image, that is, to obtain multiple prediction maps of different sizes, and then the multiple prediction maps are rescaled to a target image of the same size as the RGB image, and voting is performed based on the clustering categories of the pixels at the same position in the multiple target images to obtain the category of each pixel in the corresponding RGB image. The HSV color space model can better express the boundary information of objects in the image, and the neighborhood gradient features and the global mean difference features are combined at different sizes to detect the main object, which can improve the detection accuracy of the subject object and improve the robustness of the main object detection method.

[0122] Furthermore, this subject object detection method is universal and can be applied not only to servers with high computing power but also to terminals. It can also flexibly select the size and number of each HSV image according to the computing power of the terminal or server that executes the subject object detection process.

[0123] It should be understood that although Figure 1 The steps in the flowchart are shown in sequence as indicated by the arrows, but these steps are not necessarily executed in the order indicated by the arrows. Unless otherwise specified in this document, there is no strict order restriction for the execution of these steps, and these steps can be executed in other orders. Moreover, Figure 1At least part of the steps may include multiple steps or multiple stages. These steps or stages are not necessarily performed at the same time, but can be performed at different times. The execution order of these steps or stages is not necessarily sequential, but can be performed in turn or alternately with other steps or at least part of the steps or stages in other steps.

[0124] In one embodiment, Figure 7 As shown, a subject object detection device 700 is provided, comprising: an acquisition module 701, a determination module 702, a clustering module 703, a reset module 704, a voting module 705 and an extraction module 706, wherein:

[0125] An acquisition module 701 is used to acquire multiple HSV images of different sizes; the multiple HSV images are obtained from the same RGB image;

[0126] A determination module 702 is used to determine a feature vector corresponding to each pixel in each HSV image;

[0127] The clustering module 703 is used to cluster each pixel in each HSV image according to the corresponding feature vector to obtain the cluster category corresponding to each pixel;

[0128] A reset module 704, used to reset each HSV image to a target image with the same size as the RGB image;

[0129] The voting module 705 is used to obtain the category of the corresponding pixel point in the RGB image according to the cluster category corresponding to each pixel point in each target image;

[0130] The extraction module 706 is used to extract the foreground area corresponding to the main object from the RGB image based on the category of each pixel point in the RGB image.

[0131] In one embodiment, the acquisition module 701 is further used to acquire an RGB image; reset the RGB image into a plurality of RGB sub-images with different sizes; and convert each RGB sub-image into a corresponding HSV image.

[0132] In one embodiment, the clustering module 703 is also used to perform binary clustering on each pixel in the HSV image according to the feature vector corresponding to each pixel in the HSV image in accordance with the K-means clustering method to obtain the cluster category corresponding to each pixel in the HSV image.

[0133] In one embodiment, the voting module 705 is further used to vote for the categories of the pixels at the same position in the RGB image according to the cluster categories corresponding to the pixels at the same position in each target image, so as to obtain the category of each pixel in the RGB image.

[0134] In one embodiment, the determination module 702 is also used to calculate the gradient distribution and the mean difference distribution for each pixel point in each HSV image on each color component; based on the gradient distribution and the mean difference distribution corresponding to each pixel point on each color component, a corresponding feature vector is obtained.

[0135] In one embodiment, the determination module 702 is also used to, for each HSV image, take each pixel in the HSV image as the central pixel in turn, and obtain a corresponding normalized difference on each color component based on each neighborhood pixel of the central pixel and the component value corresponding to the central pixel on the color component, and obtain the gradient distribution of the central pixel on the color component based on the normalized difference.

[0136] In one embodiment, the determination module 702 is also used to obtain, for each HSV image, on each color component, a corresponding component mean based on the component value of each pixel point in the HSV image on the color component, and to obtain the corresponding mean difference value distribution of each pixel point on the color component based on the component value and the component mean of each pixel point in the HSV image on the color component.

[0137] For the specific definition of the subject object detection device, please refer to the definition of the subject object detection method above, which will not be repeated here. Each module in the above-mentioned subject object detection device can be implemented in whole or in part by software, hardware and a combination thereof. The above-mentioned modules can be embedded in or independent of the processor in the computer device in the form of hardware, or can be stored in the memory of the computer device in the form of software, so that the processor can call and execute the operations corresponding to the above modules.

[0138] In one embodiment, a computer device is provided. The computer device may be a terminal, and its internal structure diagram may be as follows: Figure 8As shown. The computer device includes a processor, a memory, a communication interface, a display screen and an input device connected through a system bus. Among them, the processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system and a computer program. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The communication interface of the computer device is used to communicate with an external terminal in a wired or wireless manner, and the wireless manner can be achieved through WIFI, an operator network, NFC (near field communication) or other technologies. When the computer program is executed by the processor, a subject object detection method is implemented. The display screen of the computer device can be a liquid crystal display screen or an electronic ink display screen, and the input device of the computer device can be a touch layer covered on the display screen, or a button, trackball or touchpad set on the computer device housing, or an external keyboard, touchpad or mouse, etc.

[0139] Those skilled in the art will understand that Figure 8 The structure shown in the figure is only a block diagram of a part of the structure related to the solution of the present application, and does not constitute a limitation on the computer device to which the solution of the present application is applied. The specific computer device may include more or fewer components than those shown in the figure, or combine certain components, or have a different arrangement of components.

[0140] In one embodiment, a computer device is provided, including a memory and a processor, wherein a computer program is stored in the memory, and when the processor executes the computer program, the following steps are implemented:

[0141] Acquire multiple HSV images of different sizes; obtain multiple HSV images from the same RGB image; determine the feature vector corresponding to each pixel in each HSV image; cluster each pixel in each HSV image according to the corresponding feature vector to obtain the cluster category corresponding to each pixel; reset each HSV image to a target image with the same size as the RGB image; obtain the category of the corresponding pixel in the RGB image according to the cluster category corresponding to each pixel in each target image; extract the foreground area corresponding to the main object from the RGB image based on the category of each pixel in the RGB image.

[0142] In one embodiment, when the processor executes the computer program, the following steps are further implemented: acquiring an RGB image; resetting the RGB image into a plurality of RGB sub-images of different sizes; and converting each RGB sub-image into a corresponding HSV image.

[0143] In one embodiment, when the processor executes the computer program, the following steps are also implemented: for each HSV image, according to the feature vector corresponding to each pixel in the HSV image, each pixel in the HSV image is clustered into two categories according to the K-means clustering method to obtain the cluster category corresponding to each pixel in the HSV image.

[0144] In one embodiment, when the processor executes the computer program, the following steps are also implemented: according to the cluster categories corresponding to the pixels at the same position in each target image, the categories of the pixels at the same position in the RGB image are voted to obtain the category of each pixel in the RGB image.

[0145] In one embodiment, when the processor executes the computer program, the following steps are also implemented: for each pixel point in each HSV image, the gradient distribution and the mean difference value distribution are calculated respectively on each color component; based on the gradient distribution and the mean difference value distribution corresponding to each pixel point on each color component, the corresponding feature vector is obtained.

[0146] In one embodiment, the processor further implements the following steps when executing the computer program: for each HSV image, each pixel in the HSV image is taken as the central pixel in turn, and on each color component, a corresponding normalized difference is obtained based on each neighborhood pixel of the central pixel and the component value corresponding to the central pixel on the color component, and the gradient distribution of the central pixel on the color component is obtained based on the normalized difference.

[0147] In one embodiment, when the processor executes the computer program, the following steps are also implemented: for each HSV image, on each color component, a corresponding component mean is obtained based on the component value of each pixel point in the HSV image on the color component, and based on the component value and component mean of each pixel point in the HSV image on the color component, a corresponding mean difference value distribution of each pixel point on the color component is obtained.

[0148] In one embodiment, a computer readable storage medium is provided, on which a computer program is stored, and when the computer program is executed by a processor, the following steps are implemented:

[0149] Acquire multiple HSV images of different sizes; obtain multiple HSV images from the same RGB image; determine the feature vector corresponding to each pixel in each HSV image; cluster each pixel in each HSV image according to the corresponding feature vector to obtain the cluster category corresponding to each pixel; reset each HSV image to a target image with the same size as the RGB image; obtain the category of the corresponding pixel in the RGB image according to the cluster category corresponding to each pixel in each target image; extract the foreground area corresponding to the main object from the RGB image based on the category of each pixel in the RGB image.

[0150] In one embodiment, when the computer program is executed by a processor, the following steps are further implemented: acquiring an RGB image; resetting the RGB image into a plurality of RGB sub-images of different sizes; and converting each RGB sub-image into a corresponding HSV image.

[0151] In one embodiment, when the computer program is executed by the processor, the following steps are also implemented: for each HSV image, according to the feature vector corresponding to each pixel in the HSV image, each pixel in the HSV image is clustered into two categories according to the K-means clustering method to obtain the cluster category corresponding to each pixel in the HSV image.

[0152] In one embodiment, when the computer program is executed by the processor, the following steps are also implemented: according to the cluster categories corresponding to the pixels at the same position in each target image, the categories of the pixels at the same position in the RGB image are voted to obtain the category of each pixel in the RGB image.

[0153] In one embodiment, when the computer program is executed by the processor, the following steps are also implemented: for each pixel point in each HSV image, the gradient distribution and the mean difference value distribution are calculated respectively on each color component; based on the gradient distribution and the mean difference value distribution corresponding to each pixel point on each color component, the corresponding feature vector is obtained.

[0154] In one embodiment, when the computer program is executed by the processor, the following steps are also implemented: for each HSV image, each pixel in the HSV image is taken as the central pixel in turn, and on each color component, a corresponding normalized difference is obtained based on each neighborhood pixel of the central pixel and the component value corresponding to the central pixel on the color component, and the gradient distribution of the central pixel on the color component is obtained based on the normalized difference.

[0155] In one embodiment, when the computer program is executed by the processor, the following steps are also implemented: for each HSV image, on each color component, a corresponding component mean is obtained based on the component value of each pixel point in the HSV image on the color component, and based on the component value and component mean of each pixel point in the HSV image on the color component, a corresponding mean difference value distribution of each pixel point on the color component is obtained.

[0156] Those of ordinary skill in the art can understand that all or part of the processes in the above-mentioned embodiment methods can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to memory, storage, database or other media used in the embodiments provided in this application can include at least one of non-volatile and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory or optical memory, etc. Volatile memory can include random access memory (RAM) or external cache memory. As an illustration and not limitation, RAM can be in various forms, such as static random access memory (SRAM) or dynamic random access memory (DRAM).

[0157] The technical features of the above embodiments may be combined arbitrarily. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.

[0158] The above-mentioned embodiments only express several implementation methods of the present application, and the descriptions thereof are relatively specific and detailed, but they cannot be understood as limiting the scope of the invention patent. It should be pointed out that, for a person of ordinary skill in the art, several variations and improvements can be made without departing from the concept of the present application, and these all belong to the protection scope of the present application. Therefore, the protection scope of the patent of the present application shall be subject to the attached claims.

Claims

1. A subject object detection method, characterized in that: The method comprises: Acquire multiple HSV images of different sizes; the multiple HSV images are obtained from the same RGB image; Determine the eigenvector corresponding to each pixel in each HSV image; Clustering each pixel in each HSV image according to the corresponding feature vector to obtain a clustering category corresponding to each pixel; Reset each HSV image to a target image with the same size as the RGB image; According to the cluster categories corresponding to the pixels at the same position in each of the target images, voting for the categories of the pixels at the same position in the RGB image to obtain the category of each pixel in the RGB image; Based on the category of each pixel in the RGB image, a foreground area corresponding to the main object is extracted from the RGB image.

2. The method according to claim 1, characterized in that: The step of acquiring a plurality of HSV images of different sizes comprises: Get RGB image; Resetting the RGB image into a plurality of RGB sub-images of different sizes; Convert each RGB sub-image to its corresponding HSV image.

3. The method according to claim 1, characterized in that Clustering each pixel point in each HSV image according to the corresponding feature vector to obtain a clustering category corresponding to each pixel point includes: For each HSV image, according to the feature vector corresponding to each pixel point in the HSV image, binary clustering is performed on each pixel point in the HSV image according to the K-means clustering method to obtain the cluster category corresponding to each pixel point in the HSV image.

4. The method according to any one of claims 1 to 3, characterized in that: Determining the feature vector corresponding to each pixel in each HSV image includes: For each pixel in each HSV image, the gradient distribution and the mean difference distribution are calculated for each color component. Based on the gradient distribution and the mean difference distribution corresponding to each pixel point on each color component, a corresponding feature vector is obtained.

5. The method according to claim 4, characterized in that The step of determining the gradient distribution corresponding to each pixel point on each color component includes: For each HSV image, each pixel in the HSV image is taken as the central pixel in turn, and on each color component, the corresponding normalized difference is obtained based on each neighborhood pixel of the central pixel and the component value corresponding to the central pixel on the color component, and the gradient distribution of the central pixel on the color component is obtained based on the normalized difference.

6. The method according to claim 4, characterized in that The step of determining the distribution of the mean difference value corresponding to each pixel point on each color component includes: For each HSV image, on each color component, the corresponding component mean is obtained based on the component value of each pixel in the HSV image on the color component, and based on the component value of each pixel in the HSV image on the color component and the component mean, the corresponding mean difference distribution of each pixel on the color component is obtained.

7. A subject object detection device, characterized in that: The device comprises: An acquisition module, used for acquiring a plurality of HSV images of different sizes; the plurality of HSV images are obtained from the same RGB image; A determination module is used to determine the feature vector corresponding to each pixel point in each HSV image; A clustering module, used for clustering each pixel in each HSV image according to the corresponding feature vector to obtain a clustering category corresponding to each pixel; A reset module, used for resetting each HSV image to a target image with the same size as the RGB image; An obtaining module is used to vote for the categories of the pixels at the same position in the RGB image according to the cluster categories corresponding to the pixels at the same position in each of the target images, so as to obtain the category of each pixel in the RGB image; The extraction module is used to extract the foreground area corresponding to the main object from the RGB image based on the category of each pixel point in the RGB image.

8. A computer device comprising a memory and a processor, wherein the memory stores a computer program, wherein: When the processor executes the computer program, the steps of the method according to any one of claims 1 to 6 are implemented.

9. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 6 are implemented.

Citation Information

Patent Citations

  • Multiple-dimensioned offshore oil-spill SAR image segmentation method based on JSEG and spectrum clustering

    CN103606154A

  • Image saliency target detection method based on k-means and level set superpixel segmentation

    CN110866896A

  • Image area detection method and device

    WO2016127883A1