Foot type rapid detection method and device based on image processing

The foot image processing is performed by Gaussian filtering and K-means algorithm combined with the YOLOv8 model, and the flat foot is judged by multiple features, which solves the problem of slow detection speed and inability to target different groups of people in the existing technology, and achieves faster and more accurate flat foot detection.

CN119228867APending Publication Date: 2024-12-31GUANGZHOU UNIVERSITY OF CHINESE MEDICINE

Patent Information

Application Number
CN202411477179.X
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-10-22
Publication Date
2024-12-31

AI Technical Summary

Technical Problem

In the prior art, in flat foot detection, feature extraction speed is not fast enough, image processing takes a long time, and it is impossible to accurately judge the differences in sole pressures of different groups of people.

Method used

Gaussian filtering and K-means algorithm combined with YOLOv8 model for sole image segmentation, weighted grayscale and binarization, corrosion and expansion of non-connected areas, smoothing the image using the median filtering algorithm, and passing the arch coefficient and foot The foot shape is comprehensively judged by the seal coefficient, arch width and proportional coefficient, and different judgment rules are set for the elderly, children, and middle-aged and young people.

Benefits of technology

The speed and accuracy of flat foot detection are improved, and the processing time can be shortened without losing accuracy, achieving more accurate judgments on the arch shape and stability of different groups of people.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119228867A_ABST
    Figure CN119228867A_ABST
Patent Text Reader

Abstract

The invention discloses a foot shape rapid detection method and device based on image processing. The foot shape rapid detection method comprises the following steps: S1, image preprocessing; s2, planta pedis image segmentation: segmenting a planta pedis heavy pressure part from the whole image by using a K-means algorithm in combination with a YOLOv8 model to obtain a planta pedis image; s3, graying: performing weighted graying on the sole image obtained in the step S2 to obtain a sole grey-scale map; s4, binaryzation: dividing the sole grey-scale map into a sole heavy pressure part and other parts; s5, morphological operation: performing non-connected region corrosion on the image obtained in the step S4, and then performing expansion to obtain a footprint image; and S6, foot shape detection: carrying out median filtering on the obtained footprint image, smoothing the image, solving four characteristics, and discriminating the foot shape. According to the method, the K-means algorithm and the yov8 segmentation model are combined to extract the heavy pressure area of the image, so that the calculation speed is greatly improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The invention relates to the field of image processing, and is particularly suitable for low-cost and rapid foot shape detection. Background Art

[0002] The arch of the foot plays a vital role in the human body, including support, cushioning, etc. According to the degree of curvature of the medial longitudinal arch of the foot, the foot type can be divided into normal foot, flat foot and high arch foot. Flat feet, as a common foot disease, are receiving more and more attention. Flat feet not only affect walking posture, causing foot pain, discomfort and other problems, but also affect the overall coordination and movement efficiency of the body. Most of these problems are caused by abnormal arches. There are many reasons for abnormal arches. The first is congenital factors, which may be genetic, congenital diseases, etc.; the second is acquired factors: the first is excessive weight, which causes great pressure on the sole of the foot. The second is improper wearing of shoes, which causes the middle part of the sole to sink over time. Therefore, it is particularly important to detect flat feet in a timely and accurate manner and treat them.

[0003] At present, the detection methods of foot diseases mainly include physical methods, pressure tests and laser scanning. The traditional physical method relies on professional visual observation, which is labor-intensive and inaccurate; although pressure tests and laser scanning are highly accurate, they are expensive and not easy to promote; flat foot detection technology based on image processing has the advantages of low cost, simple operation, and high degree of automation. Through image acquisition equipment, combined with computer vision algorithms, the characteristics of the sole of the foot are solved to achieve the purpose of flat foot detection.

[0004] Among them, in the flat foot detection technology based on image processing, an invention patent with a publication number of CN117958801A discloses a method and system for calculating the arch coefficient, which sets a circled area and moves the circled area, extracts the area where the most convex point of the first metatarsal bone, the area where the most convex point of the inner side of the heel and the area where the most concave point of the arch are located, which have no intersection relationship with each other through the intersection of the circled area and the outer contour of the footprint, and determines the feature points P1, P2, P3, P4 and P5 based on the area where the most convex point of the first metatarsal bone, the area where the most convex point of the inner side of the heel and the area where the most concave point of the arch are located, thereby improving the recognition accuracy of the feature points, and calculating the arch coefficient based on the coordinates of the feature points, realizing the automatic calculation of the arch coefficient, and the calculation result is stable and accurate. This invention solves the technical problem of large human influence factors in the manual recognition process by automatically calculating the arch coefficient. In addition, the present invention selects a calculation method for the feature point P3 according to different arch types, thereby solving the influence of interference points and different foot shapes on the recognition success rate during the fully automatic recognition process, thereby improving the accuracy and success rate of feature point recognition, and then improving the accuracy of arch coefficient calculation.

[0005] For another example, a master's thesis (author Liu Bintao, 2016.3.31, University of Electronic Science and Technology of China) disclosed the research on flatfoot detection methods based on image processing. The thesis first studied and analyzed the commonly used flatfoot detection methods, and then used image processing to realize the automation of flatfoot detection. The research focused on the characteristics and processing methods of footprint images. The main work is as follows: (1) The traditional flatfoot detection methods were studied and analyzed, some commonly used detection methods and flatfoot evaluation systems were listed, and the advantages and disadvantages of each method and system were analyzed. Finally, a footprint image acquisition device was introduced, which is simple, convenient and low-cost. (2) The characteristics of the acquired footprint images were analyzed, and the K-means algorithm was optimized based on the image characteristics. The optimized K-means algorithm was used to achieve stable extraction of the entire footprint. (3) Based on the principle of the mean shift algorithm, the color full footprint image was segmented by mean shift image segmentation, and the extraction of the heavy pressure area of ​​the color footprint image was achieved. (4) The image is processed by mean shift discontinuity filtering and grayscale processing, and the double threshold method and Otsu algorithm are combined to complete the preliminary extraction of the heavy pressure area in the pseudo-color footprint image, so that the heavy pressure area segmentation method is optimized. (5) The corresponding indicators of the heavy pressure area are calculated, and the arch coefficient evaluation system is used to detect flat feet. Then, the algorithm is verified and compared with multiple sets of collected samples, and the experimental results are analyzed and summarized. Finally, the flat foot detection system software is designed by combining the footprint collection device and the algorithm proposed in this paper. However, in practical applications, the following problems exist: 1. It uses the K-means algorithm to extract the characteristics of the acquired footprint image and the stability of the entire footprint, but the feature extraction and object detection performance is not high enough and the speed is not fast enough, which seriously affects the scope of practical application; 2. After using the optimized K-means algorithm to extract the entire footprint, it performs mean shift discontinuity filtering and grayscale processing on the image, and combines the double threshold method with the Otsu algorithm to complete the preliminary extraction of the heavy pressure area. This step is relatively time-consuming, and the time is mainly concentrated on the mean shift discontinuity filtering, which is about two seconds; 3. After obtaining the final footprint image, it only calculates the arch coefficient to judge the foot type, and this judgment condition is relatively simple.

[0006] In addition, existing technologies do not take into account the differences in plantar pressure among different groups such as the elderly, children, and young and middle-aged people under different conditions such as age, obesity, and disease. Therefore, it is impossible to more accurately judge the shape and stability of the arch of the foot for special groups of people. Summary of the invention

