Palm contour detection method and device, storage medium and equipment

By adaptively setting the segmentation threshold and using the inter-class variance maximization method, combined with hole filling and palm region correction, the accuracy problem of palm contour detection in multiple skin tones and environments is solved, achieving higher detection accuracy.

CN116805422BActive Publication Date: 2026-06-30BEIJING TECHSHINO TECHNOLOGY CO LTD +1

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
BEIJING TECHSHINO TECHNOLOGY CO LTD
Filing Date
2022-03-16
Publication Date
2026-06-30

Smart Images

  • Figure CN116805422B_ABST
    Figure CN116805422B_ABST
Patent Text Reader

Abstract

The application discloses a palm outline detection method and device, a storage medium and equipment, and belongs to the palm vein recognition field.The method comprises the following steps: adaptively setting a segmentation threshold according to an input image; performing binary segmentation on the input image by using the adaptively set segmentation threshold to obtain a foreground region and a background region; and finding a palm boundary based on the palm region to obtain a palm outline.In the binary segmentation process, the segmentation threshold is adaptively set according to the input image, the result after the input image is segmented by using the adaptively set segmentation threshold is more accurate, and the accuracy of palm outline detection is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of palm vein recognition, and in particular to a method, apparatus, storage medium and device for palm contour detection. Background Technology

[0002] In today's information age, accurately identifying a person and protecting information security has become a critical social issue that must be addressed. Human palm vein recognition offers advantages such as liveness detection, high accuracy, non-copyability, high security, ease of use, and contactless operation. It is unaffected by factors such as skin dryness or moisture, nor by age, making it suitable for the elderly and children.

[0003] Palm contour detection is a key step in palm vein recognition and preprocessing. Its purpose is to obtain the palm boundary, providing a basis for subsequent detection of key points of the palm boundary. These key points have two main functions: first, to distinguish between the palm part and the non-palm part; and second, the detected key points can be used to obtain the region of interest (ROI), which is the part from which features are extracted.

[0004] Hand contour detection mainly includes steps such as hand segmentation and contour extraction. Hand segmentation is to perform binary segmentation on the input image by setting a segmentation threshold, and contour extraction is to find the hand boundary based on the binary segmentation.

[0005] The segmentation threshold of existing technologies is a fixed value that is set in advance. However, the fixed segmentation threshold cannot adapt to the palms of different skin colors and different acquisition environments, which makes the binary segmentation inaccurate and thus the palm contour detection results inaccurate. Summary of the Invention

[0006] To address the shortcomings of existing technologies, this invention provides a method, apparatus, storage medium, and device for palm contour detection, which improves the accuracy of palm contour detection.

[0007] The technical solution provided by this invention is as follows:

[0008] In a first aspect, the present invention provides a method for detecting the contour of a hand, the method comprising:

[0009] The segmentation threshold is adaptively set based on the input image;

[0010] The input image is binary segmented by an adaptively set segmentation threshold to obtain a foreground region and a background region.

[0011] The palm region is extracted based on the foreground region;

[0012] Based on the palm region, the palm boundary is located to obtain the palm outline.

[0013] Furthermore, the step of adaptively setting the segmentation threshold based on the input image includes:

[0014] The value of the segmentation threshold is traversed in the gray range of [0, 255] for each gray value;

[0015] The input image is binary segmented using the value of each segmentation threshold to obtain the foreground region and background region corresponding to each segmentation threshold value;

[0016] Calculate the inter-class variance of the foreground and background regions corresponding to each segmentation threshold value;

[0017] The segmentation threshold corresponding to the largest inter-class variance is used as the adaptively set segmentation threshold.

[0018] Furthermore, the inter-class variance is determined based on the pixel proportions of the foreground and background regions in the input image corresponding to the segmentation threshold, the average gray value of the foreground region corresponding to the segmentation threshold, and the average gray value of the background region corresponding to the segmentation threshold.

[0019] Furthermore, the inter-class variance g is calculated using the following formula:

[0020] g = w0w1(μ0-μ1) 2 Where w0 and w1 are the pixel proportions of the foreground and background regions in the input image corresponding to the value of the segmentation threshold, respectively, μ0 is the average gray value of the foreground region corresponding to the value of the segmentation threshold, and μ1 is the average gray value of the background region corresponding to the value of the segmentation threshold.

[0021] Furthermore, the step of performing binary segmentation on the input image using an adaptively set segmentation threshold to obtain foreground and background regions includes:

