Ellipse detection method, computing device and storage medium based on contour recovery

Through the ellipse detection method based on contour recovery, the problems of image segmentation misjudgment and contour loss caused by posture deviation in the detection of internal and external surfaces of complex shaft-hole parts are solved, and high-precision inner hole ellipse detection is achieved.

CN116797548BActive Publication Date: 2025-09-19HUNAN UNIV +1
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202310587259.X
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-05-23
Publication Date
2025-09-19
Estimated Expiration
2043-05-23

AI Technical Summary

Technical Problem

The existing ellipse detection method has problems in detecting internal and external surface defects of complex shaft-hole parts, such as image segmentation misjudgment and loss of inner hole contour information due to the deviation between the camera and the workpiece posture, which affects the detection accuracy.

Method used

An ellipse detection method based on contour recovery is adopted. By obtaining the coverage angle range and value of the inner hole contour point set, the ellipse parameters are constructed and the maximum entropy threshold segmentation is performed to restore the inner hole contour point set and improve the detection accuracy.

Benefits of technology

It effectively restores the inner hole contour loss caused by posture offset, improves the accuracy and efficiency of ellipse detection, reduces misjudgment, and ensures the integrity and accuracy of detection.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116797548B_ABST
    Figure CN116797548B_ABST
Patent Text Reader

Abstract

The present invention discloses an ellipse detection method based on contour recovery, a computing device, and a storage medium. The method includes: obtaining a first inner hole contour point set from an inner hole image of a workpiece; determining a coverage angle range and a coverage angle value corresponding to the first inner hole contour point set; determining whether the coverage angle value is greater than a second coverage angle threshold; if not, performing ellipse detection on the first inner hole contour point set to obtain first ellipse parameters; constructing a circular ring based on the first ellipse parameters; extracting a second inner hole contour from the inner hole image using a maximum entropy threshold segmentation method; intercepting the second inner hole contour based on the circular ring to obtain a contour area to be restored; obtaining multiple contour points from the contour area to be restored, merging the points with the first inner hole contour point set to obtain a new inner hole contour point set, and performing ellipse detection on the new set to obtain new ellipse parameters as final ellipse parameters. The present invention can restore the inner hole contour and improve the accuracy of ellipse detection.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of defect detection technology, and in particular to an ellipse detection method based on contour recovery, a computing device, and a storage medium. Background Art

[0002] Cylindrical shaft-and-hole parts are widely used in equipment across various industries, such as docking rings in the aerospace field, fuel injectors in automotive engines, gear shafts, connecting flanges, and couplings. Shaft-and-hole parts typically have complex structures and require complex processing, with high requirements for form and position tolerances, surface roughness, and surface quality. They are primarily used in assembly and docking applications. Common surface defects of shaft-and-hole parts include: bumps on the workpiece end faces, chatter marks and scratches on the inner and outer cylindrical surfaces, and thread rot on the threaded surfaces. Surface defects of these parts not only affect the performance and lifespan of the parts themselves, but also the accuracy of part assembly or docking, thereby reducing the stability and reliability of the equipment. Therefore, surface defect inspection of the inner and outer surfaces of shaft-and-hole parts is extremely important for ensuring the performance of the parts during use, reducing the probability of accidents during equipment operation, and ensuring the safe and reliable operation of the equipment.

[0003] With the advent of the era of intelligent manufacturing, more and more complex shaft and hole parts are being inspected visually through the development of specialized visual inspection equipment to detect defects. Due to the complex internal and external structures of shaft and hole parts and the large number of inspection items, especially for slender shaft and hole parts, visual inspection is required at multiple stations. There are two common measurement methods: the first is to fix the imaging device and move the workpiece with the robot arm; the second is to fix the workpiece position and move the imaging device with the robot arm. Both methods may cause the relative posture between the camera lens and the workpiece to change, so necessary posture detection and posture correction are required. Posture detection has extremely important theoretical significance and engineering value for improving the detection efficiency of visual surface defects of complex shaft and hole parts at multiple stations, preventing damage during assembly or inspection, and improving production efficiency.

[0004] For complex cylindrical shaft-hole parts, it is necessary to develop visual inspection equipment to automatically detect defects on the inner and outer surfaces of such shaft-hole parts. Such shaft-hole parts are slender in shape and complex in structure. The outer surface is mainly composed of cylindrical surfaces of different diameters and external threaded surfaces, and the inner surface is mainly composed of stepped holes, stepped surfaces and internal threads. Since defects may be distributed on the inner and outer surfaces of the parts, it is necessary to perform multi-station inspection on such shaft-hole parts and adopt a measurement method in which the imaging device is fixed and the robotic arm clamps the workpiece and moves. Since the posture of the robotic arm is not consistent each time it clamps the part, and the long-term vibration at the industrial site causes the fasteners in the imaging device to become loose, the posture of the workpiece during imaging will deviate from the ideal imaging posture. The deviation of the imaging posture may result in the image not being able to cover the complete defect information on the workpiece surface. There is also the possibility of collision between the imaging device and the workpiece, resulting in damage to the imaging device and scratches on the workpiece.

[0005] It can be seen that posture detection and correction are extremely necessary during the defect detection process of shaft-hole parts and are one of the key technologies in the development of visual inspection equipment. When inspecting internal and external surface defects of circular shaft-hole parts, the actual imaging posture deviates from the ideal imaging posture. Detecting the posture between the circular shaft-hole part and the camera based on endoscopic imaging is of great engineering significance for the safe production and reliable posture detection of shaft-hole parts.

[0006] It should be noted that for shaft-and-hole parts, a robotic arm is typically used to grip the workpiece, which is then controlled to move it to a designated imaging position for imaging. Endoscopic images of shaft-and-hole parts lack distinct point and line features, only circular features. Therefore, a pose detection method based on circular features is required.

[0007] When the camera's optical axis is not perpendicular to the workpiece's end face, the spatial circle will become an ellipse when projected onto the imaging plane. To detect the target spatial circle's pose, the ellipse projected onto the image must first be identified. Therefore, one of the key techniques for pose detection based on circle features is ellipse detection. Existing ellipse detection schemes can cause high-grayscale background areas near the inner hole's edge contour to be mistakenly identified as the target area during image segmentation. Furthermore, due to the large relative pose deviation between the camera and the workpiece, the inner hole's contour can become unclear, leading to the loss of some inner hole edge information during image segmentation, which in turn leads to low ellipse detection accuracy.

[0008] Therefore, an ellipse detection method is needed to solve the problems existing in the above technical solutions. Summary of the Invention

[0009] To this end, the present invention provides an ellipse detection method based on contour recovery to solve or at least alleviate the above problems.