[0007] A brief summary of embodiments of the present invention is provided below to provide a basic understanding of certain aspects of the present invention. It should be understood that the following summary is not an exhaustive summary of the present invention. It is not intended to identify key or important parts of the present invention, nor is it intended to limit the scope of the present invention. Its purpose is merely to provide certain concepts in a simplified form as a prelude to a more detailed description discussed later.

[0008] According to one aspect of the present application, a method for rapid foot type detection based on image processing is provided, which comprises:

[0009] Step S1, image preprocessing: obtain a sample image set, and use a Gaussian function as a filter function to reduce noise and smooth the image;

[0010] Step S2, plantar image segmentation: Use the K-means algorithm combined with the YOLOv8 segmentation model to segment the plantar pressure area in the sample image set after the image preprocessing in step S1 from the entire image to obtain a plantar image; specifically including:

[0011] Step S21: Use the K-means algorithm to perform the following secondary preprocessing on each image in the sample image set:

[0012] Step S211, load the image file to be processed, convert it into a vector representation of the RGB color space, extract the feature vector of the image file, and organize the extracted feature vector into a two-dimensional feature matrix, in which each row represents a sample (data point) and each column represents a feature; in the constructed feature matrix, randomly select K data points (i.e., K rows) as initial clustering centers;

[0013] Step S212: Use the Euclidean distance formula to calculate the distance between each data point and each initial cluster center. The Euclidean distance formula is: Each data point is then assigned to the cluster represented by the nearest initial cluster center, and the members of each cluster are updated based on the assignment result; each cluster has a representative point, called the cluster center or centroid, which represents the "average" position of all data points in the cluster. Therefore, the number of clusters is the same as the number of cluster centers.

[0014] Where d is the Euclidean distance between the first data point and the second data point; x1, y1 are the coordinates of the first data point, and x2, y2 are the coordinates of the second data point;

[0015] Step S213: recalculate the cluster center of each cluster; the calculation formula of the new cluster center is: Where ci is the coordinate of the cluster center of the i-th cluster, ni is the number of data points in the cluster, and pij represents the coordinate of the j-th data point;

[0016] Step S214, repeat S212 and S213 until the cluster center no longer changes significantly or the maximum number of iterations is reached;

[0017] Step S22, segmenting the image after secondary preprocessing through the YOLOv8 model to obtain a plantar image;

[0018] This step specifically includes:

[0019] Step S221, building a hardware platform, using the RV1126 development board to control the camera to take pictures, and collecting plantar images of different groups of people as a data set for the deep learning model;

[0020] Step S222: select the YOLOV8-seg model as the segmentation model of this article according to the difficulty of deployment and the reasoning speed after deployment;

[0021] Step S223: label and train the data set according to the format requirements of YOLO, convert the best model obtained through training from .PT to .ONNX and then to .RKNN model, and finally deploy the .RKNN model file on the RV1126 development board;

[0022] Step S224, input the image after the K-means clustering algorithm into the model for inference, and the model will output the result information, and the result information will be post-processed to obtain the segmented sole image, at which time the heavy pressure area of ​​the sole is displayed in the form of a black mask;

[0023] Step S3, grayscale conversion: weighted grayscale conversion is performed on the plantar image obtained in step S2 to obtain a grayscale image;

[0024] Step S4, Binarization: Grayscale Figure 2 The value is converted into two parts: the plantar pressure area and the non-plantar pressure area. The plantar pressure area corresponds to white pixels, and the non-plantar pressure area corresponds to black pixels.

[0025] Step S5, morphological operation: the image obtained in step S4 is first corroded in non-connected areas, and then dilated to repair some useful parts of the corroded areas;

[0026] Step S6, foot type detection: Use the median filter algorithm to smooth the image and perform foot type detection on the final footprint image. The foot type detection algorithm includes the following specific steps:

[0027] Step S61, smoothing the image using a median filter to remove salt and pepper noise; operating on the pixels covered by the window by moving a window on the image; at each window position, collecting the values ​​of all pixels in the window and sorting them by numerical value; selecting the middle value from the sorted pixel value list; replacing the pixel value at the center of the window with the selected median value;

[0028] Step S62, scan the image line by line from top to bottom and from left to right, determine the grayscale value of the traversed pixel points, divide the footprint into 3 parts, calculate the middle area and the total area to obtain the arch coefficient = Sm / Sz; where Sm is the area of ​​the middle part, and Sz is the total area of ​​the footprint.

[0029] Step S63, crop the image at a fixed size, scan the pixels to find the two rightmost points a and b; connect the two points to get a straight line ab, and use the variable setting method to calculate the area of ​​the area enclosed by ab and the footprint, that is, calculate the footprint coefficient = Sab / Sz, where Sab is the area of ​​the enclosed black area, and Sz is the total area of ​​the footprint;

[0030] Step S64, crop the image with a fixed size, traverse the pixel points to find the innermost point c of the arch, draw a perpendicular line between c and the straight line ab, the foot of the perpendicular is point d, the length of cd is AW', and the arch width = AW' / L is obtained by combining the scale;

[0031] Where L is the scale, which is the ratio of the actual foot length to the picture foot length, and AW′ is the length of the line segment cd;

[0032] Step S65, after edge detection, cd is extended to the left. When it intersects with the first white point, this white point is the desired point e, and the proportionality coefficient = AW' / Lce;

[0033] Where AW′ is the length of line segment cd, Lce is the length of line segment ce;

[0034] Step S66, judging the foot shape according to the calculated arch coefficient, footprint coefficient, arch width and proportional coefficient, and pre-set judgment rules.

[0035] As an implementable solution, the foot type judgment rules in the present application are as follows: if the arch coefficient is less than 0.21, it is a high-arched foot; if it is between 0.21 and 0.26, it is a normal foot; if it is greater than 0.26, it is a flat foot; if the footprint coefficient is greater than 0.31, it is a high-arched foot; if it is between 0.20 and 0.31, it is a normal foot; if it is less than 0.20, it is a flat foot; if the arch width is greater than 2.82, it is a high-arched foot; if it is between 2.43 and 2.82, it is a normal foot; if it is less than 2.43, it is a flat foot; if the ratio coefficient is greater than 1.57, it is a high-arched foot; if it is between 0.89 and 1.57, it is a normal foot; if it is less than 0.89, it is a flat foot.

[0036] As a further solution, the S1 image preprocessing also includes an image classification step, which specifically includes:

[0037] The sample image set is divided into three sets: a sample image set of the elderly group, a sample image set of the children group and a sample image set of the young and middle-aged group. The sample image set of the elderly group, the sample image set of the children group and the sample image set of the young and middle-aged group are further divided into an obesity state set, a chronic disease state set and a normal state set, namely: the sample image set of the elderly group includes a sample image set of the elderly group in an obesity state, a sample image set of the elderly group in a chronic disease state and a sample image set of the elderly group in a normal state; the sample image set of the children group includes a sample image set of the children group in an obesity state, a sample image set of the children group in a chronic disease state and a sample image set of the children group in a normal state; the sample image set of the young and middle-aged group includes a sample image set of the young and middle-aged group in an obesity state, a sample image set of the young and middle-aged group in a chronic disease state and a sample image set of the young and middle-aged group in a normal state; wherein the chronic disease state refers to sample images of the group having a medically chronic disease such as cardiovascular and cerebrovascular disease, cancer, diabetes, chronic respiratory disease and the like;

[0038] The foot shape detection algorithm in step S6 also includes judging the foot shape respectively according to the calculated arch coefficient, footprint coefficient, arch width and proportion coefficient, as well as the pre-set judgment rules for the elderly group, children group and middle-aged and young people group.