[0022] The gray value of each pixel in the input image is compared with the adaptively set segmentation threshold. Pixels with gray values ​​greater than the adaptively set segmentation threshold are designated as foreground regions, and pixels with gray values ​​less than or equal to the adaptively set segmentation threshold are designated as background regions.

[0023] For each pixel, determine the number of pixels belonging to the foreground region within a certain area around the pixel. If the number is less than a set threshold, the pixel is considered as the background region; otherwise, the pixel is considered as the foreground region.

[0024] Furthermore, the step of extracting the palm region based on the foreground region includes:

[0025] Extract the largest connected region from the foreground region to obtain the palm region;

[0026] Calculate the centroid (x) of the palm region c ,y c and the minimum bounding rectangle;

[0027] Based on the width w of the minimum bounding rectangle pv The distance d from the centroid to the palm boundary is determined by the height h of the input image. c ;

[0028] [:,y c +d c The :h] region is set as the background region, and the maximum connected region of the foreground region is extracted again to obtain the palm region.

[0029] Furthermore, the step of finding the palm boundary based on the palm region to obtain the palm outline includes:

[0030] Calculate the centroid of the palm region and use the boundary point of the palm region directly below the centroid as the initial contour point;

[0031] Take the pixel at a certain distance directly above the initial contour point as the starting point, and with the initial contour point as the center and the distance between the initial contour point and the starting point as the radius, find the intersection point with the boundary of the palm area in a clockwise or counterclockwise direction from the starting point, and take it as the next contour point.

[0032] For each current contour point after the initial contour point, with the current contour point as the center and the distance between the current contour point and the previous contour point as the radius, starting from the previous contour point, find the intersection point with the boundary of the palm area in a clockwise or counterclockwise direction, and use it as the next contour point; until all contour points form a closed area.

[0033] In a second aspect, the present invention provides a palm contour detection device, the device comprising:

[0034] The segmentation threshold setting module is used to adaptively set the segmentation threshold based on the input image;

[0035] The binary segmentation module is used to perform binary segmentation on the input image using an adaptively set segmentation threshold to obtain a foreground region and a background region.

[0036] A palm region extraction module is used to extract the palm region based on the foreground region;

[0037] The palm contour extraction module is used to find the palm boundary based on the palm region and obtain the palm contour.

[0038] Furthermore, the segmentation threshold setting module includes:

[0039] The traversal unit is used to traverse each gray value in the gray range of [0, 255] of the segmentation threshold.

[0040] The first segmentation unit is used to perform binary segmentation on the input image using the value of each segmentation threshold, to obtain the foreground region and background region corresponding to the value of each segmentation threshold;

[0041] The inter-class variance calculation unit is used to calculate the inter-class variance of the foreground and background regions corresponding to each segmentation threshold value;

[0042] The segmentation threshold determination unit is used to take the value of the segmentation threshold corresponding to the largest inter-class variance as the adaptively set segmentation threshold.

[0043] Furthermore, the inter-class variance is determined based on the pixel proportions of the foreground and background regions in the input image corresponding to the segmentation threshold, the average gray value of the foreground region corresponding to the segmentation threshold, and the average gray value of the background region corresponding to the segmentation threshold.

[0044] Furthermore, the inter-class variance g is calculated using the following formula:

[0045] g = w0w1(μ0-μ1) 2 Where w0 and w1 are the pixel proportions of the foreground and background regions in the input image corresponding to the value of the segmentation threshold, respectively, μ0 is the average gray value of the foreground region corresponding to the value of the segmentation threshold, and μ1 is the average gray value of the background region corresponding to the value of the segmentation threshold.

[0046] Furthermore, the binary segmentation module includes:

[0047] The second segmentation unit is used to compare the gray value of each pixel in the input image with an adaptively set segmentation threshold, and to designate pixels with gray values ​​greater than the adaptively set segmentation threshold as foreground regions and pixels with gray values ​​less than or equal to the adaptively set segmentation threshold as background regions.

[0048] The hole filling unit is used to determine the number of pixels belonging to the foreground region within a certain area around each pixel. If the number is less than a set threshold, the pixel is regarded as the background region; otherwise, the pixel is regarded as the foreground region.

[0049] Furthermore, the palm region extraction module includes:

[0050] The first extraction unit is used to extract the largest connected region of the foreground region to obtain the palm region;