[0010] According to one aspect of the present invention, there is provided an ellipse detection method based on contour recovery, which is executed in a computing device to perform ellipse detection on the inner hole contour of a workpiece, the method comprising: obtaining a first inner hole contour point set from the inner hole image of the workpiece; determining the coverage angle range and coverage angle value corresponding to the first inner hole contour point set; judging whether the coverage angle value is greater than a second coverage angle threshold; if it is less than or equal to the second coverage angle threshold, performing ellipse detection on the first inner hole contour point set to obtain a first ellipse parameter; constructing a circular ring according to the first ellipse parameter; extracting a second inner hole contour from the inner hole image of the workpiece using a maximum entropy threshold segmentation method; intercepting the second inner hole contour based on the circular ring to obtain a contour area to be restored; obtaining multiple contour points of the inner hole from the contour area to be restored, and merging them with the first inner hole contour point set to obtain a new inner hole contour point set; performing ellipse detection on the new inner hole contour point set to obtain new ellipse parameters, and using the new ellipse parameters as the final ellipse parameters.

[0011] Optionally, in the ellipse detection method based on contour recovery according to the present invention, it also includes: if the coverage angle value is greater than a second coverage angle threshold, performing ellipse detection on the first inner hole contour point set to obtain a first ellipse parameter, and using the first ellipse parameter as the final ellipse parameter.

[0012] Optionally, in the ellipse detection method based on contour recovery according to the present invention, ellipse detection is performed on the inner hole contour point set, including: randomly obtaining a predetermined number of contour points from the inner hole contour point set, the predetermined number being greater than 3; judging whether the distance between any two contour points in the predetermined number of contour points is greater than a first distance threshold; if it is greater than the first distance threshold, fitting to form an initial ellipse based on the predetermined number of contour points; randomly obtaining the next contour point from the inner hole contour point set, and judging whether the distance from the next contour point to the initial ellipse is less than a second distance threshold; if it is less than the second distance threshold, determining the target coverage angle values ​​of all target contour points in the inner hole contour point set whose distance to the initial ellipse is less than the second distance threshold; judging whether the target coverage angle value is greater than the first coverage angle threshold, and if it is greater than the first coverage angle threshold, obtaining ellipse parameters based on the initial ellipse.

[0013] Optionally, in the ellipse detection method based on contour recovery according to the present invention, a circular ring is constructed according to the first ellipse parameters, including: the first ellipse parameters include the center point, major semi-axis, minor semi-axis, and inclination angle of the ellipse; and a circular ring is constructed with the center point as the center of the circle, the major semi-axis as the outer ring radius, and the minor semi-axis as the inner ring radius.

[0014] Optionally, in the ellipse detection method based on contour recovery according to the present invention, randomly obtaining the next contour point from the inner hole contour point set includes: judging whether the major and minor axis sizes and the major and minor axis ratios of the initial ellipse meet predetermined conditions; if the predetermined conditions are met, randomly obtaining the next contour point from the inner hole contour point set.

[0015] Optionally, in the ellipse detection method based on contour recovery according to the present invention, a set of inner hole contour points is obtained from the inner hole image of the workpiece, including: using the maximum inter-class variance threshold segmentation method to segment the inner hole image to obtain a high grayscale value area; sorting the grayscale values ​​of the high grayscale value area and obtaining the median grayscale value; segmenting the high grayscale value area according to the median grayscale value to extract a first inner hole contour; extracting multiple contour points from the first inner hole contour to obtain a first inner hole contour point set.

[0016] Optionally, in the ellipse detection method based on contour recovery according to the present invention, obtaining a first inner hole contour point set from the inner hole image of the workpiece includes: obtaining the first inner hole contour point set from the inner hole image of the workpiece using a radial search method.

[0017] Optionally, in the ellipse detection method based on contour recovery according to the present invention, it also includes: recording the angle information corresponding to each contour point in the first inner hole contour point set, so as to determine the coverage angle range according to the angle information corresponding to all contour points, and determine the corresponding coverage angle value according to the coverage angle range.

[0018] Optionally, in the ellipse detection method based on contour recovery according to the present invention, multiple contour points of the inner hole are obtained from the contour area to be restored, and are merged with the first inner hole contour point set to obtain a new inner hole contour point set, including: searching for multiple contour points in the contour area to be restored in an area outside the coverage angle range to obtain a set of inner hole contour points to be restored; and merging the inner hole contour point set to be restored with the first inner hole contour point set to obtain a new inner hole contour point set.

[0019] Optionally, in the ellipse detection method based on contour restoration according to the present invention, the second coverage angle threshold is 180°.

[0020] Optionally, in the ellipse detection method based on contour recovery according to the present invention, the first coverage angle threshold is 288°; and the predetermined number is 6.

[0021] Optionally, in the ellipse detection method based on contour recovery according to the present invention, the workpiece is a shaft-hole type part.

[0022] According to one aspect of the present invention, a computing device is provided, comprising: at least one processor; and a memory storing program instructions, wherein the program instructions are configured to be suitable for execution by the at least one processor, and the program instructions include instructions for executing the ellipse detection method based on contour recovery as described above.

[0023] According to one aspect of the present invention, a readable storage medium storing program instructions is provided. When the program instructions are read and executed by a computing device, the computing device executes the above-mentioned ellipse detection method based on contour recovery.

[0024] According to the technical solution of the present invention, a method for ellipse detection based on contour recovery is provided. The method obtains a first set of inner hole contour points from an inner hole image of a workpiece, determines the coverage angle range and coverage angle value corresponding to the first set of inner hole contour points, and determines whether the coverage angle value is greater than a second coverage angle threshold. If not, ellipse detection is performed on the first set of inner hole contour points to obtain first ellipse parameters. A circular ring is constructed based on the first ellipse parameters, and a maximum entropy threshold segmentation method is used to extract a second inner hole contour from the inner hole image of the workpiece. Subsequently, the second inner hole contour is intercepted based on the circular ring to obtain a contour region to be restored. Furthermore, multiple inner hole contour points are obtained from the contour region to be restored and merged with the first set of inner hole contour points to obtain a new set of inner hole contour points. Ellipse detection is then performed on the new set of inner hole contour points to obtain new ellipse parameters, which are used as the final ellipse parameters. Thus, according to the technical solution of the present invention, the inner hole contour can be restored in situations where the workpiece has a large position offset relative to the camera, resulting in a large loss of the inner hole contour. Ellipse detection is then performed on the new set of inner hole contour points after restoration, thereby improving the accuracy of ellipse detection.

[0025] Furthermore, the ellipse detection scheme for the inner hole contour point set adopted according to the present invention adds multiple judgment conditions, which can timely terminate the subsequent detection process of erroneous ellipses, which is beneficial to improving the ellipse detection efficiency of the inner hole contour of axial hole workpieces.

