Finger crescent subject recognition method and device based on computer vision

Through computer vision technology, Python and OpenCV libraries are used to perform image processing on finger crescents, extract their chromaticity values ​​and shape features, solve the problem of lack of objectivity and quantitative identification in traditional methods, and realize automatic identification and diagnostic analysis of finger crescents. .

CN117173153BActive Publication Date: 2024-09-06SOUTHEAST UNIV NANJING INST OF BIOMATERIALS & MEDICAL DEVICES
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202311275565.6
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-09-28
Publication Date
2024-09-06
Estimated Expiration
2043-09-28

AI Technical Summary

Technical Problem

The traditional method of judging finger crescents lacks objectivity and quantitative identification, and cannot effectively conduct automated health status analysis.

Method used

Using a method based on computer vision, by obtaining a set of finger images, the average chromaticity value and shape characteristics of the crescent body are extracted, and Python and OpenCV libraries are used for image processing and analysis, including grayscale conversion, contour detection, approximate polygon approximation and shape analysis. , generate recognition results.

Benefits of technology

It realizes the automatic quantitative identification of the main body of the finger crescent, provides objective and accurate multi-type feature data, and provides comprehensive and accurate data for subsequent diagnostic analysis.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN117173153B
    Figure CN117173153B
Patent Text Reader

Abstract

The present invention relates to a finger crescent body recognition method and device based on computer vision, the method comprising: obtaining an image set, the image set comprising multiple finger images of a detection object containing a crescent body, and the brightness of each finger image is consistent; extracting the average chromaticity value of the crescent body part in the finger image; defining a class in Python to analyze the shape of the crescent body in the finger image, including: converting the finger image into a grayscale image and performing binarization processing; finding the outline of the crescent body in the grayscale image; approximating the outline to obtain an approximate polygon, judging the shape type of the crescent body according to the number of vertices of the approximate polygon; outputting the chromaticity value of the crescent body part and the shape analysis result of the crescent body as the recognition result. The present invention realizes automatic and objective quantitative recognition of crescent body features, and provides accurate feature data for subsequent clinical diagnosis.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of image processing, and in particular to a method and device for identifying a finger crescent subject based on computer vision. Background Art

[0002] The human finger lunula refers to the arc-shaped area of ​​the fingernail bed. It is located at the top of the nail bed and presents a half-moon-shaped curve, hence the name lunula. The main function of the finger lunula is to protect the fingertips and nail beds. It plays a buffering and protective role, which can reduce the damage to the fingers when they are hit and pressed by the outside world. The existence of the finger lunula makes the nails stronger and less likely to break and break. In addition, the finger lunula can also prevent the nails from growing too long and prevent the nails from piercing the skin, causing infection and pain.

[0003] The health of the finger lunula can reflect the overall health of the human body. A healthy finger lunula should be a transparent, smooth, and uniform half-moon shape, forming a perfect connection with the nail bed. If the finger lunula is pale or whitish in color, it may be a sign of malnutrition or anemia. If the finger lunula is yellow or yellowish in color, it may be a sign of nail fungus infection or other health problems. At the same time, the size and shape of the finger lunula vary from person to person, and are usually related to individual genetic factors. Therefore, regular observation of the color and shape of the finger lunula can help clinicians detect abnormalities in physical health in a timely manner. However, the traditional judgment of the finger lunula relies on the doctor's subjective evaluation, which is not objective, and the prior art also lacks a method for objectively quantifying and evaluating the finger lunula. Summary of the invention

[0004] In view of the deficiencies in the prior art, the present invention provides a method and device for identifying a finger crescent body based on computer vision, the purpose of which is to automatically and objectively quantify the features of the crescent body.

[0005] The technical solution adopted by the present invention is as follows:

[0006] The present invention provides a finger crescent subject recognition method based on computer vision, comprising:

[0007] Acquire an image set, wherein the image set includes multiple finger images of a detection object including a crescent body, and the brightness of each finger image is consistent;

[0008] Extract the average chromaticity value of the main part of the crescent in the finger image;

[0009] Define a class in Python to analyze the shape of the crescent body in the finger image, including:

[0010] Convert the finger image into a grayscale image and perform binarization processing;

[0011] Find the outline of the crescent body in the grayscale image;

[0012] Approximating the outline to obtain an approximate polygon, and determining the shape type of the crescent body according to the number of vertices of the approximate polygon;

[0013] The chromaticity value of the main part of the crescent and the shape analysis result of the main part of the crescent are output as the recognition result.

[0014] Further technical solutions are:

[0015] The method of extracting the average chromaticity value of the main part of the crescent in the finger image includes:

[0016] Convert each finger image into a grayscale image and then into RGBA format to obtain the width and height of the image;

[0017] Perform pixel traversal on each image, and for each pixel, determine whether its RGB value is all 0. If so, set it as a new background color, thereby replacing the color of the background area with a unified new background color, and then resave the image; the background area is the remaining area excluding the main part of the crescent;

[0018] Convert each resaved image to RGBA format, obtain the width and height of the image, and initialize the counters of the number of non-background pixels and pixel values ​​of the image to zero;

[0019] Then, the image is traversed pixel by pixel, and the obtained pixel value is compared with the background color. If they are not equal, it is judged as a non-background pixel point, and the pixel value and number of the non-background pixel points are accumulated to obtain the accumulated pixel value and the total number of non-background pixel points;

[0020] Divide the accumulated pixel value by the total number of non-background pixels to obtain the average pixel value of each image;

[0021] The average pixel value of all images in the image set is accumulated and divided by the total number of images to obtain the total average pixel value of the image set.

[0022] The main part of the crescent of each image is printed according to the average pixel value of each image to obtain a homogenized image of the main part of the crescent.

[0023] The new background color is white with an RGB value of (255,255,255).

[0024] Define a class in Python to analyze the shape of the crescent body in the finger image, including:

[0025] The perimeter, center position and area of ​​the crescent body are calculated based on the outline.

[0026] During shape analysis, a blank image having the same size as the image to be analyzed is created, which is used to print out the main body of the crescent according to the outline, and the center point is marked according to the center position.

[0027] The contour of the crescent body is found using the findContours module in the OpenCV library based on the Python algorithm, and the approxPolyDP module is used to approximate the contour to obtain an approximate polygon.

[0028] In the class constructor, create a dictionary to record the number of different crescent body shapes.

[0029] The correlation between the recognition result and the clinical data and the diagnosis result is established by training the diagnosis model.

[0030] The present invention also provides a finger crescent main body recognition device based on computer vision, which is used to execute the finger crescent main body recognition method based on computer vision.

[0031] The beneficial effects of the present invention are as follows:

[0032] The present invention realizes automatic quantitative recognition of the main body of the crescent on the finger based on computer vision technology, obtains multi-type features of the main body of the crescent, and provides objective, accurate and comprehensive data for subsequent diagnosis and analysis.

[0033] The recognition method of the present invention is implemented based on Python algorithm using OpenCV library. The algorithm is concise, easy to understand, and easy to debug and optimize.

[0034] Other features and advantages of the present invention will be set forth in the following description or may be learned by practicing the present invention. BRIEF DESCRIPTION OF THE DRAWINGS

[0035] Figure 1 A flowchart of a method is provided for an embodiment of the present invention.

[0036] Figure 2 This is a finger image collected by the embodiment of the present invention.

[0037] Figure 3 This is a homogenized image of the crescent body printed out according to an embodiment of the present invention. DETAILED DESCRIPTION

[0038] The specific implementation of the present invention is described below with reference to the accompanying drawings.

[0039] See also Figure 1 The present application provides a finger crescent subject recognition method based on computer vision, comprising:

[0040] Acquire an image set, wherein the image set includes multiple finger images of a detection object including a crescent body, and the brightness of each finger image is consistent;

[0041] Extract the average chromaticity value of the main part of the crescent in the finger image;

[0042] Define a class in Python to analyze the shape of the crescent body in the finger image, including:

[0043] Convert the finger image into a grayscale image and perform binarization processing;

[0044] Find the outline of the crescent body in the grayscale image;

[0045] Approximating the outline to obtain an approximate polygon, and determining the shape type of the crescent body according to the number of vertices of the approximate polygon;

[0046] The chromaticity value of the main part of the crescent and the shape analysis result of the main part of the crescent are output as the recognition result.

[0047] This application realizes the quantitative identification of the finger crescent features, providing comprehensive, accurate and objective data for subsequent diagnostic analysis.

[0048] Since the main body color of the crescent is not uniform, in order to obtain a uniform and quantifiable color feature, the present application extracts the average chromaticity value of the main body of the crescent in the finger image, specifically including:

[0049] Convert each finger image into a grayscale image and then into RGBA format to obtain the width and height of the image. A person skilled in the art will know that after conversion into a grayscale image, the rest of the image at the crescent part, i.e., the background area, is black with an RGB value of (0,0,0).

[0050] Perform pixel traversal on each image, and for each pixel, determine whether its RGB value is all 0. If so, set it as a new background color, thereby replacing the color of the background area with a unified new background color, and then resave the image; the background area is the remaining area excluding the main part of the crescent;