[0051] The first calculation unit is used to calculate the centroid (x) of the palm region. c ,y c and the minimum bounding rectangle;

[0052] The second calculation unit calculates based on the width w of the minimum bounding rectangle. pv The distance d from the centroid to the palm boundary is determined by the height h of the input image. c ;

[0053] The second extraction unit is used to extract [:,y c +d c The :h] region is set as the background region, and the maximum connected region of the foreground region is extracted again to obtain the palm region.

[0054] Furthermore, the palm contour extraction module includes:

[0055] An initial calculation unit is used to calculate the centroid of the palm region and take the boundary point of the palm region directly below the centroid as the initial contour point;

[0056] The searching unit is used to take a pixel at a certain distance directly above the initial contour point as the starting point, and with the initial contour point as the center and the distance between the initial contour point and the starting point as the radius, to search for the intersection point with the boundary of the palm area in a clockwise or counterclockwise direction, and take it as the next contour point.

[0057] The iterative unit is used to find the intersection point with the boundary of the palm region for each current contour point after the initial contour point, with the current contour point as the center and the distance between the current contour point and the previous contour point as the radius, starting from the previous contour point in a clockwise or counterclockwise direction, and use it as the next contour point; until all contour points form a closed region.

[0058] Thirdly, the present invention provides a computer-readable storage medium for palm contour detection, including a memory for storing processor-executable instructions, which, when executed by the processor, implement the steps of the palm contour detection method described in the first aspect.

[0059] Fourthly, the present invention provides an apparatus for palm contour detection, comprising at least one processor and a memory storing computer-executable instructions, wherein the processor executes the instructions to implement the steps of the palm contour detection method described in the first aspect.

[0060] The present invention has the following beneficial effects:

[0061] This invention first adaptively sets a segmentation threshold based on the input image, and then performs binary segmentation on the input image using this adaptively set threshold to obtain foreground and background regions. Next, a palm region is extracted based on the foreground region, and the palm boundary is located based on this palm region to obtain the palm contour. In this invention, the segmentation threshold is adaptively set based on the input image during binary segmentation, resulting in more accurate segmentation and improved accuracy of palm contour detection. Attached Figure Description

[0062] Figure 1 This is a flowchart of the palm contour detection method of the present invention;

[0063] Figure 2 This is a schematic diagram of the input image;

[0064] Figure 3 This is a schematic diagram of the foreground and background regions obtained after binary segmentation.

[0065] Figure 4 A diagram illustrating the palm area;

[0066] Figure 5 A schematic diagram of the outline of a hand;

[0067] Figure 6 This is a diagram showing the corrected palm area.

[0068] Figure 7 This is a schematic diagram showing the hole after it has been filled.

[0069] Figure 8 A schematic diagram illustrating the process of extracting palm contour points;

[0070] Figure 9 This is a schematic diagram of the palm contour detection device of the present invention. Detailed Implementation

[0071] To make the technical problems, technical solutions, and advantages of this invention clearer, the technical solutions of this invention will be clearly and completely described below in conjunction with the accompanying drawings and specific embodiments. Obviously, the described embodiments are only a part of the embodiments of this invention, and not all of them. The components of the embodiments of this invention described and shown in the accompanying drawings can generally be arranged and designed in various different configurations. Therefore, the following detailed description of the embodiments of the invention provided in the accompanying drawings is not intended to limit the scope of the claimed invention, but merely to illustrate selected embodiments of the invention. All other embodiments obtained by those skilled in the art based on the embodiments of this invention without inventive effort are within the scope of protection of this invention.

[0072] Example 1:

[0073] This invention provides a method for detecting the contour of a hand, such as... Figure 1 As shown, the method includes:

[0074] S100: Adaptively set the segmentation threshold based on the input image.

[0075] The input image contains an image of a human hand, such as Figure 2 As shown, it is a near-infrared image, acquired in a near-infrared scene. From Figure 2 As can be seen, the gray value of the palm region in the input image is significantly higher than that of the background region. Therefore, a segmentation threshold can be used for binary segmentation to separate the palm region from the background region.

[0076] However, due to differences in skin color on human hands and different acquisition environments, the gray levels of the acquired images vary, and a fixed segmentation threshold cannot perform good binary segmentation for images with different gray levels.

[0077] To address the aforementioned issues, this invention does not use a fixed segmentation threshold. Instead, it adaptively sets the segmentation threshold value for each input image. Using this segmentation threshold results in more accurate segmentation, thereby improving the accuracy of hand contour detection.