[0026] Furthermore, the present invention improves the maximum inter-class variance threshold segmentation method. Using this method, the inner hole image is first segmented to obtain high-grayscale value regions. The grayscale values ​​of these high-grayscale value regions are then sorted to obtain their median grayscale values. These high-grayscale value regions are then segmented based on the median grayscale value to extract the inner hole contour. This improves the accuracy of the segmentation of the inner hole image and the accuracy of the inner hole contour extracted from the inner hole image, thereby further improving the accuracy of ellipse detection for the inner hole contour of shaft-type workpieces.

[0027] The above description is only an overview of the technical solution of the present invention. In order to more clearly understand the technical means of the present invention, it can be implemented in accordance with the contents of the specification. In order to make the above and other purposes, features and advantages of the present invention more obvious and easy to understand, the specific implementation methods of the present invention are specifically listed below. BRIEF DESCRIPTION OF THE DRAWINGS

[0028] To achieve the above and related purposes, certain illustrative aspects are described herein in conjunction with the following description and accompanying drawings, which indicate various ways in which the principles disclosed herein may be practiced, and all aspects and their equivalents are intended to fall within the scope of the claimed subject matter. The above and other objects, features, and advantages of the present disclosure will become more apparent by reading the following detailed description in conjunction with the accompanying drawings. Throughout this disclosure, the same reference numerals generally refer to the same parts or elements.

[0029] Figure 1 A schematic diagram of a computing device 100 according to one embodiment of the present invention is shown;

[0030] Figure 2 A schematic diagram of a method 200 for detecting an ellipse of a workpiece inner hole profile according to an embodiment of the present invention is shown;

[0031] Figure 3 FIG. 3 is a schematic diagram showing an ellipse detection method 300 based on contour recovery according to an embodiment of the present invention;

[0032] Figure 4 A schematic diagram showing the effect of obtaining the contour area to be restored by intercepting the second inner hole contour based on a circular ring according to one embodiment of the present invention;

[0033] Figure 5 A schematic diagram shows the effect of merging the inner hole contour point set to be restored with the first inner hole contour point set to obtain a new inner hole contour point set according to one embodiment of the present invention. DETAILED DESCRIPTION

[0034] Exemplary embodiments of the present disclosure will be described in more detail below with reference to the accompanying drawings. Although exemplary embodiments of the present disclosure are shown in the accompanying drawings, it should be understood that the present disclosure can be implemented in various forms and should not be limited by the embodiments set forth herein. Rather, these embodiments are provided to enable a more thorough understanding of the present disclosure and to fully convey the scope of the present disclosure to those skilled in the art.

[0035] Figure 1 FIG. 1 shows a schematic diagram of a computing device 100 according to an embodiment of the present invention. Figure 1As shown, in a basic configuration, computing device 100 includes at least one processing unit 102 and system memory 104. According to one aspect, depending on the configuration and type of computing device, processing unit 102 can be implemented as a processor. System memory 104 includes, but is not limited to, volatile storage (e.g., random access memory), non-volatile storage (e.g., read-only memory), flash memory, or any combination of such memories. According to one aspect, system memory 104 includes an operating system 105.

[0036] According to one aspect, operating system 105 is suitable for controlling the operation of computing device 100, for example. Furthermore, examples may be practiced in conjunction with graphics libraries, other operating systems, or any other application programs, and are not limited to any particular application or system. Figure 1 The basic configuration is shown in FIG. 1 by those components within the dashed lines. According to one aspect, the computing device 100 has additional features or functionality. For example, according to one aspect, the computing device 100 includes additional data storage devices (removable and / or non-removable), such as magnetic disks, optical disks, or tapes. Such additional storage Figure 1 1 is illustrated by a removable storage device 109 and a non-removable storage device 110.

[0037] As stated above, according to one aspect, a program module 103 is stored in the system memory 104. According to one aspect, the program module 103 may include one or more application programs, and the present invention is not limited to the type of application program. For example, the application program may include an email and contact application program, a word processing application program, a spreadsheet application program, a database application program, a slide show application program, a drawing or computer-aided application program, a web browser application program, etc.

[0038] According to one aspect, the program module 103 includes multiple program instructions suitable for executing the ellipse detection method 200 of the inner hole contour of the workpiece and / or the ellipse detection method 300 based on contour recovery of the present invention, so as to execute the ellipse detection method 200 of the inner hole contour of the workpiece and / or the ellipse detection method 300 based on contour recovery of the present invention.

[0039] According to one aspect, examples may be practiced on a circuit comprising discrete electronic components, a packaged or integrated electronic chip containing logic gates, a circuit utilizing a microprocessor, or a single chip containing electronic components or a microprocessor. Figure 1Each or many components shown in can be integrated into a system on a chip (SOC) on a single integrated circuit to practice examples. According to one aspect, such an SOC device may include one or more processing units, a graphics unit, a communication unit, a system virtualization unit, and various application functions, all of which are integrated (or "burned") onto a chip substrate as a single integrated circuit. When operated via SOC, the functions described in this article can be operated via dedicated logic integrated with other components of the computing device 100 on a single integrated circuit (chip). Embodiments of the present invention can also be practiced using other technologies capable of performing logical operations (such as AND, OR, and NOT), including but not limited to mechanical, optical, fluid, and quantum technologies. In addition, embodiments of the present invention can be practiced in a general-purpose computer or in any other circuit or system.

[0040] According to one aspect, the computing device 100 may also have one or more input devices 112, such as a keyboard, a mouse, a pen, a voice input device, a touch input device, etc. It may also include an output device 114, such as a display, a speaker, a printer, etc. The aforementioned devices are examples, and other devices may also be used. The computing device 100 may include one or more communication connections 116 that allow communication with other computing devices 118. Examples of suitable communication connections 116 include, but are not limited to: RF transmitter, receiver, and / or transceiver circuitry; Universal Serial Bus (USB), parallel, and / or serial ports.

[0041] As used herein, the term computer-readable medium includes computer storage media. Computer storage media can include volatile and non-volatile, removable and non-removable media implemented with any method or technology for storing information (e.g., computer-readable instructions, data structures, or program modules 103). System memory 104, removable storage device 109, and non-removable storage device 110 are all examples of computer storage media (i.e., memory storage). Computer storage media can include random access memory (RAM), read-only memory (ROM), electrically erasable read-only memory (EEPROM), flash memory or other memory technology, CD-ROM, digital versatile disk (DVD) or other optical storage, cassette tape, magnetic tape, disk storage or other magnetic storage device, or any other product that can be used to store information and can be accessed by computing device 100. According to one aspect, any such computer storage medium can be a part of computing device 100. Computer storage media does not include carrier waves or other propagated data signals.

