A 2D human body shape classification method based on computer vision
Through computer vision technology, the height pixel value H, projection unit area ρ and the projection area ratio F of the orthogonal image of the 2D human body are extracted. Combined with the second-order clustering model, a fast and accurate 2D human body shape classification is achieved, solving the problem of accuracy of 2D anthropometry and promoting the development of clothing customization technology.
Patent Information
- Application Number
- CN202210996059.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-08-19
- Publication Date
- 2025-08-19
- Estimated Expiration
- 2042-08-19
AI Technical Summary
The existing 2D anthropometry technology has accuracy problems. The 3D human body scanning is costly and complex in operation, making it difficult to widely use in body shape classification. The existing 2D human body body shape classification methods are complex and have poor inclusiveness.
Using a computer vision-based method, three body shape classification indicators are extracted by collecting 2D human body orthogonal images and height information, the height pixel value H, projection unit area ρ, and the projection area ratio F on the front side of the human body are extracted, and the body shape classification is used to classify the body shape, which is simplified into 6 types of body shape classification.
It realizes fast and accurate 2D human body shape classification, reduces the inaccurate error of feature point calibration caused by different features of 2D contour image, and promotes the digitalization, automation and intelligent development of clothing customization technology.
Smart Images

Figure CN115471864B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the fields of ergonomics and anthropometry, and more particularly to a 2D human body shape classification method based on computer vision. Background Art
[0002] With the booming development of high-quality industrial clothing customization and online clothing shopping, convenient and fast 2D body measurement has become an effective way to obtain body data. However, the biggest problem with 2D body measurement is the accuracy of measurement.
[0003] With the development of computer vision technology, it has shown great advantages in digital image processing, and has improved the accuracy of 2D human body measurement to a certain extent. The main applications of computer vision technology in 2D human body measurement are: image processing, contour extraction, feature point calibration, etc. However, its application in human body shape classification is still relatively rare. The body shape classification methods described in existing literature and patents are all based on 3D human bodies and use human body dimensions as a classification method. Practical problems such as high cost and difficulty in operation of 3D human body scanning hinder its widespread application in daily life. Therefore, 2D human body measurement has become a hot topic in current research. In order to improve the accuracy of measurement, it is also necessary to propose a body shape classification method based on 2D human bodies. The application of computer vision technology to 2D human body shape classification is conducive to improving the accuracy of 2D human body measurement and the fit of clothing, thereby promoting the development of industrial clothing customization and online fitting.
[0004] Human body shape is an important indicator of human morphological characteristics. Body shape classification provides a foundation for body analysis, clothing structure design, garment size design, 3D body modeling, and virtual fitting. Body shape classification essentially involves the selection of characteristic indicators. Currently, commonly used characteristic indicators include girth difference, cross-sectional shape, body surface angles, and characteristic indices. Previous literature has not yet found a method for extracting human body shape classification indicators based on computer vision technology.
[0005] With the extensive research and application of 2D human body measurement, human body shape classification methods based on 2D images have also been developed. In their paper, Sun Jie et al. extracted 2D images of the human body from the front and side, calculated the angles that characterize the human body morphological characteristics, and used K-means clustering to divide the human body shape into 4 categories. Wang Ting et al. used 3D point cloud data of young women, selected shoulder oblique angle, back angle, shoulder-to-frontal diameter ratio and axillary-to-frontal diameter ratio to classify the human neck and shoulders, and then realized automatic recognition of the neck and shoulder shape based on the front and side 2D photos of young women. Xiaoyu Cai et al. used the research method of "three-dimensional (3D) scanning + photo" to classify the waist-abdomen-hip body shape of young women. Chinese patent application number CN201610634301.9 discloses a body shape classification method for tailor-made men's shirts. By linearly changing the parameters of each part of the men's shirt structure sample, the boundaries of the distortion of each part of the sample after the change are found, and the body shape is classified according to different rule parameters; Chinese patent application number CN201910967011.X discloses a body shape classification method based on contour features. According to the characteristics of five parts of the human body, The method uses characteristic parameters to summarize the main body shapes of each part and subdivides the five parts of the young female body. Chinese patent application number CN202011344683.4 discloses a 2D-3D non-contact anthropometric method for the elderly. This method measures the length and circumference of major body parts, derives contour curve functions and cross-sectional curve functions, and establishes a 2D-3D dimension conversion formula to classify the body shapes of the elderly. The classification methods used in the above papers and patents are also limited to information such as size and angle, requiring complex mathematical derivation and poor inclusiveness. Summary of the Invention
[0006] From the perspective of computer vision classification, this paper proposes a method for extracting body shape classification indicators based on 2D images. This method's advantage is that it bypasses the complex 3D data extraction process and directly performs body shape classification. This method achieves a transition from 3D to 2D body shape classification. The three proposed features are effective in classifying and distinguishing 2D bodies.
[0007] To achieve the above object, the present invention provides a 2D human body shape classification method based on computer vision, comprising the following steps:
[0008] S1, collect 2D human body orthogonal images and height information;
[0009] S11, collecting 2D human body orthogonal images;
[0010] Obtain orthogonal 2D images of the front and side of the human body through a 3D body scanner, mobile phone or digital camera;
[0011] S12, obtaining height information;
[0012] There are two ways to obtain height information. The first way is to directly read the height information by using a 3D body scanner to obtain orthogonal 2D images of the front and side of the human body in step S11;
[0013] The second method is to obtain the orthogonal 2D images of the front and side of the human body through a mobile phone or digital camera, and use the height acquisition method in the ISO 8559 International Organization for Standardization revised clothing size standard to obtain the height data of the subject;
[0014] S2. Preprocessing the 2D human body front and side orthogonal images to normalize the height information;
[0015] S21, pre-processing the 2D human body orthogonal image described in step S11, the specific method is as follows:
[0016] S211, using Gaussian filtering to eliminate image noise of the 2D human body front image and the 2D human body side image in step S11;
[0017] Gaussian filtering is implemented by the GaussianBlur function encapsulated by the OPenCV computer vision library, mainly using the two-dimensional Gaussian kernel function G, whose expression is:
[0018]
[0019] Where (x, y) is any pixel point in the image, δ is the standard deviation of the normal distribution, and the larger δ is, the flatter the curve of the two-dimensional Gaussian kernel function G is;
[0020] S212, performing grayscale processing on the 2D human body front and side orthogonal images after denoising in step S211 and obtaining grayscale values;
[0021] The 2D human front and side orthogonal images are converted from RGB images to BGR images, and then from BGR images to GRAY images using the cvtColor function encapsulated by the OPenCV computer vision library, to obtain a grayscale value of each pixel in the image between 0 and 255;
[0022] S213, performing threshold calculation on the grayscale values of the 2D human body front and side orthogonal images in step S212 to obtain binary images of the 2D human body front and side orthogonal images;
[0023] The threshold function encapsulated by the OPenCV computer vision library is used to perform a threshold binarization operation of the THRESH_BINARY type;
[0024] Specifically, the threshold is set to 30, values greater than the threshold are represented by 255, and values less than the threshold are represented by 0, resulting in a binary image;
[0025] Performing a closing morphological operation of dilation followed by erosion on the binary image; using the morphologyEX function encapsulated by the OPenCV computer vision library, filling small holes and smooth boundaries in the required area, and segmenting independent human image elements with unchanged area;
[0026] S214, detecting the human body contour of the binary image of the 2D human body front and side orthogonal images in step S213, and obtaining the maximum circumscribed rectangle of the human body area;
[0027] First, the contours of the binary images of the 2D human front and side orthogonal images are detected by the findContours function encapsulated by the OPenCV computer vision library, and all continuous contour points on the boundary are saved in the contours vector using the CHAIN_APPROX_NONE operation; then, the height, width and x and y coordinates of the center point of the human body region bounding box are obtained by the boundingRect function encapsulated by the OPenCV computer vision library, and the maximum circumscribed rectangular image of the human body region is cropped;
[0028] S22, normalize the height information obtained in step S12 using the following formula (2):
[0029]
[0030] Where H is the normalized height, h is the height of any sample, and h min is the minimum height in the sample, h max is the maximum height in the sample, and P is the maximum height h max The pixels between the head vertex and the ground;
[0031] S23, scaling the maximum circumscribed rectangular image of the sample human body region described in step S214 to the pixel value length of the normalized height H described in step S22; and then obtaining the normalized front and side images of the sample human body using the resize function encapsulated by the OPenCV computer vision library;
[0032] S3. Body shape classification feature extraction based on computer vision: three body shape classification indicators: height pixel value H, projection unit area ρ, and the ratio of the front and side projection areas of the human body F;
[0033] The height pixel value is the normalized height H described in step S23, which has been calculated by formula (2);
[0034] The principle and method of obtaining the projected unit area ρ are as follows:
[0035] The human body area in the human body front and side image is obtained by the human body front and side binary images described in step S213, and the background area is black. The white pixel is set to 1 and the black pixel is set to 0. The algorithm of traversing the statistical pixel value of 1 is used to obtain the cumulative distribution of the pixels in the human body area, and then the grayscale distribution histogram is obtained. The definition formula is:
[0036]
[0037]
[0038] In the formula, the size of the 2D human body digital image of the front and side is M×N, where M is the length of the image, N is the width of the image, and X (i) is the cumulative distribution of pixels in the human body area along the X-axis, Y (j) is the cumulative distribution of pixel points in the human body area along the Y-axis;
[0039] The calculation formula for the maximum height difference of the white points along the X-axis and Y-axis in the grayscale distribution histogram is as follows:
[0040] X_d=max(X (i) )-min(X (i) )(i=1,2,3...M) (5)
[0041] Y_d=max(Y (j) )-min(Y (j) )(j=1,2,3...N) (6)
[0042] The maximum grayscale distribution difference X_d along the X-axis represents the height feature. The larger the X_d, the taller the height. The maximum grayscale distribution difference Y_d along the Y-axis represents the fatness feature. The larger the Y_d, the fatter the body.
[0043] The definition formula of the projected unit area is:
[0044]
[0045] Where Q represents the cumulative number of pixels in the frontal human body area, and H represents the height pixel value;
[0046] The principle and method for obtaining the human body frontal and side projection area ratio F are as follows:
[0047] The head, neck, and arm information is removed from the front and side images of the human body, and the ratio of the front and side projection areas of the human body is defined as:
[0048]
[0049] Where Z represents the cumulative number of pixels in the frontal human body area without the head, neck, and arms, and C represents the cumulative number of pixels in the side human body area without the head and neck.
[0050] S4, using a second-order clustering model to classify the 2D human body based on the three clustering indicators of height pixel value H, projection unit area ρ, and the ratio of the front and side projection areas F of the human body described in step S3;
[0051] S41, clustering into multiple small classes through pre-clustering;
[0052] S42, clustering again into a desired number of clusters using the clustering result in step S41;
[0053] After the above steps S41 and S42, the body type classification results are obtained based on the analysis of height, fatness, and roundness of the human body.
[0054] Preferably, the clustering method described in step S4 is: using the classification option in the analysis option of SPSS software, selecting second-order clustering, setting the continuous variables as the height pixel value H and the ratio of the projected unit area ρ to the frontal side projection area F proposed in step S3, setting the distance measurement to log likelihood, and the SPSS software automatically determines the number of clusters and the number is not greater than 15; the output option is set to pivot table, chart and table, and cluster member variables are created, and then the SPSS software automatically outputs the body shape classification results.
[0055] With the present invention, users of clothing customization can quickly and automatically classify people by using a mobile phone or other camera device to capture 2D orthogonal photos of people and provide height information. Feature point calibration and body size data extraction are then performed. This reduces errors caused by inaccurate feature point calibration due to differences in 2D contour image features at the source of the data. Subsequently, accurate body data can be extracted based on different body types, and people of various body types can be matched and modeled. This invention meets the development requirements of 2D anthropometric systems that are convenient, fast, low-cost, and easy to use. Its positive effect is that it solves the problem of body type classification in the absence of body size data. It is of great significance for promoting the development of clothing customization technology and driving the clothing industry towards digitalization, automation, and intelligence. BRIEF DESCRIPTION OF THE DRAWINGS
[0056] Figure 1 This is a flow chart of a 2D human body shape classification method based on computer vision in the present invention.
[0057] Figure 2 Schematic diagram of the measurement posture 1 in the embodiment of the present invention.
[0058] Figure 3 Schematic diagram of measurement posture 2 in an embodiment of the present invention.
[0059] Figure 4 4 is a flow chart of a human body image preprocessing algorithm in an embodiment of the present invention.
[0060] Figure 5 This is a diagram showing the height normalization effect of a 2D human body image in an embodiment of the present invention.
[0061] Figure 6 1 is a binary image of the front and side of the human body image and a grayscale distribution histogram of sample 1 in an embodiment of the present invention.
[0062] Figure 7 1 is a binary image of the front and side of the human body image and a grayscale distribution histogram of sample 2 in an embodiment of the present invention.
[0063] Figure 8 This is a frontal comparison diagram of various body types for classifying human body types in an embodiment of the present invention.
[0064] Figure 9 This is a side comparison diagram of various body types for classifying human body types in an embodiment of the present invention. DETAILED DESCRIPTION
[0065] The present invention will be further described below in conjunction with specific examples. It should be understood that these examples are intended only to illustrate the present invention and are not intended to limit the scope of the present invention. Those skilled in the art may make various changes or modifications to the present invention, and these equivalent forms also fall within the scope defined by the appended claims.
[0066] Example:
[0067] like Figure 1 As shown, a 2D human body shape classification method based on computer vision includes the following steps:
[0068] S1, collect 2D human body orthogonal images and height information;
[0069] S11, collecting 2D human body orthogonal images;
[0070] Two orthogonal 2D images of the front and side of the human body in RGB format were obtained by a 3D human body scanner. The human body samples were young women aged 18 to 25 years old, with a height of 147.3 to 178.6 cm and a weight of 35.6 to 79.4 kg.
[0071] S12, obtaining height information;
[0072] The height of the subjects was obtained using the height acquisition method in the revised clothing size standard of ISO 8559 International Organization for Standardization. According to GB / T23698-2009 "General Requirements for 3D Scanning Human Body Measurement Methods", the experimental environment was at room temperature of about 25°C. The underwear worn by the subjects should be well-fitting, not loose, wrinkle-free, and not pressurize the skin. The body should be straight and the shoulders should be straight and not stiff during measurement. The measurement is divided into two postures, such as Figure 2 As shown, posture one is to stand with your feet parallel and about 20cm apart, with your arms at an angle of about 20 degrees to your body, and your palms facing inward. Figure 3 As shown, the second posture is to put your hands together at your sides, feet together, keep breathing normally, and do not tighten your abdomen.
[0073] S2, pre-processing the 2D human body front and side orthogonal images, and normalizing the height information. Figure 4 As shown, S21, preprocessing the 2D human body orthogonal image described in step S11, the specific method is as follows:
[0074] S211, using Gaussian filtering to eliminate image noise of the 2D human body front image and the 2D human body side image in step S11;
[0075] Gaussian filtering is implemented by the GaussianBlur function encapsulated by the OPenCV computer vision library, mainly using the two-dimensional Gaussian kernel function G, whose expression is:
[0076]
[0077] Where (x, y) is any pixel point in the image, δ is the standard deviation of the normal distribution, and the larger δ is, the flatter the two-dimensional Gaussian kernel function G curve is.
[0078] S212, performing grayscale processing on the 2D human body front and side orthogonal images after denoising in step S211 and obtaining grayscale values;
[0079] The 2D human front and side orthogonal images are converted from RGB images to BGR images, and then from BGR images to GRAY images using the cvtColor function encapsulated by the OPenCV computer vision library, to obtain a grayscale value of each pixel in the image between 0 and 255;
[0080] S213, performing threshold calculation on the grayscale values of the 2D human body front and side orthogonal images in step S212 to obtain binary images of the 2D human body front and side orthogonal images;
[0081] The threshold function encapsulated by the OPenCV computer vision library is used to perform a threshold binarization operation of the THRESH_BINARY type;
[0082] Specifically, the threshold is set to 30, values greater than the threshold are represented by 255, and values less than the threshold are represented by 0, resulting in a binary image;
[0083] Performing a closing morphological operation of dilation followed by erosion on the binary image; using the morphologyEX function encapsulated by the OPenCV computer vision library, filling small holes and smooth boundaries in the required area, and segmenting independent human image elements with unchanged area;
[0084] S214, detecting the human body contour of the binary image of the 2D human body front and side orthogonal images in step S213, and obtaining the maximum circumscribed rectangle of the human body area;
[0085] First, the contours of the binary images of the 2D human front and side orthogonal images are detected by the findContours function encapsulated by the OPenCV computer vision library, and all continuous contour points on the boundary are saved in the contours vector using the CHAIN_APPROX_NONE operation; then, the height, width, and x and y coordinates of the center point of the human body region bounding box are obtained by the boundingRect function encapsulated by the OPenCV computer vision library, and the maximum circumscribed rectangular image of the human body region is cropped;
[0086] S22, normalize the height information obtained in step S12 using the following formula (2):
[0087]
[0088] Where H is the normalized height, h is the height of any sample, and h min is the minimum height in the sample, h max is the maximum height in the sample. P is the maximum height h max The pixels between the head vertex and the ground; let P be 700 pixels.
[0089] S23, scaling the maximum circumscribed rectangular image of the sample human body region described in step S214 to the pixel value length of the normalized height H described in step S22; then obtaining the normalized front and side images of the sample human body through the resize function encapsulated by the OPenCV computer vision library; the height normalization effect is as follows Figure 5 shown.
[0090] S3. Body shape classification feature extraction based on computer vision: three body shape classification indicators: height pixel value H, projection unit area ρ, and the ratio of the front and side projection areas of the human body F;
[0091] The height pixel value is the normalized height H described in step S23, which has been calculated by formula (2); its essence is the normalized height pixel value. The principle and calculation method of the projected unit area ρ are as follows:
[0092] The height pixel value (H) has been calculated using formula (2). The method for calculating the projected unit area (ρ) is as follows:
[0093] like Figures 5-7 As shown, the human body area in the human body front and side images obtained by the human body front and side binary images described in step S213 is white, and the background area is black. Let the white pixel be 1 and the black pixel be 0. The algorithm of traversing the statistical pixel value of 1 is used to obtain the cumulative distribution of the pixels in the human body area, and then obtain the grayscale distribution histogram, which is defined as follows:
[0094]
[0095]
[0096] In the formula, the size of the 2D human body digital image of the front and side is M×N, where M is the length of the image, N is the width of the image, and X (i) is the cumulative distribution of pixels in the human body area along the X-axis, Y (j) is the cumulative distribution of pixel points in the human body area along the Y-axis;
[0097] The calculation formula for the maximum height difference of the white points along the X-axis and Y-axis in the grayscale distribution histogram is as follows:
[0098] X_d=max(X(i))-min(X(i))(i=1,2,3...M) (5)
[0099] Y_d=max(Y(j))-min(Y(j))(j=1,2,3...N) (6)
[0100] The maximum grayscale distribution difference X_d along the X-axis represents the height feature. The larger the X_d, the taller the height. The maximum grayscale distribution difference Y_d along the Y-axis represents the fatness feature. The larger the Y_d, the fatter the body.
[0101] However, simply using X_d and Y_d cannot accurately represent the degree of fatness or thinness of a person. For example, if a person is 160 cm tall and weighs 55 kg, and another person is 162 cm tall and weighs 56 kg, it is not possible to clearly distinguish which one is fatter. Therefore, the present invention proposes the projected unit area ρ, which represents the average white point count value per unit height. The projected unit area is defined as:
[0102]
[0103] Where Q represents the cumulative number of pixels in the frontal human body area, and H represents the height pixel value;
[0104] The principle and method for obtaining the human body frontal and side projection area ratio F are as follows:
[0105] The head, neck, and arm information are removed from the frontal and side profile images of the human body. Specifically, the head and neck information is removed along the side neck point of the human body, and the arm information is removed along the shoulder endpoint of the human body. The formula for the frontal and side profile projection area ratio of the human body is defined as:
[0106]
[0107] Where Z represents the cumulative number of pixels in the frontal human body area without the head, neck, and arms, and C represents the cumulative number of pixels in the side human body area without the head and neck.
[0108] S4, using a second-order clustering model to classify the 2D human body based on the three clustering indicators of height pixel value H, projection unit area ρ, and the ratio of the front and side projection areas F of the human body described in step S3;
[0109] S41, clustering into multiple small classes through pre-clustering;
[0110] S42, clustering again into a desired number of clusters using the clustering result in step S41;
[0111] After the above steps S41 and S42, the body type classification results are obtained based on the analysis of height, fatness, thinness, and roundness of the human body;
[0112] The clustering method described in step S4 involves using the classification option in the SPSS software analysis options, selecting second-order clustering, setting the continuous variables to the height pixel value H and the ratio of the projected unit area ρ to the frontal and side projection area F, as proposed in step S3, and setting the distance measure to log likelihood. SPSS automatically determines the number of clusters, which should not exceed 15. Output options are set to pivot tables, charts, and tables, and cluster member variables are created. SPSS then automatically outputs the body shape classification results. Results Analysis: The second-order clustering model can generate multiple clustering schemes, which are then compared based on the BIC criterion derived from each scheme. Smaller BIC values, combined with larger absolute values of BIC changes and larger distance measurement ratios between adjacent clusters, indicate better clustering results. This allows the optimal number of clusters to be determined.
[0113] The present invention determines the BIC values under different numbers of clusters. When the number of clusters is 6, the BIC value is the smallest. At the same time, the distance measurement ratio between adjacent clusters is large. The SPSS system automatically determines that the optimal number of clusters is 6. Ultimately, the human body shape is divided into 6 categories. The cluster summary is shown in Table 1 below:
[0114]
[0115] Table 1
[0116] The characteristics of each body type are described as follows:
[0117] Category 1: The centroid H of the height pixel value is 666.21, which is the largest compared to all samples, indicating that this group is the tallest; the centroid of the projection unit area feature ρ is 108.03, indicating that this group is moderately fat or thin; the centroid of the human body front and side projection area ratio feature F is 1.57, and the F value of this group is farthest from 1 among all samples, indicating that this group has a large front projection width and a small side width, and the cross-sectional shape of this group is the most flattened ellipse.
[0118] Category 2: This group has the largest number of people. The centroid of the height pixel value H is 647.16, which is in the middle range of all samples. This group is of medium to tall height. The centroid of the projection unit area feature ρ is 102.49, indicating that this group is thin. The centroid of the human body frontal and side projection area ratio feature F is 1.51, which is in the middle state among all samples, indicating that this group's body cross-sectional shape is closer to a more standard elliptical shape.
[0119] Category 3: The centroid of the height pixel value H is 625.7, which is in the middle range of all samples. This group is of medium to short height. The centroid of the projection unit area feature ρ is 107.19, indicating moderate fatness and thinness. The centroid of the human body frontal and side projection area ratio feature F is 1.53, which is in the middle state among all samples, indicating that the cross-sectional shape of this group is closer to a more standard elliptical shape.
[0120] Category 4: The centroid of the height pixel value H is 637.61, which is in the middle area of all samples. This group is of medium height. The centroid of the projection unit area feature ρ is 118.67, which is the largest compared with other categories. Therefore, this group is the fattest. The centroid of the human body front and side projection area ratio feature F is 1.45. Among all samples, the F value of this group is closest to 1, indicating that the cross-sectional shape of the sample is closer to a circle.
[0121] Category 5: The centroid of the height pixel value H is 613.14, indicating that this group is shorter than the overall sample. The centroid of the projection unit area feature ρ is 98.41, which is the smallest compared to other categories, so this group is the thinnest. The centroid of the human body frontal and side projection area ratio feature F is 1.55, indicating that the cross-sectional shape of the body is close to an oblate oval.
[0122] Category 6: The centroid of the height pixel value H is 607.5, indicating that this group is the shortest compared to all samples. The centroid of the projected unit area feature ρ is 103.11, which is in the middle range of all samples, indicating that this group is moderately fat or thin. The centroid of the human body frontal and side projection area ratio feature F is 1.48, indicating that the cross-sectional shape of this sample is also relatively round among all clusters.
[0123] like Figure 8 、 Figure 9 As shown in the figure, referring to the cluster centroid, the comparison effect of the human body closest to the centroid is selected. It can be seen from the figure that the individual types are clearly distinguished.
[0124] The advantages and positive effects of the present invention are that clothing customization users can quickly and automatically classify people by using a mobile phone or other camera device to obtain 2D human orthogonal photos and provide height information. Feature point calibration and human dimension data extraction are then performed. This reduces the error caused by inaccurate feature point calibration due to different 2D contour image features at the source of the data. Subsequently, human data can be accurately extracted based on different body shapes, and people of various body shapes can be matched and modeled. The present invention conforms to the development requirements of 2D human body measurement systems that are convenient, fast, low-cost, and easy to use. The positive effect is that it solves the problem of body type classification in the absence of human dimension data. It is of great significance to promote the development of clothing customization technology and promote the development of the clothing industry towards digitalization, automation, and intelligence.
[0125] The above description is only a preferred specific embodiment of the present invention, but the scope of protection of the present invention is not limited thereto. Any technician familiar with the technical field, within the technical scope disclosed by the present invention, who makes equivalent replacements or changes based on the technical solution and inventive concept of the present invention, should be covered by the scope of protection of the present invention.
Claims
1. A 2D human body shape classification method based on computer vision, characterized in that: The steps include: S1, collect 2D human body orthogonal images and height information; S11, collecting 2D human body orthogonal images; Obtain orthogonal 2D images of the front and side of the human body through a 3D body scanner, mobile phone or digital camera; S12, obtaining height information; There are two ways to obtain height information. The first way is to directly read the height information by using a 3D body scanner to obtain orthogonal 2D images of the front and side of the human body in step S11; The second method is to obtain the orthogonal 2D images of the front and side of the human body through a mobile phone or digital camera, and use the height acquisition method in the ISO 8559 International Organization for Standardization revised clothing size standard to obtain the height data of the subject; S2. Preprocessing the 2D human body front and side orthogonal images to normalize the height information; S21, pre-processing the 2D human body orthogonal image described in step S11, the specific method is as follows: S211, using Gaussian filtering to eliminate image noise of the 2D human body front image and the 2D human body side image in step S11; Gaussian filtering is implemented by the GaussianBlur function encapsulated by the OPenCV computer vision library, mainly using the two-dimensional Gaussian kernel function G, whose expression is: (1) Where (x, y) is any pixel point in the image, δ is the standard deviation of the normal distribution, and the larger δ is, the flatter the curve of the two-dimensional Gaussian kernel function G is; S212, performing grayscale processing on the 2D human body front and side orthogonal images after denoising in step S211 and obtaining grayscale values; The 2D human front and side orthogonal images are converted from RGB images to BGR images, and then from BGR images to GRAY images using the cvtColor function encapsulated by the OPenCV computer vision library, to obtain a grayscale value of each pixel in the image between 0 and 255; S213, performing threshold calculation on the grayscale values of the 2D human body front and side orthogonal images in step S212 to obtain binary images of the 2D human body front and side orthogonal images; The threshold function encapsulated by the OPenCV computer vision library is used to perform a threshold binarization operation of the THRESH_BINARY type; Specifically, the threshold is set to 30, values greater than the threshold are represented by 255, and values less than the threshold are represented by 0, resulting in a binary image; Performing a closing morphological operation of dilation followed by erosion on the binary image; using the morphologyEX function encapsulated by the OPenCV computer vision library, filling small holes and smooth boundaries in the required area, and segmenting independent human image elements with unchanged area; S214, detecting the human body contour of the binary image of the 2D human body front and side orthogonal images in step S213, and obtaining the maximum circumscribed rectangle of the human body area; First, the contours of the binary images of the 2D human front and side orthogonal images are detected using the findContours function encapsulated by the OPenCV computer vision library, and all continuous contour points on the boundary are saved in the contours vector using the CHAIN_APPROX_NONE operation; then, the boundingRect function encapsulated by the OPenCV computer vision library is used to obtain the height, width and x and y coordinates of the center point of the human body region bounding box, and the image of the maximum circumscribed rectangle of the human body region is cropped; S22, normalize the height information obtained in step S12 using the following formula (2): (2) Where H is the normalized height, h is the height of any sample, and h min is the minimum height in the sample, h max is the maximum height in the sample, and P is the maximum height h max The pixels between the head vertex and the ground; S23, scaling the maximum circumscribed rectangle image of the sample human body region in step S214 to the pixel value length of the normalized height H in step S22; and then obtaining the normalized front and side images of the sample human body using the resize function encapsulated by the OPenCV computer vision library; S3. Body shape classification feature extraction based on computer vision: three body shape classification indicators: height pixel value H, projection unit area ρ, and the ratio of the front and side projection areas of the human body F; The height pixel value is the normalized height H mentioned in step S23, which has been calculated by formula (2); The principle and method of obtaining the projected unit area ρ are as follows: The human body area in the human body front and side image is obtained by the human body front and side binary images described in step S213, and the background area is black. The white pixel is set to 1 and the black pixel is set to 0. The algorithm of traversing the statistical pixel value of 1 is used to obtain the cumulative distribution of the pixels in the human body area, and then the grayscale distribution histogram is obtained. The definition formula is: In the formula, the size of the 2D human body digital image of the front and side is M×N, where M is the length of the image, N is the width of the image, and X (i) is the cumulative distribution of pixels in the human body area along the X-axis, Y (j) is the cumulative distribution of pixels in the human body area along the Y-axis; The calculation formula for the maximum height difference of the white points along the X-axis and Y-axis in the grayscale distribution histogram is as follows: X_d=max ( X ( i ) ) - min ( X ( i ) )( i=1,2,3...M) (5) Y_d=max (Y ( j ) ) - min ( Y ( j ) ) ( j=1,2,3...N) (6) The maximum grayscale distribution difference X_d along the X-axis represents the height feature. The larger the X_d, the taller the height. The maximum grayscale distribution difference Y_d along the Y-axis represents the fatness feature. The larger the Y_d, the fatter the body. The definition formula of the projected unit area is: (7) Where Q represents the cumulative number of pixels in the frontal human body area, and H represents the height pixel value; The principle and method for obtaining the human body frontal and side projection area ratio F are as follows: The head, neck, and arm information is removed from the front and side images of the human body, and the ratio of the front and side projection areas of the human body is defined as: (8) Where Z represents the cumulative number of pixels in the frontal human body area without the head, neck, and arms, and C represents the cumulative number of pixels in the side human body area without the head and neck. S4, using a second-order clustering model to classify the 2D human body based on the three clustering indicators of height pixel value H, projection unit area ρ, and the ratio of the front and side projection areas F of the human body described in step S3; S41, clustering into multiple small classes through pre-clustering; S42, clustering again into a desired number of clusters using the clustering result in step S41; After the above steps S41 and S42, the body type classification results are obtained based on the analysis of height, fatness, and roundness of the human body.
2. The computer vision-based 2D human body shape classification method according to claim 1, characterized in that: The clustering method in step S4 is as follows: using the classification option in the analysis option of SPSS software, selecting second-order clustering, setting the continuous variables to the height pixel value H and the ratio of the projected unit area ρ to the frontal side projection area F proposed in step S3, setting the distance measurement to log likelihood, and the SPSS software automatically determines the number of clusters, which is no more than 15; setting the output options to pivot tables, charts, and tables, and creating cluster member variables, and then the SPSS software automatically outputs the body shape classification results.
Citation Information
Patent Citations
Body type classification method for customizing shirts
CN106418848A
A Body Shape Classification Method Based on Contour Features
CN110909593B
2D-3D non-contact type human body measurement method for old people
CN112446325A
Front-view pedestrian gait period detection method
CN104834893A
Body type data calculation method based on weight, height and body images
CN112419479A