[0078] S200: The input image is binary segmented using an adaptively set segmentation threshold to obtain a foreground region and a background region.

[0079] like Figure 3 As shown, after binary segmentation, a foreground region (white area) representing the palm region and a background region (black area) representing the non-palm region are obtained.

[0080] S300: The palm region is extracted based on the foreground region.

[0081] observe Figure 3 As shown in the foreground and background regions, the palm region is the largest connected region in the foreground region. Therefore, the largest connected region in the foreground region can be extracted to obtain the palm region, as shown below. Figure 4 As shown.

[0082] S400: Based on the palm region, find the palm boundary to obtain the palm outline.

[0083] This invention does not limit the method for obtaining the palm contour; for example, edge detection can be performed using methods such as the Sobel edge detection algorithm to obtain the palm contour image. Figure 5 As shown.

[0084] This invention first adaptively sets a segmentation threshold based on the input image, and then performs binary segmentation on the input image using this adaptively set threshold to obtain foreground and background regions. Next, a palm region is extracted based on the foreground region, and the palm boundary is located based on this palm region to obtain the palm contour. In this invention, the segmentation threshold is adaptively set based on the input image during binary segmentation, resulting in more accurate segmentation and improved accuracy of palm contour detection.

[0085] In one example, the present invention adaptively sets the segmentation threshold using the following method:

[0086] S110: Traverse each gray value in the gray range of [0, 255] using the value of the segmentation threshold.

[0087] S120: Perform binary segmentation on the input image using the value of each segmentation threshold to obtain the foreground region and background region corresponding to each segmentation threshold value.

[0088] S130: Calculate the inter-class variance of the foreground and background regions corresponding to each segmentation threshold value.

[0089] S140: Use the value of the segmentation threshold corresponding to the largest inter-class variance as the adaptively set segmentation threshold.

[0090] The segmentation threshold value of this invention maximizes the inter-class variance between the segmented foreground and background regions, thereby improving the distinguishability between the segmented foreground and background regions and thus improving the accuracy of hand contour detection.

[0091] The inter-class variance can be determined based on the pixel proportions of the foreground and background regions in the input image corresponding to the segmentation threshold, the average gray value of the foreground region corresponding to the segmentation threshold, and the average gray value of the background region corresponding to the segmentation threshold.

[0092] For example, the inter-class variance g can be calculated using the following formula:

[0093] g = w0w1(μ0-μ1) 2 Where w0 and w1 are the pixel proportions of the foreground and background regions in the input image corresponding to the value of the segmentation threshold, respectively, μ0 is the average gray value of the foreground region corresponding to the value of the segmentation threshold, and μ1 is the average gray value of the background region corresponding to the value of the segmentation threshold.

[0094] Specifically, the input image is represented by I(x,y), with a width and height of M and N, respectively, and the segmentation threshold is represented by T.

[0095] N0 = #{(x,y)|I(x,y)>T}, that is, N0 represents the number of pixels belonging to the foreground region, and the average gray value of the foreground region is μ0;

[0096]

[0097] The ratio of the number of pixels in the foreground region to the number of pixels in the input image is w0;

[0098]

[0099] N1 = #{(x,y)|I(x,y)≤T}, that is, N1 represents the number of pixels belonging to the background region, and the average gray value of the background region is μ1;

[0100]

[0101] The ratio of the number of pixels in the background region to the number of pixels in the input image is w1;

[0102]

[0103] Obviously,

[0104] w0 + w1 = 1

[0105] The average gray value of the input image I(x,y) is μ;

[0106] μ=w0μ0+w1μ1

[0107] The formula for the inter-class variance g is as follows:

[0108] g = w0(μ0 - μ) 2 +w1(μ1-μ) 2 =w0w1(μ0-μ1) 2

[0109] The segmentation threshold T that maximizes the inter-class variance g can be found within the range of [0, 255].

[0110] After obtaining the value of the segmentation threshold T, binary segmentation can be performed on the input image. One implementation method is as follows:

[0111] S210: Compare the gray value of each pixel in the input image with the adaptively set segmentation threshold, and designate pixels with gray values ​​greater than the adaptively set segmentation threshold as foreground regions (i.e., pixels belonging to the palm), and designate pixels with gray values ​​less than or equal to the adaptively set segmentation threshold as background regions (i.e., pixels not belonging to the palm).