[0042] According to one aspect, communication media is implemented by computer-readable instructions, data structures, program modules 103, or other data in a modulated data signal (e.g., a carrier wave or other transport mechanism), and includes any information delivery media. According to one aspect, the term "modulated data signal" describes a signal that has one or more characteristics set or changed in such a manner as to encode information in the signal. By way of example, and not limitation, communication media includes wired media such as a wired network or direct-wired connection, and wireless media such as acoustic, radio frequency (RF), infrared, and other wireless media.

[0043] In an embodiment according to the present invention, a computing device 100 is configured to execute the ellipse detection method 200 for the inner hole contour of a workpiece and / or the ellipse detection method 300 based on contour recovery according to the present invention. The computing device 100 includes one or more processors and one or more readable storage media storing program instructions. When the program instructions are configured to be executed by the one or more processors, the computing device executes the ellipse detection method 200 for the inner hole contour of a workpiece and / or the ellipse detection method 300 based on contour recovery according to the embodiment of the present invention.

[0044] According to one embodiment of the present invention, the program module 103 of the computing device 100 includes a plurality of program instructions for executing the ellipse detection method 200 for the inner hole contour of the workpiece and / or the ellipse detection method 300 based on contour recovery of the present invention. These program instructions can instruct the processor to execute the ellipse detection method 200 for the inner hole contour of the workpiece and / or the ellipse detection method 300 based on contour recovery of the present invention, so that in the process of missing parts detection for axial hole parts, the ellipse detection method 200 for the inner hole contour of the workpiece and / or the ellipse detection method 300 based on contour recovery of the present invention can be used to realize the posture detection between the workpiece and the camera, and improve the efficiency and accuracy of the ellipse detection of the inner hole contour of the workpiece.

[0045] Figure 2 A schematic diagram of a method 200 for detecting an ellipse of a workpiece inner hole profile according to an embodiment of the present invention is shown. The method 200 for detecting an ellipse of a workpiece inner hole profile is suitable for execution in a computing device (such as the aforementioned computing device 100).

[0046] It should be noted that in the workpiece inner hole profile defect detection method 200 of the present invention, the workpiece to be inspected may be an axial hole component (specifically, a circular axial hole component, including both an inner and outer surface). The present invention does not limit the specific type and structure of the axial hole component. For example, in some embodiments, the outer surface of the workpiece (axial hole component) may include multiple cylindrical surfaces of different diameters and an external threaded surface, and the inner surface may include a stepped hole, a stepped surface, and an internal thread.

[0047] like Figure 2 As shown, method 200 begins at step 210 .

[0048] It should be noted that before executing step 210, it is necessary to pre-capture an inner hole image of the workpiece. The inner hole image can be an endoscopic image of the workpiece. Specifically, the inner hole image of the workpiece can be captured by a camera along its optical axis. The computing device 100 can obtain the inner hole image of the workpiece captured by the camera along its optical axis. Thereafter, the method 200 of the present invention can be executed based on the inner hole image of the workpiece to determine the position of the workpiece relative to the camera (during the defect detection process of the workpiece). In this way, during the defect detection process of the workpiece, the position of the workpiece and the camera can be detected, and the position offset can be determined so that the position correction can be performed in a timely manner.

[0049] It should be understood that when the workpiece is axially offset from the camera optical axis (at a certain angle), an elliptical inner hole contour exists in the inner hole image of the workpiece collected along the camera optical axis.

[0050] like Figure 2 As shown, in step 210, a set of inner hole contour points can be obtained from the inner hole image of the workpiece based on a predetermined angle step size. Subsequently, some threshold parameters (including a first distance threshold, a second distance threshold, a first coverage angle threshold, and a maximum number of iterations) can be initialized, and ellipse detection can be performed on the set of inner hole contour points.

[0051] Here, the present invention does not limit the specific value of the predetermined angle. For example, in one embodiment, the predetermined angle may be 0.5°.

[0052] According to one embodiment of the present invention, an improved maximum inter-class variance threshold segmentation method can be used to segment the inner hole image of the workpiece to extract the inner hole contour, and an inner hole contour point set is extracted from the inner hole contour based on a predetermined angle step.

[0053] Specifically, the present invention can utilize the idea of ​​K-Means classification to improve the maximum inter-class variance threshold segmentation method.

[0054] In a specific embodiment, according to the improved maximum inter-class variance threshold segmentation method of the present invention, obtaining a set of inner hole contour points from an inner hole image of a workpiece may specifically include the following steps:

[0055] First, the maximum inter-class variance threshold segmentation method can be used to segment the inner hole image to obtain a high grayscale value area (including the inner hole outline). The high grayscale value area obtained here contains the inner hole outline and may also contain a high grayscale value background area near the inner hole outline.

[0056] Furthermore, the present invention further classifies high grayscale value regions. Specifically, the grayscale values ​​of the high grayscale value regions are sorted to obtain a median grayscale value. This median grayscale value can be used as the final image segmentation threshold of the present invention. Subsequently, the high grayscale value regions can be segmented (classified) based on the median grayscale value to extract the inner hole contour from the high grayscale value regions. In other words, the inner hole contour is obtained by extracting higher grayscale value regions from the high grayscale value regions.

[0057] Finally, a plurality of contour points may be extracted from the inner hole contour based on a predetermined angle step size, and an inner hole contour point set may be obtained according to the plurality of contour points extracted from the inner hole contour.

[0058] In one embodiment, during the process of extracting multiple contour points from the inner hole contour, angle information corresponding to each contour point may also be recorded.

[0059] Specifically, ellipse detection may be performed on the inner hole contour point set according to the following steps 220 to 270 .

[0060] In step 220, a predetermined number of contour points (of the inner hole) are randomly obtained from the inner hole contour point set. Here, it is necessary to ensure that the predetermined number of contour points have a certain interval between each other.

[0061] In one embodiment, the predetermined number is greater than 3. Specifically, the predetermined number may be 6.

[0062] In step 230, it is determined whether the distance between any two contour points in the predetermined number of contour points is greater than a first distance threshold. Here, the first distance threshold is the minimum distance required to ensure that there is a certain distance between any two contour points.

[0063] If the distance between any two contour points is greater than the first distance threshold (ensuring a minimum distance between any two contour points), then step 240 may be continued. Otherwise, the process returns to step 220: randomly obtaining a predetermined number of contour points from the inner hole contour point set again.

[0064] It should be noted that if Figure 2 As shown, each time the process returns to step 220, a new iteration begins, and the number of iterations F is incremented by 1. Furthermore, before executing step 220, it is necessary to determine whether the current number of iterations F is greater than the iteration threshold Tf. If the current number of iterations F is not greater than the iteration threshold Tf (F ≤ Tf), step 220 may be executed again. If the current number of iterations F is greater than the iteration threshold Tf (F > Tf), the ellipse detection process may be terminated.