[0039] Specifically, the foot shape detection algorithm in step S6 also includes judging the foot shape according to the calculated arch coefficient, footprint coefficient, arch width and proportional coefficient, and the pre-set judgment rules for the elderly group, children group and middle-aged and young group. The specific steps include:

[0040] Execute steps S2 to S6, and respectively calculate the arch coefficient, footprint coefficient, arch width and proportional coefficient corresponding to the sample image sets of the elderly group in an obese state, the elderly group in a chronic disease state, the elderly group in a normal state, the sample image sets of the children group in an obese state, the children group in a chronic disease state, the children group in a normal state, the sample image sets of the young and middle-aged group in an obese state, the young and middle-aged group in a chronic disease state, and the young and middle-aged group in a normal state, and judge the foot types of different groups according to the pre-set judgment rules for the elderly group, the children group, and the young and middle-aged group.

[0041] In step S2, the images of each image set are first clustered using the K-means algorithm, the area of ​​interest is retained, and the rest is filled with black pixels to prepare for the subsequent yolov8 model segmentation, which can reduce the useless features of the image, thereby speeding up the reasoning of the model. In addition, in order to increase the speed without losing accuracy, the present application directly uses the K-means algorithm and the yolov8 model to extract the heavy pressure area of ​​the image in step S2, and then performs non-connected area corrosion in step S6 to eliminate the partial area left over when the heavy pressure area is extracted, so that under the premise of shortening the time, the extraction of the heavy pressure area is still excellently completed. Thereby solving the problem that the feature extraction and object detection performance in the prior art is not high enough and the speed is not fast enough, as well as the time-consuming problem of the process of performing mean shift discontinuity filtering on the image and preliminary extraction of the heavy pressure area.

[0042] Furthermore, in step S1, the noise is reduced and the image is smoothed by Gaussian filtering, and the specific steps are as follows:

[0043] S11. Use Gaussian function as filtering function.

[0044] S12: Perform weighted averaging on the image area corresponding to the convolution template

[0045] Furthermore, in step S3, the image is weighted grayscaled. The specific steps are as follows:

[0046] S31. Grayscale conversion of RGB images is to obtain grayscale values ​​by weighted averaging the three components of RGB. The grayscale value of each point is calculated by Gary=0.3*R+0.9*G+0.11*B, where R, G, and B are the values ​​of the red, green, and blue channels, respectively.

[0047] Furthermore, in step S4, the image is binarized, and the specific steps are as follows:

[0048] Pixels with a value greater than a certain value are turned white, and pixels with a value less than a certain value are turned black. In this way, when judging the connected area, we only need to pay attention to one color for identification. If two pixels are adjacent in space, they are considered to be connected; where g(x, y) is the pixel value of the pixel after binarization, f(x, y) is the pixel value of the pixel before binarization, T is the pixel threshold of binarization, and the value range of T is 0 to 255.

[0049] Furthermore, in step S5, morphological operations are performed on the image, and the specific steps are as follows:

[0050] After the connected regions are determined, the areas of the connected regions are compared. The second largest area is the footprint itself. Then the erosion operation is used to remove the remaining small white areas, and the expansion operation is used to fill the hollow parts of the footprint with white. The image is represented as set A, the structural element is represented as set B, and z represents the position of the structural element in the image; if set A is eroded by the structural element set B, it is recorded as The corrosion operation is expressed as: Where Bz is the result of aligning the center of the structural element B to point z. If the translation of the structural element B at position z is completely contained in the set A, then z is the result of corrosion. If the set A is expanded by the structural element set B, denoted as A⊕B, the expansion operation is expressed as: in represents the empty set, that is, a set without any elements. It is the translation of the structural element set B at position z. If any translation of the structural element set B at position z has at least one point in common with the set A, then position z is the result of the expansion.

[0051] In order to overcome the defect of the prior art that the foot shape is judged by only calculating the arch coefficient, which is a relatively single judgment condition, step S6 of the present application makes a comprehensive judgment based on four characteristics: arch coefficient, footprint coefficient, arch width and proportional coefficient, which can judge the foot shape more accurately.

[0052] According to another aspect of the present application, a rapid foot type detection device based on image processing is provided, comprising:

[0053] An image preprocessing unit, for reducing noise and smoothing the image by using a Gaussian function as a filter function;

[0054] The plantar image segmentation unit is used to segment the plantar pressure area from the entire image using the K-means algorithm combined with the yolov8 segmentation model;

[0055] A grayscale unit is used to perform weighted grayscale conversion on the image obtained in the previous step to obtain a grayscale image;

[0056] Binarization unit, which divides the image into the heavy pressure area on the sole and other areas;

[0057] The morphological operation unit is used to corrode the non-connected regions of the image obtained in the previous step, then to dilate it to repair some useful parts corroded in the third step, and finally to smooth the image using the median filter algorithm;

[0058] Foot shape detection unit, used to solve the four major features of the final footprint image;

[0059] The rapid foot shape detection device based on image processing executes the rapid foot shape detection method mentioned above.

[0060] Compared with the prior art, this application has the following advantages:

[0061] 1. In order to improve the speed without losing accuracy, the K-means algorithm is directly used in combination with the yolov8 segmentation model to extract the heavily compressed area of ​​the image. After some processing, the non-connected area is eroded to eliminate some areas left over when extracting the heavily compressed area. In this way, the extraction of the heavily compressed area is still completed excellently while shortening the time.

[0062] 2. This application extracts four commonly used foot shape features (arch coefficient, footprint coefficient, arch width and proportion coefficient) to comprehensively judge the foot shape, which has the advantages of strong practicality and high accuracy;

[0063] 3. This application also innovatively adds different judgment rules for special groups based on the differences in plantar pressure of different groups such as the elderly, children, and young and middle-aged groups under different conditions such as age, obesity, and disease, so as to achieve more accurate judgment of the shape and stability of the arch of the foot. BRIEF DESCRIPTION OF THE DRAWINGS

[0064] The present invention may be better understood by referring to the following description given in conjunction with the accompanying drawings, wherein the same or similar reference numerals are used throughout the drawings to represent the same or similar components. The accompanying drawings, together with the following detailed description, are included in and form a part of this specification and are used to further illustrate the preferred embodiments of the present invention and to explain the principles and advantages of the present invention. In the drawings:

[0065] Figure 1 Schematic diagram of four major features in an embodiment of the present invention, wherein: (a) arch coefficient; (b) footprint coefficient; (c) arch width; (d) proportional coefficient.

[0066] Figure 2 Schematic diagram of the footprint acquisition process in an embodiment of the present invention, wherein: (a) original image; (b) Gaussian filtering; (c) K-means clustering; (d) Yolov8 model reasoning; (e) weighted grayscale; (f) binarization; (g) non-maximum connected area erosion; (h) dilation; (i) median filtering smoothing;

[0067] Figure 3 This is a flow chart of feature solution in an embodiment of the present invention, wherein: (a) a diagram of arch coefficient area division; (b) a diagram of footprint coefficient solution; (c) a diagram of arch width solution; (d) a diagram of ratio coefficient solution;

[0068] Figure 4 It is a general flow chart of the system in the embodiment of the present invention;

[0069] Figure 5 The test result diagram in the embodiment of the present invention, wherein: (a) is the foot shape diagram of student No. 1; (b) is the foot shape diagram of student No. 2; (c) is the foot shape diagram of student No. 3;