[0112] The foreground and background areas obtained in this step often contain some holes, which need to be filled in the subsequent S220.

[0113] S220: For each pixel, determine the number of pixels belonging to the foreground region within a certain area around the pixel. If the number is less than a set threshold, then the pixel is considered as the background region; otherwise, the pixel is considered as the foreground region.

[0114] For example, the defined area can be a sub-block of size (2r+1)×(2r+1) centered on the pixel, where r is a set value. That is, the number of pixels belonging to the foreground region (i.e., the number of pixels belonging to the palm) within the (2r+1)×(2r+1) sub-block around each pixel is determined. If the number is less than a threshold, the pixel is considered noise and set as background; otherwise, the pixel is considered part of the palm and set as foreground. This completes the hole filling process. Figure 7 As shown.

[0115] This invention does not limit the specific implementation of extracting the palm region based on the foreground region. In one example, it includes:

[0116] S310: Extract the largest connected region of the foreground region to obtain the palm region.

[0117] Since the process of acquiring the input image is unconstrained, the obtained palm region (i.e., the largest connected region) often contains noise interference, which affects the subsequent palm contour extraction. Therefore, the palm region needs to be corrected through subsequent steps S320-S340.

[0118] S320: Calculate the centroid (x) of the palm region. c ,y c and the minimum bounding rectangle, where:

[0119]

[0120]

[0121]

[0122] The width of the minimum bounding rectangle is w. pv The height is h pv .

[0123] S330: Based on the width w of the minimum bounding rectangle pv The distance d from the centroid to the palm boundary is determined by the height h of the input image. c .

[0124] In one of the examples, The coefficients a and b can be adjusted; for example, a = 4 and b = 2.

[0125] S340: [:,y c +d c The :h] region is set as the background region, and the maximum connected region of the foreground region is extracted again to obtain the palm region.

[0126] The inventors observed that the noise was mainly concentrated in the wrist area, therefore, this invention corrects the noise in the wrist area relative to the palm area. During correction, the wrist area (i.e., [:,y]) is... c +d c :h]) is set as the background area, and then the palm area is re-extracted. The corrected palm area is as follows: Figure 6 As shown.

[0127] This invention does not limit the method for finding the palm boundary and obtaining the palm contour based on the palm region. In one example, it includes:

[0128] S410: Calculate the centroid of the palm region and take the boundary point of the palm region directly below the centroid as the initial contour point.

[0129] S420: Take the pixel at a certain distance directly above the initial contour point as the starting point, and with the initial contour point as the center and the distance between the initial contour point and the starting point as the radius, find the intersection point with the boundary of the palm area in a clockwise or counterclockwise direction from the starting point, and take it as the next contour point.

[0130] S430: For each current contour point after the initial contour point, with the current contour point as the center and the distance between the current contour point and the previous contour point as the radius, starting from the previous contour point, find the intersection point with the boundary of the palm area in a clockwise or counterclockwise direction, and use it as the next contour point; until all contour points form a closed area.

[0131] Specifically:

[0132] Assume the centroid is (x c ,y c The initial contour point is (x0, y0), which represents the center point of the wrist, where x0 = x c Assume a certain distance is d, and the starting point coordinates are (x... s ,y s ), x s =x0, y s =y0-d.

[0133] Then, starting from the initial contour point (x0, y0), the finger boundary is determined iteratively to obtain subsequent contour points. Taking the clockwise direction as an example (the same applies to the counterclockwise direction), the iteration process is described in [link to documentation]. Figure 8 ,include:

[0134] Step 1: Using the reference point (x0, y0) as the center, starting from the starting point (x0, y0-r), find the intersection point (x1, y1) with the boundary of the palm area in a clockwise direction, and use it as the next contour point.

[0135] Step 2: Then, using the current contour point (x... i ,y i Centered on the previous contour point (x) i-1 ,y i-1 Starting from ), find the intersection point (x) with the boundary of the palm area in a clockwise direction. i+1 ,y i+1 ), as the next contour point, where i = 1, 2, 3, ...