[0065] like Figure 2As shown, in step 240, an initial ellipse is formed by fitting based on the predetermined number of contour points. Here, in one implementation, the initial ellipse can be formed by fitting based on the predetermined number of contour points using the least square method.

[0066] According to one embodiment of the present invention, before executing step 250, it is possible to determine whether the major and minor axis dimensions and the major and minor axis ratio of the initial ellipse meet predetermined conditions. If so, step 250 can be continued. Otherwise, the process returns to step 220 (randomly obtaining a predetermined number of contour points from the inner hole contour point set) and begins a new iteration. In this way, by adding constraints on the major and minor axis dimensions and the major and minor axis ratio, the subsequent detection process for ellipses that do not meet the required dimensions can be promptly terminated, thereby improving ellipse detection efficiency.

[0067] In step 250 , a next contour point is randomly obtained from the inner hole contour point set, and it is determined whether the distance between the next contour point and the initial ellipse is less than a second distance threshold.

[0068] Here, the second distance threshold is used to determine whether the contour point is on the initial ellipse. If the distance between the contour point and the initial ellipse is less than the second distance threshold, it is determined that the contour point is on the initial ellipse.

[0069] In one embodiment, when the predetermined number of contour points is 6 contour points, the next contour point randomly obtained in step 250 is the 7th contour point.

[0070] If the distance between the next contour point and the initial ellipse is less than the second distance threshold (indicating that the next contour point is on the initial ellipse and the initial ellipse is a possible real ellipse), then continue to step 260. Otherwise, return to step 220 (randomly obtain a predetermined number of contour points from the inner hole contour point set again) and start a new iteration.

[0071] In step 260 , target coverage angle values ​​(Value) of all target contour points in the inner hole contour point set whose distance to the initial ellipse is less than a second distance threshold are determined.

[0072] Here, the target coverage angle value can be calculated based on the number of target contour points determined. Specifically, the number of target contour points in the inner hole contour point set whose distance to the initial ellipse is less than a second distance threshold is counted. Subsequently, the target coverage angle value for all target contour points can be calculated based on the predetermined angle step size and the number of target contour points.

[0073] In one embodiment of the present invention, based on the angle information corresponding to each contour point recorded during the process of extracting multiple contour points from the inner hole contour, when determining all target contour points in the inner hole contour point set whose distance to the initial ellipse is less than a second distance threshold, the angle information corresponding to each target contour point can also be obtained. In this way, based on the angle information corresponding to all target contour points, the target coverage angle range (angle) corresponding to all target contour points can be determined, and then the target coverage angle value (Value) can be determined based on the target coverage angle range (angle). For example, if the target coverage angle range corresponding to all target contour points includes 0-60° and 90-120°, the corresponding target coverage angle value is 90°.

[0074] Finally, in step 270, it is determined whether the target coverage angle value is greater than the first coverage angle threshold. If the target coverage angle value is greater than the first coverage angle threshold (which proves that the initial ellipse is a true ellipse), ellipse parameters are obtained based on the initial ellipse (these ellipse parameters are the final ellipse parameters to be output) and output. In other words, here, by determining the parameters of the initial ellipse, the parameters of the initial ellipse are used as the final ellipse parameters and output.

[0075] Otherwise, if the target coverage angle value is less than or equal to the first coverage angle threshold, the process may return to step 220 to start a new iteration.

[0076] In one embodiment, the first coverage angle threshold may be, for example, 288°. However, it should be noted that the present invention does not limit the specific value of the first coverage angle threshold, which may be set by those skilled in the art according to specific application scenarios and actual conditions.

[0077] Taking into account the situation where a large amount of inner hole contour is lost due to a large offset of the workpiece relative to the camera, in this case, the target coverage angle values ​​of all target contour points determined from the inner hole contour point set may not meet the requirement of the first coverage angle threshold (less than or equal to the first coverage angle threshold). To this end, in one embodiment, in each iteration process, after counting the number of target contour points in the inner hole contour point set whose distance to the initial ellipse is less than the second distance threshold, the ellipse parameters of the initial ellipse with the largest number of target contour points can be saved simultaneously (from the first iteration to the local iteration process). In this way, when the number of iterations F is greater than the iteration number threshold Tf (F>Tf), the ellipse parameters of the saved initial ellipse can be output, and then the ellipse detection process ends.

[0078] It is worth noting that the present invention actually performs ellipse detection on the inner hole contour point set of the workpiece. There are gaps between the contour points in the contour point set and they are not continuous. If 3 contour points are selected, it cannot be guaranteed that the minimum number of points for ellipse fitting is reached, so the predetermined number selected is 6. In addition, in order to ensure that the initial ellipse fitted is a real ellipse, the present invention adds a variety of judgment conditions so as to promptly terminate the subsequent detection process of the wrong ellipse. In addition, considering that the inner hole contour point set of the present invention is obtained based on a predetermined angle step size and is not continuous in the image, it is not suitable to use the ratio of the number of fitting points to the circumference of the fitted ellipse as the threshold for correctly detecting the ellipse. In this regard, the present invention sets a first coverage angle threshold as the threshold of the target coverage angle value of all target contour points as a condition for judging whether the initial ellipse is a real ellipse.

[0079] In addition, considering that the contours of some inner holes are not obvious due to the large position offset of the workpiece relative to the camera, resulting in a large amount of loss of inner hole contours during the image segmentation process, the present invention also proposes an ellipse detection method 300 based on contour recovery to perform ellipse detection on the inner hole contour of the workpiece.

[0080] Figure 3 A contour recovery-based ellipse detection method 300 according to one embodiment of the present invention is illustrated. This method 300 is suitable for execution in a computing device (e.g., the aforementioned computing device 100). Using this contour recovery-based ellipse detection method 300, contour recovery can be performed when the inner hole contour is lost, thereby enabling ellipse detection of the restored inner hole contour of the workpiece.

[0081] In embodiments of the present invention, the workpiece to be inspected may be a shaft-type part (specifically, a circular shaft-type part, including both an inner and outer surface). The present invention does not limit the specific type and structure of the shaft-type part. For example, in some embodiments, the outer surface of the workpiece (shaft-type part) may include multiple cylindrical surfaces of different diameters and an external threaded surface, and the inner surface may include a stepped hole, a stepped surface, and an internal thread.

[0082] It should be noted that before executing step 310, it is necessary to pre-capture an inner bore image of the workpiece. The inner bore image may be an endoscopic image of the workpiece. Specifically, the inner bore image of the workpiece may be captured by a camera along its optical axis. The computing device 100 may obtain the inner bore image of the workpiece captured by the camera along its optical axis. Subsequently, the method 300 of the present invention may be executed based on the inner bore image of the workpiece.

