A method for detecting and measuring inner surface defects of a hole based on endoscopic images
Through the image processing steps of the endoscope image, including detection center, ring interception, nonlinear fitting and correction, the problem of quantitative analysis of the inner surface of the hole is solved, and efficient and accurate defect measurement is achieved, which is suitable for the detection requirements of industrial sites. .
Patent Information
- Application Number
- CN202210339036.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-04-01
- Publication Date
- 2024-11-22
- Estimated Expiration
- 2042-04-01
AI Technical Summary
The prior art is difficult to accurately analyze and identify the profile and size of the inner surface defect of the hole, and the detection results rely on the subjective judgment of the technician, and there is a lack of effective image processing methods.
The detection and measurement method of the inner surface of the hole based on the endoscope image includes steps 1: obtaining and preprocessing the endoscope image, step 2: detecting the image center, step 3: ring interception and difference expansion, step 4: based on the defect Nonlinear fitting of background texture, Step 5: Correct the horizontal and aspect ratio of the image, Step 6: Read the pixels and size conversion of defects, and use these steps to restore the endoscope image to orthoprojected images that conform to human visual habits to achieve defects. Measurement of profile and dimensions.
It realizes efficient and accurate measurement of the inner surface defects of the hole, has strong versatility of the detection results, is suitable for large-scale inspections in industrial sites, has good stability in image processing methods, high detection accuracy and wide applicability.
Smart Images