[0136] Step 3: When the loop iterates until all contour points form a complete closed region, i.e. (x i+1 ,y i+1 The iteration terminates when the point reaches (x0, y0) or to the right of (x0, y0). The closed curve formed by connecting all contour points is the palm contour, as shown below. Figure 5 As shown.

[0137] Example 2:

[0138] This invention provides a palm contour detection device, such as... Figure 9 As shown, the device includes:

[0139] The segmentation threshold setting module 1 is used to adaptively set the segmentation threshold according to the input image.

[0140] Binary segmentation module 2 is used to perform binary segmentation on the input image using an adaptively set segmentation threshold to obtain a foreground region and a background region.

[0141] The palm region extraction module 3 is used to extract the palm region based on the foreground region.

[0142] The palm contour extraction module 4 is used to find the palm boundary based on the palm region and obtain the palm contour.

[0143] This invention first adaptively sets a segmentation threshold based on the input image, and then performs binary segmentation on the input image using this adaptively set threshold to obtain foreground and background regions. Next, a palm region is extracted based on the foreground region, and the palm boundary is located based on this palm region to obtain the palm contour. In this invention, the segmentation threshold is adaptively set based on the input image during binary segmentation, resulting in more accurate segmentation and improved accuracy of palm contour detection.

[0144] In one example, the segmentation threshold setting module includes:

[0145] The traversal unit is used to traverse each gray value in the gray range of [0, 255] of the segmentation threshold.

[0146] The first segmentation unit is used to perform binary segmentation on the input image using the value of each segmentation threshold, so as to obtain the foreground region and background region corresponding to each segmentation threshold value.

[0147] The inter-class variance calculation unit is used to calculate the inter-class variance of the foreground and background regions corresponding to each segmentation threshold value.

[0148] The segmentation threshold determination unit is used to take the value of the segmentation threshold corresponding to the largest inter-class variance as the adaptively set segmentation threshold.

[0149] The inter-class variance is determined based on the pixel proportions of the foreground and background regions in the input image corresponding to the segmentation threshold, the average gray value of the foreground region corresponding to the segmentation threshold, and the average gray value of the background region corresponding to the segmentation threshold.

[0150] Specifically, the inter-class variance g is calculated using the following formula:

[0151] g = w0w1(μ0-μ1) 2 Where w0 and w1 are the pixel proportions of the foreground and background regions in the input image corresponding to the value of the segmentation threshold, respectively, μ0 is the average gray value of the foreground region corresponding to the value of the segmentation threshold, and μ1 is the average gray value of the background region corresponding to the value of the segmentation threshold.

[0152] The binary segmentation module includes:

[0153] The second segmentation unit is used to compare the gray value of each pixel in the input image with an adaptively set segmentation threshold, and to designate pixels with gray values ​​greater than the adaptively set segmentation threshold as foreground regions and pixels with gray values ​​less than or equal to the adaptively set segmentation threshold as background regions.

[0154] The hole filling unit is used to determine the number of pixels belonging to the foreground region within a certain area around each pixel. If the number is less than a set threshold, the pixel is regarded as the background region; otherwise, the pixel is regarded as the foreground region.

[0155] The palm region extraction module includes:

[0156] The first extraction unit is used to extract the largest connected region of the foreground region to obtain the palm region.

[0157] The first calculation unit is used to calculate the centroid (x) of the palm region. c ,y c ) and minimum bounding rectangle.

[0158] The second calculation unit calculates based on the width w of the minimum bounding rectangle. pv The distance d from the centroid to the palm boundary is determined by the height h of the input image. c .

[0159] The second extraction unit is used to extract [:,y c +d c The :h] region is set as the background region, and the maximum connected region of the foreground region is extracted again to obtain the palm region.

[0160] This invention does not limit the specific implementation of the palm contour extraction module. In one example, it includes:

[0161] An initial calculation unit is used to calculate the centroid of the palm region and take the boundary point of the palm region directly below the centroid as the initial contour point.

[0162] The searching unit is used to take a pixel at a certain distance directly above the initial contour point as the starting point, and with the initial contour point as the center and the distance between the initial contour point and the starting point as the radius, to search for the intersection point with the boundary of the palm area in a clockwise or counterclockwise direction, and take it as the next contour point.

[0163] The iterative unit is used to find the intersection point with the boundary of the palm region for each current contour point after the initial contour point, with the current contour point as the center and the distance between the current contour point and the previous contour point as the radius, starting from the previous contour point in a clockwise or counterclockwise direction, and use it as the next contour point; until all contour points form a closed region.