[0070] Figure 6 A partial data set showing the plantar image of the present invention. DETAILED DESCRIPTION

[0071] Embodiments of the present invention will be described below with reference to the accompanying drawings. Elements and features described in one drawing or one embodiment of the present invention may be combined with elements and features shown in one or more other drawings or embodiments. It should be noted that for the purpose of clarity, the representation and description of components and processes that are not related to the present invention and are known to those of ordinary skill in the art are omitted in the drawings and descriptions.

[0072] The embodiment of the present invention provides a method for rapid detection of foot type based on image processing, and proposes a foot type discrimination scheme based on image processing for the purpose of rapid detection of flat feet. First, the input image is Gaussian filtered to reduce noise, and then the K-means algorithm is combined with the Yolov8 segmentation model to segment the whole foot image, and the segmented image is weighted grayscale and binarized, and then the non-connected area is eroded, expanded and median filtered to obtain the final footprint image, and finally the footprint image is calculated to obtain the four major features.

[0073] Example 1

[0074] Specifically, the purpose of the present invention is achieved through a technical solution, and the steps of the method are as follows:

[0075] S1. Image preprocessing: Get a set of sample images, use Gaussian function as a filter function, reduce noise and smooth the image;

[0076] Step S2, plantar image segmentation: Use the K-means algorithm combined with the YOLOv8 segmentation model to segment the plantar pressure area in the sample image set after the image preprocessing in step S1 from the entire image to obtain a plantar image; specifically including:

[0077] Step S21: performing secondary preprocessing on the plantar image using the K-means algorithm;

[0078] Step S22, segmenting the image after secondary preprocessing through the YOLOv8 model to obtain a plantar image;

[0079] S3, grayscale: perform weighted grayscale on the image obtained in the previous step to obtain a grayscale image;

[0080] S4, Binarization: Grayscale Figure 2The value is converted into two parts: the plantar pressure area and the non-plantar pressure area. The plantar pressure area corresponds to white pixels, and the non-plantar pressure area corresponds to black pixels.

[0081] S5, morphological operation: first erode the non-connected areas of the image obtained in the previous step, then dilate to repair some useful parts of the eroded area, and finally use the median filter algorithm to smooth the image to obtain the footprint image;

[0082] S6, foot shape detection: solve the four major features of the final footprint image. The four major features are arch coefficient, footprint coefficient, arch width and ratio coefficient.

[0083] In step S1, Gaussian filtering is used to reduce noise and smooth the image. The specific steps are as follows:

[0084] S11. Use Gaussian function as filtering function.

[0085] S12. Perform weighted averaging on the image area corresponding to the convolution template.

[0086] In step S2, the plantar image in the sample image set after image preprocessing is segmented from the entire image by using K-means combined with the YOLOv8 algorithm. The specific steps are as follows:

[0087] Step S21: Use the K-means algorithm to perform the following secondary preprocessing on each image in the sample image set:

[0088] Step S211, load the image file to be processed, convert it into a vector representation of the RGB color space, extract the feature vector of the image file, and organize the extracted feature vector into a two-dimensional feature matrix, in which each row represents a sample (data point) and each column represents a feature; in the constructed feature matrix, randomly select K data points (i.e., K rows) as initial clustering centers;

[0089] Step S212: Use the Euclidean distance formula to calculate the distance between each data point and each initial cluster center. The Euclidean distance formula is: Each data point is then assigned to the cluster represented by the nearest initial cluster center, and the members of each cluster are updated based on the assignment result; each cluster has a representative point, called the cluster center or centroid, which represents the "average" position of all data points in the cluster. Therefore, the number of clusters is the same as the number of cluster centers.

[0090] Where d is the Euclidean distance between the first data point and the second data point; x1, y1 are the coordinates of the first data point, and x2, y2 are the coordinates of the second data point;

[0091] Step S213: recalculate the cluster center of each cluster; the calculation formula of the new cluster center is: Where ci is the coordinate of the cluster center of the i-th cluster, ni is the number of data points in the cluster, and pij represents the coordinate of the j-th data point;

[0092] Step S214, repeat S212 and S213 until the cluster center no longer changes significantly or the maximum number of iterations is reached;

[0093] Step S22: segment the image after secondary preprocessing through the YOLOv8 model to obtain a plantar image.

[0094] The specific steps of weighted grayscale conversion of the image in step S3 are as follows:

[0095] Grayscale of RGB image is to obtain the grayscale value Gray by weighted average of the three components of RGB. The grayscale value of each point is calculated by the formula: Gray = 0.299*R + 0.587*G + 0.114*B;

[0096] Among them, R, G, B are the values ​​of the red, green, and blue channels respectively, and Gray is the grayscale value calculated for each pixel in the image. In the standard 8-bit RGB color model, the value range of R, G, and B channels is from 0 to 255.

[0097] Step S4, Binarization: Grayscale Figure 2 The value is converted into two parts: the plantar pressure area and the non-plantar pressure area. The plantar pressure area corresponds to white pixels, and the non-plantar pressure area corresponds to black pixels. The specific steps are as follows:

[0098] Pixels with a value greater than a certain value are turned white, and pixels with a value less than a certain value are turned black. In this way, when judging the connected area, we only need to focus on one color to identify it. If two pixels are adjacent in space, they are considered to be connected;

[0099] Where g(x,y) is the pixel value of the pixel after binarization, f(x,y) is the pixel value of the pixel before binarization, T is the pixel threshold of binarization, and the value range of T is 0 to 255.

[0100] The specific steps of the morphological operation in step S5 are as follows:

[0101] After the connected regions are determined, the areas of the connected regions are compared to find the footprint body. Then, the erosion operation is used to remove the remaining small white areas, and the dilation operation is used to fill the hollow parts of the footprint body with white. The image is represented as set A, the structural element is represented as set B, and z represents the position of the structural element in the image. If set A is eroded by the structural element set B, it is recorded as The corrosion operation is expressed as: Among them, Bz is the result after aligning the center of the structural element set B to position z; if the translation of the structural element set B at position z is completely contained in the set A, then z is the result of corrosion; if the set A is expanded by the structural element set B, recorded as A⊕B, then the expansion operation is expressed as: Where φ represents the empty set, that is, a set without any elements. It is the translation of the structural element set B at position z. If any translation of the structural element set B at position z has at least one point in common with the set A, then position z is the result of the expansion.

[0102] Step S6: Foot shape detection algorithm includes the following specific steps:

[0103] Step S61, smoothing the image using a median filter to remove salt and pepper noise; operating on the pixels covered by the window by moving a window on the image; at each window position, collecting the values ​​of all pixels in the window and sorting them by numerical value; selecting the middle value from the sorted pixel value list; replacing the pixel value at the center of the window with the selected median value;

[0104] Step S62, scan the image line by line from top to bottom and from left to right, determine the grayscale value of the traversed pixel points, divide the footprint into 3 parts, calculate the middle area and the total area to obtain the arch coefficient = Sm / Sz; where Sm is the area of ​​the middle part, and Sz is the total area of ​​the footprint.

[0105] Step S63, crop the image at a fixed size, scan the pixels to find the two rightmost points a and b; connect the two points to get a straight line ab, and use the variable setting method to calculate the area of ​​the area enclosed by ab and the footprint, that is, calculate the footprint coefficient = Sab / Sz, where Sab is the area of ​​the enclosed black area, and Sz is the total area of ​​the footprint;

[0106] Step S64, crop the image with a fixed size, traverse the pixel points to find the innermost point c of the arch, draw a perpendicular line between c and the straight line ab, the foot of the perpendicular is point d, the length of cd is AW', and the arch width = AW' / L is obtained by combining the scale;