[0083] It should be understood that when the workpiece is axially offset from the camera optical axis (at a certain angle), an elliptical inner hole contour exists in the inner hole image of the workpiece collected along the camera optical axis.

[0084] like Figure 3As shown, in step 310, a first inner hole contour point set is acquired from the inner hole image of the workpiece.

[0085] In one embodiment, a radial search method may be used to obtain a first inner hole contour point set from an inner hole image of a workpiece.

[0086] According to one embodiment of the present invention, an improved maximum inter-class variance threshold segmentation method can be used to segment the inner hole image of the workpiece to extract the first inner hole contour, and a first inner hole contour point set can be extracted from the first inner hole contour based on a predetermined angle step.

[0087] Specifically, the present invention can utilize the idea of ​​K-Means classification to improve the maximum inter-class variance threshold segmentation method.

[0088] In a specific embodiment, according to the improved maximum inter-class variance threshold segmentation method of the present invention, obtaining a first inner hole contour point set from the inner hole image of the workpiece may specifically include the following steps:

[0089] First, the maximum inter-class variance threshold segmentation method can be used to segment the inner hole image to obtain a high grayscale value region (including the inner hole outline). The high grayscale value region obtained here includes the first inner hole outline and may include a high grayscale value background region near the first inner hole outline.

[0090] Furthermore, the present invention further classifies high grayscale value regions. Specifically, the grayscale values ​​of the high grayscale value regions are sorted by magnitude to obtain a median grayscale value. This median grayscale value can be used as the final image segmentation threshold of the present invention. Subsequently, the high grayscale value regions can be segmented (classified) based on the median grayscale value to extract the first inner hole contour from the high grayscale value regions. In other words, higher grayscale value regions are extracted from the high grayscale value regions to obtain the first inner hole contour.

[0091] Finally, a radial search method can be used to extract multiple contour points from the first inner hole contour. A first inner hole contour point set can be obtained based on the multiple contour points extracted from the first inner hole contour.

[0092] In one embodiment, during the process of extracting multiple contour points from the first inner hole contour, angle information corresponding to each contour point may also be recorded.

[0093] Then, in step 320 , the coverage angle range and coverage angle value corresponding to the first inner hole contour point set are determined.

[0094] In one embodiment, during the extraction of multiple contour points, the angle information corresponding to each contour point in the first inner hole contour point set may be recorded. Thus, in step 320, a coverage angle range may be determined based on the angle information corresponding to all contour points, and a corresponding coverage angle value may be determined based on the coverage angle range.

[0095] Next, in step 330, it is determined whether the coverage angle value is greater than a second coverage angle threshold. Here, the second coverage angle threshold is used to determine whether the inner hole profile needs to be restored. In one embodiment, the second coverage angle threshold can be set to 180 degrees, for example.

[0096] In one embodiment, if the coverage angle value is greater than the second coverage angle threshold (indicating that the inner hole contour does not need to be restored), step 335 is executed. In step 335, ellipse detection can be performed on the first inner hole contour point set to obtain first ellipse parameters, and the first ellipse parameters are used as the final ellipse parameters (i.e., the final output ellipse parameters). Specifically, ellipse detection can be performed on the first inner hole contour point set according to steps 220 to 270 of the aforementioned method 200 to obtain the first ellipse parameters.

[0097] If the coverage angle value is less than or equal to the second coverage angle threshold (indicating that the inner hole profile needs to be restored), step 340 is executed.

[0098] In step 340, ellipse detection is performed on the first inner hole contour point set to obtain corresponding first ellipse parameters. Specifically, ellipse detection can be performed on the first inner hole contour point set according to steps 220 to 270 in the aforementioned method 200 to obtain first ellipse parameters.

[0099] Next, in step 350 , a ring is constructed according to the first ellipse parameters.

[0100] In step 360 , a maximum entropy threshold segmentation method is used to extract a second inner hole contour from the inner hole image of the workpiece.

[0101] In step 370, based on the annulus constructed in step 350, the second inner hole contour is intercepted to obtain the contour area to be restored. Figure 4 A schematic diagram shows the effect of obtaining the contour area to be restored by intercepting the second inner hole contour based on a ring according to one embodiment of the present invention.

[0102] Then, in step 380 , a plurality of contour points of the inner hole are obtained from the contour area to be restored, and the plurality of contour points obtained here are merged with the first inner hole contour point set to obtain a new inner hole contour point set.

[0103] Specifically, multiple contour points within the contour area to be restored can be searched in the area outside the coverage angle range, and a set of inner hole contour points to be restored can be obtained based on all the searched contour points. Subsequently, a new set of inner hole contour points can be obtained by merging the set of inner hole contour points to be restored with the first set of inner hole contour points. Here, Figure 5 A schematic diagram shows the effect of merging the inner hole contour point set to be restored with the first inner hole contour point set to obtain a new inner hole contour point set according to one embodiment of the present invention.

[0104] Finally, in step 390 , ellipse detection is performed on the new set of inner hole contour points to obtain new ellipse parameters, which are used as final ellipse parameters (ie, final output ellipse parameters).

[0105] In an embodiment of the present invention, ellipse detection can be performed on the inner hole contour point set (first inner hole contour point set / new inner hole contour point set) according to steps 220 to 270 in the aforementioned method 200 to obtain corresponding ellipse parameters (first ellipse parameters / new ellipse parameters).

[0106] Specifically, the specific method for performing ellipse detection on the inner hole contour point set (the first inner hole contour point set / the new inner hole contour point set) according to steps 220 to 270 in the aforementioned method 200 is as follows:

[0107] A predetermined number of contour points are randomly obtained from the inner hole contour point set (the first inner hole contour point set / the new inner hole contour point set). Here, the predetermined number is greater than 3. In one embodiment, the predetermined number may be 6.

[0108] Determine whether the distance between any two contour points in the predetermined number of contour points is greater than a first distance threshold. In one embodiment, the first distance threshold may be 288°.

[0109] If the distance is greater than a first distance threshold, an initial ellipse is formed by fitting based on a predetermined number of contour points.

[0110] The next contour point is randomly obtained from the inner hole contour point set (the first inner hole contour point set / the new inner hole contour point set), and it is determined whether the distance between the next contour point and the initial ellipse is less than a second distance threshold.

[0111] If it is less than the second distance threshold, the target coverage angle values ​​of all target contour points in the inner hole contour point set (first inner hole contour point set / new inner hole contour point set) whose distance to the initial ellipse is less than the second distance threshold are determined.

[0112] It is determined whether the target coverage angle value is greater than a first coverage angle threshold. If it is greater than the first coverage angle threshold, the ellipse parameters (first ellipse parameters / new ellipse parameters) are obtained according to the initial ellipse.

