CN-122023302-A - Skin color detection method and device
Abstract
The application discloses a skin color detection method and device, and belongs to the technical field of image processing. The method comprises the steps of obtaining a first image, a first pixel range and a second pixel range, conducting pixel level screening on the first image based on the first pixel range and the second pixel range to obtain a first skin tone mask image and a second skin tone mask image, wherein the first pixel range is contained in the second pixel range, combining a selected communication area in the second skin tone mask image with a corresponding communication area in the first skin tone mask image based on an overlapping relation between all communication areas in the first skin tone mask image and the second skin tone mask image to generate a third skin tone mask image, and processing the third skin tone mask image based on spatial structure information of the first image to obtain a skin detection image.
Inventors
- CHEN JIE
- LI XIAOYU
- LI JIE
- YANG XIAO
- FAN DENGPING
- FU KEREN
Assignees
- 维沃移动通信有限公司
Dates
- Publication Date
- 20260512
- Application Date
- 20260122
Claims (10)
- 1. A method of skin tone detection, the method comprising: Acquiring a first image, a first pixel range and a second pixel range; performing pixel level screening on the first image based on the first pixel range and the second pixel range to obtain a first skin tone mask image and a second skin tone mask image, wherein the first pixel range is included in the second pixel range; combining the selected connected region in the second skin tone mask image with the corresponding connected region in the first skin tone mask image based on the overlapping relationship between the connected regions in the first skin tone mask image and the second skin tone mask image to generate the third skin tone mask image; and processing the third skin color mask image based on the spatial structure information of the first image to obtain a skin detection image.
- 2. The method of claim 1, wherein processing the third skin tone mask image based on the spatial structure information of the first image to obtain a skin detection image comprises: Performing edge detection on the first image based on an edge detection algorithm to obtain a binary edge map; processing the first image based on a monocular depth estimation algorithm to obtain a depth image; performing differential operation on the third skin color mask image and the binary edge map to obtain an edge separation mask image; Performing morphological operation on the edge separation mask image to obtain a fourth skin tone mask image; and performing foreground enhancement processing on the fourth skin tone mask image according to the depth image to obtain a skin detection image, wherein the foreground enhancement processing is used for enhancing a skin detection result corresponding to a foreground region in the depth image in the fourth skin tone mask image and inhibiting a skin detection result corresponding to a background region in the depth image in the fourth skin tone mask image.
- 3. The method of claim 1, wherein the combining the selected connected region in the second skin tone mask image with the corresponding connected region in the first skin tone mask image based on the overlapping relationship between the connected regions in the first skin tone mask image and the second skin tone mask image comprises: performing communication component analysis on the first skin tone mask image to obtain at least one first communication area; Performing communication component analysis on the second skin tone mask image to obtain at least one second communication region; Calculating the intersection ratio between the first communication area and the second communication area, wherein the intersection ratio is used for representing the degree value of the overlapping relation; under the condition that the intersection ratio is larger than a preset threshold value, replacing the region image corresponding to the first communication region according to the region image corresponding to the second communication region; and reserving the area image corresponding to the first communication area under the condition that the intersection ratio is smaller than or equal to the preset threshold value.
- 4. The method according to claim 2, wherein performing foreground enhancement processing on the fourth skin tone mask image according to the depth image to obtain a skin detection image comprises: Carrying out normalization processing on the depth image to generate a foreground weight image, wherein the weight value of the foreground region in the front Jing Quan weight image is larger than that of the background region; Performing pixel-by-pixel multiplication on the fourth skin tone mask image and the front Jing Quan heavy image to obtain a multiplication result; and normalizing the multiplied result to obtain the skin detection image.
- 5. The method of any of claims 1-4, wherein before performing pixel level filtering on the first image based on the first pixel range and the second pixel range to obtain a first skin tone mask image and a second skin tone mask image, the method further comprises: acquiring a plurality of groups of skin color sample images corresponding to a plurality of skin color features, wherein each group of skin color sample images comprises images of sample objects in a plurality of shooting environments; and determining the first pixel range and the second pixel range according to the plurality of groups of skin color sample images.
- 6. A skin tone detection apparatus, the apparatus comprising: the acquisition module is used for acquiring a first image, a first pixel range and a second pixel range; The screening module is used for carrying out pixel level screening on the first image based on the first pixel range and the second pixel range to obtain a first skin tone mask image and a second skin tone mask image, wherein the first pixel range is included in the second pixel range; A combination module, configured to combine, based on an overlapping relationship between each connected region in the first skin tone mask image and the second skin tone mask image, a selected connected region in the second skin tone mask image with a corresponding connected region in the first skin tone mask image, to generate the third skin tone mask image; And the processing module is used for processing the third skin color mask image based on the spatial structure information of the first image to obtain a skin detection image.
- 7. The apparatus of claim 6, wherein the processing module is specifically configured to: Performing edge detection on the first image based on an edge detection algorithm to obtain a binary edge map; processing the first image based on a monocular depth estimation algorithm to obtain a depth image; performing differential operation on the third skin color mask image and the binary edge map to obtain an edge separation mask image; Performing morphological operation on the edge separation mask image to obtain a fourth skin tone mask image; and performing foreground enhancement processing on the fourth skin tone mask image according to the depth image to obtain a skin detection image, wherein the foreground enhancement processing is used for enhancing a skin detection result corresponding to a foreground region in the depth image in the fourth skin tone mask image and inhibiting a skin detection result corresponding to a background region in the depth image in the fourth skin tone mask image.
- 8. The apparatus of claim 6, wherein the combining module is specifically configured to: performing communication component analysis on the first skin tone mask image to obtain at least one first communication area; Performing communication component analysis on the second skin tone mask image to obtain at least one second communication region; Calculating the intersection ratio between the first communication area and the second communication area, wherein the intersection ratio is used for representing the degree value of the overlapping relation; under the condition that the intersection ratio is larger than a preset threshold value, replacing the region image corresponding to the first communication region according to the region image corresponding to the second communication region; and reserving the area image corresponding to the first communication area under the condition that the intersection ratio is smaller than or equal to the preset threshold value.
- 9. The apparatus according to claim 7, wherein the processing module is specifically configured to: Carrying out normalization processing on the depth image to generate a foreground weight image, wherein the weight value of the foreground region in the front Jing Quan weight image is larger than that of the background region; Performing pixel-by-pixel multiplication on the fourth skin tone mask image and the front Jing Quan heavy image to obtain a multiplication result; and normalizing the multiplied result to obtain the skin detection image.
- 10. The apparatus of any one of claims 6-9, wherein the acquisition module is further configured to acquire a plurality of sets of skin tone sample images corresponding to a plurality of skin tone features, each set of skin tone sample images including images of a sample object in a plurality of capture environments; the apparatus further comprises: and the determining module is used for determining the first pixel range and the second pixel range according to the plurality of groups of sample images.
Description
Skin color detection method and device Technical Field The application belongs to the technical field of image processing, and particularly relates to a skin color detection method and device. Background In the field of digital video processing and computer vision, the goal of skin tone detection is to accurately segment a human skin region from a complex image or video sequence. Not only is the face recognition limited, but also the positioning and the extraction of all exposed skin parts of the human body are further expanded. However, the conventional thresholding method has significant limitations in practical applications. The fixed threshold range is difficult to adapt to complex and changeable illumination and background, false detection and omission are easily caused under light change, and when a real scene is processed, a detection result often contains a large number of discrete noise points, and the overall false detection rate is remarkably improved because the foreground and background relation cannot be distinguished. Semantic segmentation based on deep learning is highly dependent on large-scale, finely labeled training data, and data labeling is extremely costly. Meanwhile, the complex model brings huge parameter and calculation cost, so that the complex model is in high hardware cost, remarkable power consumption and real-time delay problem when high-definition videos are processed when the complex model is deployed. Therefore, it is difficult for the current skin tone detection technique to balance the detection accuracy and the detection resource consumption. Disclosure of Invention The embodiment of the application aims to provide a skin color detection method and device, which can solve the problem that the current skin color detection technology is difficult to balance detection precision and detection resource consumption. In a first aspect, an embodiment of the present application provides a skin color detection method, including: Acquiring a first image, a first pixel range and a second pixel range; Performing pixel level screening on the first image based on the first pixel range and the second pixel range to obtain a first skin tone mask image and a second skin tone mask image, wherein the first pixel range is contained in the second pixel range; Combining the selected connected region in the second skin tone mask image with the corresponding connected region in the first skin tone mask image based on the overlapping relationship between the connected regions in the first skin tone mask image and the second skin tone mask image to generate a third skin tone mask image; And processing the third skin tone mask image based on the spatial structure information of the first image to obtain a skin detection image. In a second aspect, an embodiment of the present application provides a skin tone detection apparatus, including: the acquisition module is used for acquiring a first image, a first pixel range and a second pixel range; The screening module is used for carrying out pixel level screening on the first image based on the first pixel range and the second pixel range to obtain a first skin tone mask image and a second skin tone mask image, wherein the first pixel range is contained in the second pixel range; The combination module is used for combining the selected connected region in the second skin tone mask image with the corresponding connected region in the first skin tone mask image based on the overlapping relation between the connected regions in the first skin tone mask image and the second skin tone mask image to generate a third skin tone mask image; And the processing module is used for processing the third skin color mask image based on the spatial structure information of the first image to obtain a skin detection image. In a third aspect, an embodiment of the present application provides an electronic device comprising a processor and a memory storing a program or instructions executable on the processor, which when executed by the processor, implement the steps of the method as described in the first aspect. In a fourth aspect, embodiments of the present application provide a readable storage medium having stored thereon a program or instructions which when executed by a processor perform the steps of the method according to the first aspect. In a fifth aspect, an embodiment of the present application provides a chip, where the chip includes a processor and a communication interface, where the communication interface is coupled to the processor, and where the processor is configured to execute a program or instructions to implement a method according to the first aspect. In a sixth aspect, embodiments of the present application provide a computer program product stored in a storage medium, the program product being executable by at least one processor to implement the method according to the first aspect. The method comprises the steps of obtaining a first image, a