[0107] Where L is the scale, which is the ratio of the actual foot length to the picture foot length, and AW′ is the length of the line segment cd;

[0108] Step S65, after edge detection, cd is extended to the left. When it intersects with the first white point, this white point is the desired point e, and the proportionality coefficient = AW' / Lce;

[0109] Where AW′ is the length of line segment cd, Lce is the length of line segment ce;

[0110] Step S66, judging the foot shape according to the calculated arch coefficient, footprint coefficient, arch width and proportional coefficient, and the pre-set judgment rules. In specific implementation, the pre-set judgment rules can be made into a table. After calculating the footprint coefficient, arch width, proportional coefficient and other features, the foot shape can be judged by comparing the table. Each coefficient has its own table. The general judgment rules are described in detail as follows:

[0111] 1. Arch coefficient determination method

[0112] Judgment of high arched foot: When the arch coefficient is less than 0.21, it indicates that the arch of the foot is high. When walking or standing, the pressure of the foot is mainly concentrated on the outside of the heel and forefoot, which can easily lead to foot fatigue and pain, and may even cause problems such as plantar fasciitis and Achilles tendonitis. At the same time, high arched foot may also affect gait and make walking posture unnatural.

[0113] Normal foot judgment: A normal foot is one with an arch coefficient between 0.21 and 0.26. When standing and walking, the pressure distribution on the sole of the foot is relatively even, which can better cushion the weight of the body and reduce damage to the joints and soft tissues of the foot.

[0114] Flat foot judgment: If the arch coefficient is greater than 0.26, it is flat foot. Flat feet have a low arch or almost no arch, and the sole of the foot has a larger contact area with the ground. The foot is prone to fatigue and pain when walking, and it may also affect the force line of the lower limbs, causing problems in the knee joint, hip joint and other parts.

[0115] 2. Footprint coefficient determination method

[0116] Judgment of high arch foot: The footprint coefficient is greater than 0.31, which is high arch foot. The footprint of high arch foot is usually narrow, with deeper footprints on the forefoot and heel, and shallower or almost no footprint in the middle part. This type of foot is relatively less stable when walking, and requires more muscle strength to maintain balance.

[0117] Normal foot judgment: A normal foot is one with a footprint coefficient between 0.20 and 0.31. The footprint of a normal foot is relatively complete, with a certain gap in the middle, and the footprints on the forefoot, heel and arch are relatively evenly distributed.

[0118] Flat foot judgment: When the footprint coefficient is less than 0.20, it is flat foot. Flat foot footprints are usually wider, the entire sole is almost in contact with the ground, and there is no obvious arch mark.

[0119] 3. Method for judging the width of the arch

[0120] Judgment of high arch foot: If the arch width is greater than 2.82, it is high arch foot. The arch of high arch foot is higher and narrower, and the bone structure of the sole is more compact, which makes it easy for the foot to concentrate pressure in a specific part when it is under pressure, increasing the risk of injury.

[0121] Normal foot judgment: A normal foot is one with an arch width between 2.43 and 2.82. A normal foot has a moderate arch width that can provide adequate support while maintaining a certain degree of flexibility.

[0122] Flat foot judgment: If the arch width is less than 2.43, it is flat foot. Flat feet have a wide and low arch, and the soft tissue on the sole of the foot is prone to overstretching when bearing the weight of the body, causing foot pain and fatigue.

[0123] 4. Ratio coefficient judgment method

[0124] Judgment of high arch foot: The ratio coefficient is greater than 1.57, which is high arch foot. The foot morphology of high arch foot makes the height difference between the forefoot and the heel larger, which will affect the biomechanical balance of the foot and may cause instability and pain when walking.

[0125] Normal foot judgment: A normal foot is one with a ratio coefficient between 0.89 and 1.57. The ratio between the forefoot and the heel of a normal foot is moderate, and it can maintain good stability and flexibility during walking and exercise.

[0126] Flat foot judgment: When the ratio coefficient is less than 0.89, it is flat foot. Flat feet have a smaller height difference between the forefoot and the heel, and a larger contact area between the sole and the ground, which will affect the propulsion and cushioning ability of the foot.

[0127] Example 2

[0128] In this embodiment, step S21 also includes: dividing the sample image set obtained in step S1 into three sets: a sample image set of the elderly group, a sample image set of the children group and a sample image set of the middle-aged and young group, and dividing the sample image set of the elderly group, the sample image set of the children group and the sample image set of the middle-aged and young group into an obesity state set, a chronic disease state set and a normal state set respectively, that is, the sample image set of the elderly group includes a sample image set of the elderly group in an obesity state, a sample image set of the elderly group in a chronic disease state, and a sample image set of the elderly group in a normal state; the sample image set of the children group includes a sample image set of the children group in an obesity state, a sample image set of the children group in a chronic disease state, and a sample image set of the children group in a normal state; the sample image set of the middle-aged and young group includes a sample image set of the middle-aged and young group in an obesity state, a sample image set of the middle-aged and young group in a chronic disease state, and a sample image set of the middle-aged and young group in a normal state; wherein the chronic disease state refers to the plantar image of the group having a medically chronic disease such as cardiovascular and cerebrovascular disease, cancer, diabetes, chronic respiratory disease, etc.;

[0129] The K-means algorithm is used to perform secondary preprocessing on the sample image sets of the obese elderly group, the chronic disease elderly group, the normal elderly group, the obese children group, the chronic disease children group, the normal children group, the obese young and middle-aged group, the chronic disease young and middle-aged group, and the normal young and middle-aged group after the above secondary division, respectively, to obtain the secondary preprocessed images of each image set (the obese elderly group, the chronic disease elderly group, the normal elderly group, the obese children group, the chronic disease children group, the normal children group, the obese young and middle-aged group, the chronic disease young and middle-aged group, and the normal young and middle-aged group).

[0130] Through the above scheme, the present application classifies the differences in plantar pressure of different groups such as the elderly, children, and young and middle-aged groups under different conditions such as age, obesity, and disease in step S2, and performs targeted implementation steps to achieve arch identification.

[0131] Among them, in the children group, age factors: When children are 6 to 12 years old, the foot bones grow and shape, and the arch of the foot develops and matures. Obesity factors: Obese children may be at risk of flattening the arch of the foot. Combined with the collected data on the children's weight and body shape, we can make a preliminary judgment on the symptoms of flat feet (such as disappearance of the arch of the foot, heel valgus, etc.).

[0132] In the elderly population, age factors: the longitudinal arch of the elderly will decrease, and the elastic shock absorption function of the arch will also decrease. Disease factors: the elderly may have diseases such as osteoporosis, arthritis, and certain chronic diseases (such as diabetes, nervous system diseases, etc.), which may affect the shape and stability of the arch. Therefore, for the elderly, the collected data on age, body shape, chronic diseases, etc. are combined, and the parameters are adjusted to judge the symptoms of arch collapse (such as lowered arch, heel pain, etc.).

[0133] Among the young and middle-aged groups, weight factors: Among the young and middle-aged groups, obese people may have uneven pressure distribution on the soles of the feet, which in turn affects the shape of the arches. Occupational factors: Occupations that require long periods of standing or walking (such as teachers, doctors, etc.) may put pressure on the arches of the feet, causing them to deform. Therefore, for young and middle-aged people, a comprehensive judgment is made based on the collected data on their weight, body shape, occupation, and chronic diseases, as well as whether they have symptoms such as sole pain and arch deformation.