Figure CN114648518B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of defect detection, and in particular to a method for detecting and measuring inner surface defects of a hole based on an endoscopic image. Background Art
[0002] Hole parts are the most common part form in mechanical processing and manufacturing. For a long time, the quality of hole parts, especially the detection of surface defects inside the hole, has been a problem that has troubled enterprises. Surface defects inside the hole, such as cracks, scratches, rust, etc., are well concealed. If not discovered in time, they can easily lead to serious consequences. According to the principle, the methods for detecting surface defects inside the hole can be divided into three categories: contact-based detection, acoustic, optical, thermal and magnetic-based detection, and visual image-based detection. From the perspective of detection efficiency and cost, internal surface defect detection based on visual images will be the main direction of future development.
[0003] With the development of miniaturization technology of imaging components, internal surface defect detection based on endoscopic images has gradually been used in industries such as medical care, aerospace, and petrochemicals. However, the endoscope lens is a typical large-scene short-focal-length lens, and the maximum depth of field is generally less than 80mm. The minimum depth of field is affected by the shooting wide angle and aperture, generally between 5-15mm, and objects within the depth of field can be clearly imaged on the phase plane. When using an endoscope to detect surface defects inside a hole, the actual surface of the hole is parallel to the main optical axis of the lens, and is distributed in a circular ring-shaped scattering on the imaging plane. There is a relatively serious distortion, and it is necessary to rely on the experience of engineering and technical personnel to estimate the defect contour, and it is difficult to quantitatively analyze and identify the contour and size of the defect. Patent application CN201911083505.8 combines a fiber optic endoscope with a reflective mirror to realize image information acquisition on the inner wall surface of a small aperture; although the acquisition of the image of the inner surface of the hole is realized, it does not involve image processing steps and methods, detection targets and standards, etc. Patent application CN201811384999.9 discloses a method for detecting porosity defects on the inner surface of castings based on endoscopic imaging, focusing on the steps and methods of endoscopic image processing. Patent application CN202110690265.9 discloses a method for detecting porosity defects in welds based on image processing, introducing the process and steps of image processing. However, the above patent applications only realize the detection of the presence or absence of defects on the inner surface of the hole, and cannot realize the quantitative analysis and measurement of defects on the inner surface of the hole. Key indicators such as the contour, size, and position of the defects still require subjective judgment by technical personnel. Summary of the invention
[0004] In order to overcome the defects of the above-mentioned prior art, the purpose of the present invention is to propose a method for detecting and measuring inner surface defects of holes based on endoscopic images, which can restore the endoscopic images into orthographic projection images that conform to human visual habits, and realize the measurement of defect contours and sizes through the number of pixels and the distance between pixels; it has the advantages of high efficiency in measuring inner surface defects of holes, strong versatility, and high detection and measurement accuracy.
[0005] In order to achieve the above object, the technical solution adopted by the present invention is:
[0006] A method for detecting and measuring inner surface defects of a hole based on an endoscopic image, specifically comprising the following steps:
[0007] Step 1: Acquisition and preprocessing of endoscopic images of surface defects in the hole;
[0008] Step 2: Detection of the center of the endoscopic image of the surface defects inside the hole;
[0009] Step 3: endoscopic image ring interception and difference expansion of the surface defects in the hole;
[0010] Step 4: Nonlinear fitting based on defect background texture;
[0011] Step 5: Adjust the aspect ratio of the corrected image;
[0012] Step 6: Defect edge pixel reading and size conversion.
[0013] The specific method of step one is:
[0014] 1) Obtaining an endoscopic image of the inner surface defect of the hole: first, according to the outline of the inner surface defect 1 of the hole part 8, a hollow area 3 is cut on the standard grid paper 2, and according to the inner diameter of the hole of the hole part 8, the standard grid paper 2 is curled and placed on the inner surface of the hole close to the hole wall, and the hollow area 3 is moved to overlap with the inner surface defect 1 of the hole, and the hole part 8 is placed vertically on the movable lifting platform 4 on the top of the optical workbench 5, and the position of the hole part 8 is fixed by the fixing device 11. The endoscope probe 6 vertically passes through the fixing adjustment device 12 at the front end of the workbench cantilever 7 and penetrates into the hole part 8, and the endoscopic image 10 is observed through the endoscope display 9, and the endoscope probe 6 is rotated. When the vertical texture in the standard grid paper 2 is uniformly scattered, the endoscope probe 6 is fixed by the fixing adjustment device 12, and then the height of the hole part 8 is adjusted by the movable lifting platform 4. When the inner surface defect 1 of the hole is located in the upper half of the endoscopic image 10, the inner surface of the hole is photographed;
[0015] 2) Preprocessing the captured endoscopic image 10: After the endoscopic image 10 is captured, grayscale conversion, median filtering and sharpening are performed on it in sequence.
[0016] The specific method of step 2 is:
[0017] 1) using an edge detection algorithm to extract edge information of the endoscopic image 10 processed in step 2) of step 1: detecting the image edge according to the discontinuity of the image grayscale value, and obtaining and extracting the boundary points;
[0018] 2) Use Hough transform method and write code based on MATLAB to determine the center of the endoscopic image:
[0019] a) Substitute the general equation of a circle (ax) 2 +(by) 2 =R 2 Convert from the xy coordinate system to the parameter space ab coordinate system, then a point on the arc in the xy coordinate system corresponds to a circle in the parameter space;
[0020] b) There are several points on an arc in the xy coordinate system, which correspond to several circles in the ab coordinate system. Since the points on the same arc in the xy coordinate system have the same center, the circles corresponding to these points in the parameter space intersect at one point, which corresponds to the center of the circle in the xy coordinate system;
[0021] c) Counting the number of times all points in the parameter space are intersected by arcs, the coordinates in the xy coordinate system corresponding to the point with the largest number of intersections are the center of the original image, that is, the endoscopic image center 13.
[0022] The specific method of step three is:
[0023] When the endoscope is used for imaging, the three-dimensional coordinates XYZ of the inner surface of the hole are converted into the two-dimensional coordinates UV of the phase plane 14, and then transformed into the MN coordinate system through coordinate mapping. A circular image 15 with a width of h pixels is intercepted with the center 13 of the endoscope image as the center of the circle. The expanded image 16 obtained by coordinate mapping transformation is filled with bilinear interpolation when the expanded image appears, and the horizontal correction result 17 is obtained. The coordinate mapping relationship is as shown in formula (1);
[0024]
[0025] in, U A’ , V A’ is the coordinate of the leftmost point A' in the phase plane, u, v are the coordinate positions of a pixel in the phase plane, m, n are the coordinate positions of the pixel in the expanded image, u c , v c are the coordinates of the center position of the image in the phase plane.
[0026] The specific method of step 4 is:
[0027] According to the imaging principle of endoscope, the mapping relationship between the three-dimensional spatial coordinate system XYZ of the inner surface of the hole and the two-dimensional coordinate system UV of the phase plane 14 can be expressed as formula (2):
[0028]
[0029] in, δ = H / h is the axial distance represented by each pixel on the inner surface of the hole. Since the equidistant circular rings on the inner surface of the hole appear as unequally spaced diffusion circular rings in the endoscopic image, δ can be understood as a nonlinear growth function determined by the distance r from the point to the center 13 of the endoscopic image, which is obtained by calibrating the texture on the standard grid paper 2 in the endoscopic image;
[0030] According to the fitting results, the true height of the inner surface of the hole represented by the pixels at different positions in the endoscopic image is obtained. Based on the fitting results, the Matlab code is used to perform nonlinear stretching on the horizontal correction result 17 in the vertical direction, so that the stretching degree at the top of the image is the smallest. As the number of image coordinate rows increases, the image stretching degree becomes larger and larger, and the stretching ratio reaches the maximum at the bottom of the image; the stretched image is proportionally adjusted to the size before correction to obtain the vertical correction result 20, so as to observe the correction effect.
[0031] The specific method of step five is:
[0032] According to the horizontal direction correction result 17 of step 3, the radial distance a=2πR / M, mm / pixel, of the inner surface of the hole represented by each pixel in the horizontal direction is calculated, where R is the aperture and M is the number of horizontal pixels of the image after correction;
[0033] According to the vertical direction correction result 20 of step 4, the axial distance b of the inner surface of the hole represented by each pixel in the vertical direction is calculated as 1 / N, mm / pixel, where N is the average number of pixels in the vertical direction of adjacent intersections of the standard grid paper 2 in the corrected image;
[0034] Taking the real distance of each pixel in the horizontal direction as the standard, the vertical correction result 20 is proportionally stretched in the vertical direction, and the stretching ratio is b / a. After proportional expansion, the hole inner surface endoscopy image correction result 21 is obtained. At this time, the distance between two adjacent pixels in the image is a mm, and each pixel represents a*a mm. 2 Surface defects inside the hole.
[0035] The specific method of step six is:
[0036] For the endoscopic image correction result 21 obtained in step 5, edge detection is performed again to obtain the corrected image edge detection result 22. The pixel coordinates of the image edge are read. The defect length aL in mm can be calculated based on the distance between pixels L. The defect area a can be calculated based on the number of pixels S in the defect area.2 S, unit: mm 2 .
[0037] The sharpening process in step 1 (2) adopts Laplace sharpening process.
[0038] The operators that can be used in step 1) of step 2 include Canny operator, Sobel operator, and Prewitt operator.
[0039] In the step 4, the texture on the standard grid paper 2 in the endoscopic image is calibrated using the actual distance of the smallest circle 18 at the bottom of the hole at the maximum depth of field as a reference, or using the actual distance of the largest circle 19 of the endoscopic image at the minimum depth of field as a reference.
[0040] Beneficial effects of the present invention:
[0041] 1. The method for measuring surface defects in holes based on endoscopic images proposed in the present invention can accurately determine the center of the image by adding background texture. It has high measurement efficiency and strong versatility, and can meet the large-scale detection and measurement needs of industrial sites.
[0042] 2. The image processing methods involved in the method of the present invention, such as image preprocessing, edge detection, Hough transform, difference expansion, etc., are all very mature image processing methods with good stability, simplicity and feasibility.
[0043] 3. The present invention is insensitive to aperture, the detection result is highly accurate, and the detection precision is not affected by the detection object, and has good applicability. BRIEF DESCRIPTION OF THE DRAWINGS
[0044] Figure 1 This is a flow chart for detecting and measuring surface defects in holes according to the present invention.
[0045] Figure 2 It is a structural schematic diagram of the shooting device of the present invention.
[0046] Figure 3 This is the endoscopic image preprocessing result of the present invention.
[0047] Figure 4 It is the endoscope image center detection result of the present invention.
[0048] Figure 5 Schematic diagram of the endoscopic image correction principle of the present invention.
[0049] Figure 6 This is the result of the endoscopic image horizontal correction of the present invention.
[0050] Figure 7 It is a nonlinear growth function diagram of the distance from pixel to image center of the present invention.
[0051] Figure 8 This is the result of the vertical correction of the endoscopic image of the present invention.
[0052] Fig. 9 This is the endoscopic image correction result of the present invention.
[0053] Fig.10 This is the corrected image edge detection result of the present invention.
[0054] In the figure: 1. Surface defects inside the hole; 2. Standard grid paper; 3. Hollow areas on the standard grid paper; 4. Movable lifting platform; 5. Optical workbench; 6. Endoscope probe; 7. Workbench cantilever; 8. Hole parts; 9. Endoscope display; 10. Endoscopic image; 11. Fixing device; 12. Fixing adjustment device; 13. Endoscopic image center; 14. Phase plane; 15. Ring image; 16. Expanded image; 17. Horizontal correction result; 18. Minimum circle at the bottom of the hole; 19. Maximum circle of the endoscopy image; 20. Vertical correction result; 21. Endoscopic image correction result; 22. Corrected image edge detection result. DETAILED DESCRIPTION
[0055] The structural principle and working principle of the present invention are further described in detail below with reference to the accompanying drawings.
[0056] A method for detecting and measuring surface defects of a hole based on an endoscopic image, comprising the following steps:
[0057] 1. Endoscopic image acquisition and preprocessing of surface defects in holes
[0058] 1) Obtaining an endoscopic image of the inner surface defect of the hole: first, according to the outline of the inner surface defect 1 of the hole part 8, a hollow area 3 is cut on the standard grid paper 2, and according to the inner diameter of the hole of the hole part 8, the standard grid paper 2 is curled and placed on the inner surface of the hole close to the hole wall, the hollow area 3 is moved to overlap with the inner surface defect 1 of the hole, the hole part 8 is vertically placed on the movable lifting platform 4 on the top of the optical workbench 5, and the position of the hole part 8 is fixed by the fixing device 11. The endoscope probe 6 vertically passes through the fixed adjustment device 12 at the front end of the workbench cantilever 7 and penetrates into the hole part 8, and the endoscopic image 10 is observed through the endoscope display 9, and the endoscopic probe 6 is rotated. When the vertical texture in the standard grid paper 2 is uniformly scattered, the endoscopic probe 6 is fixed by the fixed adjustment device 12, and then the height of the hole part 8 is adjusted by the movable lifting platform 4. When the inner surface defect 1 of the hole is located in the upper half of the endoscopic image 10, the inner surface of the hole is photographed; the specific shooting scheme is as follows Figure 2 As shown;
[0059] 2) Preprocessing the captured endoscopic image 10: After the endoscopic image 10 is captured, grayscale conversion, median filtering and Laplace sharpening are performed on it in sequence; the preprocessing result of the endoscopic image 10 is as follows: Figure 3 As shown;
[0060] 2. Endoscopic image center detection of surface defects in holes
[0061] First, edge information of the endoscopic image 10 processed in step 2) of step 1 is extracted by using an edge detection algorithm: the image edge is detected according to the discontinuity of the image gray value, and the boundary points are obtained and extracted; the essence of edge detection is to detect the discontinuity of the image gray value, following the principle that the first-order derivative of the gray value is greater than a specific threshold, and commonly used operators include Canny operator, Sobel operator, Prewitt operator, etc.;
[0062] Secondly, the Hough transform method is used and the code is written based on Matlab to determine the center of the endoscopic image. The Hough transform detects objects with specific shapes through a summation algorithm. This process is to obtain a result that meets the requirements of a specific shape by calculating the maximum value of the summation result in the parameter space; the specific detection steps are as follows:
[0063] a) Substitute the general equation of a circle (ax) 2 +(by) 2 =R 2 Convert from the xy coordinate system to the parameter space ab coordinate system, then a point on the arc in the xy coordinate system corresponds to a circle in the parameter space;
[0064] b) There are many points on an arc in the xy coordinate system, which correspond to many circles in the ab coordinate system; since the points on the same arc in the xy coordinate system have the same center, the circles corresponding to these points in the parameter space intersect at one point, which is the center of the corresponding arc;
[0065] c) Count the number of times all points in the parameter space are intersected by arcs, and the coordinates in the xy coordinate system corresponding to the point with the largest number of intersections are the center of the original image, that is, the endoscopic image center 13. The detection result of the endoscopic image center 13 is as follows: Figure 4 shown.
[0066] 3. Endoscopic image ring interception and difference expansion of hole surface defects
[0067] When the endoscope is used for imaging, the three-dimensional coordinates XYZ of the inner surface of the hole are converted into the two-dimensional coordinates UV of the phase plane 14, and then transformed into the MN coordinate system through coordinate mapping. The principle is as follows Figure 5 A circular image 15 with a width of h pixels is intercepted with the center of the endoscopic image 13 as the center, and the expanded image 16 is obtained by coordinate mapping transformation. The empty pixels that appear during the expansion are filled with bilinear interpolation to obtain the horizontal correction result 17, as shown in FIG. Figure 6 As shown, the coordinate mapping relationship is shown in formula (1)
[0068]
[0069] in, U A’ , V A’ is the coordinate of the leftmost point A' in the phase plane, u, v are the coordinate positions of a pixel in the phase plane, m, n are the coordinate positions of the pixel in the expanded image, u c , v c are the coordinates of the center position of the image in the phase plane.
[0070] 4. Nonlinear fitting based on defect background texture
[0071] According to the imaging principle of endoscope, the mapping relationship between the three-dimensional spatial coordinate system XYZ of the inner surface of the hole and the two-dimensional coordinate system UV of the phase plane 14 can be expressed as formula (2):
[0072]
[0073] in, δ=H / h is the axial distance represented by each pixel on the inner surface of the hole. Since the equidistant circular rings on the inner surface of the hole appear as unequally spaced diffuse circular rings in the endoscopic image, δ can be understood as a nonlinear growth function determined by the distance r from the point to the center 13 of the endoscopic image, which can be obtained by calibrating the texture on the standard grid paper 2 in the endoscopic image.
[0074] During calibration, the minimum circle 18 at the bottom of the hole at the maximum depth of field can be used as a reference, or the maximum circle 19 of the endoscope image at the minimum depth of field can be used as a reference. Taking the maximum circle 19 of the endoscope image as a reference, the vertical distance from the inner surface of the hole corresponding to each point on the maximum radius circle to the lens needs to be determined using the lens wide angle α and aperture R; when taking the minimum circle 18 at the bottom of the hole as a reference, the distance from the bottom of the hole part to the lens needs to be known; taking the minimum circle 18 at the bottom of the hole as an example for calibration, the results are as follows Figure 7 As shown; in the figure, the X-axis is the distance r from the pixel to the image center 13, in pixels, and the Y-axis is the actual height of the inner surface of the hole represented by each pixel at the intersection of the calibration paper, in millimeters;
[0075] According to the fitting results, the real height of the inner surface of the hole represented by the pixels at different positions in the endoscopic image is obtained. Based on the fitting results, the code is written in Matlab to perform nonlinear stretching on the horizontal correction result 17 in the vertical direction, so that the stretching degree at the top of the image is the smallest. As the number of image coordinate rows increases, the image stretching degree becomes larger and larger, and the stretching ratio reaches the maximum at the bottom of the image; the stretched image is proportionally adjusted to the size before correction to obtain the vertical correction result 20, so as to observe the correction effect, as shown in FIG. Figure 8 As shown;
[0076] 5. Adjust the aspect ratio of the corrected image
[0077] According to the horizontal correction result 17 of the third step, the radial distance a=2πR / M (mm / pixel) of the inner surface of the hole represented by each pixel in the horizontal direction is calculated, where R is the aperture and M is the number of horizontal pixels of the corrected image; according to the vertical correction result 20 of the fourth step, the axial distance b=1 / N (mm / pixel) of the inner surface of the hole represented by each pixel in the vertical direction is calculated, where N is the average number of pixels in the vertical direction of adjacent intersections of the standard grid paper 2 in the corrected image.
[0078] Taking the real distance of each pixel in the horizontal direction as the standard, the vertical correction result 20 is proportionally stretched in the vertical direction, and the stretching ratio is b / a. After proportional expansion, the hole inner surface endoscopic image correction result 21 is obtained, as shown in FIG. Fig. 9 As shown. At this time, the distance between two adjacent pixels in the image is a mm, and each pixel represents a*a mm 2 Surface defects inside the hole.
[0079] 6. Defect edge pixel reading and size conversion
[0080] For the endoscopic image correction result 21, edge detection is performed again to obtain the correction image edge detection result 22, such as Fig.10 Read the pixel coordinates of the edge of the image, and the defect length aL can be calculated based on the distance between pixels L, in mm. The defect area a can be calculated based on the number of pixels S in the defect area. 2 S, unit: mm 2 .
[0081] The grayscale conversion, median filtering and sharpening processing in step 2) of step 1 and the edge detection in step 2 are all basic operations conventional in the field of image processing and will not be described in detail.
[0082] The Hough transform method and Matlab code writing to determine the image center are conventional operations and will not be described in detail.
[0083] The above specific implementation methods are only used to illustrate the technical solutions of the present invention, rather than to be exhaustive or limiting thereof. Ordinary technicians in the field should also understand that they can still modify the technical solutions recorded in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein, and these modifications or replacements do not make the essence of the corresponding technical solutions deviate from the scope of the claims of the present invention.
Claims
1. A method for detecting and measuring inner surface defects of a hole based on an endoscopic image, characterized in that: The specific steps include: Step 1: Acquisition and preprocessing of endoscopic images of surface defects in the hole; Step 2: Detection of the center of the endoscopic image of the surface defects inside the hole; Step 3: Circular interception and difference expansion of the endoscopic image of the surface defects in the hole; the specific method is: During endoscope imaging, the three-dimensional coordinates XYZ of the inner surface of the hole are converted into the two-dimensional coordinates UV of the phase plane (14), and then transformed into the MN coordinate system through coordinate mapping. A circular image (15) with a width of h pixels is intercepted with the center of the endoscope image (13) as the center of the circle. The expanded image (16) obtained by coordinate mapping transformation is filled with bilinear interpolation to obtain the horizontal correction result (17). The coordinate mapping relationship is as shown in formula (1); in, U A’ , V A’ is the coordinate of the leftmost point A' in the phase plane, u, v are the coordinate positions of a pixel in the phase plane (14), m, n are the coordinate positions of the pixel in the expanded image, u c , v c are the coordinates of the image center position on the phase plane (14); Step 4: Nonlinear fitting based on defect background texture; the specific method is: According to the principle of endoscopic imaging, the mapping relationship between the three-dimensional spatial coordinate system XYZ of the inner surface of the hole and the two-dimensional coordinate UV of the phase plane (14) can be expressed as formula (2): in, δ = H / h is the axial distance represented by each pixel on the inner surface of the hole. Since the equidistant circular rings on the inner surface of the hole appear as unequally spaced diffuse circular rings in the endoscopic image, δ can be understood as a nonlinear growth function determined by the distance r from the point to the center of the endoscopic image (13), which is obtained by calibrating the texture on the standard grid paper (2) in the endoscopic image; The real height of the inner surface of the hole represented by the pixels at different positions in the endoscopic image is obtained according to the fitting results. Based on the fitting results, a code is written in Matlab to perform nonlinear stretching on the horizontal correction result (17) in the vertical direction, so that the stretching degree at the top of the image is the smallest. As the number of image coordinate rows increases, the image stretching degree increases, and the stretching ratio reaches the maximum at the bottom of the image. The stretched image is proportionally adjusted to the size before correction to obtain the vertical correction result (20) to facilitate observation of the correction effect. Step 5: Adjust the aspect ratio of the corrected image; Step 6: Defect edge pixel reading and size conversion.
2. The method for detecting and measuring inner surface defects of a hole based on an endoscopic image according to claim 1, characterized in that: The specific method of step one is: 1) Obtaining an endoscopic image of the inner surface defect of the hole: first, according to the outline of the inner surface defect (1) of the hole part (8), cut out a hollow area (3) on the standard grid paper (2), and according to the size of the inner diameter of the hole of the hole part (8), roll up the standard grid paper (2) and place it on the inner surface of the hole close to the hole wall, move the hollow area (3) so that it coincides with the inner surface defect (1), place the hole part (8) vertically on the movable lifting platform (4) on the top of the optical workbench (5), fix the position of the hole part (8) by the fixing device (11), and use the endoscope to probe The head (6) vertically passes through the fixing device (12) at the front end of the workbench cantilever (7) and penetrates into the hole part (8), and the endoscopic image (10) is observed through the endoscopic display (9). The endoscopic probe (6) is rotated. When the vertical texture in the standard grid paper (2) is evenly scattered, the endoscopic probe (6) is fixed by the fixing adjustment device (12), and then the height of the hole part (8) is adjusted by the movable lifting platform (4). When the inner surface defect (1) of the hole is located in the upper half of the endoscopic image (10), the inner surface of the hole is photographed; 2) Preprocessing the captured endoscopic image (10): After capturing the endoscopic image (10), grayscale conversion, median filtering and sharpening processing are performed on it in sequence.
3. The method for detecting and measuring inner surface defects of a hole based on an endoscopic image according to claim 1, characterized in that: The specific method of step 2 is: 1) using an edge detection algorithm to extract edge information of the endoscopic image (10) processed in step 2) of step 1: detecting the image edge according to the discontinuity of the image grayscale value, and obtaining and extracting the boundary points; 2) Use Hough transform method and write code based on MATLAB to determine the center of the endoscopic image: a) Substitute the general equation of a circle (ax) 2 +(by) 2 =R 2 Convert from the xy coordinate system to the parameter space ab coordinate system, then a point on the arc in the xy coordinate system corresponds to a circle in the parameter space; b) There are several points on an arc in the xy coordinate system, which correspond to several circles in the ab coordinate system. Since the points on the same arc in the xy coordinate system have the same center, the circles corresponding to these points in the parameter space intersect at one point, which corresponds to the center of the circle in the xy coordinate system; c) Count the number of times all points in the parameter space are intersected by arcs, and the coordinates in the xy coordinate system corresponding to the point with the largest number of intersections are the center of the original image, that is, the center of the endoscopic image (13).
4. The method for detecting and measuring inner surface defects of a hole based on an endoscopic image according to claim 1, characterized in that: The specific method of step 5 is: according to the horizontal direction correction result (17) of step 3, calculate the radial distance a=2πR / M, mm / pixel, of the inner surface of the hole represented by each pixel in the horizontal direction, where R is the aperture and M is the number of horizontal pixels of the image after correction; According to the vertical direction correction result (20) of step 4, the axial distance b of the inner surface of the hole represented by each pixel in the vertical direction is calculated as 1 / N, mm / pixel, where N is the average number of pixels in the vertical direction of adjacent intersections of the standard grid paper (2) in the corrected image; Taking the real distance of each pixel in the horizontal direction as the standard, the vertical correction result (20) is stretched in the vertical direction in equal proportion, and the stretching ratio is b / a. After proportional expansion, the correction result of the endoscopic image of the inner surface of the hole (21) is obtained. At this time, the distance between two adjacent pixels in the image is a mm, and each pixel represents a*amm. 2 Surface defects inside the hole.
5. The method for detecting and measuring inner surface defects of a hole based on an endoscopic image according to claim 1, characterized in that: The specific method of step 6 is: for the endoscopic image correction result (21) obtained in step 5, edge detection is performed again to obtain the correction image edge detection result (22), the pixel coordinates of the image edge are read, and the defect length aL can be calculated according to the distance L between pixels, in mm, and the defect area a can be calculated according to the number of pixels S in the defect area. 2 S, unit: mm 2 .
6. The method for detecting and measuring inner surface defects of a hole based on endoscopic images according to claim 3, characterized in that: The sharpening process in step 1 (2) adopts Laplace sharpening process.
7. The method for detecting and measuring inner surface defects of a hole based on endoscopic images according to claim 5, characterized in that: In the step 4, the texture on the standard grid paper (2) in the endoscopic image is calibrated using the smallest circle (18) at the bottom of the hole at the maximum depth of field as a reference, or using the largest circle (19) of the endoscopic image at the minimum depth of field as a reference.
