Method and system for extracting a nail profile
By performing 3D scanning and point cloud processing on the nails, the curved point cloud of the nails is segmented and flattened, solving the problem of nail stickers not adhering to the user's nails and achieving a perfect adhesion effect for the nail stickers.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- SHANGHAI HUIZI COSMETICS CO LTD
- Filing Date
- 2021-04-28
- Publication Date
- 2026-07-14
AI Technical Summary
In existing technologies, the shape of nail stickers is fixed and the perfect edge curvature does not match the actual outline of the user's nail, resulting in problems such as incomplete application or overflow. Furthermore, existing methods cannot accurately extract the 3D nail outline using two-dimensional image recognition.
By performing a 3D scan on the target finger and converting it into 3D point cloud data, the nail surface point cloud is segmented using the region growing segmentation method. This is then flattened into a planar nail point cloud. Combined with point cloud direction correction and edge processing, a nail shape that better fits the nail contour is obtained.
The extracted nail outline perfectly matches the user's nail outline, ensuring that the nail stickers adhere perfectly without incomplete or overflowing, thus improving algorithm efficiency and outline fit.
Smart Images

Figure CN117616454B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of image processing, and more specifically, to a method and system for extracting nail contours based on 3D point cloud results. Background Technology
[0002] In recent years, with people's pursuit of beautiful nails, a simple nail art product called nail stickers has appeared on the market. As a pre-formed sticker, nail stickers can be directly applied to the nail using an adhesive layer. Compared with traditional nail polish, nail stickers have advantages such as ease of use, low price, and availability anytime, anywhere, and are gradually gaining popularity among fashion-conscious people.
[0003] Nail stickers are generally shaped and fixed at the factory, and for aesthetic purposes, their outer contours usually have perfect edge curvature in a flat state. However, this fixed and perfect edge curvature does not conform to the actual contour of the user's nail, and cannot fully adapt to the shape of different users' nails. Nail stickers often have problems such as incomplete application or overflow when applied to users' nails.
[0004] Currently, the main method to solve this problem is to use image recognition to extract the user's nail outline. For example, Chinese patent application CN109770520A discloses a printing method for a nail art device. In this printing method, a camera device takes a video or photograph of the user's fingers, and the control module determines the position, shape, and size of the nails based on the video or photograph taken by the camera device, and identifies the nail outline.
[0005] However, the printing method of this nail art device extracts 2D data of two-dimensional images, which does not perfectly match the curved 3D shape of the nail, resulting in the extracted nail outline not matching the real outline of the nail.
[0006] To solve the above technical problems, there is an urgent need for a new nail contour extraction method to extract a curved 3D nail contour that fits the edge of the user's nail more closely. Summary of the Invention
[0007] In a first aspect, this application provides a method for extracting nail contours, comprising the following steps:
[0008] Data acquisition steps: Perform a 3D scan on the target finger to obtain the 3D data of the target finger. Finger 3D data of fingers Finger Nail 3D data containing at least all nails Nail ;
[0009] Data point cloud steps: Data on finger 3D dataFinger Convert to 3D point cloud data to obtain finger point cloud. Finger Finger pointing cloud Finger Nail surface point cloud containing at least all nails Nail-s ;
[0010] Steps to obtain fingernail point cloud: Obtain finger point cloud (Cloud) Finger Segment the surface and obtain the fingernail-shaped point cloud (Cloud). Nail-s ;
[0011] Nail dot cloud flattening steps: Flatten the nail dot cloud on its curved surface Nail-s Flattening the surface with equal area yields a planar point cloud of the nail. Nail-p ;
[0012] Nail outline drawing steps: Based on the nail plane point cloud Nail-p Contour point cloud Contour Draw the shape to obtain the nail shape.
[0013] Furthermore, as a preferred option, the data point cloud step also includes:
[0014] Point cloud orientation correction sub-step: Point your finger into the cloud. Finger Transform into output finger dot cloud Finger-o This enables the output of finger dot cloud. Finger-o The posture and position are changed to the preset posture and position;
[0015] The preset pose and position refer to the output finger dot cloud. Finger-o The centroid of the finger coincides with the origin of the coordinate system in the PCL point cloud library; the tip of the finger points in the positive direction of the x-axis in the coordinate system; and the back of the finger points in the negative direction of the z-axis in the coordinate system.
[0016] Furthermore, as a preferred embodiment, the step of correcting the point cloud orientation also includes:
[0017] Verification sub-step: Check whether the back of the fingers in the transformed finger point cloud points in the negative direction of the z-axis in the coordinate system;
[0018] If the back of the finger points in the positive z-axis direction of the coordinate system, the transformed finger point cloud is rotated 180° around the x-axis and used as the output finger point cloud (Cloud). Finger-o ;
[0019] If the back of the finger points in the negative z-axis direction of the coordinate system, the transformed finger point cloud will be directly used as the output finger point cloud (Cloud). Finger-o .
[0020] Furthermore, preferably, the nail point cloud acquisition step includes:
[0021] Point cloud segmentation sub-steps: The region growing segmentation method is used to segment and calibrate the finger point cloud. Finger Obtain the fingernail-shaped point cloud (Cloud). Nail-s .
[0022] Furthermore, preferably, after the point cloud segmentation sub-step, the following steps are also included:
[0023] Clustering restraint step: within the search radius R rs Based on the input smaller than the search radius R rs The search radius Rrs' is obtained within the search radius R. rs 'The angle θ between the normal vectors of the lower point and its neighboring points Rrs' and increase the angle threshold θ thres2 As a criterion for judgment;
[0024] If the search radius R rs and search radius R rs The difference between the angles of the normal vectors of the lower point and its neighboring points is greater than the angle threshold θ. thres2 If it stops growing, then growth will cease.
[0025] Furthermore, preferably, before the point cloud segmentation sub-step, the following steps are also included:
[0026] The seed point S0 selection sub-step first determines and obtains the nail surface region Nrange(x, y), and selects a point in the nail surface region Nrange(x, y) as the seed point S0, and starts the growth process through the seed point S0.
[0027] Furthermore, as a preferred option, in the nail point cloud flattening step, the nail curved surface point cloud is flattened. Nail-s Divide the point cloud into n layers L along the x-axis. i Then, according to each layer of point cloud L i The entire object is unfolded and flattened to obtain a planar point cloud of the nail (Cloud). Nail-p .
[0028] Furthermore, as a preferred option, the nail dot cloud flattening step specifically includes:
[0029] Each layer of point cloud L i Points p in the middle j The x-axis coordinates are unified, while the y-axis and z-axis coordinates remain unchanged, resulting in an approximately arc-shaped point cloud set, stand_L. i ;
[0030] Set each layer of point cloud to stand_L i All points p, according to the y-coordinate of the nail center. y Divided into 2 parts: L_part1 i L_part2 i ;
[0031] The arc-shaped point cloud L_part1 of each part i L_part2 i The L_ordered_parts are obtained by sorting the nails from near to far along the midline. i .
[0032] Furthermore, preferably, after the nail dot cloud flattening step, the following steps are also included:
[0033] The edge processing step will generate the nail-shaped point cloud. Nail-p Perform edge processing to make the edges smooth.
[0034] Secondly, this application also provides a nail contour extraction system, which is used to implement the nail contour extraction method in any of the foregoing technical solutions. Specifically, the nail contour extraction system includes:
[0035] The data acquisition device performs a 3D scan of the target finger to obtain 3D data of the target finger. Finger The finger 3D data Finger Nail 3D data containing at least all nails Nail ;
[0036] A data conversion device is communicatively connected to the data acquisition device. The data conversion device receives and processes the 3D data of the finger. Finger Converted into 3D point cloud data, thus obtaining finger point cloud. Finger The finger-pointing cloud Finger Nail surface point cloud containing at least all nails Nail-s ;
[0037] The PCL point cloud library is communicatively connected to the data conversion device.
[0038] A segmentation module, located within the PCL point cloud library, is configured to segment the finger point cloud. Finger The segmentation process is performed to extract the fingernail surface point cloud. Nail-s ;
[0039] The flattening module is communicatively connected to the PCL point cloud library. The flattening module is configured to flatten the nail-shaped surface point cloud. Nail-s Unfold and flatten the surface area to obtain a planar point cloud of the nail. Nail-p ;
[0040] The drawing module is communicatively connected to the flattening module, and the drawing module receives the nail-shaped point cloud (Cloud). Nail-p And based on the nail plane point cloud Cloud Nail-p Contour point cloud Contour The shape is drawn to obtain the nail shape.
[0041] Furthermore, preferably, the data conversion device includes a correction module, which is configured to convert the finger-pointing cloud into a digital format. Finger Transform into output finger dot cloud Finger-o This makes the output finger dot cloud (Cloud) Finger-o The posture and position are switched to the preset posture and position.
[0042] Furthermore, preferably, the nail contour extraction system further includes:
[0043] The verification module is communicatively connected to the correction module, and the verification module is configured to receive and verify the back-pointing of fingers in the converted finger point cloud.
[0044] If the back of the finger in the converted finger point cloud points towards the positive z-axis in the coordinate system, the correction module is used to rotate it 180° around the x-axis to obtain the output finger point cloud (Cloud). Finger-o ;
[0045] If the back of the finger in the transformed finger point cloud points in the negative z-axis direction of the coordinate system, then the transformed finger point cloud is directly used as the output finger point cloud Cloud. Finger-o .
[0046] Furthermore, as a preferred embodiment, the nail contour extraction system further includes a seed point selection module S0, which acquires the nail surface point cloud Cloud. Nail-s The segmentation module selects a point as a seed point S0 within a surface region Nrange(x, y) on the surface, and then starts the growth process through the seed point S0.
[0047] Furthermore, preferably, the segmentation module is configured to be able to segment the nail surface point cloud. Nail-s Divide the point cloud into n layers L along the x-axis.i Then, according to the point cloud L described for each layer... i The entire object is unfolded and flattened to obtain a planar point cloud of the nail (Cloud). Nail-p .
[0048] Furthermore, preferably, the flattening module is configured to be able to flatten each layer of the point cloud L i Points p in j The x-axis coordinates are unified, while the y-axis and z-axis coordinates remain unchanged, resulting in an approximately arc-shaped point cloud set, stand_L. i Then, the point cloud set stand_L for each layer i All points p, according to the y-coordinate of the nail center. y Divided into 2 parts: L_part1 i L_part2 i Finally, the arc-shaped point cloud L_part1 of each part is... i L_part2 i The L_ordered_parts are obtained by sorting the nails from near to far along the midline. i .
[0049] Furthermore, preferably, the PCL point cloud library also includes:
[0050] The edge processing module is used to process the obtained nail planar point cloud (Cloud). Nail-p Perform edge processing to make the edges smooth.
[0051] Compared with the prior art, the beneficial effects of the present invention are:
[0052] 1. This invention obtains a curved fingernail point cloud through 3D point cloud, and then flattens it. The outer contour point cloud shape of the flattened fingernail point cloud is more closely matched with the outer contour of the curved fingernail.
[0053] 2. This invention greatly facilitates the calculation and processing of finger point clouds by converting the converted finger point cloud to the desired pose and position.
[0054] 3. By adding clustering constraint conditions, this invention can more precisely calculate whether points in the finger point cloud belong to the nail point cloud, thereby more effectively separating the nail surface point cloud from the finger point cloud.
[0055] 4. This invention first determines the nail surface region, and then selects a point from the nail surface region as a seed point to start the growth process. This ensures that the point cloud obtained by the growth process is the nail surface point cloud. Only one growth process is required, which reduces the time required for the growth algorithm and improves the algorithm efficiency.
[0056] 5. The present invention layers the nail along the growth direction and then flattens each layer. The resulting nail planar point cloud is flattened in the width direction. The shape outline drawn based on the outline point cloud of this nail planar point cloud can fit the nail more closely in the side dimension of the nail.
[0057] 6. This invention performs edge processing on the obtained nail plane point cloud to make the edges smooth and improve the aesthetics of the obtained nail shape. Attached Figure Description
[0058] Figure 1 This is a flowchart illustrating the nail contour extraction method in Implementation Method 1.
[0059] Figure 2 This is a block diagram of the nail contour extraction system in Implementation Method 1;
[0060] Figure 3 This is a flowchart illustrating the nail contour extraction method in Implementation Method 1 (point cloud segmentation sub-step);
[0061] Figure 4 This is a flowchart illustrating the nail contour extraction method in Implementation Method 2 (point cloud direction correction sub-step);
[0062] Figure 5 This is a block diagram (correction module) of the nail contour extraction system in Implementation Method 2;
[0063] Figure 6 This is a flowchart (verification sub-step) of the nail contour extraction method in Implementation Method 2;
[0064] Figure 7 This is a block diagram (verification module) of the nail contour extraction system in Implementation Method 2;
[0065] Figure 8 Within the search radius R rs A schematic diagram of the normals of the adjacent point cloud below;
[0066] Figure 9a Based on the search radius R rs The segmentation results of the finger dot cloud;
[0067] Figure 9b Based on reducing the search radius R rs The segmentation results of the finger dot cloud;
[0068] Figure 10 This is a flowchart illustrating the nail contour extraction method in Implementation Method 3;
[0069] Figure 11 Implementation method three is based on the search radius R. rs'A schematic diagram of the normals of the adjacent point cloud below;'
[0070] Figure 12 Implementation method three is based on the search radius R. rs The segmentation result of the finger dot cloud below;
[0071] Figure 13 This is a flowchart of the nail contour extraction method in Implementation Method 3 (seed point S0 selection sub-step);
[0072] Figure 14 This is a block diagram (selection submodule) of the nail contour extraction system in Implementation Method 3;
[0073] Figure 15 This is a schematic diagram of the structure under surface region A in implementation method three;
[0074] Figure 16 This is a schematic diagram of the layered structure of the nail surface dot cloud along the nail growth direction in Embodiment 4;
[0075] Figure 17 This is a schematic diagram of the structure in Implementation Method 4 that unifies the points on each layer of the point cloud onto the same plane;
[0076] Figure 18 This is a schematic diagram of the structure of point clouds unfolded under the same plane in Implementation Method 4;
[0077] Figure 19 This is a flowchart illustrating the nail contour extraction method in Implementation Method 5;
[0078] Figure 20 This is a block diagram of the nail contour extraction system in Implementation Method 5.
[0079] Explanation of reference numerals in the attached figures:
[0080] 1. Data acquisition device; 2. Data conversion device; 3. PCL point cloud library; 4. Segmentation module; 5. Flattening module; 6. Drawing module; 7. Correction module; 8. Verification module; 9. Selection module; 10. Boundary extraction module; 11. Edge processing module. Detailed Implementation
[0081] The technical solutions in the embodiments of this application will now be described with reference to the accompanying drawings.
[0082] It should be understood that the specific examples in this document are only intended to help those skilled in the art better understand the embodiments of this application, and are not intended to limit the scope of the embodiments of this application.
[0083] It should also be understood that, in the various embodiments of this application, the sequence number of each process does not imply the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of this application.
[0084] It should also be understood that the various embodiments described in this specification can be implemented individually or in combination, and the embodiments in this application are not limited in this respect.
[0085] Unless otherwise stated, all technical and scientific terms used in the embodiments of this application have the same meaning as commonly understood by one of ordinary skill in the art. The terminology used in this application is for the purpose of describing particular embodiments only and is not intended to limit the scope of this application. The term "and / or" as used in this application includes any and all combinations of one or more of the associated listed items.
[0086] Implementation Method 1
[0087] The first embodiment of this application provides a method for extracting nail contours, and more particularly relates to a method for extracting nail contours based on 3D point cloud results.
[0088] For details, see Figure 1 As shown, the method for extracting the nail outline in this embodiment includes the following steps:
[0089] Data acquisition steps: Perform a 3D scan on the target finger to obtain the 3D data of the target finger. Finger 3D data of fingers Finger Nail 3D data containing at least all nails Nail ;
[0090] Data point cloud steps: Data on finger 3D data Finger Convert to 3D point cloud data to obtain finger point cloud. Finger Finger pointing cloud Finger Nail surface point cloud containing at least all nails Nail-s ;
[0091] Steps to obtain fingernail point cloud: Obtain finger point cloud (Cloud) Finger Segment the surface and obtain the fingernail-shaped point cloud (Cloud). Nail-s ;
[0092] Nail dot cloud flattening steps: Flatten the nail dot cloud on its curved surface Nail-s Flattening the surface with equal area yields a planar point cloud of the nail. Nail-p ;
[0093] Nail outline drawing steps: Based on the nail plane point cloud Nail-p Contour point cloud Contour The shape is drawn to obtain the nail shape.
[0094] Compared with existing technologies, the nail contour extraction method provided in Embodiment 1 obtains a nail surface point cloud (Cloud) of a nail with an uneven, curved surface. Nail-s The nail-shaped point cloud formed after flattening Nail-p The flattened fingernail-shaped point cloud Nail-p Outer contour point cloud Contour The shape fits the outer contour of the curved nail more closely.
[0095] Thus, the flattened fingernail-shaped point cloud (Cloud) Nail-p Outer contour point cloud Contour The shape is drawn to obtain the nail shape on a flat surface. The nail sticker is then made based on this nail shape as a template. The made nail sticker can adapt to the surface curvature of the nail. When it is applied to the user's nail surface, the outer contour of the nail sticker is consistent with the outer contour of the nail, without any incomplete application or overflow.
[0096] In other words, the nail contour extraction method provided in Embodiment 1 obtains a three-dimensional image of the nail surface, performs point cloud processing on it, and then processes the point cloud of the nail surface into a cloud. Nail-s Segment and flatten into a fingernail-shaped point cloud. Nail-p Based on the nail planar point cloud Cloud Nail-p Drawing the outer contour of the point cloud Contour Shape: Obtaining a planar nail shape. Compared to existing technologies that use two-dimensional images to obtain nail shapes, the outer contour shape of the nail outline extracted in this embodiment is completely consistent with the outer contour of the user's nail. The nail stickers made based on this nail shape can be perfectly attached to the user's nails without being incomplete or overflowing.
[0097] See Figure 2 As shown, this embodiment also provides a nail contour extraction system, which can extract the nail contour using the aforementioned nail contour extraction method. Specifically, the nail contour extraction system includes a data acquisition device 1, a data conversion device 2, a PCL point cloud library 3, a flattening module 5, and a drawing module 6, which are connected in sequence via communication. The PCL point cloud library 3 includes a segmentation module 4.
[0098] Specifically, in combination Figure 1 and Figure 2As shown, in the data acquisition step, the target finger is 3D scanned using data acquisition device 1 to obtain the 3D data of the target finger. Finger To extract the nail outline of the target finger, the data acquisition device 1, during the data acquisition step, performs a 3D scan of the target finger that includes at least the entire nail and the surrounding skin. Based on this, the finger 3D data is generated. Finger Then it must contain at least the 3D data of all the nails. Nail Generally, it also includes at least 3D data of the skin around the nails. Skin .
[0099] Data acquisition device 1 can utilize LiDAR, a depth camera, or a 3D scanner, structured light camera, or binocular camera primarily based on LiDAR and a depth camera. Thus, in the data acquisition step, data acquisition device 1 can use LiDAR to perform 3D scanning of the target finger using triangulation or Time-of-Flight (TOF) ranging principles, or a depth camera to perform 3D scanning of the target finger using structured light ranging, binocular vision ranging, and TOF ranging principles, enabling rapid and accurate acquisition of 3D finger data. Finger .
[0100] The various 3D scanning and ranging principles listed above, such as triangulation ranging, TOF ranging, structured light ranging, and binocular vision ranging, are all existing technologies that are widely used in daily life. Their principles will not be elaborated here.
[0101] In particular, the triangulation principle, TOF distance measurement principle, structured light distance measurement principle, and binocular vision distance measurement principle each have their own advantages and disadvantages in practical applications. Their requirements for the measurement environment, optical fiber, distance, measurement accuracy, and product cost are all different. In the practical application of this embodiment, the specific type of data acquisition device 1 needs to be selected.
[0102] Specifically, in combination Figure 1 and Figure 2 As shown, in the data point cloud step, the data conversion device 2 receives the finger 3D data collected and sent by the data acquisition device 1. Finger Then, the finger 3D data... Finger Convert the data to 3D point cloud data in PCD format to obtain finger point cloud (Cloud). Finger Specifically, the data conversion device 2 converts the 3D data of the finger into digital data. FingerThe format is converted to a format supported by the PCL database 3, such as pcd or ply. The specific format chosen depends on the data format acquired by the data acquisition device 1 and the data format supported by the segmentation module 4. Because finger 3D data... Finger Nail 3D data containing at least fingernails Nail and 3D data of the skin around the nails Skin Therefore, the 3D data of the finger... Finger The format is converted to a data format supported by PCL database 3, such as pcd format, and then the finger pointing cloud is displayed. Finger The cloud contains at least a point cloud of nail surfaces with uneven surfaces and curved curvature. Nail-s And the skin point cloud of the skin around the nail. Skin .
[0103] Of course, in other examples of this embodiment, if the data acquisition device 1 has a built-in data conversion function, then in the data point cloud step, the data acquisition device 1 can also function as the data conversion device 2, and directly convert the acquired finger 3D data into a digital representation of the data. Finger The data format is converted to PCD format to obtain finger dot cloud. Finger .
[0104] PCL (Point Cloud Library) 3 is a large-scale, cross-platform, open-source C++ programming library built upon previous research on point clouds. It is used to store 3D finger data. Finger For example, converting the data format to PCD format is an example of how 3D finger data can be converted. PCD format data is a format supported by the PCL point cloud library 3. Finger Finger dot cloud converted to PCD format Finger Entering the PCL point cloud library 3 allows you to utilize the relevant algorithms within the PCL point cloud library 3 to analyze finger point clouds. Finger Further processing will be carried out.
[0105] Due to the initial acquisition of finger 3D data Data Finger Includes 3D nail data of all fingernails. Nail and 3D data of the skin around the nails Skin Therefore, the 3D data of the finger... Finger The finger point cloud obtained after point cloudification and even conversion. Finger This includes the nail surface point cloud. Nail-s Skin point cloud around the nailsSkin In extracting the outline of the nail, it is necessary to convert the nail's curved surface into a point cloud. Nail-s Skin Point Cloud Skin Separate and extract the required nail surface point cloud. Nail-s .
[0106] Based on this, in the nail point cloud acquisition step, see... Figure 3 As shown, this specifically includes a point cloud segmentation sub-step. In this sub-step, the segmentation module 4 from the PCL point cloud library 3 is used to segment the finger point cloud (Cloud). Finger Segmentation, finger pointing to cloud Finger Nail surface point cloud Nail-s Skin Point Cloud Skin Segmentation is performed to extract the point cloud of the curved nail surface. Nail-s .
[0107] In particular, combined Figure 2 and Figure 3 As shown, the point cloud segmentation sub-step in this embodiment uses the region growing segmentation method to segment and calibrate the finger point cloud. Finger The specific segmentation method is as follows:
[0108] enter:
[0109] Input point cloud {P}
[0110] Input search radius R rs
[0111] • Input curvature threshold curvature thres , angle threshold θ thres
[0112] Output:
[0113] Output a list of region clusters R after point cloud segmentation.
[0114] initialization:
[0115] • Initialize the region cluster list R
[0116] • Initialize the point list {A} ← {1, ..., P_size}, and push all points of the point cloud into the list {A}.
[0117] Calculate the normal vector {N} of each point in the input point cloud.
[0118] Calculate the curvature {c} of each point in the input point cloud.
[0119] Algorithm loop:
[0120] • As long as list {A} is not empty, then:
[0121] ◆ Clear the current region list {R c} and the current seed list {S c}
[0122] ◆Find the point P with the current minimum curvature in list {A} min And the point P with minimum curvature min Remove {A}←{A}\P from list {A} min .
[0123] ◆At the same time, the aforementioned minimum curvature point P will be removed from list {A}. min Push the current region list {R c} and the current seed list {S c}
[0124] {S c}←{S c}∪P min , {R c}←{R c}∪P min .
[0125] ◆For the current seed list {S c Each point {S} in} c (i)}, repeat:
[0126] ■ Quickly find point {S} using a k-dtree c All neighboring nodes of (i)} {Nb c}
[0127] ■For {Nb c For each point {Nb} that is a neighbor of all its neighbors c (j)}, repeat:
[0128] Traversing the list {Nb c} Looking for if there is a bit {Nb c (j)} satisfies the condition, point {S} c (i)} and the current neighbor {Nb} c The angle between the normal vectors of (j)} is less than the angle threshold θ. thres cos -1 (S c (i), Nb c (j)≤θ thres ),but:
[0129] ■Points {Nb} that meet the conditions c (j)} Add to the current region list {R c},
[0130] {R c}←{R c}∪Nb c (j)
[0131] Points {Nb} that meet the conditions c (j)} is removed from list {A}.
[0132] {A}←{A}∪Nb c (j).
[0133] ■ If the point {Nb} satisfies the condition c The curvature of (j)} is less than the curvature threshold curvature. thres Then the
[0134] Points {Nb} that satisfy the conditions c (j)}Pre-push seed list {S c},
[0135] {S c}←{S c}∪Nb c (j).
[0136] ◆ List the current region {R c Add the resulting list of region clusters R after segmentation.
[0137] {R}←{R}∪R c .
[0138] In this way, you can tap the cloud with your finger. Finger Segmentation, skin removal point cloud Skin The nail surface point cloud was grown and extracted. Nail-s .
[0139] Specifically, in combination Figure 1 and Figure 2 As shown, in the nail point cloud flattening step, the flattening module 5, which is communicatively connected to the segmentation module 4, flattens the nail surface point cloud Cloud acquired by the data conversion device 2 in the nail point cloud acquisition step. Nail-s By unfolding and flattening the surface with equal area, a planar point cloud of a fingernail is obtained. Nail-p .
[0140] Finally, in the nail outline drawing step, the drawing module 6, which is communicatively connected to the flattening module 5, receives the nail plane point cloud (Cloud). Nail-p Then draw the nail-shaped point cloud. Nail-p Contour point cloud Contour Shape, to obtain the nail shape.
[0141] In subsequent production, based on the aforementioned method and the edge contour point cloud in the system... Contour The edge outline of the nail obtained by drawing the shape can be used to create a nail sticker model, which serves as the basis for making nail stickers and studying nail shapes.
[0142] It should be noted that the nails mentioned in this application can be fingernails or toenails.
[0143] Implementation Method 2
[0144] Embodiment 2 of this application provides a method and system for extracting nail contours. The extraction method and system are based on the design and implementation of the nail contour extraction method and system in Embodiment 1. The actual process or structure is similar to that of Embodiment 1, but there are some differences. The following focuses on describing the differences. Unless otherwise described in detail, the differences are considered to be the same as those in Embodiment 1 and will not be repeated.
[0145] PCL point cloud library 3 can use a visualization window to draw a coordinate system (x, y, z), which positions the point cloud in the 3D world. However, in this second implementation method, to facilitate subsequent manipulation of the finger point cloud... Finger To obtain accurate and efficient processing results, see [link / reference]. Figure 4 and Figure 5 As shown, the data point cloud step includes a point cloud orientation correction sub-step, and the nail contour extraction system also includes a correction module 7. In this point cloud orientation correction sub-step, we use the correction module 7 to convert the finger point cloud (Cloud) obtained by the data conversion device 2 in the data point cloud step. Finger Transform the pose and position to obtain the output finger dot cloud. Finger-o This enables the output of finger dot cloud. Finger-o The posture and position are transformed to the preset posture and position we want.
[0146] The correction module 7 can be set up independently and communicate with the data conversion device 2, or it can be integrated into the data conversion device 2 or be part of the data conversion device 2.
[0147] Specifically, our desired posture and position are achieved by changing the finger's pointing cloud. Finger To enable the output of finger dot cloud Finger-o The centroid of the finger coincides with the origin of the coordinate system in the PCL point cloud library 3, the tip of the finger points in the positive direction of the x-axis in the coordinate system, and the back of the finger points in the negative direction of the z-axis in the coordinate system.
[0148] More specifically, the tip of the finger refers to the end of the finger closer to the nail growth point, and the tip of the finger points in the direction of nail growth; the back of the finger refers to the side of the finger with nails, and the back of the finger points in the direction from the fingertip towards the nail.
[0149] Based on this requirement, the finger 3D data obtained in the data point cloud step is first processed... Finger Convert to obtain finger-pointing cloud. Finger (Hereinafter referred to as input finger point cloud), then proceed to the point cloud orientation correction sub-step, using correction module 7 to correct the input finger point cloud Cloud. Finger The pose and position are transformed to obtain new finger pointing in the desired pose and position. Finger-o (Hereinafter referred to as output finger dot cloud).
[0150] In this embodiment, the correction module 7 in the point cloud orientation correction sub-step transforms the input finger point cloud (Cloud) using a TF rotation matrix. Finger The posture and position will be used to input finger pointing Cloud. Finger Transform into output finger dot cloud Finger-o The specific formula steps are as follows:
[0151] Cloud Finger-o =Cloud Finger *tf
[0152]
[0153]
[0154]
[0155] in,
[0156] tf is the rotation matrix;
[0157] Cloud Finger To extract the 3D finger data obtained in the point cloud step Finger The input finger dot cloud obtained after conversion;
[0158] Cloud Finger-o To input finger-pointing cloud Finger The output finger dot cloud after TF rotation;
[0159] R is the pose rotation amount of the rotation matrix;
[0160] T is the translation amount of the rotation matrix;
[0161] For input finger pointing cloud Finger The eigenvectors along the x, y, and z axes are obtained by solving the covariance matrix of PCA (Principal Components Analysis).
[0162] c is the input for finger pointing cloud. Finger The center of mass;
[0163] x c y c z c The input method is Cloud (pointing finger). Finger The coordinates of the centroid.
[0164] Thus, the output finger dot cloud obtained after TF rotation transformation is... Finger-o The finger's centroid coincides with the origin, with the fingertip pointing in the positive x-axis and the back of the finger pointing in the negative z-axis. The output finger point cloud is consistent with the preset pose and position. Finger-o This can provide a basis for subsequent output of finger point cloud cloud. Finger-o This provides good prerequisites for processing.
[0165] The above-mentioned finger dot cloud obtained after TF rotation transformation Finger-o It is also possible that the back of the finger points in the positive direction of the z-axis in the coordinate system. Based on this, see... Figure 6 and Figure 7 As shown, after the point cloud orientation correction sub-step, the data point cloud step also includes a verification sub-step, and the fingernail contour extraction system also includes a verification module 8. In the verification sub-step, the verification module 8 is used to verify the back-pointing direction of the fingers in the converted finger point cloud, checking whether it points in the negative direction of the z-axis in the coordinate system.
[0166] The verification module 8 is communicatively connected to the correction module 7. The verification module 8 can be set up independently and communicate with the data conversion device 2, or it can be integrated into the data conversion device 2 or be part of the data conversion device 2.
[0167] If the verification module 8 determines that the back of the finger in the transformed finger point cloud points in the positive z-axis direction of the coordinate system, we use the correction module 7 to rotate the transformed finger point cloud 180° around the x-axis and use it as the output finger point cloud (Cloud). Finger-o For subsequent output.
[0168] If the verification module 8 determines that the back of the finger in the transformed finger point cloud points in the negative direction of the z-axis in the coordinate system, we will directly use this transformed finger point cloud as the output finger point cloud Cloud. Finger-o For subsequent output.
[0169] In this way, it can be ensured that the output of finger-pointing cloud is accurate. Finger-o The back of the middle finger points in the negative direction of the z-axis in the coordinate system.
[0170] Bounding boxes, also known as minimum circumscribed rectangles, are algorithms for finding the optimal bounding space of a discrete point set. The basic idea is to approximate complex geometric objects using a slightly larger, simpler geometric shape (called a bounding box). PCL Point Cloud Library 3 acquires point cloud bounding boxes and uses them to calculate and process data.
[0171] Specifically, the verification steps for the above verification sub-steps are as follows:
[0172] Calculate the finger dot cloud obtained after TensorFlow rotation transformation. Finger In the mean value of the z-coordinate And the median z of the bounding box m And make a judgment.
[0173]
[0174]
[0175] if, The finger point cloud obtained after TF rotation transformation is rotated 180° around the x-axis;
[0176] if Keep the finger point cloud obtained after TF rotation transformation unchanged.
[0177] in, The average value of the z-axis coordinates of the finger point cloud;
[0178] z m This refers to the median of the bounding box of the cloud along the z-axis;
[0179] z max The maximum value of the finger point cloud coordinates on the z-axis;
[0180] z min The minimum value of the finger point cloud coordinates on the z-axis.
[0181] More specifically, if, This indicates that the back of the finger in the finger point cloud obtained after the TensorFlow rotation transformation points towards the positive z-axis in the coordinate system. Therefore, the finger point cloud obtained after the TensorFlow rotation transformation is rotated 180° around the x-axis, and this 180° rotated finger point cloud is then used as the output finger point cloud (Cloud). Finger-o .
[0182] if This indicates the finger dot cloud (Cloud) obtained after TF rotation transformation. Finger The back of the finger points in the negative z-axis direction of the coordinate system. Thus, keeping the finger point cloud obtained after the TensorFlow rotation transformation unchanged, it becomes the output finger point cloud (Cloud). Finger-o .
[0183] Implementation Method 3
[0184] Embodiment 3 of this application provides a method and system for extracting nail contours. The extraction method and system are based on the design and implementation of the nail contour extraction method and system in Embodiment 1 or 2. The actual process or structure is similar to that of Embodiment 1 or 2 but there are some differences. The following focuses on describing the differences. Unless otherwise described in detail, the method and system are considered to be the same as those in Embodiment 1 and 2 and will not be described again.
[0185] like Figure 8 As shown, in the point cloud of the nail surface Cloud Nail-s Skin Point Cloud Skin When segmenting according to the point cloud segmentation sub-steps and segmentation module 4 as described in Embodiment 1, under the aforementioned clustering constraint conditions, the nail surface point cloud Cloud... Nail-s The segmentation growth depends only on the angle Δθ between the normal vectors of two adjacent points and the curvature threshold of the point. thres This results in a relatively large error.
[0186] In particular, if the nail groove is not obvious or the fingers are dotted with cloud-like patterns. Finger The point cloud model has significant noise, especially the finger point cloud. Finger The point cloud in the image does not have particularly large undulations, that is, it is a fingernail-shaped point cloud. Nail-s Skin Point Cloud Skin When the undulation of the transition area is small, the skin point cloud... Skin The normals of adjacent point clouds will also produce significant errors, thus affecting the appearance of the skin point cloud. Skin The point in the middle was incorrectly pushed into the pre-seed list {S c} and finally added to the output list of region clusters R after segmentation, which is also the part that originally belonged to the skin point cloud Cloud. SkinPoints in the cloud were incorrectly added to the nail surface point cloud. Nail-s middle.
[0187] Specifically, such as Figure 9a As shown, within the search radius R rs Below, skin point cloud Skin The angles θ1 and θ2 between the normal vectors of adjacent points and their neighbors simultaneously satisfy an angle threshold θ. thres Thus, the following conditions mentioned above are met:
[0188] ■ If the point {Nb} satisfies the condition c The curvature of (j)} is less than the curvature threshold curvature. thres Then the point {Nb} that satisfies the condition will be... c (j)}Pre-push seed list {S c},
[0189] {S c}←{S c}∪{Nb c (j)}
[0190] This will perform the following actions:
[0191] The current region list {R c Add the resulting list of region clusters R after segmentation.
[0192] {R}←{R}∪{R c}
[0193] Thus, the skin's point cloud... Skin The point cloud in the data is categorized into the region cluster list R, making the nail-shaped surface point cloud Cloud in PCL point cloud library 3... Nail-s The growth extends beyond the undulating areas, that is, to the skin, thus causing... Figure 9a The situation described above ultimately led to the failure of nail splitting.
[0194] In this situation, in some embodiments of this implementation, we can reduce the search radius R. rs The method is used to refine the calculation and obtain a more accurate normal vector for the n points.
[0195] However, as Figure 9b As shown, the search radius R rs While reducing the value helps in accurately calculating the normal vector of point n, it also makes the finger-pointing cloud (Cloud) more complex. Finger The noise of the model relative to the reduced R rs The increase in noise leads to a greater algorithm error in the region growth process of the PCL point cloud library 3, resulting in incomplete growth of the groove part and thus affecting the accuracy of the results.
[0196] Based on this, refer to Figure 10 and Figure 11 As shown, this third embodiment optimizes this by adding a clustering constraint sub-step after the point cloud segmentation sub-step in the nail point cloud acquisition step. The clustering constraint sub-step improves the accuracy of the calculation results by adding clustering constraint conditions to the segmentation module 4.
[0197] The specific steps of this cluster restraint process are as follows:
[0198] In the search radius R rs Based on this, input the search radius Rrs', where the search radius Rrs' is smaller than the search radius R. rs Obtain the angle θ between the normal vectors of the point and its neighboring points under the search radius Rrs'. Rrs' and increase the angle threshold θ thres2 As a criterion, a judgment is made;
[0199] If the current point θ Rrs -θ Rrs' >θ thres2 If it stops growing, then growth will cease.
[0200] If the current point θ Rrs -θ Rrs' ≤θ thres2 Then the current point is added to the current region list {R}. c}
[0201] in,
[0202] θ Rrs To search within radius R rs The angle between the normal vectors of the lower point and its neighboring points;
[0203] θ Rrs' Let be the angle between the normal vectors of the point and its neighboring points under the search radius Rrs'.
[0204] Taking two points n1 and n2 as an example, see [link / reference]. Figure 11 As shown, for point n1, Δθ1 = θ1' - θ1, and Δθ1 > θ thres2 n1 is not clustered into the current region list {R}. c};The Δθ2 of point n2 is θ2'-θ2, and its Δθ2≤θ thres2 n2 is clustered into the current region list {R}. c}
[0205] in,
[0206] θ1 is within the search radius R rs The angle between the normal vectors of the lower point n1 and its neighboring points;
[0207] θ1' is the angle between the normal vectors of point n1 and its neighboring points under the search radius Rrs';
[0208] θ2 is within the search radius R rs The angle between the normal vectors of the lower point n2 and its neighboring points;
[0209] θ2' is the angle between the normal vectors of point n2 and its neighboring points under the search radius Rrs'.
[0210] Thus, by adding this clustering constraint, for points that satisfy the condition that the angle between the normal vectors of the current point and its current neighbor is less than the angle threshold θ, the following conditions are met. thres At the point of time, reduce the search radius R. rs Then, further clustering constraints are applied, such that a point is only allowed to cluster if it is within the search radius R. rs The angle between the normal vector of the search radius Rrs' and the neighboring point is less than the angle threshold θ. thres2 Only then was it determined that it belonged to the fingernail-shaped point cloud. Nail-s The points in the list are grouped and added to the current region list {R}. c By removing points that do not meet this condition, the cloud size of the nail-shaped surface is effectively reduced. Nail-s The erroneous growth, and obtain such Figure 12 As shown, from the finger-pointing cloud Finger Accurate extraction and segmentation of surface point clouds in Cloud Nail-s The segmentation effect.
[0211] Here, the search radius Rrs' is much smaller than the search radius R. rs Specifically, the search radius Rrs' can be set to the search radius R. rs More preferably, the search radius Rrs' is 0.01-0.8 times the search radius R. rs The ratio is 0.1-0.3 times. Thus, it is possible to reasonably increase the workload in the PCL point cloud library 3 while meeting one's own segmentation accuracy requirements for finger point clouds (Cloud). Finger The point cloud in the image is segmented and grown to obtain a more accurate nail-shaped surface point cloud. Nail-s .
[0212] More specifically, in the segmentation module 4, the aforementioned point cloud segmentation sub-step and clustering constraint sub-step are performed to create the nail-shaped surface point cloud. Nail-s During region growth, the point with the smallest curvature in list {A} is repeatedly extracted as the seed point S0 to start the growth process until list {A} is empty. Thus, the input finger-based cloud (Cloud) is generated. Finger After all regions have grown, the fingernail-shaped point cloud (Cloud) is obtained. Nail-s .
[0213] However, although segmentation module 4 in the above steps can obtain the fingernail surface point cloud (Cloud), Nail-s However, it repeatedly extracts the point with the smallest curvature from list {A} as the seed point S0 to start the growth process. These processes also result in the acquisition of finger point cloud. Finger Unnecessary skin point cloud Skin This also makes the growth process repetitive and redundant, as seen in the nail surface point cloud. Nail-s Its growth efficiency is extremely low.
[0214] For this, see Figure 13 and Figure 14 As shown, in this third embodiment, before the point cloud segmentation sub-step of the nail point cloud acquisition step, a seed point S0 selection sub-step is also included. The nail contour extraction system also includes a selection module 9 that is communicatively connected to the segmentation module 4. In this seed point S0 selection sub-step, the selection module 9 first determines the nail surface region Nrange(x, y) of the nail and selects a point in the nail surface region Nrange(x, y) as the seed point S0. The segmentation module 4 then begins the growth process through the seed point S0.
[0215] Thus, the growth process originates from the fingernail surface point cloud. Nail-s The growth process begins with the nail surface region Nrange(x, y), requiring only one growth cycle to ensure that the result is the nail surface point cloud Cloud. Nail-s This reduces the time required for the growth algorithm and improves the algorithm's efficiency.
[0216] More specifically, the determination of the surface region Nrange(x, y) is based on the aforementioned process of inputting the finger point cloud Cloud. Finger The finger dot cloud obtained after rotation by TensorFlow is orthogonal to the coordinate axes. Finger-o This was done on the basis of... (e.g.) Figure 15 As shown, the shaded area is the region Nrange(x, y) to be determined. It is a rectangular area enclosed by a range of values along the x and y axes, and its expression is:
[0217] Nrange(x, y) = {x∈(x...y)} lowerlimit x upperlimit ), y∈(y lowerlimi y upperlimit )}
[0218] in,
[0219] x min Point cloud for nail surface Nail-s Minimum value on the x-axis;
[0220] xmax Point cloud for nail surface Nail-s The maximum value on the x-axis;
[0221] y min Point cloud for nail surface Nail-s Minimum value on the y-axis;
[0222] y max Point cloud for nail surface Nail-s The maximum value on the y-axis.
[0223] This rectangular area is defined by the nail-shaped surface point cloud (Cloud). Nail-s The width of the rectangle can be determined by a set ratio on the x-axis and y-axis, and preferably it is set to be symmetrical on both sides of the x-axis and both sides of the y-axis. In a preferred embodiment, the range of the rectangular surface region Nrange(x,y) is located at 1 / 2 of the y-axis width and 3 / 4 of the x-axis width of the entire surface region Nrange(x,y).
[0224] That is:
[0225] x lowerlimit =(x min ×(4-(3-a))+x max ×(3-a)) / 4
[0226] x upperlimit =(x min ×(4-(3+a))+x max ×(3+a)) / 4
[0227] y lowerlimit =(y min ×(2-(1-b))+y max ×(1-b) / 2
[0228] y upperlimit =(y min ×(2-(1+b))+y max ×(1+b) / 2
[0229] in,
[0230] 'a' is the radius of the rectangle along the x-axis.
[0231] b is the radius of the rectangle in the y-axis direction.
[0232] Thus, after determining the nail surface region Nrange(x, y), the points of this nail surface region Nrange(x, y) are separated by the segmentation module 4 in the PCL point cloud library 3. Then, one point is randomly selected as the initial seed point S0 for growth. This ensures that this single growth operation actually occurs within the nail surface region Nrange(x, y), resulting in the nail surface point cloud. Nail-s The growth process is simple and occurs only once; nail surface point cloud. Nail-s The growth efficiency was greatly improved.
[0233] Implementation Method 4
[0234] Embodiment 4 of this application provides a method and system for extracting nail contours. This extraction method and system are based on the design and implementation of the nail contour extraction methods and systems in Embodiments 1 to 3. Their actual processes or structures are similar but different. The following focuses on describing the differences. Unless otherwise described in detail, they can be considered the same as those in Embodiments 1 to 3 and will not be repeated.
[0235] In the nail point cloud flattening step, the nail curved surface point cloud Cloud is flattened using the flattening module 5. Nail-s Flattening with equal surface area results in a point cloud resembling a fingernail. Nail-p At that time, due to the point cloud of the nail surface Nail-s The curved shape results in a point cloud on the nail surface. Nail-p Nail stickers made as models cannot perfectly fit the nail.
[0236] To improve this, in the nail dot cloud flattening step of this embodiment four, the following is performed: Figure 16 As shown, the point cloud of the nail surface is first displayed using the flattening module 5. Nail-s Divide the point cloud into n layers L along the x-axis. i Then, according to each layer of point cloud L i The entire object is flattened to the same length to obtain a planar point cloud of the nail. Nail-p .
[0237] For each layer of point cloud L i The point cloud is:
[0238] L i ={p∈Cloud Nail-s |p x <=limitL i &p x >=limitR i}
[0239] in,
[0240] L i The point cloud L of the current layer after being horizontally segmented along the x-axis. i ;
[0241] p represents the current layer point cloud L i The point in the middle;
[0242] p x Let p be the x-coordinate of point p.
[0243] limitL i For the current layer point cloud L i The minimum value along the x-axis;
[0244] limitR i For the current layer point cloud L i The maximum value on the x-axis.
[0245] traversing the cloud of fingernail curved surfaces Nail-s Each layer of point cloud L i For all points, only the x-axis coordinate value of point p is p x Satisfy condition limitL i ≤p x ≤limitR i Then the point p will be assigned to the current layer L. i This leads to aggregation into the current region list {R}. c}
[0246] More specifically, for each layer of point cloud L i The x-axis range of the points in the middle is:
[0247] limitL i =minx+i×ld
[0248] limitR i =minx+(i+1)×ld
[0249] ld = (maxx - minx) / n
[0250] in,
[0251] minx is the current layer point cloud L i The x-axis minimum value;
[0252] maxx represents the current layer of point cloud L. i The x-axis maximum value;
[0253] ld is for each layer L i The width of the point cloud;
[0254] n represents the point cloud of the nail surface. Nail-sThe number of layers divided horizontally along the x-axis.
[0255] Here, the number of layers n is not a fixed number, but rather is determined by the point cloud of the nail-shaped surface. Nail-s The length of the point cloud on the x-axis is determined by the density of the input point cloud.
[0256] Of course, it can also be derived from the fingernail surface point cloud. Nail-s The density of the point cloud is obtained by taking the length of the point cloud on the x-axis and the number of layers n.
[0257] Thus, along the direction of nail growth, that is, the positive x-axis, the point cloud of the nail surface is represented. Nail-s Perform layering, and then process the point cloud L in each layer. i Flatten the point cloud to the same length, each layer L i The length along the y-axis remains unchanged before and after flattening, resulting in the fingernail-shaped point cloud obtained from this. Nail-p It achieves a perfect match in the width direction of the nail, that is, in the y-axis direction. And, for the nail surface point cloud... Nail-s Flattening is performed only in the positive x-axis direction, which can also adapt to the nail growth direction and the relatively symmetrical characteristics of the nail along the growth direction, reducing the errors caused by the conversion of curved surfaces to planes, and preserving the nail plane point cloud as much as possible during the unfolding process. Nail-p The shape and length of the nail remain unchanged in the lateral dimension. Based on this, a nail planar point cloud is generated. Nail-p Contour point cloud Contour The drawn shape and outline can fit the nail better on the side dimension, so the nail stickers made in this way can be completely attached to the nail without problems such as incomplete attachment or overflow.
[0258] And, see Figure 17 As shown, in the nail point cloud flattening step, each point cloud layer L is flattened. i Points p in j The x-axis coordinates are unified, while the y-axis and z-axis coordinates remain unchanged, resulting in an approximately arc-shaped point cloud set, stand_L. i .
[0259] Simply put, it involves combining point clouds of different layers. i Points p on j All of these are unified to the same level to facilitate further calculations. Specifically, the point cloud L at each layer... i Mapping to the plane x = XL using the mapping f. i Above, from the point cloud L of each layer i The aforementioned approximately arc-shaped point cloud set stand_L is obtained. i.
[0260] stand_L i =f(L i )
[0261] f:p∈L i →p x =XL ix
[0262] Then, see Figure 18 As shown, each layer of point cloud is set as stand_L i All points p in the fingernail surface point cloud Cloud Nail-s The y-coordinate of the midline of the middle fingernail (Center) y Divided into 2 parts: L_part1 i L_part2 i ,in,
[0263] L_part1 i ={p|p y <=Center y}
[0264] L_part2 i ={p|p y >Center y}
[0265] in,
[0266] stand_L i To make each layer of point cloud L i Points p in j The point cloud set that is approximately arc-shaped is obtained by unifying the x-axis coordinate values and keeping the y-axis and z-axis coordinate values unchanged;
[0267] f is a mapping;
[0268] p represents the current layer's point cloud set, stand_L i The point in the middle;
[0269] p x Let p be the x-coordinate of point p.
[0270] XL ix For plane XL i x-axis coordinate value;
[0271] L_part1 i For the current layer point cloud set stand_L i The arc-shaped point cloud set on one side of the midline of the middle fingernail;
[0272] L_part2 iFor the current layer point cloud set stand_L i The arc-shaped point cloud set on the other side of the midline of the middle fingernail;
[0273] p y Let p be the y-coordinate of point p.
[0274] Center y Point cloud for nail surface Nail-s The y-axis coordinate of the midline of the middle fingernail.
[0275] stand_L i Divided into L_part1 i L_part2 i After dividing into two parts, then divide the arc-shaped point cloud L_part1 of each part. i L_part2 i The point cloud L_ordered_part is obtained by sorting the points according to the midline of the nail from near to far. i .
[0276] The specific algorithm is as follows:
[0277] enter:
[0278] Input point cloud L_part i
[0279] • Input radius threshold R thres
[0280] Output:
[0281] Output the sorted point cloud L_ordered_part i
[0282] initialization:
[0283] • Initialized sorted point cloud L_ordered_part i
[0284] ● Initialize the point list {P}, and set the point cloud L_part i Push all points onto list {P}
[0285] Calculate the normal vector {N} of each point in the input point cloud.
[0286] ● Calculate the curvature {c} of each point in the input point cloud.
[0287] Algorithm loop:
[0288] • Traverse all points in list {P} to find {P0}, where the y-coordinate of {P0} is the distance from the midline of the finger to the center. y shortest
[0289] And remove {P0} from the list {P} {p}←{p}\P0
[0290] Simultaneously, {P0} is pushed into the point cloud L_ordered_part. i ,
[0291] L_ordered_part i ←L_ordered_part i ∪P0
[0292] • As long as list {P} is not empty, then:
[0293] ◆Find the point cloud L_ordered_part i The current maximum point P in the sequence end
[0294] ◆Find the point P at the current distance in list {A} end Point P with the minimum straight-line distance min and P min Remove {A}←{A}\P from list {A} min
[0295] ◆At the same time, P min Push the point cloud L_ordered_part i ,
[0296] L_ordered_part i ←L_ordered_part i ∪P min
[0297] ◆When the list {P} is empty, output the sorted point cloud L_ordered_part i
[0298] Then, the ordered arc-shaped point cloud L_ordered_part is processed. i Expand into a point cloud L_expand_part i ,in,
[0299] d_curve = d_straight
[0300] And d_curve is approximately equal to the straight-line distance between points P1 and P2:
[0301] d_curve≈√(P1 y -P2 y ) 2 +(P1 z -P2 z )2
[0302] The corresponding points P1' and P2' after expansion are:
[0303]
[0304]
[0305] sequentially all points L_expand_part i All corresponding points have been calculated.
[0306] Finally, expand all the line point clouds L_expand_part i All merged into the new Cloud_expand Nail
[0307] Cloud_expand Nail =ΣL_expand_part i
[0308] The new Cloud_expand after the merger Nail This refers to the point cloud of a fingernail plane. Nail-p .
[0309] Implementation Method 5
[0310] Embodiment 5 of this application provides a method and system for extracting nail contours. The extraction method and system are based on the design and implementation of the nail contour extraction methods and systems in Embodiments 1 to 4. Their actual processes or structures are similar but different. The following focuses on describing the differences. Unless otherwise described in detail, they can be considered the same as those in Embodiments 1 to 4 and will not be repeated.
[0311] In this fifth embodiment, see Figure 19 and Figure 20 As shown, before drawing the nail outline, the nail outline extraction method also includes a boundary extraction step. The nail outline extraction system further includes a boundary extraction module 10, which is communicatively connected to the flattening module 5 and the drawing module 6. In this boundary extraction step, the boundary extraction module 10 is used to extract the nail planar point cloud (Cloud). Nail-p Outline point cloud of the outer edge Contour Then, the outline point cloud (Cloud) is depicted using drawing module 6. Contour Draw the shape to obtain the nail shape.
[0312] We extract the nail-shaped planar point cloud (Cloud) using the boundary extraction module 10. Nail-pContour point cloud Contour However, if we directly extract the flattened fingernail plane point cloud (Cloud) Nail-p Due to noise in the original point cloud and errors in fingernail segmentation, the extracted edges have obvious jagged edges, which are present in the outermost contour point cloud. Contour The lack of smoothness affects the aesthetics of the resulting nail outline. Therefore, we can use the nail planar point cloud (Cloud) to... Nail-p The edges are smoothed to preserve the original edge features of the nail as much as possible, resulting in a point cloud on the nail plane. Nail-p Edge contour point cloud Contour It is smoother and more rounded.
[0313] The boundary extraction module 10 is communicatively connected to the flattening module 5 and the drawing module 6. The boundary extraction module 10 can be set up independently and communicate with the PCL point cloud library 3, or it can be integrated into the PCL point cloud library 3, or it can be part of the PCL point cloud library 3.
[0314] Thus, in the nail outline drawing step, the boundary extraction module 10 is used to extract the nail plane point cloud (Cloud). Nail-p Contour point cloud in Contour .
[0315] Then, in the nail point cloud flattening step, an edge processing step is included after the boundary extraction step. The nail contour extraction system also includes an edge processing module 11, which is located in the PCL point cloud library 3 and is communicatively connected to both the boundary extraction module 10 and the drawing module 6. In the boundary extraction step, the edge processing module 11 is used to flatten the obtained contour point cloud. Contour Smoothing is applied to make the edges smooth.
[0316] The edge processing module 11 is communicatively connected to the boundary extraction module 10 and the drawing module 6. The edge processing module 11 can be set up independently and communicate with the PCL point cloud library 3, or it can be integrated into the PCL point cloud library 3, or it can be part of the PCL point cloud library 3.
[0317] Specifically, in the edge processing step, the edge processing module 11 uses curve fitting to smooth the insufficiently smooth contour point cloud (hereinafter also referred to as the input contour point cloud) extracted by the boundary extraction module 10 in the boundary extraction step. Contour-i Curve fitting is performed on the edges of the point cloud to obtain a smooth contour point cloud (hereinafter also referred to as the output contour point cloud). Contour This process, known as edge processing, results in a smooth nail curve. The specific steps of this edge processing step are as follows:
[0318] ① Extract the nail-shaped planar point cloud Cloud using the boundary extraction module 10 provided by the PCL point cloud library 3. Nail-p Input contour point cloud Contour-i ;
[0319] ② Extract the input contour point cloud Cloud Contour-i Perform curve fitting to obtain the curve Contour_hull1;
[0320] ③ Locate the input contour point cloud along the x-axis. Contour-i The x-coordinate of the widest point is x1;
[0321] ④ For the input contour point cloud (Cloud) Contour-i Take all points with coordinates greater than x1 to obtain the set hull1;
[0322] ⑤ For all points of the fitted curve Contour_hull1, select the points with coordinates less than x1 to obtain the set hull2;
[0323] ⑥ Merge the obtained point sets hull1 and hull2 to obtain the final contour point cloud. Contour .
[0324] The resulting contour point cloud Contour While ensuring the matching of the nail's curvature and edge contour, it better conforms to the specific edge contour direction of the nail, and also improves the aesthetics of the drawn nail contour, which in turn helps to improve the aesthetics of the nail stickers produced when they are made into nail sticker models.
[0325] Those skilled in the art will recognize that the modules and algorithm steps of the various embodiments described in conjunction with the implementations disclosed herein can be implemented in electronic hardware, computer software, or a combination of both. Furthermore, software modules can be stored in any form of computer storage medium. To clearly illustrate the interchangeability of hardware and software, the composition and steps of each embodiment have been generally described in terms of functionality in the foregoing description. Whether these functions are implemented in hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementations should not be considered beyond the scope of the invention.
[0326] It should be understood that the above-disclosed embodiments can be implemented in many different forms, and the scope of the claims should not be construed as limited to the embodiments described herein. Specifically, these embodiments are provided to make this disclosure thorough and comprehensive, and to fully convey the concept of embodiments of the invention to those skilled in the art. This disclosure is intended to cover all alternatives, modifications, and equivalents to embodiments falling within the spirit and scope of this disclosure as defined by the appended claims. Furthermore, numerous specific details will be set forth in the following detailed description of embodiments of this disclosure for thorough understanding. However, it will be apparent to those skilled in the art that embodiments of this disclosure can be practiced without these specific details.
Claims
1. A method for extracting nail contours, characterized in that, Includes the following steps: Data acquisition steps: Perform a 3D scan on the target finger to obtain the 3D data of the target finger. Finger 3D data of fingers Finger Nail 3D data containing at least all nails Nail ; Data point cloud steps: Data on finger 3D data Finger Convert to 3D point cloud data to obtain finger point cloud. Finger Finger pointing cloud Finger Nail surface point cloud containing at least all nails Nail-s ; Steps to obtain fingernail point cloud: Obtain finger point cloud (Cloud) Finger Segment the surface and obtain the fingernail-shaped point cloud (Cloud). Nail-s ; Nail dot cloud flattening steps: Flatten the nail dot cloud on its curved surface Nail-s Flattening the surface with equal area yields a planar point cloud of the nail. Nail-p ; Nail outline drawing steps: Based on the nail plane point cloud Nail-p Contour point cloud Contour The shape is drawn to obtain the nail shape. In the nail point cloud flattening step, the nail curved surface point cloud is flattened. Nail-s Divide the point cloud into n layers L along the x-axis. i Then, according to each layer of point cloud L i The entire object is unfolded and flattened to obtain a planar point cloud of the nail (Cloud). Nail-p, The fingernail point cloud flattening step specifically includes: flattening each layer of point cloud L i Points p in the middle j The x-axis coordinates are unified, while the y-axis and z-axis coordinates remain unchanged, resulting in an approximately arc-shaped point cloud set, stand_L. i ; Set each layer of point cloud to stand_L i All points p, according to the y-coordinate of the nail center. y Divided into 2 parts: L_part1 i L_part2 i ; The arc-shaped point cloud L_part1 of each part i L_part2 i The L_ordered_parts are obtained by sorting the nails from near to far along the midline. i .
2. The method for extracting nail contours according to claim 1, characterized in that, The data point cloud step also includes: Point cloud orientation correction sub-step: Point your finger into the cloud. Finger Transform into output finger dot cloud Finger-o This enables the output of finger dot cloud. Finger-o The posture and position are changed to the preset posture and position; The preset pose and position refer to the output finger dot cloud. Finger-o The centroid of the finger coincides with the origin of the coordinate system in the PCL point cloud library; the tip of the finger points in the positive direction of the x-axis in the coordinate system; and the back of the finger points in the negative direction of the z-axis in the coordinate system.
3. The method for extracting nail contours according to claim 2, characterized in that, The sub-step for point cloud orientation correction also includes: Verification sub-step: Check whether the back of the fingers in the transformed finger point cloud points in the negative z-axis direction of the coordinate system. If the back of the finger points in the positive z-axis direction of the coordinate system, the transformed finger point cloud is rotated 180° around the x-axis and used as the output finger point cloud (Cloud). Finger-o ; If the back of the finger points in the negative z-axis direction of the coordinate system, the transformed finger point cloud will be directly used as the output finger point cloud (Cloud). Finger-o .
4. The method for extracting nail contours according to any one of claims 1-3, characterized in that, The nail point cloud acquisition step includes: Point cloud segmentation sub-steps: The region growing segmentation method is used to segment the finger point cloud. Finger Obtain the fingernail-shaped point cloud (Cloud). Nail-s .
5. The method for extracting nail contours according to claim 4, characterized in that, Following the point cloud segmentation sub-step, the following are also included: Clustering restraint step: within the search radius R rs Based on the input smaller than the search radius R rs Given a search radius Rrs', obtain the angle θ between the normal vectors of a point and its neighboring points within the search radius Rrs'. Rrs’ and increase the angle threshold θ thres2 As a criterion for judgment; If the search radius R rs The difference between the angles between the normal vectors of a point and its neighbors under the search radius Rrs' is greater than the angle threshold θ. thres2 If it stops growing, then growth will cease.
6. The method for extracting nail contours according to claim 4, characterized in that, Before the point cloud segmentation sub-step, the following are also included: The seed point S0 selection sub-step first determines and obtains the nail surface region Nrange(x, y), and selects a point in the nail surface region Nrange(x, y) as the seed point S0, and starts the growth process through the seed point S0.
7. The method for extracting nail contours according to any one of claims 1-3 and 5-6, characterized in that, Following the nail dotting and smoothing step, the process also includes: The edge processing step will generate the nail-shaped point cloud. Nail-p Perform edge processing to make the edges smooth.
8. A nail contour extraction system for implementing the nail contour extraction method according to any one of claims 1-7, characterized in that, include: The data acquisition device performs a 3D scan of the target finger to obtain 3D data of the target finger. Finger The finger 3D data Finger Nail 3D data containing at least all nails Nail ; A data conversion device is communicatively connected to the data acquisition device. The data conversion device receives and processes the 3D data of the finger. Finger Converted into 3D point cloud data, thus obtaining finger point cloud. Finger The finger-pointing cloud Finger Nail surface point cloud containing at least all nails Nail-s ; The PCL point cloud library is communicatively connected to the data conversion device. A segmentation module, located within the PCL point cloud library, is configured to segment the finger point cloud. Finger The segmentation process is performed to extract the fingernail surface point cloud. Nail-s ; The flattening module is communicatively connected to the PCL point cloud library. The flattening module is configured to flatten the nail-shaped surface point cloud. Nail-s Unfold and flatten the surface area to obtain a planar point cloud of the nail. Nail-p ; The drawing module is communicatively connected to the flattening module, and the drawing module receives the nail-shaped point cloud (Cloud). Nail-p And based on the nail plane point cloud Cloud Nail-p Contour point cloud Contour The shape is drawn to obtain the nail shape.
9. The nail contour extraction system according to claim 8, characterized in that, The data conversion device includes a correction module, which is configured to convert the finger-pointing cloud into a digital format. Fingei Transform into output finger dot cloud Finger-o This makes the output finger dot cloud (Cloud) Finger-o The posture and position are switched to the preset posture and position.
10. The nail contour extraction system according to claim 9, characterized in that, The nail contour extraction system also includes: The verification module is communicatively connected to the correction module, and the verification module is configured to receive and verify the back-pointing of fingers in the converted finger point cloud. If the back of the finger in the converted finger point cloud points towards the positive z-axis in the coordinate system, the correction module is used to rotate it 180° around the x-axis to obtain the output finger point cloud (Cloud). Finger-o ; If the back of the finger in the transformed finger point cloud points in the negative z-axis direction of the coordinate system, then the transformed finger point cloud is directly used as the output finger point cloud Cloud. Finger-o .
11. The nail contour extraction system according to claim 8, characterized in that, The nail contour extraction system also includes: The seed point S0 selection module is communicatively connected to the segmentation module shown. The selection module is configured to acquire the fingernail surface point cloud Cloud. Nail-s The segmentation module selects a point as a seed point S0 within a surface region Nrange(x, y) on the surface, and then starts the growth process through the seed point S0.
12. The nail contour extraction system according to claim 8, characterized in that, The flattening module is configured to be able to flatten the nail surface point cloud. Nail-s Divide the point cloud into n layers L along the x-axis. i Then, according to the point cloud L described for each layer... i The entire object is unfolded and flattened to obtain a planar point cloud of the nail (Cloud). Nail-p .
13. The nail contour extraction system according to claim 8, characterized in that, The flattening module is configured to be able to flatten each layer of the point cloud L i Points p in j The x-axis coordinates are unified, while the y-axis and z-axis coordinates remain unchanged, resulting in an approximately arc-shaped point cloud set, stand_L. i Then, the point cloud set stand_L for each layer i All points p, according to the y-coordinate of the nail center. y Divided into 2 parts: L_part1 i L_part2 i Finally, the arc-shaped point cloud L_part1 of each part is... i L_part2 i The L_ordered_parts are obtained by sorting the nails from near to far along the midline. i .
14. The nail contour extraction system according to claim 8, characterized in that, The PCL point cloud library also includes: The edge processing module is used to process the obtained nail planar point cloud (Cloud). Nail-p Perform edge processing to make the edges smooth.
Citation Information
Patent Citations
Printing method of nail art device
CN109770520A
Manicure machine, manicure method and protective film cutting method
CN110477575A
Nail area image acquisition method and system, computing device and storage medium
CN111739028A