[0134] Meanwhile, the foot shape detection algorithm in step S7 also includes judging the foot shape according to the calculated arch coefficient, footprint coefficient, arch width and proportion coefficient, and the pre-set judgment rules for the elderly group, children group and middle-aged and young group. The specific steps include:

[0135] Execute steps S2 to S6, and respectively calculate the arch coefficient, footprint coefficient, arch width and proportional coefficient corresponding to the sample image sets of the elderly group in an obese state, the elderly group in a chronic disease state, the elderly group in a normal state, the sample image sets of the children group in an obese state, the children group in a chronic disease state, the children group in a normal state, the sample image sets of the young and middle-aged group in an obese state, the young and middle-aged group in a chronic disease state, and the young and middle-aged group in a normal state, and judge the foot types of different groups according to the pre-set judgment rules for the elderly group, the children group, and the young and middle-aged group.

[0136] In this embodiment, after big data extraction and theoretical deduction, the foot type judgment rules for the obese elderly group in this application are as follows: if the arch coefficient is less than 0.20, it is a high-arched foot, between 0.20 and 0.25, it is a normal foot, and greater than 0.25 is a flat foot; if the footprint coefficient is greater than 0.30, it is a high-arched foot, between 0.20 and 0.30, it is a normal foot, and less than 0.20 is a flat foot; if the arch width is greater than 2.87, it is a high-arched foot, between 2.43 and 2.87, it is a normal foot, and less than 2.43 is a flat foot; if the ratio coefficient is greater than 1.55, it is a high-arched foot, between 0.89 and 1.55, it is a normal foot, and less than 0.89 is a flat foot.

[0137] In the elderly group with chronic diseases in this application, the rules for judging foot type are as follows: if the arch coefficient is less than 0.20, it is a high-arched foot; if it is between 0.20 and 0.26, it is a normal foot; if it is greater than 0.26, it is a flat foot; if the footprint coefficient is greater than 0.30, it is a high-arched foot; if it is between 0.20 and 0.30, it is a normal foot; if it is less than 0.20, it is a flat foot; if the arch width is greater than 2.85, it is a high-arched foot; if it is between 2.43 and 2.85, it is a normal foot; if it is less than 2.43, it is a flat foot; if the ratio coefficient is greater than 1.56, it is a high-arched foot; if it is between 0.89 and 1.56, it is a normal foot; if it is less than 0.89, it is a flat foot.

[0138] In the elderly group in normal condition in this application, the rules for judging foot type are as follows: if the arch coefficient is less than 0.21, it is a high-arched foot; if it is between 0.21 and 0.26, it is a normal foot; if it is greater than 0.26, it is a flat foot; if the footprint coefficient is greater than 0.31, it is a high-arched foot; if it is between 0.20 and 0.31, it is a normal foot; if it is less than 0.20, it is a flat foot; if the arch width is greater than 2.82, it is a high-arched foot; if it is between 2.43 and 2.82, it is a normal foot; if it is less than 2.43, it is a flat foot; if the ratio coefficient is greater than 1.57, it is a high-arched foot; if it is between 0.89 and 1.57, it is a normal foot; if it is less than 0.89, it is a flat foot.

[0139] In the obese children group in this application, the rules for judging foot type are as follows: if the arch coefficient is less than 0.22, it is a high-arched foot; if it is between 0.22 and 0.26, it is a normal foot; if it is greater than 0.26, it is a flat foot; if the footprint coefficient is greater than 0.31, it is a high-arched foot; if it is between 0.20 and 0.31, it is a normal foot; if it is less than 0.20, it is a flat foot; if the arch width is greater than 2.82, it is a high-arched foot; if it is between 2.42 and 2.82, it is a normal foot; if it is less than 2.42, it is a flat foot; if the ratio coefficient is greater than 1.57, it is a high-arched foot; if it is between 0.89 and 1.57, it is a normal foot; if it is less than 0.89, it is a flat foot.

[0140] In the group of children with chronic diseases in this application, the rules for judging foot type are as follows: if the arch coefficient is less than 0.22, it is a high-arched foot; if it is between 0.22 and 0.26, it is a normal foot; if it is greater than 0.26, it is a flat foot; if the footprint coefficient is greater than 0.30, it is a high-arched foot; if it is between 0.20 and 0.30, it is a normal foot; if it is less than 0.20, it is a flat foot; if the arch width is greater than 2.85, it is a high-arched foot; if it is between 2.43 and 2.85, it is a normal foot; if it is less than 2.43, it is a flat foot; if the ratio coefficient is greater than 1.56, it is a high-arched foot; if it is between 0.89 and 1.56, it is a normal foot; if it is less than 0.89, it is a flat foot.

[0141] In the normal children group in this application, the foot type judgment rules are as follows: if the arch coefficient is less than 0.21, it is a high-arched foot; if it is between 0.21 and 0.26, it is a normal foot; if it is greater than 0.26, it is a flat foot; if the footprint coefficient is greater than 0.31, it is a high-arched foot; if it is between 0.20 and 0.31, it is a normal foot; if it is less than 0.20, it is a flat foot; if the arch width is greater than 2.82, it is a high-arched foot; if it is between 2.43 and 2.82, it is a normal foot; if it is less than 2.43, it is a flat foot; if the ratio coefficient is greater than 1.57, it is a high-arched foot; if it is between 0.89 and 1.57, it is a normal foot; if it is less than 0.89, it is a flat foot.

[0142] In the obese young and middle-aged groups in this application, the rules for judging foot type are as follows: if the arch coefficient is less than 0.22, it is a high-arched foot; if it is between 0.22 and 0.26, it is a normal foot; if it is greater than 0.26, it is a flat foot; if the footprint coefficient is greater than 0.31, it is a high-arched foot; if it is between 0.20 and 0.31, it is a normal foot; if it is less than 0.20, it is a flat foot; if the arch width is greater than 2.82, it is a high-arched foot; if it is between 2.42 and 2.82, it is a normal foot; if it is less than 2.42, it is a flat foot; if the ratio coefficient is greater than 1.57, it is a high-arched foot; if it is between 0.89 and 1.57, it is a normal foot; if it is less than 0.89, it is a flat foot.

[0143] In the young and middle-aged groups with chronic diseases in this application, the rules for judging foot type are as follows: if the arch coefficient is less than 0.21, it is a high-arched foot; if it is between 0.21 and 0.26, it is a normal foot; if it is greater than 0.26, it is a flat foot; if the footprint coefficient is greater than 0.30, it is a high-arched foot; if it is between 0.20 and 0.30, it is a normal foot; if it is less than 0.20, it is a flat foot; if the arch width is greater than 2.86, it is a high-arched foot; if it is between 2.43 and 2.86, it is a normal foot; if it is less than 2.43, it is a flat foot; if the ratio coefficient is greater than 1.56, it is a high-arched foot; if it is between 0.89 and 1.56, it is a normal foot; if it is less than 0.89, it is a flat foot.

[0144] In the normal young and middle-aged groups in this application, the rules for judging foot type are as follows: if the arch coefficient is less than 0.21, it is a high-arched foot; if it is between 0.21 and 0.26, it is a normal foot; if it is greater than 0.26, it is a flat foot; if the footprint coefficient is greater than 0.31, it is a high-arched foot; if it is between 0.20 and 0.31, it is a normal foot; if it is less than 0.20, it is a flat foot; if the arch width is greater than 2.82, it is a high-arched foot; if it is between 2.43 and 2.82, it is a normal foot; if it is less than 2.43, it is a flat foot; if the ratio coefficient is greater than 1.57, it is a high-arched foot; if it is between 0.89 and 1.57, it is a normal foot; if it is less than 0.89, it is a flat foot.