[0113] Here, it should be understood that the first ellipse parameters are obtained by performing ellipse detection on the first set of inner hole contour points according to steps 220 to 270 of the aforementioned method 200. The new ellipse parameters are obtained by performing ellipse detection on the new set of inner hole contour points according to steps 220 to 270 of the aforementioned method 200.

[0114] In one embodiment, before randomly acquiring the next contour point from the inner hole contour point set (the first inner hole contour point set / the new inner hole contour point set), it may also be determined whether the major and minor axis dimensions and the major and minor axis ratios of the initial ellipse meet predetermined conditions. If the predetermined conditions are met, the next contour point is randomly acquired from the inner hole contour point set.

[0115] It should be noted that, regarding the specific implementation method of performing ellipse detection on the inner hole contour point set (first inner hole contour point set / new inner hole contour point set) to obtain the corresponding ellipse parameters (first ellipse parameters / new ellipse parameters), please refer to the description in the previous method 200 and will not be repeated here.

[0116] In summary, according to the present invention, the ellipse detection method 200 for the inner hole contour of a workpiece obtains an inner hole contour point set from the inner hole image of the workpiece based on a predetermined angular step size. A predetermined number of contour points are randomly obtained from the inner hole contour point set, and a determination is made as to whether the distance between any two contour points is greater than a first distance threshold. If so, an initial ellipse is formed based on the predetermined number of contour points. Next, a next contour point is randomly obtained from the inner hole contour point set, and a determination is made as to whether the distance between the next contour point and the initial ellipse is less than a second distance threshold. If so, the target coverage angle values ​​of all target contour points in the inner hole contour point set whose distance to the initial ellipse is less than the second distance threshold are determined. The target coverage angle values ​​are then determined as greater than a first coverage angle threshold. If so, the ellipse parameters are obtained based on the initial ellipse. Thus, according to the technical solution of the present invention, the existing ellipse detection algorithm is improved by adding multiple judgment conditions, which can promptly terminate the subsequent detection process for erroneous ellipses, thereby improving the efficiency of ellipse detection for the inner hole contour of axial-type workpieces.

[0117] Furthermore, according to the improved maximum inter-class variance threshold segmentation method of the present invention, the maximum inter-class variance threshold segmentation method is used to first segment the inner hole image to obtain high grayscale value areas. Then, the grayscale values ​​of the high grayscale value areas are sorted to obtain the median grayscale value. The high grayscale value areas are then segmented based on the median grayscale value to extract the inner hole contour. This helps improve the segmentation accuracy of the inner hole image and the accuracy of the inner hole contour extracted from the inner hole image, thereby further improving the ellipse detection accuracy of the inner hole contour of shaft-type workpieces.

[0118] According to the contour recovery-based ellipse detection method 300 of the present invention, a first set of inner hole contour points is obtained from an inner hole image of a workpiece, and the coverage angle range and coverage angle value corresponding to the first set of inner hole contour points are determined. It is then determined whether the coverage angle value is greater than a second coverage angle threshold. If not, ellipse detection is performed on the first set of inner hole contour points to obtain first ellipse parameters. A circular ring is constructed based on the first ellipse parameters, and a maximum entropy threshold segmentation method is used to extract a second inner hole contour from the inner hole image of the workpiece. The second inner hole contour is then intercepted based on the circular ring to obtain a contour region to be restored. Furthermore, multiple inner hole contour points are obtained from the contour region to be restored and merged with the first set of inner hole contour points to obtain a new set of inner hole contour points. Ellipse detection is then performed on the new set of inner hole contour points according to the method 200 described above to obtain new ellipse parameters, which are used as the final ellipse parameters. Thus, according to the technical solution of the present invention, the inner hole contour can be restored in situations where the workpiece has a large position offset relative to the camera, resulting in a significant loss of the inner hole contour. Ellipse detection is then performed on the new set of restored inner hole contour points, thereby improving ellipse detection accuracy.

[0119] A9. A method as described in any one of A1-A8, wherein a plurality of contour points of the inner hole are obtained from the contour area to be restored and merged with the first inner hole contour point set to obtain a new inner hole contour point set, comprising: searching for a plurality of contour points in the contour area to be restored in an area outside the coverage angle range to obtain a set of inner hole contour points to be restored; and merging the set of inner hole contour points to be restored with the first inner hole contour point set to obtain a new set of inner hole contour points.

[0120] A10. The method as described in any one of A1-A9, wherein the second coverage angle threshold is 180°.

[0121] A11. The method as described in A3, wherein the first coverage angle threshold is 288°; and the predetermined number is 6.

[0122] A12. A method as described in any one of A1-A11, wherein the workpiece is a shaft hole type part.

[0123] The various techniques described herein may be implemented in conjunction with hardware or software, or a combination thereof. Thus, the methods and apparatus of the present invention, or certain aspects or portions of the methods and apparatus of the present invention, may be implemented in the form of program codes (i.e., instructions) embedded in a tangible medium, such as a removable hard disk, a USB flash drive, a floppy disk, a CD-ROM, or any other machine-readable storage medium, wherein when the program is loaded into a machine such as a computer and executed by the machine, the machine becomes an apparatus for practicing the present invention.

[0124] When the program code is executed on a programmable computer, the mobile terminal generally includes a processor, a storage medium readable by the processor (including volatile and non-volatile memory and / or storage elements), at least one input device, and at least one output device. The memory is configured to store the program code; and the processor is configured to execute the ellipse detection method based on contour recovery of the present invention according to the instructions in the program code stored in the memory.

[0125] By way of example and not limitation, readable media include readable storage media and communication media. Readable storage media store information such as computer-readable instructions, data structures, program modules, or other data. Communication media typically embody computer-readable instructions, data structures, program modules, or other data in a modulated data signal such as a carrier wave or other transport mechanism, and include any information delivery medium. Combinations of any of the above are also included within the scope of readable media.

[0126] In the description provided herein, the algorithms and displays are not inherently related to any particular computer, virtual system, or other device. Various general-purpose systems may also be used in conjunction with the examples of the present invention. Based on the above description, it is apparent that the structure required for constructing such systems is well understood. In addition, the present invention is not directed to any specific programming language. It should be understood that various programming languages ​​may be utilized to implement the present invention described herein, and the description of specific languages ​​above is provided for the purpose of disclosing the preferred embodiment of the present invention.

[0127] In the description provided herein, a large number of specific details are described. However, it is understood that embodiments of the present invention can be practiced without these specific details. In some instances, well-known methods, structures, and techniques are not shown in detail so as not to obscure the understanding of this description.

[0128] Similarly, it should be understood that in order to streamline the disclosure and aid in understanding one or more of the various inventive aspects, in the above description of exemplary embodiments of the invention, various features of the invention are sometimes grouped together into a single embodiment, figure, or description thereof.