[0164] The device provided in this embodiment of the invention has the same implementation principle and technical effects as the aforementioned method embodiment 1. For the sake of brevity, any parts not mentioned in this device embodiment can be referred to the corresponding content in the aforementioned method embodiment 1. Those skilled in the art will clearly understand that, for the sake of convenience and brevity, the specific working processes of the aforementioned device and unit can all be referred to the corresponding processes in the aforementioned method embodiment 1, and will not be repeated here.

[0165] Example 3:

[0166] The method described in Embodiment 1 of this invention can implement business logic through a computer program and record it on a storage medium. This storage medium can be read and executed by a computer, achieving the effects of the solution described in Embodiment 1 of this specification. Therefore, this invention also provides a computer-readable storage medium for palm contour detection, including a memory for storing processor-executable instructions. When executed by a processor, the instructions implement the steps of the palm contour detection method of Embodiment 1.

[0167] This invention first adaptively sets a segmentation threshold based on the input image, and then performs binary segmentation on the input image using this adaptively set threshold to obtain foreground and background regions. Next, a palm region is extracted based on the foreground region, and the palm boundary is located based on this palm region to obtain the palm contour. In this invention, the segmentation threshold is adaptively set based on the input image during binary segmentation, resulting in more accurate segmentation and improved accuracy of palm contour detection.

[0168] The storage medium may include a physical device for storing information, typically digitizing the information and then storing it using electrical, magnetic, or optical methods. The storage medium may include: devices that store information using electrical energy, such as various types of memory, like RAM and ROM; devices that store information using magnetic energy, such as hard disks, floppy disks, magnetic tapes, magnetic core memory, bubble memory, and USB flash drives; and devices that store information using optical methods, such as CDs or DVDs. Of course, there are other readable storage media, such as quantum memories and graphene memories.

[0169] The storage medium described above may also include other implementation methods according to the description of method embodiment 1. The implementation principle and technical effects of this embodiment are the same as those of the aforementioned method embodiment 1. For details, please refer to the description of the relevant method embodiment 1, which will not be repeated here.

[0170] Example 4:

[0171] The present invention also provides a device for palm contour detection. The device may be a standalone computer, or it may include an actual operating device that uses one or more of the methods or embodiments described in this specification. The palm contour detection device may include at least one processor and a memory storing computer-executable instructions. When the processor executes the instructions, it implements the steps of the palm contour detection method described in any one or more embodiments 1 above.

[0172] This invention first adaptively sets a segmentation threshold based on the input image, and then performs binary segmentation on the input image using this adaptively set threshold to obtain foreground and background regions. Next, a palm region is extracted based on the foreground region, and the palm boundary is located based on this palm region to obtain the palm contour. In this invention, the segmentation threshold is adaptively set based on the input image during binary segmentation, resulting in more accurate segmentation and improved accuracy of palm contour detection.

[0173] The device described above may include other implementation methods according to the description of method embodiment 1. The implementation principle and technical effects of this embodiment are the same as those of the aforementioned method embodiment 1. For details, please refer to the description of the relevant method embodiment 1, which will not be repeated here.

[0174] Finally, it should be noted that the above-described embodiments are merely specific implementations of the present invention, used to illustrate the technical solutions of the present invention, and not to limit it. The scope of protection of the present invention is not limited thereto. Although the present invention has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that any person skilled in the art can still modify or easily conceive of changes to the technical solutions described in the foregoing embodiments within the scope of the technology disclosed in the present invention, or make equivalent substitutions for some of the technical features; and these modifications, changes, or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of the present invention. All should be covered within the scope of protection of the present invention. Therefore, the scope of protection of the present invention should be determined by the scope of the claims.

Claims

1. A method for detecting the contour of a hand, characterized in that, The method includes: The segmentation threshold is adaptively set based on the input image; The input image is binary segmented by an adaptively set segmentation threshold to obtain a foreground region and a background region. The palm region is extracted based on the foreground region; Based on the palm region, the palm boundary is located to obtain the palm outline; The step of extracting the palm region based on the foreground region includes: Extract the largest connected region from the foreground region to obtain the palm region; Calculate the centroid of the palm region and the minimum bounding rectangle; Based on the width of the minimum bounding rectangle The distance from the centroid to the palm boundary is determined by the height h of the input image. ; Will The region is set as the background region, and the maximum connected region of the foreground region is extracted again to obtain the palm region; The process of finding the palm boundary based on the palm region to obtain the palm outline includes: Calculate the centroid of the palm region and use the boundary point of the palm region directly below the centroid as the initial contour point; Take the pixel at a certain distance directly above the initial contour point as the starting point, and with the initial contour point as the center and the distance between the initial contour point and the starting point as the radius, find the intersection point with the boundary of the palm area in a clockwise or counterclockwise direction from the starting point, and take it as the next contour point. For each current contour point after the initial contour point, with the current contour point as the center and the distance between the current contour point and the previous contour point as the radius, starting from the previous contour point, find the intersection point with the boundary of the palm area in a clockwise or counterclockwise direction, and use it as the next contour point; until all contour points form a closed area.