[0145] From the above description of the present invention, it can be seen that compared with the prior art, some algorithms of the present invention are improved as follows:

[0146] 1. As an improvement, when using the K-means algorithm for image segmentation, three cluster centers are customized to divide the image into three parts. The area of ​​the footprint is calculated to be in the middle of the three parts. By filling pixels, the segmented image can be obtained after clustering is completed.

[0147] 2. As an improvement, the corrosion of non-connected areas is more targeted than the ordinary corrosion operation, which can prevent the necessary parts from being corroded and retain the useful information of the image to the greatest extent. The number of connected areas and the corresponding area in the image are calculated through CCA, and the small connected areas are corroded.

[0148] 3. As an improvement, the algorithm process for solving the ratio coefficient includes: performing Canny edge detection on the image after solving the arch width, filling the edge with white pixels, and then extending the line segment cd to the left. When it intersects with the first white pixel point, this point is point e, and then connecting points c and e into a line to obtain line segment ce.

[0149] From the above description of the present invention, it can be seen that the present invention has the following beneficial effects:

[0150] 1. Fast speed: It only takes 1-1.5 seconds from inputting the image to be inspected to outputting the result.

[0151] 2. Low cost: In terms of hardware, you only need to configure a transparent device for people to stand on and a camera for taking pictures.

[0152] Using the above solution, the time consumed and parameter values ​​corresponding to the final test results are recorded in the following table:

[0153] correspond Figure 5 Label Arch coefficient Footprint coefficient Scale factor Time consumed / s foot shape a 0.24148 0.26853 1.27076 1.24 normal b 0.11214 0.34742 1.96730 1.37 High Bow c 0.27977 0.18674 0.83652 1.26 Flat

[0154] Since arch width requires actual foot length, arch width is not required.

[0155] Figure 1 In the figure, (a) arch coefficient; (b) footprint coefficient; (c) arch width; (d) proportional coefficient.

[0156] Figure 2 In the figure, (a) original image; (b) Gaussian filtering; (c) K-means clustering; (d) Yolov8 model inference; (e) weighted grayscale; (f) binarization; (g) non-maximum connected region erosion; (h) dilation; (i) median filter smoothing;

[0157] Figure 3 In the figure, (a). Arch coefficient area division diagram; (b). Footprint coefficient solution diagram; (c). Arch width solution diagram; (d). Ratio coefficient solution diagram.

[0158] See also Figure 4 , the present invention mainly includes the following 7 processes: S1, image preprocessing: use Gaussian function as filter function to reduce noise and smooth image; S2, plantar image segmentation: use K-means algorithm combined with YOLOV8 segmentation model to segment the plantar pressure area from the image; S3, grayscale: weighted grayscale the image obtained in the previous step to obtain a grayscale image; S4, binarization: divide the image into plantar pressure area and other areas; S5, morphological operation: first corrode the non-connected area of ​​the image obtained in the previous step, then expand it, and finally perform median filtering to smooth the image. S6, foot type detection: obtain the four features of arch coefficient, footprint coefficient, proportional coefficient, and arch width from the obtained footprint image to distinguish the foot type.

[0159] Figure 5 The test result diagrams of the examples are as follows: (a) is the foot shape diagram of student number 1; (b) is the foot shape diagram of student number 2; and (c) is the foot shape diagram of student number 3.

[0160] Another embodiment of the present invention further provides a foot type rapid detection device based on image processing, comprising:

[0161] An image preprocessing unit, for reducing noise and smoothing the image by using a Gaussian function as a filter function;

[0162] The plantar image segmentation unit is used to segment the plantar image from the entire image using the K-means algorithm combined with the YOLOv8 algorithm;

[0163] A grayscale unit is used to perform weighted grayscale conversion on the image obtained in the previous step to obtain a grayscale image;

[0164] Erosion unit, used to eliminate small noise points;

[0165] A heavy pressure area extraction unit is used to extract the heavy pressure area by using double threshold segmentation combined with the Otsu algorithm;

[0166] The morphological operation unit is used to corrode the non-connected regions of the image obtained in the previous step, then to dilate it to repair some useful parts corroded in the third step, and finally to smooth the image using the median filter algorithm;

[0167] Foot shape detection unit, used to solve the four major features of the final footprint image;

[0168] The rapid foot shape detection device based on image processing executes the rapid foot shape detection method mentioned above.

[0169] It should be emphasized that the term “include / comprises” when used herein refers to the presence of features, elements, steps or components, but does not exclude the presence or addition of one or more other features, elements, steps or components.

[0170] In addition, the method of the present invention is not limited to being executed in the time sequence described in the specification, and may also be executed in other time sequences, in parallel or independently. Therefore, the execution order of the method described in this specification does not limit the technical scope of the present invention.

[0171] Although the present invention has been disclosed above by describing specific embodiments of the present invention, it should be understood that all the above embodiments and examples are exemplary rather than restrictive. Those skilled in the art may design various modifications, improvements or equivalents of the present invention within the spirit and scope of the appended claims. These modifications, improvements or equivalents should also be considered to be included in the protection scope of the present invention.

Claims

1. A method for rapid foot shape detection based on image processing, characterized in that: include: Step S1, image preprocessing: obtain a sample image set, and use a Gaussian function as a filter function to reduce noise and smooth the image; Step S2, plantar image segmentation: Use the K-means algorithm combined with the YOLOv8 segmentation model to segment the plantar pressure area in the sample image set after the image preprocessing in step S1 from the entire image to obtain a plantar image; specifically including: Step S21: Use the K-means algorithm to perform the following secondary preprocessing on each image in the sample image set: Step S211, load the image file to be processed, convert it into a vector representation of the RGB color space, extract the feature vector of the image file, organize the extracted feature vector into a two-dimensional feature matrix, where each row represents a data point and each column represents a feature; in the constructed feature matrix, randomly select K data points as initial clustering centers; Step S212: Use the Euclidean distance formula to calculate the distance between each data point and each initial cluster center. The Euclidean distance formula is: Each data point is then assigned to the cluster represented by the nearest initial cluster center, and the members of each cluster are updated based on the assignment results; Where d is the Euclidean distance between the first data point and the second data point; x1, y1 are the coordinates of the first data point, and x2, y2 are the coordinates of the second data point; Step S213, recalculate the cluster center of each cluster; the calculation formula of the new cluster center is: Where ci is the coordinate of the cluster center of the i-th cluster, ni is the number of data points in the cluster, and pij represents the coordinate of the j-th data point; Step S214, repeat S212 and S213 until the cluster center no longer changes significantly or the maximum number of iterations is reached; Step S22, segmenting the image after secondary preprocessing through the YOLOv8 model to obtain a plantar image; Step S3, grayscale conversion: weighted grayscale conversion is performed on the plantar image obtained in step S2 to obtain a grayscale image; Step S4, binarization: binarizing the grayscale image into two parts: a plantar heavy pressure area and a non-plantar heavy pressure area, the plantar heavy pressure area corresponds to white pixels, and the non-plantar heavy pressure area corresponds to black pixels; Step S5, morphological operation: the image obtained in step S4 is first corroded in non-connected areas, and then dilated to repair some useful parts of the corroded areas; Step S6, foot type detection: Use the median filter algorithm to smooth the image and perform foot type detection on the final footprint image. The foot type detection algorithm includes the following specific steps: Step S61, smoothing the image using a median filter to remove salt and pepper noise; operating on the pixels covered by the window by moving a window on the image; at each window position, collecting the values ​​of all pixels in the window and sorting them by numerical value; selecting the middle value from the sorted pixel value list; replacing the pixel value at the center of the window with the selected median value; Step S62, traverse and scan the image line by line from top to bottom and from left to right, determine the grayscale value of the traversed pixel points, divide the footprint into three parts, calculate the area of ​​the middle part and the total area of ​​the footprint, that is, obtain the arch coefficient = Sm / Sz; where Sm is the area of ​​the middle part, and Sz is the total area of ​​the footprint. Step S63, crop the image at a fixed size, scan the pixels to find the two rightmost points a and b; connect the two points to get a straight line ab, and use the variable setting method to calculate the area of ​​the area enclosed by ab and the footprint, that is, calculate the footprint coefficient = Sab / Sz, where Sab is the area of ​​the enclosed black area, and Sz is the total area of ​​the footprint; Step S64, crop the image with a fixed size, traverse the pixel points to find the innermost point c of the arch, draw a perpendicular line between c and the straight line ab, the foot of the perpendicular is point d, the length of cd is AW', and the arch width = AW' / L is obtained by combining the scale; where L is the scale, which is the ratio of the actual foot length to the foot length in the image, and AW' is the length of the line segment cd; Step S65, after edge detection, cd is extended to the left. When it intersects with the first white point, this white point is the desired point e, and the proportionality coefficient = AW' / Lce; Where AW′ is the length of line segment cd, Lce is the length of line segment ce; Step S66, foot shape detection: determine the foot shape based on the calculated arch coefficient, footprint coefficient, arch width and proportional coefficient, as well as pre-set judgment rules.

