A method, device, storage medium and electronic device for evaluating nail head assembly quality
By using the grayscale average of the target image as a threshold in the nail head assembly quality assessment to segment the nail head area and surrounding areas, the problem of low accuracy in nail head assembly quality assessment is solved and accurate identification of the nail head area is achieved. Separation and acquisition of point cloud data improves assessment accuracy.
Patent Information
- Application Number
- CN202311164453.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-09-11
- Publication Date
- 2024-10-18
- Estimated Expiration
- 2043-09-11
AI Technical Summary
The accuracy of nail head assembly quality assessment in the prior art is low, mainly because the nail head material and base material are different, so the area around the nail head is not necessarily flat, and the brightness is different, making it difficult to accurately extract the nail head area and surrounding areas.
By obtaining the grayscale average of the first target point and the second target point on the target image, using these average values as the first and second segmentation thresholds, reverse binarization and segmentation of the target image are performed, and the nail head regions are obtained respectively. and the surrounding area, and then calculate the amount of bumps to evaluate the assembly quality.
It effectively separates the nail head from its surrounding area, improves the accuracy of nail head assembly quality assessment, and controls the nail head through grayscale threshold to ensure accurate point cloud data of each area.
Smart Images

Figure CN117350951B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the technical field of structured light measurement, and in particular to a nail head assembly quality assessment method, device, storage medium and electronic device. Background Art
[0002] Measuring the convexity and concavity of the nail head (i.e., the height difference between the nail head and its surrounding surface) through structured light measurement is an important means of inspecting the quality of rivet assembly. Usually, obtaining the convexity and concavity of the nail head requires first segmenting the nail head area and the area around the nail head from the two-dimensional image, generating three-dimensional data in the two areas respectively, and then calculating the height difference between the two three-dimensional data.
[0003] However, in actual measurement, due to the different types of nail head materials and substrates, the area around the nail head is not necessarily flat. At the same time, under reflection, the different brightness of each area makes it difficult to accurately extract the nail head area and the surrounding area, resulting in low accuracy in the assessment of the assembly quality of the nail head. Summary of the invention
[0004] The main purpose of the present application is to provide a nail head assembly quality assessment method, device, storage medium and electronic device, aiming to solve the problem of low accuracy in nail head assembly quality assessment in the prior art.
[0005] To achieve the above objectives, the technical solutions adopted in the embodiments of the present application are as follows:
[0006] In a first aspect, an embodiment of the present application provides a nail head assembly quality assessment method, comprising the following steps:
[0007] The grayscale average value of the first target point and the grayscale average value of the second target point on the target image are respectively obtained; wherein the target image is obtained based on spot projection on the target object, the measured surface of the target object has a plurality of nail heads, and the target image has a plurality of circular spots formed by the nail heads, the first target point is a point whose distance from the center of the target circular spot is less than a first threshold, the target circular spot is a circular spot closest to the center of the target image, and the second target point is a point whose distance from the center of the target circular spot is within a second threshold range, and the lower limit of the second threshold range is greater than the first threshold;
[0008] The target image is reversely binarized according to a first segmentation threshold to obtain a nail head area mask; wherein the first segmentation threshold is the average of the grayscale average of the first target point and the grayscale average of the second target point;
[0009] Segment the target image according to a second segmentation threshold to obtain a mask of the area around the nail head; wherein the second segmentation threshold is obtained by reducing the first segmentation threshold;
[0010] According to the mask of the nail head area and the mask of the area around the nail head, the concave-convex amount is calculated to complete the assembly quality evaluation of the nail head.
[0011] In a possible implementation manner of the first aspect, performing inverse binarization on the target image according to the first segmentation threshold to obtain a nail head region mask includes:
[0012] According to the first segmentation threshold, the target image is reversely binarized to obtain an area set to 1 and an area set to 0;
[0013] Based on the area set to 1, the nail head area mask is obtained.
[0014] In a possible implementation manner of the first aspect, after the target image is reversely binarized according to the first segmentation threshold to obtain the area set to 1 and the area set to 0, the nail head assembly quality assessment method further includes:
[0015] Mask the area set to 0 to eliminate the points set to 1 in the area set to 0, and obtain the target area set to 1;
[0016] According to the area set to 1, the nail head area mask is obtained, including:
[0017] According to the target area set to 1, the nail head area mask is obtained.
[0018] In a possible implementation manner of the first aspect, segmenting the target image according to the second segmentation threshold to obtain a mask of the area around the nail head includes:
[0019] Segment the target image according to the second segmentation threshold to obtain an area set to 0;
[0020] Based on the area set to 0, a mask of the area around the nail head is obtained.
[0021] In a possible implementation manner of the first aspect, after the target image is segmented according to the second segmentation threshold and the area set to 0 is obtained, the nail head assembly quality assessment method further includes:
[0022] Perform complementary masking according to the area set to 0 to obtain a first mask;
[0023] According to the area set to 0, the mask of the area around the nail head is obtained, including:
[0024] The mask of the nail head surrounding area is obtained by subtracting the first mask from the nail head area mask.
[0025] In a possible implementation manner of the first aspect, before respectively obtaining the grayscale average value of the first target point and the grayscale average value of the second target point on the target image, the nail head assembly quality assessment method further includes:
[0026] According to the coordinates of the center of the circular spot and the size of the target image, the distance information between the circular spots and the center of the target image is obtained;
[0027] The target circular spot is obtained according to the minimum value in the distance information.
[0028] In a possible implementation manner of the first aspect, before respectively obtaining the grayscale average value of the first target point and the grayscale average value of the second target point on the target image, the nail head assembly quality assessment method further includes:
[0029] The target image is obtained according to the light spot projected onto the measured surface of the target object.
[0030] In a second aspect, an embodiment of the present application provides a nail head assembly quality assessment device, comprising:
[0031] An acquisition module, the acquisition module is used to respectively obtain the grayscale average value of the first target point and the grayscale average value of the second target point on the target image; wherein the target image is obtained based on spot projection on the target object, the measured surface of the target object has a plurality of nail heads, and the target image has a plurality of circular spots formed by the nail heads, the first target point is a point whose distance from the center of the target circular spot is less than a first threshold value, the target circular spot is a circular spot closest to the center of the target image, and the second target point is a point whose distance from the center of the target circular spot is within a second threshold range, and the lower limit of the second threshold range is greater than the first threshold value;
[0032] A binarization module, the binarization module is used to perform inverse binarization on the target image according to a first segmentation threshold to obtain a nail head area mask; wherein the first segmentation threshold is the average of the grayscale average of the first target point and the grayscale average of the second target point;
[0033] A segmentation module, the segmentation module is used to segment the target image according to a second segmentation threshold to obtain a mask of the area around the nail head; wherein the second segmentation threshold is obtained by reducing the first segmentation threshold;
[0034] The evaluation module is used to calculate the concave-convex amount according to the nail head area mask and the nail head surrounding area mask to complete the assembly quality evaluation of the nail head.
[0035] In a third aspect, an embodiment of the present application provides a computer-readable storage medium storing a computer program. When the computer program is loaded and executed by a processor, the nail head assembly quality assessment method provided in any one of the first aspects above is implemented.
[0036] In a fourth aspect, an embodiment of the present application provides an electronic device, including a processor and a memory, wherein:
[0037] The memory is used to store computer programs;
[0038] The processor is used to load and execute a computer program so that the electronic device executes the nail head assembly quality assessment method provided in any one of the first aspects above.
[0039] Compared with the prior art, the beneficial effects of this application are:
[0040] The present application provides a method, device, storage medium and electronic device for evaluating the quality of nail head assembly. The method includes: obtaining the grayscale average value of a first target point and the grayscale average value of a second target point on a target image respectively; wherein the target image is obtained by projecting a light spot on a target object, a surface of the target object to be measured has a plurality of nail heads, and the target image has a plurality of circular spots formed by the nail heads, the first target point is a point whose distance from the center of the target circular spot is less than a first threshold, the target circular spot is a circular spot closest to the center of the target image, and the second target point is a point whose distance from the center of the target circular spot is within a second threshold range, and the lower limit of the second threshold range is greater than the first threshold; performing reverse binarization on the target image according to a first segmentation threshold to obtain a nail head area mask; wherein the first segmentation threshold is the average of the grayscale average value of the first target point and the grayscale average value of the second target point; performing segmentation on the target image according to the second segmentation threshold to obtain a nail head surrounding area mask; wherein the second segmentation threshold is obtained by reducing the first segmentation threshold; performing concave-convex amount calculation according to the nail head area mask and the nail head surrounding area mask to complete the evaluation of the assembly quality of the nail head.
[0041] The present application first takes the circular spot closest to the center of the image as the target circular spot, and takes the relative distance thereto as the basis. Points within the first threshold value can be ensured to be points within the nail head area, and the second threshold range can ensure that the points taken are all within the projected light spot and outside the nail head area. Obviously, the grayscale average value of the first target point is smaller than the grayscale average value of the second target point. Using the average value of the two as the threshold for reverse binarization will set the nail head area to 1, and the area around the nail head will be approximated as a plane. The segmentation is performed with a parameter smaller than the first segmentation threshold, and the area outside the light spot is set to 0 to obtain a mask of the area around the nail head. The above-mentioned means uses grayscale as a threshold for card control, which can effectively separate the nail head from the area outside the nail head, so that the mask can be used to obtain accurate point cloud data of each area, thereby improving the accuracy of the assembly quality assessment of the nail head. BRIEF DESCRIPTION OF THE DRAWINGS
[0042] Figure 1 A schematic diagram of the structure of an electronic device of a hardware operating environment involved in an embodiment of the present application;
[0043] Figure 2 A schematic diagram of a process for evaluating nail head assembly quality provided in an embodiment of the present application;
[0044] Figure 3A flow chart of an implementation method of obtaining a target circular spot in a nail head assembly quality assessment method provided in an embodiment of the present application;
[0045] Figure 4 A flowchart of an implementation method of obtaining a mask in the nail head assembly quality assessment method provided in an embodiment of the present application;
[0046] Figure 5 A schematic diagram of a target image in a nail head assembly quality assessment method provided in an embodiment of the present application;
[0047] Figure 6 A schematic diagram of a nail head area mask in a nail head assembly quality assessment method provided in an embodiment of the present application;
[0048] Figure 7 A schematic diagram of a mask of an area surrounding a nail head in a nail head assembly quality assessment method provided in an embodiment of the present application;
[0049] Figure 8 A schematic diagram of a module of a nail head assembly quality assessment device provided in an embodiment of the present application;
[0050] Markings in the figure: 101 - processor, 102 - communication bus, 103 - network interface, 104 - user interface, 105 - memory. DETAILED DESCRIPTION
[0051] It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application.
[0052] See attached Figure 1 , attached Figure 1This is a schematic diagram of the structure of an electronic device of the hardware operating environment involved in the embodiment of the present application. The electronic device may include: a processor 101, such as a central processing unit (CPU), a communication bus 102, a user interface 104, a network interface 103, and a memory 105. Among them, the communication bus 102 is used to realize the connection and communication between these components. The user interface 104 may include a display screen (Display), an input unit such as a keyboard (Keyboard), and the user interface 104 may also include a standard wired interface and a wireless interface. The network interface 103 may optionally include a standard wired interface and a wireless interface (such as a wireless fidelity (WIreless-FIdelity, WI-FI) interface). The memory 105 may optionally be a storage device independent of the aforementioned processor 101. The memory 105 may be a high-speed random access memory (RAM) memory, or it may be a stable non-volatile memory (NVM), such as at least one disk storage; the processor 101 may be a general-purpose processor, including a central processing unit, a network processor, etc., or it may be a digital signal processor, an application-specific integrated circuit, a field programmable gate array or other programmable logic device, a discrete gate or transistor logic device, or a discrete hardware component.
[0053] Those skilled in the art will appreciate that Figure 1 The structure shown in the figure does not constitute a limitation on the electronic device, and may include more or less components than shown in the figure, or combine certain components, or arrange the components differently.
[0054] As attached Figure 1 As shown, the memory 105 as a storage medium may include an operating system, a network communication module, a user interface module, and a nail head assembly quality assessment device.
[0055] In the attached Figure 1 In the electronic device shown, the network interface 103 is mainly used for data communication with the network server; the user interface 104 is mainly used for data interaction with the user; the processor 101 and the memory 105 in the present application can be set in the electronic device, and the electronic device calls the nail head assembly quality assessment device stored in the memory 105 through the processor 101, and executes the nail head assembly quality assessment method provided in the embodiment of the present application.
[0056] See attached Figure 2 Based on the hardware device of the aforementioned embodiment, the embodiment of the present application provides a nail head assembly quality assessment method, comprising the following steps:
[0057] S10: Obtain a target image according to the light spot projected onto the measured surface of the target object.
[0058] In the specific implementation process, the target object is an object equipped with rivets, such as aircraft parts, which may be equipped with several rivets, leaving multiple nail head positions on the surface. The projection system projects a circular light spot slightly larger than 2 times the diameter of the nail head onto the measured surface of the target object, such as the attached Figure 5 As shown, it can be seen from the image that in the entire image, the area illuminated by the backlight plate has a significantly larger grayscale value than other areas, and within the area illuminated by the light spot, the grayscale value of the nail head area is significantly smaller than that of the area outside the nail head.
[0059] S20: Obtain a target circular spot according to the target image;
[0060] S201: obtaining distance information between a plurality of circular spots and the center of the target image according to the coordinates of the center of the circular spots and the size of the target image;
[0061] S202: Obtain the target circular spot according to the minimum value in the distance information.
[0062] In the specific implementation process, under ambient lighting, other nail heads also appear in the camera's field of view. At this time, circular spot recognition is performed on the entire picture. Using OpenCV's SimpleBlobDetect method, multiple nail heads including the nail heads in the bright spot area can be identified. At this time, the distance between the center of the identified circular spot and the center of the image is calculated one by one. The calculation method is to subtract 1 / 2 of the length and width of the image from the coordinates of the center of the circle and take the absolute value, and then add them. The numerical value is used as the basis for sorting to find the circular spot closest to the center of the image, that is, the target circular spot.
[0063] S30: respectively obtain the grayscale average value of the first target point and the grayscale average value of the second target point on the target image; wherein the target image is obtained based on spot projection on the target object, the measured surface of the target object has a number of nail heads, and the target image has a number of circular spots formed by the nail heads, the first target point is a point whose distance from the center of the target circular spot is less than a first threshold, the target circular spot is a circular spot closest to the center of the target image, and the second target point is a point whose distance from the center of the target circular spot is within a second threshold range, and the lower limit of the second threshold range is greater than the first threshold.
[0064] In the specific implementation process, after obtaining the target circular spot, the average grayscale value of the points whose distance to the center of the circular spot is less than the first threshold is first calculated, and the points with a radius of 0.7 times the circular spot radius are usually taken. 0.7 times the circular spot radius can ensure that these points are all located within the nail head area. Then the average grayscale value of the points whose distance to the center of the circular spot is within the second threshold range is calculated, and the average grayscale value of the points with a distance greater than 1.2 times the circular spot radius and less than 1.8 times the circular spot radius is usually taken. This radius range can ensure that the points taken are all within the bright spot and outside the nail head. Since the lower limit of the second threshold range is limited to be greater than the first threshold, the average of the former is significantly smaller than the average of the latter.
[0065] S40: performing inverse binarization on the target image according to a first segmentation threshold to obtain a nail head region mask; wherein the first segmentation threshold is the average of the grayscale average of the first target point and the grayscale average of the second target point.
[0066] In the specific implementation process, reverse binarization is a threshold segmentation method, which is to invert the output binary image according to the threshold comparison result. When the brightness of the original image is greater than the threshold, the output image brightness is 0, otherwise the output image brightness is 1. The average value of the two is used as the threshold for reverse binarization, which will set the nail head area to 1 and the area outside the nail head in the light spot to 0. That is, the target image is reversely binarized according to the first segmentation threshold to obtain the nail head area mask, including:
[0067] According to the first segmentation threshold, the target image is reversely binarized to obtain an area set to 1 and an area set to 0;
[0068] Based on the area set to 1, the nail head area mask is obtained.
[0069] Since there are also points set to 0 or 1 in the area outside the spot, a circular mask with the center of the spot as the center and a radius of 1.5 times the radius of the spot is used to eliminate the area outside the radius of 1.5 times the center of the spot, and obtain a mask with only the nail head area set to 1, as shown in the attached figure. Figure 6 That is, after the target image is reversely binarized according to the first segmentation threshold and the area set to 1 and the area set to 0 are obtained, the nail head assembly quality assessment method further includes:
[0070] Mask the area set to 0 to eliminate the points set to 1 in the area set to 0, and obtain the target area set to 1;
[0071] According to the area set to 1, the nail head area mask is obtained, including:
[0072] According to the target area set to 1, the nail head area mask is obtained.
[0073] S50: Segment the target image according to a second segmentation threshold to obtain a mask of the area around the nail head; wherein the second segmentation threshold is obtained by reducing the first segmentation threshold.
[0074] In the specific implementation process, after obtaining the nail head area mask, a value smaller than the first segmentation threshold is used as the second segmentation threshold for segmentation. For example, 0.8 times the average grayscale of the light spot is used as the threshold for segmentation, and the area outside the light spot can be set to 0. Since the grayscale of the nail head area is also smaller than the average brightness of the light spot, it is also set to 0, and the following is obtained. Figure 7 That is, the target image is segmented according to the second segmentation threshold to obtain a mask of the area around the nail head, including:
[0075] Segment the target image according to the second segmentation threshold to obtain an area set to 0;
[0076] Based on the area set to 0, a mask of the area around the nail head is obtained.
[0077] In the specific implementation process, since the second segmentation threshold may not guarantee that every point in the nail head area is 0, in order to improve the accuracy, the mask can be used with the complementary mask of the circular mask with the center of the circular spot as the center and 1.5 times the radius of the circular spot as the radius, and the area within 1.5 times the radius of the circular spot center is eliminated to obtain a mask with only the spot area, and then subtract the nail head mask obtained above to obtain an accurate mask of the area outside the nail head. That is, after the target image is segmented according to the second segmentation threshold and the area set to 0 is obtained, the nail head assembly quality assessment method also includes:
[0078] Perform complementary masking according to the area set to 0 to obtain a first mask;
[0079] According to the area set to 0, the mask of the area around the nail head is obtained, including:
[0080] The mask of the nail head surrounding area is obtained by subtracting the first mask from the nail head area mask.
[0081] S60: Calculating the concave-convex amount according to the nail head area mask and the nail head surrounding area mask to complete the assembly quality evaluation of the nail head.
[0082] In the specific implementation process, the above two masks will be used to calculate the two point clouds of the nail head and the area outside the nail head respectively, and perform subsequent concave and convex calculations to complete the assembly quality assessment of the nail head. It is divided into two masks because when measuring the concave and convex amount, the area outside the nail head is not necessarily a plane, and a small area around the nail head is taken as an approximation of the plane.
[0083] In this embodiment, the circular spot closest to the center of the image is first taken as the target circular spot, and the relative distance thereto is used as the basis. Points within the first threshold value can be ensured to be points within the nail head area, and the second threshold range can ensure that the points taken are all within the projected light spot and outside the nail head area. Obviously, the grayscale average value of the first target point is smaller than the grayscale average value of the second target point. Reverse binarization is performed using the average value of the two as the threshold, which will set the nail head area to 1, and the area around the nail head is approximated as a plane. The area is segmented using a parameter smaller than the first segmentation threshold, and the area outside the light spot is set to 0 to obtain a mask for the area around the nail head. The above-mentioned means uses grayscale as a threshold for card control, which can effectively separate the nail head from the area outside the nail head, so that accurate point cloud data of each area can be obtained using the mask respectively, thereby improving the accuracy of the assembly quality assessment of the nail head.
[0084] The method of this application mainly includes two parts. The first part is to aim the structured light projection at the nail head to be tested, use the left and right cameras to shoot the nail head image, and identify the center and diameter of the circular spot; the second part is to determine the type of circular spot after obtaining the center and diameter of the circular spot, and then use two thresholds to segment the image respectively, and finally obtain the nail head area mask and the nail head surrounding area mask.
[0085] See attached Figure 3 , the embodiment of the present application is further described, which is an implementation method for obtaining a target circular spot:
[0086] Step 1: Aim the center of the structured light projection at the nail head to be tested, and project a circular pattern slightly larger than 2 times the diameter of the nail head onto the nail head to be tested.
[0087] Step 2: Use the left and right cameras to capture the nail head image and identify the dark circular spots in the image.
[0088] Step 3: Determine whether the number of identified dark circular spots is 0. If the number of dark circular spots is 0, identify the bright circular spots in the image; if the number of dark circular spots is not 0, determine whether the number of dark circular spots is greater than 1.
[0089] Step 4: If the number of dark spots is equal to 1, determine whether the distance from the spot to the center of the image is greater than 2 times the diameter.
[0090] Step 5: If the distance from the circular spot to the center of the image is less than 2 times the diameter, the center and diameter of the circular spot are returned. If the distance from the circular spot to the center of the image is greater than 2 times the diameter, the bright circular spot in the image is identified.
[0091] Step 6: If the number of dark spots is greater than 1, bubble sort the spots based on the distance from the center of the spot to the center of the image to obtain the spot closest to the center of the image. Then execute step 6.
[0092] Step 7, following steps 3 and 5, when identifying bright circular spots in the image, it is determined whether the number of bright circular spots identified is 0. If the number of bright circular spots is 0, the identification fails; if the number of bright circular spots is not 0, it is determined whether the number of bright circular spots is greater than 1.
[0093] Step 8: If the number of bright spots is greater than 1, sort by the distance from the center of the spot to the center of the image, get the spot closest to the center of the image, and return the center and diameter of the spot. If the number of bright spots is equal to 1, return the center and diameter of the spot.
[0094] See attached Figure 4 , the embodiment of the present application is further described as an implementation method of obtaining a mask:
[0095] Step 9: After obtaining the center and diameter of the circular spot, calculate the pixel values of the pixels whose distance to the center of the circular spot is less than 0.7 times the radius, take the average, and record it as A. Calculate the pixel values of the pixels whose distance to the center of the circular spot is greater than 1.2 times the radius and less than 1.8 times the radius, take the average, and record it as B.
[0096] Step 10, determine whether A is greater than B. If so, the circular spot is a bright circular spot. If not, the circular spot is a dark circular spot.
[0097] Step 11, when the obtained circular spot is a bright circular spot, binarization is performed with (A+B) / 2 as the threshold to obtain the nail head area mask; binarization is performed with 0.8*B as the threshold to obtain the nail head and surrounding area mask; the two masks are subtracted to obtain the nail head surrounding area mask.
[0098] Step 12. When the obtained circular spot is a dark circular spot, reverse binarization is performed with (A+B) / 2 as the threshold, and the area outside 1.5 times the circular spot diameter from the center of the circular spot is set to 0 to obtain the nail head area mask; binarization is performed with 0.8*B as the threshold to obtain the nail head surrounding area mask, and the area within 1.5 times the circular spot diameter from the center of the circular spot is set to 1; the two masks are subtracted to obtain the nail head surrounding area mask.
[0099] Step 13: Finally, output the nail head area mask and the nail head surrounding area mask.
[0100] See attached Figure 8 Based on the same inventive concept as in the above-mentioned embodiment, the embodiment of the present application further provides a nail head assembly quality assessment device, which includes:
[0101] An acquisition module, the acquisition module is used to respectively obtain the grayscale average value of the first target point and the grayscale average value of the second target point on the target image; wherein the target image is obtained based on spot projection on the target object, the measured surface of the target object has a plurality of nail heads, and the target image has a plurality of circular spots formed by the nail heads, the first target point is a point whose distance from the center of the target circular spot is less than a first threshold value, the target circular spot is a circular spot closest to the center of the target image, and the second target point is a point whose distance from the center of the target circular spot is within a second threshold range, and the lower limit of the second threshold range is greater than the first threshold value;
[0102] A binarization module, the binarization module is used to perform inverse binarization on the target image according to a first segmentation threshold to obtain a nail head area mask; wherein the first segmentation threshold is the average of the grayscale average of the first target point and the grayscale average of the second target point;
[0103] A segmentation module, the segmentation module is used to segment the target image according to a second segmentation threshold to obtain a mask of the area around the nail head; wherein the second segmentation threshold is obtained by reducing the first segmentation threshold;
[0104] The evaluation module is used to calculate the concave-convex amount according to the nail head area mask and the nail head surrounding area mask to complete the assembly quality evaluation of the nail head.
[0105] Those skilled in the art should understand that the division of the various modules in the embodiment is only a division of logical functions, and can be fully or partially integrated into one or more actual carriers in actual application, and these modules can be all implemented in the form of software called by the processing unit, or all implemented in the form of hardware, or implemented in the form of a combination of software and hardware. It should be noted that the modules in the nail head assembly quality assessment device in this embodiment correspond one-to-one to the steps in the nail head assembly quality assessment method in the aforementioned embodiment. Therefore, the specific implementation of this embodiment can refer to the implementation of the aforementioned nail head assembly quality assessment method, which will not be repeated here.
[0106] Based on the same inventive concept as in the aforementioned embodiment, an embodiment of the present application further provides a computer-readable storage medium storing a computer program. When the computer program is loaded and executed by a processor, a nail head assembly quality assessment method as provided in the embodiment of the present application is implemented.
[0107] Based on the same inventive concept as in the above-mentioned embodiment, an embodiment of the present application further provides an electronic device, including a processor and a memory, wherein:
[0108] The memory is used to store computer programs;
[0109] The processor is used to load and execute a computer program so that the electronic device executes the nail head assembly quality assessment method provided in the embodiment of the present application.
[0110] In some embodiments, the computer readable storage medium may be a memory such as FRAM, ROM, PROM, EPROM, EEPROM, flash memory, magnetic surface memory, optical disk, or CD-ROM; or various devices including one or any combination of the above memories. The computer may be various computing devices including intelligent terminals and servers.
[0111] In some embodiments, executable instructions may be in the form of a program, software, software module, script or code, written in any form of programming language (including compiled or interpreted languages, or declarative or procedural languages), and may be deployed in any form, including as a stand-alone program or as a module, component, subroutine or other unit suitable for use in a computing environment.
[0112] As an example, executable instructions may, but need not, correspond to a file in a file system, may be stored as part of a file that stores other programs or data, such as in one or more scripts in a HyperText Markup Language (HTML) document, in a single file dedicated to the program in question, or in multiple coordinated files (e.g., files storing one or more modules, subroutines, or code portions).
[0113] By way of example, executable instructions may be deployed to be executed on one computing device, or on multiple computing devices located at one site, or on multiple computing devices distributed across multiple sites and interconnected by a communication network.
[0114] It should be noted that, in this article, the terms "include", "comprises" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, article or system including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or system. In the absence of further restrictions, an element defined by the sentence "comprises a ..." does not exclude the existence of other identical elements in the process, method, article or system including the element.
[0115] The serial numbers of the above-mentioned embodiments of the present application are for description only and do not represent the advantages or disadvantages of the embodiments.
[0116] Through the description of the above implementation methods, those skilled in the art can clearly understand that the above-mentioned embodiment methods can be implemented by means of software plus a necessary general hardware platform, and of course by hardware, but in many cases the former is a better implementation method. Based on such an understanding, the technical solution of the present application, or the part that contributes to the prior art, can be embodied in the form of a software product, which is stored in a storage medium (such as a read-only memory / random access memory, a magnetic disk, or an optical disk), and includes a number of instructions for enabling a multimedia terminal device (which can be a mobile phone, a computer, a television receiver, or a network device, etc.) to execute the methods described in each embodiment of the present application.
[0117] In summary, the present application provides a method, device, storage medium and electronic device for evaluating the quality of nail head assembly, the method comprising: obtaining the grayscale average value of a first target point and the grayscale average value of a second target point on a target image respectively; wherein the target image is obtained based on spot projection on a target object, a plurality of nail heads are provided on a measured surface of the target object, and a plurality of circular spots formed by the nail heads are provided on the target image, the first target point is a point whose center distance from the target circular spot is less than a first threshold value, the target circular spot is a circular spot closest to the center of the target image, and the second target point is a point whose center distance from the target circular spot is within a second threshold range, and the lower limit of the second threshold range is greater than the first threshold value; the target image is reversely binarized according to a first segmentation threshold value to obtain a nail head area mask; wherein the first segmentation threshold value is the average of the grayscale average value of the first target point and the grayscale average value of the second target point; the target image is segmented according to a second segmentation threshold value to obtain a mask of an area around the nail head; wherein the second segmentation threshold value is obtained by reducing the first segmentation threshold value; and the concave-convex amount is calculated according to the nail head area mask and the nail head surrounding area mask to complete the evaluation of the assembly quality of the nail head.
[0118] The present application first takes the circular spot closest to the center of the image as the target circular spot, and takes the relative distance thereto as the basis. Points within the first threshold value can be ensured to be points within the nail head area, and the second threshold range can ensure that the points taken are all within the projected light spot and outside the nail head area. Obviously, the grayscale average value of the first target point is smaller than the grayscale average value of the second target point. Using the average value of the two as the threshold for reverse binarization will set the nail head area to 1, and the area around the nail head will be approximated as a plane. The segmentation is performed with a parameter smaller than the first segmentation threshold, and the area outside the light spot is set to 0 to obtain a mask of the area around the nail head. The above-mentioned means uses grayscale as a threshold for card control, which can effectively separate the nail head from the area outside the nail head, so that the mask can be used to obtain accurate point cloud data of each area, thereby improving the accuracy of the assembly quality assessment of the nail head.
[0119] The above description is only a preferred embodiment of the present application and is not intended to limit the present application. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of the present application should be included in the protection scope of the present application.
Claims
1. A method for evaluating the quality of nail head assembly. It is characterized in that The following steps are involved: The grayscale average value of the first target point and the grayscale average value of the second target point on the target image are respectively obtained; wherein the target image is obtained based on spot projection on the target object, the measured surface of the target object has a plurality of nail heads, the target image has a plurality of circular spots formed by the nail heads, the first target point is a point whose distance from the center of the target circular spot is less than a first threshold, the target circular spot is the circular spot closest to the center of the target image, the second target point is a point whose distance from the center of the target circular spot is within a second threshold range, and the lower limit of the second threshold range is greater than the first threshold; Performing inverse binarization on the target image according to a first segmentation threshold to obtain a nail head area mask; wherein the first segmentation threshold is the average of the grayscale average of the first target point and the grayscale average of the second target point; Segment the target image according to a second segmentation threshold to obtain a mask of the area around the nail head; wherein the second segmentation threshold is obtained by reducing the first segmentation threshold; The concave-convex amount is calculated based on the nail head area mask and the nail head surrounding area mask to complete the assembly quality evaluation of the nail head.
2. The nail head assembly quality assessment method according to claim 1, It is characterized in that The step of performing inverse binarization on the target image according to the first segmentation threshold to obtain a nail head area mask includes: Performing reverse binarization on the target image according to a first segmentation threshold to obtain an area set to 1 and an area set to 0; According to the area set to 1, a nail head area mask is obtained.
3. The nail head assembly quality assessment method according to claim 2, It is characterized in that After the target image is reversely binarized according to the first segmentation threshold to obtain the area set to 1 and the area set to 0, the nail head assembly quality assessment method further includes: Masking the area set to 0 to eliminate the points set to 1 in the area set to 0, and obtaining a target area set to 1; The step of obtaining a nail head area mask according to the area set to 1 includes: According to the target area set to 1, a nail head area mask is obtained.
4. The nail head assembly quality assessment method according to claim 1, It is characterized in that The step of segmenting the target image according to the second segmentation threshold to obtain a mask of the area around the nail head includes: Segmenting the target image according to a second segmentation threshold to obtain an area set to 0; According to the area set to 0, a mask of the area around the nail head is obtained.
5. The nail head assembly quality assessment method according to claim 4, It is characterized in that After segmenting the target image according to the second segmentation threshold and obtaining the area set to 0, the nail head assembly quality assessment method further includes: Perform complementary masking according to the area set to 0 to obtain a first mask; The step of obtaining a mask of an area around the nail head according to the area set to 0 includes: The mask of the nail head surrounding area is obtained by subtracting the first mask from the nail head area mask.
6. The nail head assembly quality assessment method according to claim 1, It is characterized in that Before respectively obtaining the grayscale average value of the first target point and the grayscale average value of the second target point on the target image, the nail head assembly quality assessment method further includes: According to the coordinates of the center of the circular spot and the size of the target image, obtaining distance information between a number of the circular spots and the center of the target image; The target circular spot is obtained according to the minimum value in the distance information.
7. The nail head assembly quality assessment method according to claim 1, It is characterized in that Before respectively obtaining the grayscale average value of the first target point and the grayscale average value of the second target point on the target image, the nail head assembly quality assessment method further includes: The target image is obtained according to the light spot projected onto the measured surface of the target object.
8. A nail head assembly quality assessment device, It is characterized in that include: An acquisition module, the acquisition module is used to respectively obtain the grayscale average value of a first target point and the grayscale average value of a second target point on a target image; wherein the target image is obtained based on spot projection on a target object, a measured surface of the target object has a plurality of nail heads, the target image has a plurality of circular spots formed by the nail heads, the first target point is a point whose distance from the center of the target circular spot is less than a first threshold, the target circular spot is the circular spot closest to the center of the target image, the second target point is a point whose distance from the center of the target circular spot is within a second threshold range, and the lower limit of the second threshold range is greater than the first threshold; A binarization module, the binarization module is used to perform inverse binarization on the target image according to a first segmentation threshold to obtain a nail head area mask; wherein the first segmentation threshold is the average of the grayscale average of the first target point and the grayscale average of the second target point; A segmentation module, the segmentation module is used to segment the target image according to a second segmentation threshold to obtain a mask of the area around the nail head; wherein the second segmentation threshold is obtained by reducing the first segmentation threshold; An evaluation module is used to calculate the concave-convex amount according to the nail head area mask and the nail head surrounding area mask to complete the assembly quality evaluation of the nail head.
9. A computer-readable storage medium storing a computer program, It is characterized in that When the computer program is loaded and executed by a processor, the nail head assembly quality assessment method according to any one of claims 1 to 7 is implemented.
10. An electronic device, It is characterized in that comprising a processor and a memory, wherein: The memory is used to store computer programs; The processor is used to load and execute the computer program so as to enable the electronic device to perform the nail head assembly quality assessment method according to any one of claims 1 to 7.
Citation Information
Patent Citations
Rivet size detection system based on image recognition
CN115511862A
Aircraft rivet concave-convex amount measuring method based on binocular surface structured light
CN116358449A
Device and method for checking the correct fitting of a connection organ having a head, relative to a fitting surface
US20160320175A1