[0129] Those skilled in the art will appreciate that the modules, units, or components of the devices in the examples disclosed herein may be arranged in the device described in the embodiment, or alternatively may be located in one or more devices different from the devices in the examples. The modules in the foregoing examples may be combined into one module or further divided into multiple submodules.

[0130] Those skilled in the art will appreciate that the modules in the devices of the embodiments can be adaptively changed and installed in one or more devices different from the embodiments. The modules, units, or components in the embodiments can be combined into one module, unit, or component, and furthermore, they can be divided into multiple submodules, subunits, or subcomponents.

[0131] Furthermore, those skilled in the art will appreciate that although some embodiments described herein include certain features and not other features included in other embodiments, the combination of features from different embodiments is intended to be within the scope of the invention and to form different embodiments.

[0132] In addition, some of the embodiments are described herein as methods or combinations of method elements that can be implemented by a processor of a computer system or by other devices that perform the functions described. Thus, a processor having the necessary instructions for implementing the method or method element forms a device for implementing the method or method element. Furthermore, the elements described herein of the device embodiments are examples of devices for implementing the functions performed by the elements for the purpose of implementing the invention.

[0133] As used herein, unless otherwise specified, the use of ordinal numbers "first," "second," "third," etc. to describe common objects merely indicates that different instances of similar objects are involved and are not intended to imply that the objects so described must have a given order in time, space, ranking, or in any other manner.

[0134] Although the present invention has been described with respect to a limited number of embodiments, those skilled in the art, having benefit of the foregoing description, will appreciate that other embodiments are contemplated within the scope of the invention thus described. Furthermore, it should be noted that the language used in this specification has been selected primarily for readability and instructional purposes and is not selected to explain or limit the subject matter of the present invention.

Claims

1. A method for ellipse detection based on contour recovery, executed in a computing device to perform ellipse detection on a workpiece inner hole contour, the method comprising: Acquire a first inner hole contour point set from the inner hole image of the workpiece; Determine the coverage angle range and coverage angle value corresponding to the first inner hole contour point set; Determining whether the coverage angle value is greater than a second coverage angle threshold; If it is less than or equal to the second coverage angle threshold, performing ellipse detection on the first inner hole contour point set to obtain first ellipse parameters; constructing a ring according to the first ellipse parameters; Extracting a second inner hole contour from the inner hole image of the workpiece using a maximum entropy threshold segmentation method; Based on the circular ring, intercepting the second inner hole contour to obtain a contour area to be restored; Acquire multiple contour points of the inner hole from the contour area to be restored, and merge them with the first inner hole contour point set to obtain a new inner hole contour point set; Perform ellipse detection on the new inner hole contour point set to obtain new ellipse parameters, and use the new ellipse parameters as final ellipse parameters.

2. The method according to claim 1, wherein Also includes: If the coverage angle value is greater than a second coverage angle threshold, ellipse detection is performed on the first inner hole contour point set to obtain first ellipse parameters, and the first ellipse parameters are used as final ellipse parameters.

3. The method according to claim 1 or 2, wherein Perform ellipse detection on the inner hole contour point set, including: Randomly acquiring a predetermined number of contour points from the inner hole contour point set, wherein the predetermined number is greater than 3; Determining whether a distance between any two contour points among the predetermined number of contour points is greater than a first distance threshold; If the distance is greater than a first distance threshold, an initial ellipse is formed by fitting based on the predetermined number of contour points; randomly obtaining a next contour point from the inner hole contour point set, and determining whether a distance between the next contour point and the initial ellipse is less than a second distance threshold; If it is less than a second distance threshold, determining target coverage angle values ​​of all target contour points in the inner hole contour point set whose distance to the initial ellipse is less than the second distance threshold; It is determined whether the target coverage angle value is greater than a first coverage angle threshold; if so, ellipse parameters are obtained according to the initial ellipse.

4. The method according to claim 3, wherein: Constructing a ring according to the first ellipse parameters includes: The first ellipse parameters include the center point, major semi-axis, minor semi-axis, and tilt angle of the ellipse; A circular ring is constructed with the center point as the center, the major semi-axis as the outer ring radius, and the minor semi-axis as the inner ring radius.

5. The method according to claim 3 or 4, wherein: Randomly obtaining the next contour point from the inner hole contour point set, including: Determining whether the major and minor axis sizes and the major and minor axis ratios of the initial ellipse meet predetermined conditions; If the predetermined condition is met, the next contour point is randomly obtained from the inner hole contour point set.

6. The method according to any one of claims 1 to 5, wherein Obtaining a set of inner hole contour points from the inner hole image of the workpiece, including: The inner hole image is segmented using the maximum inter-class variance threshold segmentation method to obtain a high gray value area; Sort the grayscale values ​​of the high grayscale value area by size and obtain the median grayscale value; Segmenting the high grayscale value region according to the grayscale median to extract a first inner hole contour; A plurality of contour points are extracted from the first inner hole contour to obtain a first inner hole contour point set.

7. The method according to any one of claims 1 to 6, wherein Acquiring a first inner hole contour point set from the inner hole image of the workpiece, including: A radial search method is used to obtain a first inner hole contour point set from the inner hole image of the workpiece.

8. The method according to any one of claims 1 to 7, wherein Also includes: The angle information corresponding to each contour point in the first inner hole contour point set is recorded, so as to determine a coverage angle range according to the angle information corresponding to all contour points, and determine a corresponding coverage angle value according to the coverage angle range.

9. The method according to any one of claims 1 to 8, wherein Acquire multiple inner hole contour points from the contour area to be restored, and merge them with the first inner hole contour point set to obtain a new inner hole contour point set, including: In an area outside the coverage angle range, searching for multiple contour points in the area of ​​the contour to be restored to obtain a set of inner hole contour points to be restored; The inner hole contour point set to be restored is merged with the first inner hole contour point set to obtain a new inner hole contour point set.

10. The method according to any one of claims 1 to 9, wherein The second coverage angle threshold is 180°.

11. The method of claim 3, wherein: The first coverage angle threshold is 288°; The predetermined number is 6.

12. The method according to any one of claims 1 to 11, wherein The workpiece is a shaft hole type part.

13. A computing device comprising: at least one processor; as well as A memory storing program instructions, wherein the program instructions are configured to be executed by the at least one processor, and the program instructions include instructions for executing the method according to any one of claims 1 to 12.

14. A readable storage medium storing program instructions, wherein when the program instructions are read and executed by a computing device, the computing device is caused to execute the method according to any one of claims 1 to 12.

Citation Information

Patent Citations

  • Round hole detection method and device, electronic equipment and storage medium

    CN112184639A

  • Pointer type instrument reading identification method and identification device

    CN115049916A