2. The hand contour detection method according to claim 1, characterized in that, The step of adaptively setting the segmentation threshold based on the input image includes: The segmentation threshold is taken to traverse each gray value in the gray range of [0, 255]. The input image is binary segmented using the value of each segmentation threshold to obtain the foreground region and background region corresponding to each segmentation threshold value; Calculate the inter-class variance of the foreground and background regions corresponding to each segmentation threshold value; The segmentation threshold corresponding to the largest inter-class variance is used as the adaptively set segmentation threshold.

3. The hand contour detection method according to claim 2, characterized in that, The inter-class variance is determined based on the pixel proportions of the foreground and background regions in the input image corresponding to the segmentation threshold, the average gray value of the foreground region corresponding to the segmentation threshold, and the average gray value of the background region corresponding to the segmentation threshold.

4. The hand contour detection method according to claim 3, characterized in that, The inter-class variance g is calculated using the following formula: ,in, and These represent the pixel percentages of the foreground and background regions in the input image corresponding to the values ​​of the segmentation threshold. The value of the segmentation threshold corresponds to the average grayscale value of the foreground region. The average grayscale value of the background region corresponding to the value of the segmentation threshold.

5. The hand contour detection method according to claim 1, characterized in that, The step of performing binary segmentation on the input image using an adaptively set segmentation threshold to obtain a foreground region and a background region includes: The gray value of each pixel in the input image is compared with the adaptively set segmentation threshold. Pixels with gray values ​​greater than the adaptively set segmentation threshold are designated as foreground regions, and pixels with gray values ​​less than or equal to the adaptively set segmentation threshold are designated as background regions. For each pixel, determine the number of pixels belonging to the foreground region within a certain area around the pixel. If the number is less than a set threshold, the pixel is considered as the background region; otherwise, the pixel is considered as the foreground region.

6. A hand contour detection device, characterized in that, The device includes: The segmentation threshold setting module is used to adaptively set the segmentation threshold based on the input image; The binary segmentation module is used to perform binary segmentation on the input image using an adaptively set segmentation threshold to obtain a foreground region and a background region. A palm region extraction module is used to extract the palm region based on the foreground region; The palm contour extraction module is used to find the palm boundary based on the palm region and obtain the palm contour. The palm region extraction module includes: The first extraction unit is used to extract the largest connected region of the foreground region to obtain the palm region; The first calculation unit is used to calculate the centroid of the palm region. and the minimum bounding rectangle; The second calculation unit calculates based on the width of the minimum bounding rectangle. The distance from the centroid to the palm boundary is determined by the height h of the input image. ; The second extraction unit is used to extract... The region is set as the background region, and the maximum connected region of the foreground region is extracted again to obtain the palm region; The palm contour extraction module includes: An initial calculation unit is used to calculate the centroid of the palm region and take the boundary point of the palm region directly below the centroid as the initial contour point; The searching unit is used to take a pixel at a certain distance directly above the initial contour point as the starting point, and with the initial contour point as the center and the distance between the initial contour point and the starting point as the radius, to search for the intersection point with the boundary of the palm area in a clockwise or counterclockwise direction, and take it as the next contour point. The iterative unit is used to find the intersection point with the boundary of the palm region for each current contour point after the initial contour point, with the current contour point as the center and the distance between the current contour point and the previous contour point as the radius, starting from the previous contour point in a clockwise or counterclockwise direction, and use it as the next contour point; until all contour points form a closed region.

7. A computer-readable storage medium for palm contour detection, characterized in that, It includes a memory for storing processor-executable instructions, which, when executed by the processor, implement the steps of the palm contour detection method according to any one of claims 1-5.

8. A device for detecting the contour of a hand, characterized in that, It includes at least one processor and a memory storing computer-executable instructions, wherein the processor executes the instructions to implement the steps of the palm contour detection method according to any one of claims 1-5.