[0051] Convert each resaved image to RGBA format, obtain the width and height of the image, and initialize the counters of the number of non-background pixels and pixel values ​​of the image to zero;

[0052] Then, the image is traversed pixel by pixel, and the obtained pixel value is compared with the background color. If they are not equal, it is judged as a non-background pixel point, and the pixel value and number of the non-background pixel points are accumulated to obtain the accumulated pixel value and the total number of non-background pixel points;

[0053] Divide the accumulated pixel value by the total number of non-background pixels to obtain the average pixel value of each image;

[0054] The average pixel value of all images in the image set is accumulated and divided by the total number of images to obtain the total average pixel value of the image set.

[0055] So far, the present application has obtained the average pixel value of the crescent body of each to-be-detected finger of each detection object, and obtained the total average pixel value of the crescent bodies of all fingers.

[0056] Based on the obtained average pixel value index and the identified shape type, the objective parameters of the crescent body can be provided for subsequent clinical diagnosis. At the same time, the mapping relationship between the objective parameters of the crescent body and clinical symptoms and diagnostic results can be further established by training the diagnostic model.

[0057] The following is a specific example to further illustrate the computer vision-based finger crescent subject recognition method of the present application.

[0058] This embodiment recognizes the finger crescent body based on the Python algorithm, including:

[0059] Multiple finger images of the detection object containing the crescent body are obtained. When collecting images, automatic white balance and automatic exposure are applied, and no color gain is used. The finger crescent is placed on the platform directly below the camera. All images are preprocessed to make the brightness consistent, and are collected and saved in JPG format (860×480 pixels) to form an image set; the collected pictures are as follows: Figure 2 As shown, it should be noted that due to the limitation that the drawings in the specification cannot be in color, Figure 2 This is the effect picture after grayscale processing, which is actually a color image taken normally;

[0060] Use the OpenCV library to load the input image, convert the image to grayscale, and then use the convert() method to convert the image to RGBA mode. The attributes get the width and height of the image.

[0061] Use the load() method to obtain the pixel data of the image, and use a nested loop to traverse the pixels of the image according to the width and height;

[0062] For each pixel, determine whether its RGB value is all 0. If so, set it to the new background color - white with an RGB value of (255,255,255), and then save the image. At this time, the main part of the crescent in the image is highlighted.

[0063] Calculate the average chromaticity value of the image excluding the background: Use the Image.open() function in the PI L library to open the image with the background removed (or the background color unified), and convert it to RGBA mode, then obtain the width and height of the image, and initialize the red, green, and blue channels and pixel counters to 0 respectively. Next, loop through each pixel point, and for each pixel point, determine whether its transparency is not 0. If so, add its RGB value to the corresponding channel and counter respectively. Finally, calculate the average chromaticity value according to the value of the counter, and return a tuple representing the RGBA color, which is the average pixel value of the main part of the crescent. The RGBA value of the main body of the crescent in a certain image obtained in this embodiment is (177, 162, 171, 255), where the RGB pixel value is (177, 162, 171), and the brightness value is 255;

[0064] Print the average distribution map of the main body of the crescent according to the average pixel value, that is, the map after the chromaticity of the main body of the crescent is averaged, such as Figure 3 As shown, Figure 2 Same, Figure 3 This is the effect picture after grayscale processing, which is actually a color image;

[0065] So far, chroma extraction is completed;

[0066] On this basis, the average pixel value of the main part of the crescent of each image can be weighted averaged to obtain the total average pixel value of the entire image set, that is, the average chromaticity value of the main part of the crescent of all fingers of the detected object;

[0067] Then, the main shape of the crescent is analyzed. This step can also be performed before the chromaticity value is extracted, and specifically includes:

[0068] Use OpenCV library to load input image;

[0069] Define a class in Python to analyze the shape of the crescent body in the finger image:

[0070] Convert the input image into a grayscale image, obtain the height, width and number of channels of the image, and perform binarization processing to obtain a binary image;

[0071] Use the findContours function to find the contours in the image, use the approxPolyDP function to approximate the contours to get an approximate polygon, and determine the type of shape based on the number of vertices of the polygon;

[0072] Specifically, the algorithm in this embodiment assumes that the shape in the image is closed and the boundary of the shape is continuous. If other types of images need to be processed, please modify according to specific needs.

[0073] The circumference (cv.arcLength function), center position and area (cv.contourArea function) of the crescent body can also be calculated based on the contour. The recognition result of the crescent body shape in a certain image obtained in this embodiment is: circumference 468.458mm, area 4466.500mm 2 , the shape is round.

[0074] In order to obtain the visualization results, after the image is loaded, a blank image with the same size as the input image is created to print the outline of the crescent body and mark the center position;

