A method for detecting the smoothness of polished titanium plate based on image processing
Through image processing technology, multi-angle edge detection and evaluation index calculation are used to solve the problem of reflection texture interference on the polished surface of the titanium plate, and improve the accuracy of the smoothness detection of the polished surface of the titanium plate.
Patent Information
- Application Number
- CN202410805114.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-06-21
- Publication Date
- 2024-09-06
- Estimated Expiration
- 2044-06-21
AI Technical Summary
It is difficult to accurately eliminate the interference of the reflection texture on the polished surface of the titanium plate with the existing technology, resulting in low smoothness detection accuracy and the inability to effectively distinguish between the edge of the reflection and the edge of the polished surface of the titanium plate itself.
Using a method based on image processing, by obtaining corrected images from multiple angles, perform edge detection and segmentation, calculate the first and second evaluation indicators, and use the morphological differences and pixel value differences of edge lines to determine the probability of reflection for further optimization Edge line completion to improve discrimination accuracy.
The accuracy of the smoothness detection of the polished surface of the titanium plate is improved, and the reflection edge and the edge of the polished surface of the titanium plate itself can be distinguished more accurately, reducing the interference of reflection texture and improving the detection accuracy.
Smart Images

Figure CN118379282B
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of image processing, and more specifically, to a method for detecting the smoothness of a polished surface of a titanium plate based on image processing. Background Art
[0002] The smoothness of the polished surface of the titanium plate will affect the appearance, mechanical properties, lubrication effect, corrosion resistance and cleanliness. In order to ensure the above effects of the polished surface of the titanium plate, the smoothness of the polished surface of the titanium plate needs to be tested.
[0003] The existing patent application document CN116030058A provides a quality evaluation method for the surface roughness of a polishing pad. In this document, a texture image is obtained by removing low-frequency information in the image based on the grayscale distribution change amplitude and gradient information, and a roughness index is constructed based on the texture information in the texture image, thereby achieving roughness evaluation. However, since the titanium plate will produce a mirror effect after polishing, there will often be reflections of other objects on the polished surface of the titanium plate. To detect the smoothness of the polished surface of the titanium plate, it is necessary to obtain the texture information of the titanium plate surface itself. The texture information of the reflections of other objects on the polished surface of the titanium plate will cover or submerge the texture information of the titanium plate surface itself. Therefore, how to eliminate the interference of the reflected texture and accurately extract the own texture has become a problem to be solved.
[0004] The existing patent document CN104156727B provides a method for detecting light reflections based on monocular vision, in which the light reflection area is obtained by analyzing the grayscale value gradient from one pixel to the surrounding pixels in each area. However, the reflections in this invention include not only light reflections, but also reflections of cameras and other objects. Therefore, the technical solution in this patent document can only exclude light reflections, but cannot exclude all reflections on the polished surface of the titanium plate. Summary of the invention
[0005] In order to solve the problem of reflection texture interference in the process of detecting the smoothness of the polished surface of the titanium plate, the present invention proposes a method for detecting the smoothness of the polished surface of the titanium plate based on image processing, which comprises the following steps:
[0006] Acquire corrected images of the polished surface of the titanium plate at multiple angles, and perform edge detection processing on the corrected images to obtain corresponding corrected edge images, wherein the corrected images at each angle and the corrected edge images are segmented to obtain multiple corrected image blocks and multiple corrected edge image blocks, wherein the corrected edge image blocks contain multiple edge lines;
[0007] Calculating a first evaluation index, where the first evaluation index is negatively correlated with a first distance, where the first distance is a mean value of distances between an edge line and chain codes corresponding to edge lines in corrected edge image blocks at all other angles;
[0008] Calculate a second evaluation index; the second evaluation index is equal to the product of the pixel value deviation and the degree of morphological abnormality, wherein the difference between the mean of the pixel values of the pixels on both sides of the edge line in the corrected image block and the median of the pixel values in the corrected image is taken as the pixel value deviation, and the mean of the distances between the chain code of the edge line and the chain codes of other edge lines in the corrected edge image is taken as the degree of morphological abnormality;
[0009] The ratio of the second evaluation index to the first evaluation index is used as the reflection probability of the edge line to judge the smoothness of the polished surface of the titanium plate.
[0010] The present invention reflects the morphological difference of the edge line at different viewing angles through a first evaluation index, and the morphological difference of the edge line at different viewing angles is an important feature for distinguishing the reflected edge from the edge line of the polished surface of the titanium plate itself. Therefore, the first evaluation index is used to accurately distinguish the reflected edge line from the edge line of the polished surface of the titanium plate itself, providing a basis for accurately eliminating the influence of the reflected edge line and accurately performing smoothness detection. Considering that there may be a small number of reflected edge lines with small morphological differences at different viewing angles, the first evaluation index cannot distinguish the reflected edge line from the edge line of the polished surface of the titanium plate itself. Therefore, the second evaluation index is calculated in combination with the morphological difference between the edge lines in the same viewing angle and the pixel value difference around the edge line. The morphological difference between the edge lines in the same viewing angle and the pixel value difference around the edge line are another important feature for distinguishing the reflected edge from the edge of the polished surface of the titanium plate itself. The second evaluation index is used to further accurately distinguish the reflected edge line from the edge line of the polished surface of the titanium plate itself, thereby further improving the accuracy of smoothness detection.
[0011] Preferably, before obtaining the first evaluation index, it is necessary to complete and optimize the edge lines in the corrected edge image block, including:
[0012] Obtain a connection object of an end point of the edge line;
[0013] In response to one end point of the edge line and the connection object satisfying a connection determination condition, obtaining a connection line between one end point of the edge line and the connection object; connecting one end point of the edge line and the connection object using the connection line to obtain a temporary edge line, and performing connection completion processing on the other end point of the temporary edge line to obtain a completed edge line;
[0014] In response to one endpoint of the edge line and the connection object not satisfying a connection determination condition, a connection completion process is performed on the other endpoint of the temporary edge line to obtain a completed edge line.
[0015] The present invention can prevent the problem of reduced similarity of corresponding edge lines at different angles due to missing edge lines by optimizing and completing edge lines, thereby eliminating the influence of missing edge lines on the judgment of whether each edge line conforms to the reflected texture, thereby improving the distinction accuracy between the reflected texture and the texture of the polished surface of the titanium plate itself.
[0016] Preferably, the connection object of one end point of the edge line is a preferred connection object, and a method for obtaining the preferred connection object includes:
[0017] Calculating the connection possibility between an endpoint of the edge line and a reference edge line; the reference edge line is an edge line corresponding to a preset number of endpoints closest to the endpoint of the edge line;
[0018] The reference edge line corresponding to the maximum connection possibility is used as the preferred connection object of one end point of the edge line.
[0019] Preferably, the formula for calculating the connection possibility between an end point of the edge line and the reference edge line is:
[0020] ;
[0021] in, Indicates the mark value of the connection line between one end point of an edge line and the i-th reference edge line at the j-th other angle. Indicates the similarity between the edge line and the i-th reference edge line at the j-th other angle, Indicates the number of angles collected from the polished surface of the titanium plate. represents the connection possibility between one end point of the edge line and the i-th reference edge line, and norm[ ] represents the linear normalization function.
[0022] The present invention reflects the possibility that each reference edge line is the remaining residual part of an edge line by analyzing the connection possibility, in other words, the possibility that each reference edge line is the connection object of an edge line, thereby finding the accurate connection object for the edge line and providing a basis for accurate edge line repair.
[0023] Preferably, the method for obtaining the connection line mark value includes:
[0024] The position of any corrected edge image block at any angle is recorded as the target position, and the edge line between one end point of an edge line and the end point of a reference edge line in the corrected edge image block at the target position of other angles is obtained and recorded as a feasible connecting line between the end point of the edge line and the reference edge line at other angles; when there is a feasible connecting line between the end point of the edge line and the reference edge line at another angle, the connecting line mark value between the end point of the edge line and the reference edge line at another angle is set to 1; when there is no feasible connecting line between the end point of the edge line and the reference edge line at another angle, the connecting line mark value between the end point of the edge line and the reference edge line at another angle is set to 0.
[0025] By obtaining the connection line mark value, the present invention can reflect the existence of an edge line in images at other angles at the pixel position between an edge line and a reference edge line, and further reflect whether the reference edge line is the other residual part of the edge line, providing a basis for selecting a connection object for the edge line.
[0026] Preferably, the method for obtaining the similarity includes:
[0027] In the corrected edge image block of the target position at other angles, the edge line with the most pixel positions intersecting with an edge line is obtained and recorded as the corresponding edge line of the edge line at other angles. The DTW distance between the chain code of the edge line and the chain code of the corresponding edge line at other angles is added by one and then the reciprocal is taken to obtain the similarity of the edge line at other angles, the similarity of the reference edge line of the edge line at other angles is obtained, and the average of the similarity of the edge line at other angles and the similarity of the reference edge line of the edge line at other angles is taken as the similarity of the edge line and the reference edge line at other angles.
[0028] Preferably, the connection determination condition is a preferred connection determination condition, and the preferred connection determination condition is that the connection possibility is greater than a preset possibility threshold.
[0029] Preferably, a connection line between an end point of the edge line and the connection object is a preferred connection line. The method for obtaining the preferred connection line comprises the steps of:
[0030] The angle corresponding to when the connection line mark value of one endpoint of the edge line and the connection object is equal to 1 is used as the reference angle of the endpoint of the edge line, and the angle corresponding to the maximum similarity between the edge line and the connection object is obtained among all reference angles as the preferred angle between the endpoint of the edge line and the connection object, and the feasible connection line between the endpoint of the edge line and the connection object at the preferred angle is used as the preferred connection line between the endpoint of the edge line and the connection object.
[0031] The present invention can obtain a relatively fitting defective portion between an edge line and a connection object by obtaining a preferred connection line, thus laying a foundation for accurately repairing the edge line.
[0032] Preferably, the method for acquiring pixels on both sides of the edge line comprises the steps of:
[0033] Starting from an edge point of an edge line, draw a first direction perpendicular line and a second direction perpendicular line to the edge line; obtain the edge point closest to the edge point on the first direction perpendicular line, record it as the first blocked edge point, when the distance between the first blocked edge point and the edge point is less than or equal to the preset truncation length, take the pixel points between the first blocked edge point and the edge point on the first direction perpendicular line as the first research pixel point; when the distance between the first blocked edge point and the edge point is greater than the preset truncation length, take the continuous preset truncation length pixel points on the first direction perpendicular line starting from the edge point as the first research pixel point; obtain the second research pixel point of the edge point according to the second direction perpendicular line; the first research pixel point and the second research pixel point are the pixels on both sides of the edge line.
[0034] The present invention has the following beneficial effects:
[0035] Compared with the traditional reflection detection method, the present invention uses the similarity calculation of the same edge line at different angles when analyzing the difference between the texture of the reflected object and the texture of the polished surface of the titanium plate itself, so as to more accurately distinguish the textures of various types of reflected objects and the textures of the polished surface of the titanium plate itself, thereby providing a basis for subsequent accurate smoothness analysis.
[0036] Furthermore, when the present invention calculates and analyzes the similarity of the same edge line at different angles, it will be disturbed by the missing edge line. Therefore, before calculating the similarity of the same edge line at different angles, each edge line is repaired with reference to the edge lines at the same position at other angles, thereby eliminating the effect of the missing edge line on the similarity of the same edge line at different angles, thereby improving the accuracy of distinguishing the texture of the reflected object and the texture of the polished surface of the titanium plate itself.
[0037] Furthermore, when repairing each edge line with reference to the edge lines at the same position at other angles, the present invention analyzes the connection possibility between the edge line and several nearest edge lines, screens out the preferred connection objects, and accurately screens out other residual objects corresponding to each edge line, thereby providing a basis for subsequent accurate edge line repair.
[0038] Furthermore, when repairing each edge line with reference to the edge lines at the same position at other angles, the present invention analyzes the similarity between the edge line and the connection object, and the edge lines at the same position at other angles, and selects the preferred connection line between the edge line and the connection object based on the similarity, thereby providing a basis for subsequent accurate edge line repair.
[0039] Furthermore, the present invention further distinguishes the textures of various reflected objects and the texture of the polished surface of the titanium plate itself according to the difference between the pixel values of the pixel points around each edge line and the pixel values of the entire image, as well as the morphological difference between each edge line and other edge lines at the same angle, thereby improving the accuracy of distinguishing the texture of the reflected objects and the texture of the polished surface of the titanium plate itself, and providing a basis for subsequent accurate smoothness analysis. BRIEF DESCRIPTION OF THE DRAWINGS
[0040] By reading the following detailed description with reference to the accompanying drawings, the above and other objects, features and advantages of the exemplary embodiments of the present invention will become readily understood. In the accompanying drawings, several embodiments of the present invention are shown in an exemplary and non-limiting manner, and the same or corresponding reference numerals represent the same or corresponding parts, wherein:
[0041] Figure 1 This is a flowchart of a method for detecting the smoothness of a polished surface of a titanium plate based on image processing according to an embodiment of the present invention;
[0042] Figure 2 Schematic diagram of the position of the camera provided in the embodiment of the present invention when collecting images of the polished surface of the titanium plate at multiple angles;
[0043] Figure 3 is an image of one angle of the polished surface of the titanium plate provided by an embodiment of the present invention;
[0044] Figure 4 This is an image of the polished surface of the titanium plate provided by an embodiment of the present invention from another angle. DETAILED DESCRIPTION
[0045] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative work are within the scope of protection of the present invention.
[0046] The specific embodiments of the present invention are described in detail below with reference to the accompanying drawings.
[0047] See also Figure 1 , which shows a flow chart of a method for detecting the smoothness of a polished surface of a titanium plate based on image processing provided by an embodiment of the present invention, the method comprising the following steps:
[0048] S1. Obtain corrected images and corrected edge images at multiple angles of the polished surface of the titanium plate, divide the corrected images at each angle of the polished surface of the titanium plate into a number of corrected image blocks, and divide the corrected edge images at each angle of the polished surface of the titanium plate into a number of corrected edge image blocks.
[0049] S10. Acquire images of the polished surface of the titanium plate at various angles.
[0050] Optionally, as an example, the method for acquiring images of the polished surface of the titanium plate at various angles includes: Figure 2 As shown, Figure 2 The figure shows the position diagram of the camera when collecting images of the polished surface of the titanium plate from multiple angles. A circular slide is set just above the polished surface of the titanium plate and at a distance of H cm from the polished surface of the titanium plate. The industrial camera is moved on the circular slide. The image of the polished surface of the titanium plate is collected once, and images of each angle of the polished surface of the titanium plate are obtained. Where H is the preset height, represents the preset angle interval. In this embodiment, H is set to 10. 5 is used for description, and other embodiments may take other values, and this embodiment does not make any specific limitation. Figure 3 An image showing one angle of the polished surface of a titanium plate. Figure 4 An image showing another angle of the polished surface of the titanium plate.
[0051] S11. Obtain corrected images at various angles of the polished surface of the titanium plate based on the images at various angles of the polished surface of the titanium plate, and obtain corrected edge images at various angles of the polished surface of the titanium plate based on the corrected images at various angles of the polished surface of the titanium plate.
[0052] It should be noted that, due to the difference in the reflected objects on the image of the polished surface of the titanium plate collected at different viewing angles, the difference in the reflected objects on the image of the polished surface of the titanium plate collected at different viewing angles is mainly related to factors such as the position of the light source and visual differences. That is to say, the change in the acquisition viewing angle will cause the relative position of the camera position and the light source position to change, so that the light reflected from the polished surface of the titanium plate to the camera will change, and the reflected object is due to the light of the real object projected onto the polished surface of the titanium plate, and enters the camera through reflection, so that the reflected object on the polished surface of the titanium plate collected by the camera is obtained. Therefore, the change in the light reflected from the polished surface of the titanium plate to the camera will cause the reflected objects on the image of the polished surface of the titanium plate collected at different viewing angles to be different. This change is not just a difference in viewing angle, and this difference cannot be removed by visual correction. There will also be differences in the texture of the polished surface of the titanium plate collected at different angles, and this difference is only a difference in viewing angle, which can be removed by visual correction. Therefore, the situation of each texture being a reflection can be determined by analyzing the texture difference after viewing angle correction at different viewing angles. Therefore, visual correction is required first.
[0053] Optionally, as an example, the method for acquiring the corrected images of the polished surface of the titanium plate at various angles includes: taking the center of the polished surface of the titanium plate as the coordinate origin, taking the direction of the long side of the polished surface of the titanium plate as the x-axis, taking the direction of the wide side of the polished surface of the titanium plate as the y-axis, and taking the direction perpendicular to the polished surface of the titanium plate as the z-axis as the world coordinate system. Figure 2 As shown, the coordinates of each image acquisition point on the circular slide are obtained in the world coordinate system, which are recorded as the world coordinates of each image acquisition point. The angle between the optical axis of the camera and z is obtained, which is recorded as the shooting angle; any angle is used as the reference angle, and the images of the polished surface of the titanium plate at each angle are transformed by the existing perspective transformation method according to the world coordinates of the image acquisition point corresponding to the polished surface image of the titanium plate at each angle, the shooting angle and the camera parameters, and the images of the polished surface of the titanium plate at each angle are transformed to the reference angle to obtain the corrected images of the polished surface of the titanium plate at each angle.
[0054] Optionally, as an example, the method for acquiring edge images at various angles of the polished surface of the titanium plate includes: using a Canny algorithm to perform edge detection processing on the corrected images at various angles of the polished surface of the titanium plate to obtain corrected edge images at various angles of the polished surface of the titanium plate.
[0055] S12. Divide the corrected image into a number of corrected image blocks, and divide the corrected edge image into a number of corrected edge image blocks.
[0056] It should be noted that, due to the change in the relative position of the camera and the polished surface of the titanium plate, and the change in the position of the camera and the reflected object, the position of the reflected area in the corrected images of the polished surface of the titanium plate at different angles will change. Therefore, it is possible to select image areas with better quality (areas without reflection or areas with less reflection) from the corrected images of each angle of the polished surface of the titanium plate, and then stitch together the image areas with better quality selected from the corrected images of all angles of the polished surface of the titanium plate to obtain a better image of the polished surface of the titanium plate. This eliminates the interference of the texture of the reflected object in the polished surface of the titanium plate and achieves accurate smoothness detection. Therefore, image segmentation is required first.
[0057] Optionally, as an example, the method for obtaining the corrected image blocks at each angle and the corrected edge image blocks at each angle includes: evenly dividing the corrected image at each angle into N image blocks, which are recorded as the corrected image blocks at each angle. Evenly dividing the corrected edge image at each angle into N image blocks, which are recorded as the corrected edge image blocks at each angle, N represents the preset number of blocks, and this embodiment is described by taking N as 64 as an example, and other embodiments may take other values, which are not specifically limited in this embodiment.
[0058] S2. Obtain edge lines in the corrected edge image blocks at each angle.
[0059] Optionally, as an example, the method for acquiring edge lines in the corrected edge image blocks at each angle includes: directly acquiring edge lines in the corrected edge image blocks at each angle.
[0060] It should be noted that the perspective correction has eliminated the perspective difference in the above process. Generally, the difference of the self-texture under different perspectives should be eliminated, so the difference of the self-texture under different perspectives should be small. The texture difference of the reflected object under different perspectives cannot be eliminated through perspective correction, so the texture difference of the reflected object under different perspectives should be large. Therefore, the difference of the same texture under different perspectives can be analyzed to determine whether each texture is a reflection.
[0061] It needs to be further explained that due to the differences in light conditions at different viewing angles, the display quality of the same texture at different viewing angles is different. For example, a texture has a higher display quality in an image at one viewing angle, and the edge line corresponding to this texture is a complete edge line connected together. However, the display quality of the texture in an image at another viewing angle is poor, and the edge line corresponding to the texture is not connected in the middle, but is divided into several small edge lines. At this time, although they are edge lines of the same texture at two viewing angles, the difference between the same edge lines at different viewing angles is still large. It is easy to misjudge the texture itself as the texture of the reflected object. This affects the accuracy of smoothness detection. Therefore, it is necessary to refer to the edge lines at other angles to complete the edge lines.
[0062] Preferably, as an example, after the edge lines in the corrected edge image blocks at each angle are complemented and optimized, the edge lines in the corrected edge image blocks at each angle are obtained; the edge lines in the corrected edge image blocks at each angle are complemented and optimized, including steps S20-S21.
[0063] It should be noted that in order to complete and optimize each edge line, it is necessary to obtain other residual parts of each edge line. In this embodiment, the other residual parts of each edge line are described by connecting objects.
[0064] S20. Obtain a connection object of one end point of the edge line.
[0065] Optionally, as an example, the method for obtaining the connection object of an endpoint of the edge line includes: taking an edge line corresponding to an endpoint of another edge line closest to an endpoint of the edge line as the connection object of the edge line.
[0066] It should be noted that since there may be multiple edge lines around an edge line, sometimes the nearest edge line is not the other incomplete parts of the edge line, and other closer edge lines may be other residual parts of the edge line. Therefore, it is necessary to screen out which one is the connection object of the edge line among the closer edge lines.
[0067] It should be further explained that, since the image quality in some angles is good and relatively complete edge lines can be retained, the image quality in some angles is poor and a complete edge line is divided into multiple parts. Therefore, the edge lines in images at other angles can be referenced to screen which edge line is the connection object of the edge line. Any edge line is called a target edge line. When an edge line is the connection object of the target edge line, there is an edge line in the image at other angles at the pixel position between the target edge line and the edge line. Therefore, it can be determined whether the edge line is the connection object of the target edge line based on the existence of an edge line in the image at other angles at the pixel position between the target edge line and the edge line. Due to the interference of the reflected texture, the edge line at the same position of the target edge line and the edge line in the image at other angles may be a reflected texture rather than a self-texture, resulting in the existence of an edge line in the image at other angles at the position between the target edge line and the edge line, but it is not the self-edge line of the polished surface of the titanium plate, and the edge line of this angle cannot be referenced. Since the reflected textures at different angles are different, and the differences of the own textures at different angles are small, the interference of the reflected texture on the edge line repair can be eliminated by analyzing the similarity between the target edge line and the edge line and the edge lines at the same position at other angles.
[0068] Preferably, as an example, the connection object of one end point of the edge line is the preferred connection object, and the method for obtaining the preferred connection object includes S200-S202.
[0069] S200. Obtain a reference edge line of one end point of the edge line.
[0070] Preferably, as an example, a method for obtaining a reference edge line of an end point of the edge line includes:
[0071] Get the endpoints of S other edge lines closest to an endpoint of an edge line, record them as the reference endpoint of the endpoint of the edge line, and use the edge line corresponding to the reference endpoint of the endpoint of the edge line as the reference edge line of the endpoint of the edge line. S represents a preset number. This embodiment is described by taking S as 3 as an example. Other embodiments may take other values, and this embodiment does not make specific limitations.
[0072] S201. Calculate the connection possibility between an end point of an edge line and a reference edge line.
[0073] Preferably, as an example, the method for obtaining the connection possibility between an end point of the edge line and the reference edge line includes:
[0074] First, the connection line mark values of the edge line and the reference edge line at other angles are obtained.
[0075] The position of any corrected edge image block at any angle is recorded as the target position, and the edge line between one end point of an edge line and the end point of a reference edge line in the corrected edge image block at the target position of other angles is obtained and recorded as a feasible connecting line between the end point of the edge line and the reference edge line at other angles; when there is a feasible connecting line between the end point of the edge line and the reference edge line at another angle, the connecting line mark value between the end point of the edge line and the reference edge line at another angle is set to 1; when there is no feasible connecting line between the end point of the edge line and the reference edge line at another angle, the connecting line mark value between the end point of the edge line and the reference edge line at another angle is set to 0.
[0076] It should be noted that the connection line mark value is used to reflect the position between the edge line and the reference edge line in an image at one angle, and the presence of the edge line in images at other angles.
[0077] Then, the similarity between the edge line and the reference edge line at other angles is calculated.
[0078] In the corrected edge image block of the target position at other angles, the edge line with the most pixel positions intersecting with an edge line is obtained and recorded as the corresponding edge line of the edge line at other angles. The DTW distance between the chain code of the edge line and the chain code of the corresponding edge line at other angles is added by one and then the reciprocal is taken to obtain the similarity of the edge line at other angles, the similarity of the reference edge line of the edge line at other angles is obtained, and the average of the similarity of the edge line at other angles and the similarity of the reference edge line of the edge line at other angles is taken as the similarity of the edge line and the reference edge line at other angles.
[0079] Specifically, when the pixel position intersections of all edge lines of the corrected edge image block at the same position at other angles and an edge line at one angle are empty, the similarity of the edge line at other angles is set to 0.
[0080] It should be noted that similarity is used to reflect the similarity between an edge line in an image at one angle and edge lines at the same position at other angles. Because only when edge lines at the same position at other angles are similar to it, can it be determined that the edge line and edge lines at the same position at other angles are the same edge line, rather than the interference edge line of the reflected object, so that it can be complemented by referring to edge lines at other angles.
[0081] Finally, the connection possibility between the edge line and the reference edge line is calculated according to the similarity between the edge line and the reference edge line at other angles and the connection line mark value.
[0082] ;
[0083] in, Indicates the connection line mark value between one end point of an edge line and the i-th reference edge line at the j-th other angle. This value can reflect the pixel position between one end point of the edge line and the i-th reference edge line, and the existence of the edge line in the image at the j-th other angle. Indicates the similarity between the edge line and the i-th reference edge line at the j-th other angle. The larger the value, the greater the similarity between the edge line and the corresponding edge line at the j-th other angle. Therefore, the possibility that the edge line and the corresponding edge line at the j-th other angle are the same edge line is greater. When the i-th reference edge line of the edge line and the corresponding edge at the j-th other angle describe the same texture edge line, there is a high possibility that there is no interruption between the corresponding edge line of the edge line at the j-th other angle and the corresponding edge line of the i-th reference edge line. Therefore, there may be a phenomenon of texture pixel loss caused by poor image quality between the edge line and the i-th reference edge line. Therefore, it is necessary to use edge lines in other images to supplement it. Indicates the number of angles at which the rectified image of the polished surface of the titanium plate is collected. represents the connection possibility between one end point of the edge line and the i-th reference edge line, norm[ ] represents the linear normalization function, through It can reflect the situation that an endpoint of the edge line needs to be connected and supplemented with the i-th reference edge line.
[0084] S202. Obtain a preferred connection object according to the connection possibility.
[0085] Preferably, as an example, the reference edge line corresponding to the maximum connection possibility is used as the preferred connection object of one end point of the edge line.
[0086] S21. In response to one end point of the edge line and the connection object satisfying a connection determination condition, obtaining a connection line between one end point of the edge line and the connection object, connecting one end point of the edge line and the connection object using the connection line to obtain a temporary edge line, and performing connection completion processing on the other end point of the temporary edge line to obtain a completed edge line. In response to one end point of the edge line and the connection object not satisfying a connection determination condition, performing connection completion processing on the other end point of the temporary edge line to obtain a completed edge line.
[0087] It should be noted that, after obtaining the connection object in the previous step, a connection line is still needed to connect the edge line and the connection object to achieve edge line repair. Therefore, the connection line between the edge line and the connection object needs to be obtained below.
[0088] Optionally, as an example, in response to an endpoint of the edge line and the connection object satisfying a connection determination condition, obtaining a connection line between the endpoint of the edge line and the connection object includes:
[0089] The connection determination condition is set as follows: a feasible connection line exists between an end point of an edge line and a connection object at another angle.
[0090] A feasible connection line between an end point of an edge line and a connection object at any other angle is used as a connection line between the end point of the edge line and the connection object.
[0091] It should be noted that since the feasible connection line at any angle may be the interference edge line of the reflected object, the accuracy of repairing the edge line of the self-texture of the polished surface of the titanium plate by using the interference edge line of the reflected object is poor.
[0092] Preferably, as an example, in response to an endpoint of the edge line and the connection object satisfying a connection determination condition, obtaining a connection line between the endpoint of the edge line and the connection object includes:
[0093] First, set the connection determination conditions.
[0094] The connection determination condition is a preferred connection determination condition, and the preferred connection determination condition is set as follows: the connection determination condition is set as the connection possibility is greater than a preset possibility threshold Y1. This embodiment is described by taking Y1 as 0.6 as an example, and other embodiments may take other values, which are not specifically limited in this embodiment.
[0095] Then, a connection line between an end point of the edge line and the connection object is obtained.
[0096] A connection line between an end point of the edge line and the connection object is a preferred connection line. A method for obtaining the preferred connection line includes:
[0097] The angle between one endpoint of an edge line and the connection object when the connection line mark value is equal to 1 is used as the reference angle of the endpoint of the edge line, and the angle corresponding to the maximum similarity between the edge line and the connection object is obtained among all reference angles as the preferred angle between the endpoint of the edge line and the connection object, and the feasible connection line between the endpoint of the edge line and the connection object at the preferred angle is used as the preferred connection line between the endpoint of the edge line and the connection object.
[0098] S3. Calculate a first evaluation index.
[0099] It should be noted that, since the edge lines of the reflected objects at different angles are greatly different, the edge lines of the texture of the polished surface of the titanium plate at different angles are less different, and therefore the first evaluation index can be calculated based on this.
[0100] Preferably, as an example, the method for obtaining the first evaluation index of the edge line includes:
[0101] Obtain the corresponding edge lines of the edge line at other angles; add one to the dtw distance between the chain code of the edge line and the chain code of the corresponding edge line at other angles and take the reciprocal as the similarity of the edge line at other angles; and take the average of the similarities of the edge line at all other angles as the first evaluation index of the edge line.
[0102] Specifically, when the pixel position intersections of all edge lines of the corrected edge image block at the same position at other angles and an edge line at one angle are empty, the similarity of the edge line at other angles is set to 0.
[0103] It should be noted that the first evaluation index is used to reflect the similarity of edge lines at the same position at different angles. The larger the value, the more likely the edge line is the edge line of the texture of the polished surface of the titanium plate itself, and the less likely it is the edge line of a reflected object.
[0104] S4. Calculate a second evaluation index.
[0105] It should be noted that, in order to prevent the reflection texture from being too different at different angles, resulting in the inability to accurately distinguish the reflection texture from the texture of the polished surface of the titanium steel plate itself. The reflection texture and the texture of the polished surface of the titanium steel plate itself need to be distinguished based on other differences between the reflection texture and the texture of the polished surface of the titanium steel plate itself. The second evaluation index is used to reflect the evaluation index.
[0106] It should be noted that, generally, there is a certain difference between the color of the reflected object and the color of the polished surface of the titanium steel plate, and there is a certain difference between the shape of the reflected object and the texture of the polished surface of the titanium steel plate itself. Therefore, the second evaluation index can be obtained by the difference between the pixel value and the overall pixel value in the area on both sides of each edge line in the corrected image block at each angle, as well as the difference in shape between each edge line in the corrected image block at each angle and other edge lines in the image of the polished surface of the titanium steel plate at that angle.
[0107] Preferably, as an example, the method for calculating the second evaluation index includes steps S40-S42.
[0108] S40. Obtain the pixel value deviation of the edge line.
[0109] First, get the pixels on both sides of the edge line.
[0110] Optionally, as an example, a method for acquiring pixels on both sides of an edge line includes:
[0111] The pixels that are not on the edge line within the 8-neighborhood of a pixel on the edge line are regarded as the two side pixels of the pixel on the edge line, and the two side pixels of all pixels on the edge line are regarded as the two side pixels of the edge line.
[0112] It should be noted that, since the number of pixels on both sides obtained by the above method is small, the analysis result based on the pixel values of a small number of pixels is not accurate enough, so more pixels need to be expanded.
[0113] Preferably, as an example, a method for obtaining pixel points on both sides of an edge line includes: starting from an edge point of an edge line, making a first direction perpendicular line and a second direction perpendicular line perpendicular to the edge line; obtaining the edge point closest to the edge point on the first direction perpendicular line, recorded as the first blocking edge point, when the distance between the first blocking edge point and the edge point is less than or equal to the preset truncation length Q, taking the pixel points between the first blocking edge point and the edge point on the first direction perpendicular line as the first research pixel point; when the distance between the first blocking edge point and the edge point is greater than the preset truncation length Q, taking the continuous preset truncation length Q pixel points on the first direction perpendicular line starting from the edge point as the first research pixel point; obtaining the second research pixel point of the edge point according to the second direction perpendicular line; the first research pixel point and the second research pixel point are the pixels on both sides of the edge line. This embodiment is described by taking Q as 10 as an example, and other embodiments may take other values, which are not specifically limited in this embodiment.
[0114] Then, the pixel value deviation of the edge line is calculated.
[0115] Preferably, as an example, the method for obtaining the pixel value deviation includes:
[0116] The difference between the mean pixel value of pixels on both sides of the edge line in the corrected images at all angles and the median pixel value of all pixels in the corrected images at the angle where the edge line is located is taken as the pixel value deviation.
[0117] It should be noted that, since the collected image is an RGB three-channel image, a pixel has a pixel value in each channel image, and the average pixel value of the pixel in all channel images is taken as the pixel value of the pixel.
[0118] It should be further explained that the pixel value deviation is used to reflect the difference between the color around each edge line and the overall color of the image. The greater the difference between the color around the edge line and the overall color of the image, the greater the possibility that the edge line is a texture edge line of a reflected object.
[0119] S41. Obtain the degree of morphological abnormality of the edge line.
[0120] Preferably, as an example, a method for obtaining the degree of morphological abnormality of the edge line includes:
[0121] The dtw distance between the chain code of the edge line and the chain codes of other edge lines in the corrected edge image at the angle where the edge line is located is taken as the morphological difference between the edge line and other edge lines, and the mean of the morphological differences between the edge line and all other edge lines is taken as the morphological abnormality degree of the edge line.
[0122] It should be noted that the DTW distance is calculated using the Dynamic Time Warping algorithm (DTW algorithm for short).
[0123] It should be noted that the degree of morphological abnormality is used to reflect the morphological difference between an edge line and other edge lines in the same image. The larger the value, the greater the possibility that the edge line is a texture edge line of a reflected object.
[0124] S42. The product of the pixel value deviation and the degree of morphological abnormality of the edge line is used as the second evaluation index of the edge line.
[0125] S5. Obtain the reflection probability of the edge line according to the second evaluation index and the first evaluation index.
[0126] Optionally, as an example, the method for obtaining the reflection probability of an edge line includes: taking the ratio of the second evaluation index to the first evaluation index as the reflection probability of the edge line.
[0127] S6. Obtain an optimized edge image and an optimized image of the polished surface of the titanium plate according to the reflection probability.
[0128] It should be noted that in order to reduce the interference of the texture of the reflected object on the smoothness detection, it is necessary to select a region with better quality in the image at each angle, and stitch the regions with better quality selected from the images at all angles into a complete image with better quality.
[0129] Optionally, as an example, the optimized edge image of the polished surface of a titanium plate and the method for acquiring the optimized image include: taking the inverse of the reflection probability mean of all edge lines in a corrected edge image block as the preference degree of the corrected edge image block.
[0130] The corrected edge image block corresponding to the maximum preferred degree is obtained from the corrected edge image blocks at the target position at all angles as the preferred edge image block at the target position, and the corrected image block corresponding to the preferred edge image block at the target position is used as the preferred image block at the target position.
[0131] The image composed of the preferred edge image blocks at all positions is used as the optimized edge image of the polished surface of the titanium plate. The image composed of the preferred image blocks at all positions is used as the optimized image of the polished surface of the titanium plate.
[0132] S7. Obtain the smoothness of the polished surface of the titanium plate according to the optimized edge image and the optimized image.
[0133] Optionally, as an example, a method for obtaining the smoothness of a polished surface of a titanium plate includes: obtaining the distance between an edge point on an edge line and the nearest edge point in the horizontal direction of the optimized edge image, recorded as the lateral interval of the edge point on the edge line, and obtaining the distance between the edge point on the edge line and the nearest edge point in the vertical direction of the optimized edge image as the longitudinal interval of the edge point on the edge line. The average of the lateral interval and the longitudinal interval of the edge point on the edge line is used as the comprehensive interval of the edge point on the edge line. The average of the comprehensive intervals of all edge points on the edge line is used as the comprehensive interval of the edge line. The inverse of the average of the comprehensive intervals of all edge lines in the optimized edge image is used as the texture density.
[0134] The average of the gradient values of all edge points on the edge line in the optimized edge image is used as the texture depth of the edge line in the optimized edge image. The average of the texture depths of all edge lines in the optimized edge image is used as the comprehensive texture depth.
[0135] The reciprocal of the product of texture density and comprehensive texture depth is taken as the smoothness of the polished surface of the titanium plate.
[0136] At this point, this embodiment is completed.
[0137] The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. Any modifications, equivalent substitutions, improvements, etc. made within the principles of the present invention should be included in the protection scope of the present invention.
Claims
1. A method for detecting the smoothness of a polished titanium plate based on image processing, characterized in that: include: Acquire corrected images of the polished surface of the titanium plate at multiple angles, and perform edge detection processing on the corrected images to obtain corresponding corrected edge images, wherein the corrected images at each angle and the corrected edge images are segmented to obtain multiple corrected image blocks and multiple corrected edge image blocks, wherein the corrected edge image blocks contain multiple edge lines; Calculate a first evaluation index, the first evaluation index is negatively correlated with a first distance, the first distance being the average of the distances between the edge line and the chain codes of the corresponding edge lines in the corrected edge image blocks at all other angles; obtain the corresponding edge lines of the edge line at other angles; add one to the dtw distance between the chain code of the edge line and the chain code of the corresponding edge lines at other angles and take the reciprocal as the similarity of the edge line at other angles; take the average of the similarities of the edge line at all other angles as the first evaluation index of the edge line, That is, the first distance is the same as the dtw distance; Calculate a second evaluation index; the second evaluation index is equal to the product of the pixel value deviation and the degree of morphological abnormality, wherein the difference between the mean of the pixel values of the pixels on both sides of the edge line in the corrected image block and the median of the pixel values in the corrected image is taken as the pixel value deviation, and the mean of the distances between the chain code of the edge line and the chain codes of other edge lines in the corrected edge image is taken as the degree of morphological abnormality; Using the ratio of the second evaluation index to the first evaluation index as the reflection probability of the edge line to judge the smoothness of the polished surface of the titanium plate; Before obtaining the first evaluation index, it is necessary to complete and optimize the edge lines in the corrected edge image block, including: Obtain a connection object of an end point of the edge line; In response to one end point of the edge line and the connection object satisfying a connection determination condition, obtaining a connection line between one end point of the edge line and the connection object; connecting one end point of the edge line and the connection object using the connection line to obtain a temporary edge line, and performing connection completion processing on the other end point of the temporary edge line to obtain a completed edge line; In response to one endpoint of the edge line and the connection object not satisfying a connection determination condition, a connection completion process is performed on the other endpoint of the temporary edge line to obtain a completed edge line.
2. The method for detecting the smoothness of the polished surface of a titanium plate based on image processing according to claim 1 is characterized in that: The connection object of one end point of the edge line is a preferred connection object, and a method for obtaining the preferred connection object includes: Calculating the connection possibility between an endpoint of the edge line and a reference edge line; the reference edge line is an edge line corresponding to a preset number of endpoints closest to the endpoint of the edge line; The reference edge line corresponding to the maximum connection possibility is used as the preferred connection object of one end point of the edge line.
3. The method for detecting the smoothness of the polished surface of a titanium plate based on image processing according to claim 2 is characterized in that: The formula for calculating the connection possibility between an end point of the edge line and the reference edge line is: ; in, Indicates the mark value of the connection line between one end point of an edge line and the i-th reference edge line at the j-th other angle. Indicates the similarity between the edge line and the i-th reference edge line at the j-th other angle, Indicates the number of angles collected from the polished surface of the titanium plate. represents the connection possibility between one end point of the edge line and the i-th reference edge line, and norm[ ] represents the linear normalization function.
4. A method for detecting the smoothness of a polished titanium plate based on image processing according to claim 3, characterized in that: The method for obtaining the connection line mark value includes: The position of any corrected edge image block at any angle is recorded as the target position, and the edge line between one end point of an edge line and the end point of a reference edge line in the corrected edge image block at the target position of other angles is obtained and recorded as a feasible connecting line between the end point of the edge line and the reference edge line at other angles; when there is a feasible connecting line between the end point of the edge line and the reference edge line at another angle, the connecting line mark value between the end point of the edge line and the reference edge line at another angle is set to 1; when there is no feasible connecting line between the end point of the edge line and the reference edge line at another angle, the connecting line mark value between the end point of the edge line and the reference edge line at another angle is set to 0.
5. The method for detecting the smoothness of the polished surface of a titanium plate based on image processing according to claim 4 is characterized in that: The method for obtaining the similarity includes: In the corrected edge image block of the target position at other angles, the edge line with the most pixel positions intersecting with an edge line is obtained and recorded as the corresponding edge line of the edge line at other angles. The DTW distance between the chain code of the edge line and the chain code of the corresponding edge line at other angles is added by one and then the reciprocal is taken to obtain the similarity of the edge line at other angles, the similarity of the reference edge line of the edge line at other angles is obtained, and the average of the similarity of the edge line at other angles and the similarity of the reference edge line of the edge line at other angles is taken as the similarity of the edge line and the reference edge line at other angles.
6. The method for detecting the smoothness of the polished surface of a titanium plate based on image processing according to claim 1, characterized in that: The connection determination condition is a preferred connection determination condition, and the preferred connection determination condition is that the connection possibility is greater than a preset possibility threshold.
7. The method for detecting the smoothness of the polished surface of a titanium plate based on image processing according to claim 4 is characterized in that: The connecting line between one end point of the edge line and the connecting object is a preferred connecting line. The method for obtaining the preferred connecting line comprises the steps of: The angle corresponding to when the connection line mark value of one endpoint of the edge line and the connection object is equal to 1 is used as the reference angle of the endpoint of the edge line, and the angle corresponding to the maximum similarity between the edge line and the connection object is obtained among all reference angles as the preferred angle between the endpoint of the edge line and the connection object, and the feasible connection line between the endpoint of the edge line and the connection object at the preferred angle is used as the preferred connection line between the endpoint of the edge line and the connection object.
8. The method for detecting the smoothness of the polished surface of a titanium plate based on image processing according to claim 1, characterized in that: The method for acquiring pixels on both sides of the edge line comprises the steps of: Starting from an edge point of an edge line, draw a first direction perpendicular line and a second direction perpendicular line to the edge line; obtain the edge point closest to the edge point on the first direction perpendicular line, record it as the first blocked edge point, when the distance between the first blocked edge point and the edge point is less than or equal to the preset truncation length, take the pixel points between the first blocked edge point and the edge point on the first direction perpendicular line as the first research pixel point; when the distance between the first blocked edge point and the edge point is greater than the preset truncation length, take the continuous preset truncation length pixel points on the first direction perpendicular line starting from the edge point as the first research pixel point; obtain the second research pixel point of the edge point according to the second direction perpendicular line; the first research pixel point and the second research pixel point are the pixels on both sides of the edge line.