2. The method for rapid foot type detection based on image processing according to claim 1, characterized in that: The S1 image preprocessing also includes the step of image classification, which specifically includes: The sample image set is divided into three sets: a sample image set of the elderly group, a sample image set of the children group and a sample image set of the young and middle-aged group. The sample image set of the elderly group, the sample image set of the children group and the sample image set of the young and middle-aged group are further divided into an obesity state set, a chronic disease state set and a normal state set, namely: the sample image set of the elderly group includes a sample image set of the elderly group in an obesity state, a sample image set of the elderly group in a chronic disease state and a sample image set of the elderly group in a normal state; the sample image set of the children group includes a sample image set of the children group in an obesity state, a sample image set of the children group in a chronic disease state and a sample image set of the children group in a normal state; the sample image set of the young and middle-aged group includes a sample image set of the young and middle-aged group in an obesity state, a sample image set of the young and middle-aged group in a chronic disease state and a sample image set of the young and middle-aged group in a normal state; wherein the chronic disease state refers to sample images of the group having a medically chronic disease such as cardiovascular and cerebrovascular disease, cancer, diabetes, chronic respiratory disease and the like; The foot shape detection algorithm in step S6 also includes judging the foot shape respectively according to the calculated arch coefficient, footprint coefficient, arch width and proportion coefficient, as well as the pre-set judgment rules for the elderly group, children group and middle-aged and young people group.

3. The method for rapid foot type detection based on image processing according to claim 1, characterized in that: In step S1, Gaussian filtering is used to reduce noise and smooth the image. The specific steps are as follows: Step S11, using a Gaussian function as a filter function; Step S12: performing weighted averaging on the image area corresponding to the convolution template.

4. The method for rapid foot type detection based on image processing according to claim 1, characterized in that: In step S3, the image is weighted grayscaled, and the specific steps are as follows: Grayscale of RGB image is to obtain the grayscale value Gray by weighted average of the three components of RGB. The grayscale value of each point is calculated by the formula: Gray = 0.299*R + 0.587*G + 0.114*B; Among them, R, G, B are the values ​​of the red, green, and blue channels respectively, and Gray is the grayscale value calculated for each pixel in the image. In the standard 8-bit RGB color model, the value range of R, G, and B channels is from 0 to 255.

5. The method for rapid foot type detection based on image processing according to claim 1, characterized in that: The specific steps of binarization in step S4 are as follows: Pixels with a value greater than a certain value are turned white, and pixels with a value less than a certain value are turned black. In this way, when judging the connected area, we only need to focus on one color to identify it. If two pixels are adjacent in space, they are considered to be connected; Where g(x,y) is the pixel value of the pixel after binarization, f(x,y) is the pixel value of the pixel before binarization, T is the pixel threshold of binarization, and the value range of T is 0 to 255.

6. The method for rapid foot type detection based on image processing according to claim 1, characterized in that: The specific steps of the morphological operation in step S5 are as follows: After the connected regions are determined, the areas of the connected regions are compared to find the footprint body. Then, the erosion operation is used to remove the remaining small white areas, and the dilation operation is used to fill the hollow parts of the footprint body with white. The image is represented as set A, the structural element is represented as set B, and z represents the position of the structural element in the image. If set A is eroded by the structural element set B, it is recorded as The corrosion operation is expressed as: Among them, Bz is the result after aligning the center of the structural element set B to position z; if the translation of the structural element set B at position z is completely contained in the set A, then z is the result of corrosion; if the set A is expanded by the structural element set B, recorded as A⊕B, then the expansion operation is expressed as: in represents the empty set, that is, a set without any elements. It is the translation of the structural element set B at position z. If any translation of the structural element set B at position z has at least one point in common with the set A, then position z is the result of the expansion.

7. The method for rapid foot type detection based on image processing according to claim 2, characterized in that: The foot shape detection algorithm in step S6 also includes judging the foot shape according to the calculated arch coefficient, footprint coefficient, arch width and proportion coefficient, and the pre-set judgment rules for the elderly group, children group and middle-aged and young group. The specific steps include: Execute steps S2 to S6, and respectively calculate the arch coefficient, footprint coefficient, arch width and proportional coefficient corresponding to the sample image sets of the elderly group in an obese state, the elderly group in a chronic disease state, the elderly group in a normal state, the sample image sets of the children group in an obese state, the children group in a chronic disease state, the children group in a normal state, the sample image sets of the young and middle-aged group in an obese state, the young and middle-aged group in a chronic disease state, and the young and middle-aged group in a normal state, and judge the foot types of different groups according to the pre-set judgment rules for the elderly group, the children group, and the young and middle-aged group.

8. A rapid foot shape detection device based on image processing, characterized in that: include: An image preprocessing unit, for reducing noise and smoothing the image by using a Gaussian function as a filter function; The plantar image segmentation unit is used to segment the plantar pressure area in the sample image set from the entire image using the K-means algorithm combined with the YOLOv8 model; A grayscale unit performs weighted grayscale conversion on the image to obtain a grayscale image; Binarization unit, which divides the image into the heavy pressure area on the sole and other areas; The morphological operation unit is used to erode and dilate the non-connected areas of the image to repair the useful parts, and finally use the median filter to smooth the image; Foot shape detection unit, used to solve the four major features of the final footprint image; The rapid foot shape detection device executes the rapid foot shape detection method based on image processing described in any one of claims 1-7.

Citation Information

Patent Citations

  • Corn aflatoxin detection method based on YOLO

    CN113506242A

  • Foot arch coefficient calculation method and system

    CN117958801A

  • Method for processing image segmentation using Morphological operation

    KR1020150059860A

Cited By

  • Method for calculating arch index through plantar image

    CN120021975A