[0075] The final printout includes the recognition results of the crescent body (outline and center position), chromaticity value, shape type, area and perimeter.

[0076] In order to prepare for the creation of a more comprehensive database for subsequent clinical diagnosis, this embodiment initializes a dictionary in the class constructor to store the number of different shapes.

[0077] The recognition results obtained in this embodiment can be used as objective parameters of the crescent body for subsequent clinical diagnosis. The relationship between the recognition results of the crescent body quantitative features and the clinical (personal health status, related symptoms, etc.) and diagnostic results can be further established by training the diagnostic model.

[0078] This embodiment also provides a method for executing the above-mentioned finger crescent subject recognition based on computer vision.

[0079] This application is based on computer vision technology to automatically analyze and identify the main body of the finger crescent. A variety of identification features (chromaticity value, contour, area, perimeter and center position) can be obtained, thereby improving the accuracy of subsequent crescent status analysis and symptom diagnosis. The algorithm used in the identification method can be implemented in Python, and the code is concise and easy to understand, debug and optimize.

[0080] Those skilled in the art can understand that the above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. Although the present invention is described in detail with reference to the aforementioned embodiments, those skilled in the art can still modify the technical solutions recorded in the aforementioned embodiments or replace some of the technical features therein by equivalents. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present invention shall be included in the protection scope of the present invention.

Claims

1. A finger crescent subject recognition method based on computer vision, characterized in that: include: Acquire an image set, wherein the image set includes multiple finger images of a detection object including a crescent body, and the brightness of each finger image is consistent; Extract the average chromaticity value of the main part of the crescent in the finger image; Define a class in Python to analyze the shape of the crescent body in the finger image, including: Convert the finger image into a grayscale image and perform binarization processing; Find the outline of the crescent body in the grayscale image; Approximating the outline to obtain an approximate polygon, and determining the shape type of the crescent body according to the number of vertices of the approximate polygon; Outputting the chromaticity value of the main part of the crescent and the shape analysis result of the main part of the crescent as the recognition result; The step of extracting the average chromaticity value of the main part of the crescent in the finger image includes: Convert each finger image into a grayscale image and then into RGBA format to obtain the width and height of the image; Perform pixel traversal on each image, and for each pixel, determine whether its RGB value is all 0. If so, set it as a new background color, thereby replacing the color of the background area with a unified new background color, and then resave the image; the background area is the remaining area excluding the main part of the crescent; Convert each resaved image to RGBA format, obtain the width and height of the image, and initialize the counters of the number of non-background pixels and pixel values ​​of the image to zero; Then, the image is traversed pixel by pixel, and the obtained pixel value is compared with the background color. If they are not equal, it is judged as a non-background pixel point, and the pixel value and number of the non-background pixel points are accumulated to obtain the accumulated pixel value and the total number of non-background pixel points; Divide the accumulated pixel value by the total number of non-background pixels to obtain the average pixel value of each image; The average pixel value of all images in the image set is accumulated and divided by the total number of images to obtain the total average pixel value of the image set.

2. The finger crescent subject recognition method based on computer vision according to claim 1 is characterized in that: The main part of the crescent of each image is printed according to the average pixel value of each image to obtain a homogenized image of the main part of the crescent.

3. The finger crescent subject recognition method based on computer vision according to claim 1 is characterized in that: The new background color is white with an RGB value of (255, 255, 255).

4. The finger crescent subject recognition method based on computer vision according to claim 1, characterized in that: Define a class in Python to analyze the shape of the crescent body in the finger image, including: The perimeter, center position and area of ​​the crescent body are calculated based on the outline.

5. The finger crescent subject recognition method based on computer vision according to claim 4 is characterized in that: During shape analysis, a blank image having the same size as the image to be analyzed is created, which is used to print out the main body of the crescent according to the outline, and the center point is marked according to the center position.

6. The finger crescent subject recognition method based on computer vision according to claim 1, characterized in that: The contour of the crescent body is found using the findContours module in the OpenCV library based on the Python algorithm, and the approxPolyDP module is used to approximate the contour to obtain an approximate polygon.

7. The finger crescent subject recognition method based on computer vision according to claim 1, characterized in that: In the class constructor, create a dictionary to record the number of different crescent body shapes.

8. The finger crescent subject recognition method based on computer vision according to claim 1, characterized in that: The correlation between the recognition result and the clinical data and the diagnosis result is established by training the diagnosis model.

9. A finger crescent body recognition device based on computer vision, characterized in that: Used to execute the computer vision-based finger crescent subject recognition method as described in any one of claims 1-8.