Workpiece micropore measurement method and device, computer equipment, readable storage medium and program product
By employing image enhancement and human-machine collaborative labeling techniques, the problem of high-precision, non-destructive measurement of micro-holes with large aspect ratios was solved, achieving efficient micro-hole measurement results.
Patent Information
- Application Number
- CN202511715862.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-11-21
- Publication Date
- 2026-02-10
AI Technical Summary
Existing technologies are insufficient for achieving high-precision, non-destructive, and efficient measurement of micropores with large aspect ratios. Contact measurement is prone to damaging the inner wall, while CT measurement has low accuracy and is time-consuming, failing to meet the requirements for efficient detection.
Image enhancement, achieved through image acquisition, illumination unevenness correction, and detail enhancement processing, combined with human-machine collaborative labeling and minimum circumcircle algorithm fitting, enables high-precision measurement of micropore edge contours.
It achieves high-precision, non-destructive, and efficient measurement of micro-holes with large aspect ratios, overcomes the damage risk of contact measurement, and improves measurement accuracy and efficiency.
Smart Images

Figure CN121504893A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of workpiece measurement technology, and in particular to a method, apparatus, computer equipment, computer-readable storage medium, and computer program product for measuring micro-holes in workpieces. Background Technology
[0002] With the development of the high-end manufacturing industry, micro-holes with large aspect ratios (diameter φ50μm~φ500μm, depth 0.5mm~5mm) are increasingly used in core components. To ensure the usability of the workpiece, it is necessary to measure the micro-holes.
[0003] In related technologies, micropore measurement is generally achieved through contact measurement or CT (Computed Tomography) scanning. However, the problems with these methods are that contact measurement is prone to damaging the inner wall of the micropore and introducing impurities, and the depth measurement accuracy is only ±5μm. Although industrial CT scanning is a non-destructive method, its measurement speed is slow (>10 minutes / pore) and its depth accuracy is low (±20μm), which cannot meet the requirements for efficient detection.
[0004] Therefore, a workpiece micro-hole measurement solution with higher accuracy, efficiency, and safety is needed. Summary of the Invention
[0005] Therefore, it is necessary to provide a workpiece microhole measurement method, apparatus, computer equipment, computer-readable storage medium, and computer program product that can improve measurement accuracy and measurement safety in response to the above-mentioned technical problems.
[0006] In a first aspect, this application provides a method for measuring micro-holes in a workpiece, the method comprising:
[0007] In response to a micropore measurement request for a target workpiece, an image of the target workpiece is acquired to obtain an original image of the target workpiece;
[0008] The original image is enhanced to obtain an enhanced image of the target workpiece; the image enhancement includes at least one of illumination unevenness correction and detail enhancement processing;
[0009] The enhanced image is displayed in response to a marking operation on the enhanced image; the marking operation is used to mark the edge coordinates of the microholes in the target workpiece.
[0010] The edge contour of the micropore in the enhanced image is obtained by fitting the edge coordinate points, and the pore size parameter of the micropore is determined based on the edge contour.
[0011] In some embodiments, after image enhancement of the original image, the method further includes:
[0012] The enhanced image is subjected to image quality assessment to obtain the assessment result;
[0013] If the evaluation result meets the preset conditions, the step of displaying the enhanced image is executed in response to the labeling operation on the enhanced image;
[0014] If the evaluation result does not meet the preset conditions, a preset prompt message will be displayed; the prompt message is used to suggest adjusting the acquisition parameters of the original image.
[0015] In some embodiments, after image enhancement of the original image and before displaying the enhanced image, the method further includes:
[0016] The micropores are detected in the original image to obtain the reference position of the micropores in the original image;
[0017] The original image is cropped based on the reference position to obtain the image to be processed;
[0018] The image to be processed is enhanced to obtain the enhanced image.
[0019] In some embodiments, the step of enhancing the original image to obtain an enhanced image includes:
[0020] The illumination channel of the original image is subjected to contrast-limited adaptive histogram equalization to obtain the equalized illumination channel.
[0021] The equalized illumination channel is blurred using a large Gaussian kernel to obtain the background illumination of the original image.
[0022] The equalized illumination channel is compared with the background illumination to obtain the corrected illumination channel corresponding to the original image.
[0023] The corrected illumination channel is merged with the original color channel of the original image to obtain the enhanced image.
[0024] In some embodiments, the step of enhancing the original image to obtain an enhanced image includes:
[0025] The original image is subjected to edge-preserving filtering to obtain the filtered image;
[0026] Calculate the gradient magnitude of the original image to obtain the gradient magnitude image corresponding to the original image;
[0027] The filtered image and the normalized gradient magnitude image are fused according to a preset weight to obtain the enhanced image.
[0028] In some embodiments, the number of edge coordinate points is at least three; the step of fitting the edge coordinate points to obtain the edge contour of the micropore in the enhanced image, and determining the pore size parameter of the micropore based on the edge contour, includes:
[0029] The pixel center coordinates and pixel radius of the smallest circumscribed circle of the at least three marker points are obtained by fitting the at least three marker points using the inner circumference method.
[0030] Based on the calibration parameters of the acquisition device for the original image, the coordinates of the pixel center and the pixel radius are converted to obtain the aperture parameters of the micropore.
[0031] Secondly, this application also provides a workpiece micro-hole measuring device, the device comprising:
[0032] The acquisition module is used to acquire images of the target workpiece in response to a micro-hole measurement request for the target workpiece, and obtain the original image of the target workpiece.
[0033] An enhancement module is used to enhance the original image to obtain an enhanced image of the target workpiece; the image enhancement includes at least one of illumination unevenness correction and detail enhancement processing;
[0034] A marking module is used to display the enhanced image and responds to a marking operation on the enhanced image; the marking operation is used to mark the edge coordinate points of microholes in the target workpiece;
[0035] The fitting module is used to fit the edge coordinate points to obtain the edge contour of the micropore in the enhanced image, and to determine the pore size parameter of the micropore based on the edge contour.
[0036] Thirdly, this application also provides a computer device, including a memory and a processor, wherein the memory stores a computer program, and the processor executes the computer program to implement the steps included in any of the aforementioned embodiments of the workpiece micro-hole measurement method.
[0037] Fourthly, this application also provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the steps included in any of the aforementioned embodiments of the workpiece micro-hole measurement method.
[0038] Fifthly, this application also provides a computer program product, including a computer program that, when executed by a processor, implements the steps included in any of the aforementioned workpiece micro-hole measurement method embodiments.
[0039] The aforementioned workpiece micro-hole measurement method, apparatus, computer equipment, computer-readable storage medium, and computer program product, in response to a micro-hole measurement request for a target workpiece, acquire an image of the target workpiece to obtain an original image of the target workpiece; perform image enhancement on the original image to obtain an enhanced image of the target workpiece; the image enhancement includes at least one of illumination unevenness correction and detail enhancement processing, thereby providing a basis for subsequent marking operations, improving the accuracy of subsequent marking operations, displaying the enhanced image, and responding to a marking operation on the enhanced image; the marking operation is used to mark the edge coordinate points of the micro-holes in the target workpiece; fitting is performed based on the edge coordinate points to obtain the edge contour of the micro-hole in the enhanced image, and the aperture parameter of the micro-hole is determined based on the edge contour. This embodiment of the invention, from high-quality image acquisition, targeted image enhancement, human-machine collaborative precise marking to final geometric fitting calculation, achieves high-precision, non-destructive, and efficient measurement of micro-holes with large aspect ratios, overcoming the damage risks of contact measurement. Attached Figure Description
[0040] To more clearly illustrate the technical solutions in the embodiments of this application or related technologies, the drawings used in the description of the embodiments of this application or related technologies will be briefly introduced below. Obviously, the drawings described below are only some embodiments of this application. For those skilled in the art, other related drawings can be obtained based on these drawings without creative effort.
[0041] Figure 1 This is a diagram illustrating the application environment of a workpiece measurement method in one embodiment;
[0042] Figure 2 This is a flowchart illustrating a workpiece measurement method in one embodiment;
[0043] Figure 3 This is a schematic diagram of the measurement system on which the workpiece measurement method is based in one embodiment;
[0044] Figure 4 This is a schematic diagram of the controller interface of the measurement system on which the workpiece measurement method is based in one embodiment;
[0045] Figure 5 This is a schematic diagram of the system structure on which the workpiece measurement method is based in another embodiment;
[0046] Figure 6 This is a schematic diagram of the processing timing of the workpiece measurement method in another embodiment;
[0047] Figure 7 This is a schematic diagram of the original image in a workpiece measurement method in another embodiment;
[0048] Figure 8 This is a schematic diagram of the image to be processed in a workpiece measurement method in another embodiment;
[0049] Figure 9 This is a schematic diagram of marker points in an enhanced image in a workpiece measurement method according to another embodiment;
[0050] Figure 10 This is a schematic diagram of the microhole edge profile obtained by fitting in the workpiece measurement method of another embodiment.
[0051] Figure 11 This is a structural block diagram of the workpiece measuring device in one embodiment;
[0052] Figure 12 This is an internal structural diagram of a computer device in one embodiment. Detailed Implementation
[0053] To make the objectives, technical solutions, and advantages of this application clearer, the following detailed description is provided in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative and not intended to limit the scope of this application.
[0054] Explanation of related terms:
[0055] High aspect ratio micropores: These are tiny holes with a depth-to-diameter ratio (DPR) ≥ 10:1. In this solution, they specifically refer to holes with a diameter of φ50μm~φ500μm and a depth of 0.5mm~5mm, which are commonly found in precision molds, aero-engine blades, semiconductor chips and other components.
[0056] Telecentric Lens: A special type of optical lens in which the object-side principal ray is parallel to the optical axis. It features low distortion (typically ≤0.1%) and no perspective error, ensuring that the image size of the object remains consistent at different working distances. It is a core optical component for high-precision dimensional measurement.
[0057] Confocal optical imaging: an optical imaging technique that uses a pinhole between the light source and the detector to allow only reflected light from the focal point to pass through the pinhole for imaging, while stray light from non-focal points is filtered out. This results in high-resolution, high-contrast images, suitable for layered imaging and precise positioning of minute structures.
[0058] Motorized Z-axis Stage: A precision mechanical device that can move along the Z-axis (vertical direction). It achieves precise displacement through motor drive. The minimum step distance is its core performance indicator (≤1μm in this solution). It is used to adjust the distance between the camera / lens and the micro-aperture, so as to move the focus along the depth direction of the micro-aperture.
[0059] CLAHE (Contrast Limited Adaptive Histogram Equalization) is an image enhancement algorithm that divides an image into multiple sub-regions and performs histogram equalization on each sub-region while limiting the contrast enhancement (to avoid noise amplification). It can effectively enhance local details (such as the edges of micro-holes) and is especially suitable for images with uneven lighting.
[0060] Sobel Gradient: An image edge detection algorithm that calculates the gradient of grayscale changes in the X (horizontal) and Y (vertical) directions of an image to obtain the gradient magnitude and direction. It can highlight the edge contours in the image (such as the boundary between the inner wall of a micropore and the background) and is a basic algorithm for detail enhancement and edge extraction.
[0061] The Laplacian operator is a second-order differential operator used to calculate the second-order rate of change of image gray values, which can reflect the edge intensity in the image (the gray value change rate is large at the edge, and the operator response value is high). In this scheme, the image sharpness is evaluated by calculating the mean of its absolute value (Sharpness = mean (|Laplacian (I)|)).
[0062] Minimum Enclosing Circle Algorithm: A geometric fitting algorithm that, given a set of points on a plane (such as the edge points of a micro-hole clicked by the user), calculates the smallest circle that can completely enclose all points and outputs the coordinates of the circle's center and radius. It is a commonly used algorithm for calculating the size of circular objects from discrete points.
[0063] OpenCV (Open Source Computer Vision Library) is an open-source computer vision library that provides a large number of computer vision algorithm interfaces (such as cv2.VideoCapture and cv2.minEnclosingCircle) for image acquisition, preprocessing, edge detection, and geometric fitting. It is the core tool library for the software implementation of this solution.
[0064] NumPy (Numerical Python): A numerical computing library for the Python language that supports high-dimensional arrays (such as BGR two-dimensional matrices for images, numpy.ndarray) and matrix operations. It is a fundamental dependency library for OpenCV in processing image data and can efficiently store and compute image pixel information.
[0065] Pixel Size: The physical size (unit: mm) of a single pixel on an industrial camera sensor. It is the core parameter for converting pixel coordinates into physical size. In this solution, the camera pixel size is 0.0022 mm, meaning that each pixel corresponds to a length of 0.0022 mm in reality.
[0066] Magnification: The magnification ratio by which the optical system (lens) images an object onto the sensor. In this solution, the telecentric lens has a magnification ratio of 4.0, which means that the actual size of the object is magnified 4 times on the sensor after being imaged by the lens (e.g., an actual 1mm object corresponds to a 4mm sensor length after imaging).
[0067] Frame rate (FPS, Frames Per Second): The number of image frames captured by the camera per second. In this scheme, it is set to 30 FPS, that is, 30 frames of images are captured per second. The higher the frame rate, the shorter the image acquisition interval, the faster the system responds to dynamic scenes, and the more measurement errors caused by slight movement of objects can be reduced.
[0068] USB Industrial Camera: An industrial-grade image acquisition device that communicates with an industrial computer via a USB interface. It features high resolution (2592x1944 pixels in this solution) and high stability, making it suitable for close-range, small-to-medium batch image acquisition scenarios. Its cost is lower than that of interface cameras such as GigE and Camera Link.
[0069] Before describing the embodiments of the present invention, the related technologies and their existing problems will be further explained:
[0070] In fields such as precision manufacturing, aerospace, and microelectronics, it is important to perform non-destructive measurement of key aperture parameters for "micro-holes with large aspect ratios" (aspect ratio ≥ 10:1).
[0071] In related technologies, the measurement of micropores with large aspect ratios generally includes the following methods:
[0072] Contact measurement: The principle is to use a mechanical probe to contact the inner wall of the micropore, move the probe along the Z-axis to record the position difference between the pore opening and the bottom of the pore (pore depth), and obtain the pore diameter by scanning the probe laterally;
[0073] In addition, CT measurement technology: the principle is to obtain three-dimensional images of micropores through X-ray tomography, and then calculate the pore depth and pore diameter through image reconstruction.
[0074] However, considering the characteristics of such micropores, such as "large aspect ratio and complex internal wall reflections," traditional measurement techniques struggle to simultaneously meet the requirements of "high precision, non-destructive testing, and speed." Specifically, this manifests in the following ways:
[0075] Contact measurement is prone to scratching the inner wall of micropores and introducing residual impurities, which does not meet the requirements of non-destructive testing. Furthermore, the depth measurement accuracy of contact measurement is only ±5μm, which cannot meet the high precision requirement of "±1μm". In addition, the measurement speed of contact measurement is slow (>2 minutes / hole), resulting in low efficiency.
[0076] Correspondingly, the measurement accuracy of CT measurement is only ±20μm, which is difficult to meet the needs of industrial measurement. In addition, the measurement time of CT measurement is long (>10 minutes / well), making it difficult to adapt to batch testing scenarios. Furthermore, the equipment cost of CT measurement is high and the operation is complicated, which greatly limits the applicable scenarios.
[0077] Therefore, a more precise and efficient non-destructive measurement solution is needed for micro-holes with large aspect ratios.
[0078] It should be noted that the terms "first," "second," etc., used in this application can be used to describe various elements, but these elements are not limited by these terms. These terms are only used to distinguish the first element from the second element. The terms "comprising" and "having," and any variations thereof, used in this application, are intended to cover non-exclusive inclusion. The term "multiple" used in this application refers to two or more. The term "and / or" used in this application refers to one of the embodiments, or any combination of multiple embodiments.
[0079] The workpiece measurement method provided in this application embodiment can be applied to, for example... Figure 1 In the application environment shown, terminal 102 communicates with server 104 via a network. A data storage system can store the data that server 104 needs to process. The data storage system can be integrated onto server 104 or located in the cloud or on another network server. In response to a micro-hole measurement request for a target workpiece, terminal 102 acquires an image of the target workpiece, obtaining an original image of the target workpiece; terminal 102 sends the original image to server 104, server 104 performs image enhancement on the original image, obtaining an enhanced image of the target workpiece, which is then returned to terminal 102; the image enhancement includes at least one of illumination unevenness correction and detail enhancement processing.
[0080] Terminal 102 displays the enhanced image and, in response to a marking operation on the enhanced image, sends the marking operation to server 104; the marking operation is used to mark the edge coordinate points of the microholes in the target workpiece.
[0081] Server 104 fits the edge coordinates to obtain the edge contour of the micropore in the enhanced image, determines the aperture parameter of the micropore based on the edge contour, and returns the aperture parameter to terminal 102 for display. Terminal 102 can be, but is not limited to, various personal computers, laptops, smartphones, tablets, drones, low-altitude aircraft, IoT devices, and portable wearable devices. IoT devices can be smart speakers, smart TVs, smart air conditioners, smart in-vehicle devices, projection devices, etc. Portable wearable devices can be smartwatches, smart bracelets, head-mounted devices, etc. Head-mounted devices can be virtual reality (VR) devices, augmented reality (AR) devices, smart glasses, etc. Server 104 can be a standalone physical server, a server cluster or distributed system composed of multiple physical servers, or a cloud server providing cloud computing services.
[0082] In one exemplary embodiment, such as Figure 2 As shown, a method for measuring micro-holes in a workpiece is provided, which can be applied to... Figure 1 Taking server 104 as an example, the following steps are included:
[0083] Step 202: In response to the micro-hole measurement request for the target workpiece, image acquisition is performed on the target workpiece to obtain the original image of the target workpiece.
[0084] In response to the event that the target workpiece to be measured is placed in the image acquisition area, the micro-hole measurement request can be triggered by the user through a preset interactive interface or a shortcut key. In response to this micro-hole measurement request, the image acquisition device is controlled to take a picture. Optionally, the acquired raw image and its acquisition parameters, such as camera resolution, frame rate, and processing speed, can also be displayed in real time through the interactive interface.
[0085] The target workpieces include precision molds, aero-engine blades, semiconductor chips, and other components containing micro-holes. Micro-holes can include high aspect ratio micro-holes, that is, holes with a depth-to-diameter ratio greater than or equal to 10:1, with diameters typically ranging from φ50μm to φ500μm and depths ranging from 0.5mm to 5mm.
[0086] Specifically, image acquisition can be achieved using an industrial camera equipped with a telecentric lens. Optionally, to obtain stable and clear images and provide a basis for manual marking in subsequent steps, the camera parameters of the industrial camera can be configured before acquisition. For example, the camera resolution can be set to the highest level (e.g., 2592×1944 pixels), a fixed frame rate can be set (e.g., 30 FPS), and automatic exposure, automatic white balance, and automatic focus functions can be disabled. Instead, parameters such as exposure time and gain can be manually optimized according to the ambient lighting conditions. Optionally, an industrial camera with 5 megapixels or higher can be combined with a telecentric lens with 4x magnification to ensure imaging resolution and low geometric distortion. This embodiment of the invention, through the combination of a high-resolution industrial camera and a low-distortion telecentric lens, ensures high-quality raw images at the hardware level, laying a reliable data foundation for subsequent non-contact, high-precision measurements.
[0087] Optionally, unlike manual triggering of micro-hole measurement requests by users, the micro-hole location can be automatically located through image recognition, thus eliminating the need for manual intervention and achieving fully automated measurement, making it more suitable for online inspection scenarios on production lines. Specifically, the micro-hole location can be automatically located from the original image based on a template matching algorithm. This template matching algorithm can be based on a processing template of the target workpiece, matching it with the original image to obtain the actual micro-hole location.
[0088] Step 204: Perform image enhancement on the original image to obtain an enhanced image of the target workpiece; the image enhancement includes at least one of uneven illumination correction and detail enhancement processing.
[0089] In this invention, considering the deep and narrow internal structure of micropores with large aspect ratios and complex internal wall reflections, the acquired raw images are prone to problems such as uneven illumination, blurred edges, and insufficient contrast. These problems can affect the accuracy of subsequent edge recognition and deep hole size measurement. Therefore, in this embodiment of the invention, before deep hole edge marking and aperture parameter calculation, image enhancement is performed on the acquired raw images to eliminate imaging defects and improve the clarity and recognizability of the micropore edge region.
[0090] Specifically, enhancement methods may include illumination unevenness correction, detail enhancement processing, or a combination thereof. Considering that light is difficult to diffuse uniformly during the original image acquisition of the workpiece's micro-holes, illumination unevenness correction is used. In the LAB color space, adaptive histogram equalization (CLAHE) is applied to the luminance channel (L channel) to limit contrast, thereby enhancing local contrast. Subsequently, Gaussian blur is used to obtain background illumination estimation, and illumination correction is achieved through division operations, ultimately resulting in an image with uniform illumination.
[0091] Correspondingly, in order to highlight the edge region of the micropores and provide a clear image as a basis for extracting the micropore edges in subsequent steps, a detail enhancement filter can be applied to the original image and weighted and fused with the calculated gradient magnitude image to obtain an enhanced image with significantly enhanced contour information.
[0092] Step 206: Display the enhanced image in response to a marking operation on the enhanced image; the marking operation is used to mark the edge coordinates of the microholes in the target workpiece.
[0093] In view of the problems with the accuracy and efficiency of existing automatic measurement solutions (such as contact inspection or industrial CT scanning), and the insufficient reliability when dealing with complex edges or poor imaging, this embodiment of the invention adopts a human-computer interactive marking method. Based on manual marking of the edge coordinate points of microholes in the target workpiece, this provides a priori reference for subsequent detection of the microhole edge contour. The marking operation may include the user clicking on at least three coordinate points on the edge contour of the microhole using a mouse or touchscreen on the displayed enhanced image. Optionally, the marking operation may include three or more non-collinear points existing on the circumference of the microhole to obtain sufficient geometric constraints to fit the edge contour of the microhole.
[0094] In this embodiment of the invention, artificial marking cleverly combines the precise computing power of computers with the intelligence of the human visual system, which can still accurately identify contours in blurry and noisy environments, thereby greatly improving the robustness and adaptability of micro-hole measurement in complex, non-destructive testing scenarios.
[0095] Fitting refers to using mathematical methods to reconstruct a complete geometric shape from discrete coordinate points. In this embodiment of the invention, the minimum circumcircle algorithm is used for fitting based on at least three edge coordinate points marked by the user. The minimum circumcircle algorithm is used to calculate the smallest circle that encloses all marked points and outputs the center pixel coordinates and radius pixel value of the circle. This circle is the fitted micropore edge contour.
[0096] It should be noted that, considering the possibility of errors in a single labeling operation, it is optional to perform statistical analysis (such as cluster analysis) on multiple labeling operations, take the average or median distribution position of the labeling points, and perform fitting calculations based on the average or median distribution position to obtain the contour edge of the micropore in the enhanced image.
[0097] Step 208: Fit the edge coordinates to obtain the edge contour of the micropore in the enhanced image, and determine the pore size parameter of the micropore based on the edge contour.
[0098] The pore size parameter can include the physical diameter of the micropore.
[0099] The aperture parameters are calculated based on the principles of geometric optics and camera calibration results. The specific formula is as follows:
[0100] Physical diameter = (2 × fitted pixel radius × pixel size) / optical magnification;
[0101] In this calculation, the pixel size is an inherent parameter of the camera sensor (e.g., 0.0022 mm / pixel), and the optical magnification is determined by the lens (e.g., 4.0x). This conversion accurately maps the pixel size in the image to real physical space, ultimately outputting the actual physical diameter of the micro-aperture. The measurement results are then displayed on the user interface.
[0102] By using the minimum circumcircle algorithm to optimally fit discrete edge points, the algorithm can effectively average out the small deviations that may exist in user clicks, and obtain a circular outline that is closer to the real shape. Combined with precise camera calibration parameters, a high-precision mapping from image pixel space to real physical space is achieved, which ultimately ensures that the measurement accuracy of aperture parameters reaches the micrometer level.
[0103] Optionally, the enhanced image can be automatically identified and fitted with a circle based on a preset circle detection algorithm, such as the Hough circle detection algorithm, thus eliminating the need for users to manually click on edge points and making it more suitable for batch detection scenarios. However, to improve the accuracy of microhole measurement, the edge sharpness of the enhanced image is generally required to be higher when using a circle detection algorithm for automatic detection.
[0104] Optionally, considering that there may be errors in workpiece processing or that the image acquisition conditions are not ideal, there may be slight defects at the edge of the micro-hole. That is, the micro-hole contour in the enhanced image may not appear as an ideal circle. Therefore, an ellipse fitting algorithm can be used to calculate the equivalent diameter by fitting the elliptical contour of the micro-hole edge, thereby improving the measurement accuracy in defect scenarios.
[0105] The aperture parameters of the micropores are displayed through a preset interactive interface. Optionally, the historical measurement results of the micropores of the target workpiece can also be displayed through the interactive interface. For example, a small chart can be drawn at a preset position on the interactive interface. This chart is used to dynamically display the change curve of the micropore diameter measurement value of the most recent preset (e.g., 100) frames, which makes it easier for users to observe the stability of the measurement results, so that the collected parameters or workpiece position can be adjusted in time when a large deviation occurs.
[0106] This invention successfully achieves high-precision, non-destructive, and efficient measurement of large aspect ratio micro-holes, which is difficult to handle in related technologies, through a complete process from high-quality image acquisition, targeted image enhancement, human-machine collaborative precise labeling to final geometric fitting calculation. It effectively overcomes the damage risks and problems of contact measurement.
[0107] In some embodiments, considering that in addition to measuring the aperture parameter, there is usually a need to measure the depth-to-diameter ratio for micropores, and the depth-to-diameter ratio parameter of micropores is determined by two key dimensions: aperture and depth. The aperture measurement can be performed by the aforementioned image processing and fitting module, which will not be elaborated here; while the depth measurement, in this embodiment of the invention, can be achieved by controlling the precise displacement of the electric Z-axis platform and reading its physical calibration value.
[0108] The structure of the measurement system can be referenced. Figure 3 .like Figure 3 As shown, the system for measuring the depth of micro-holes in a workpiece can include, from top to bottom: an industrial camera, a telecentric lens, a ring light source, and a motorized Z-axis platform carrying the target workpiece. This motorized Z-axis platform is driven by a separate controller (or "motion control card"), which connects and interacts with a computer device (terminal 102 or server 104) performing image processing via a communication interface (such as USB, RS232, or Ethernet). The controller's interface can be found in [reference needed]. Figure 4 .like Figure 4 As shown, the controller has function buttons such as "Start", "Stop", "Operation", "Output", and "Input".
[0109] The measurement process of the microaperture depth can be based on the "focal plane" principle of confocal optical imaging, and is specifically achieved through the following steps:
[0110] The first step is initial positioning to determine the location of the focal plane at the orifice:
[0111] In response to the micro-hole measurement request, the system first controls the electric Z-axis platform to move the target workpiece along the Z-axis (i.e., the optical axis and depth direction). During this process, the image acquisition module continuously operates and transmits the image stream to the image quality assessment module in real time. The operator observes the real-time image or, based on the sharpness score automatically calculated by the system, locates the sharpest and clearest position of the micro-hole opening edge in the image. At this point, the focal plane of the telecentric lens falls precisely on the micro-hole opening plane. The operator records the Z-axis coordinate Z1 displayed by the electric Z-axis platform controller at this moment as the opening position coordinate through the interactive interface (e.g., clicking the "Opening Position" button) or automatically recorded by the system when the sharpness score reaches its peak.
[0112] The second step is to move the focal point downwards to determine the position of the focal plane at the bottom of the hole:
[0113] After completing the orifice positioning through the aforementioned steps, the system controls the electric Z-axis platform via commands, causing it to precisely advance the workpiece downwards along the Z-axis (i.e., towards the lens). Specifically, the measuring platform can move incrementally in minimum step sizes of ≤1μm. For each tiny step, the image quality assessment module calculates the sharpness score for the current frame. When the focal plane moves to the bottom of the micro-hole, the edge or feature of the hole bottom will again reach its sharpest state in the image, resulting in another peak in the sharpness score. The system also records the Z-axis coordinate Z2 displayed by the electric Z-axis platform controller at this time as the hole bottom position coordinate.
[0114] The third step, depth calculation, can be based on direct conversion of physical displacement: the physical depth H of the micropore can be calculated using a simple displacement difference formula:
[0115] H = |Z2 - Z1|;
[0116] Z1 and Z2 are coordinate values with physical length units (such as millimeters or micrometers) directly read from the electric Z-axis platform controller. Since the electric Z-axis platform itself is precisely calibrated, its displacement accuracy directly determines the depth measurement accuracy (in this scheme, thanks to the platform with a minimum step size ≤1μm, the depth measurement accuracy can reach ≤±1μm). This calculation process is extremely simple and reliable, requiring no complex image algorithms; the results are received and displayed by the main control and UI modules.
[0117] Step 4: Calculate and output the depth-to-diameter ratio:
[0118] After obtaining the aperture D accurately calculated by the image algorithm (as obtained in step 208 above) and the aperture depth H directly measured by the platform displacement, the system's main control and UI modules automatically calculate and output the final depth-to-diameter ratio (H / D). Simultaneously, the three key parameters—aperture, aperture depth, and depth-to-diameter ratio—are displayed on the user interface, completing the full characterization of the micro-hole morphology. In this embodiment of the invention, by combining the depth measurement embodiment with the aperture measurement scheme, a complete, efficient, and high-precision micro-hole depth-to-diameter ratio measurement system is constructed. The depth measurement utilizes the physical displacement of the electric Z-axis platform, with accuracy directly guaranteed by high-precision hardware (≤±1μm), avoiding errors that may arise from purely visual depth measurement, improving the accuracy and safety of depth measurement, and thus enhancing the accuracy and safety of workpiece micro-hole depth-to-diameter ratio measurement.
[0119] Meanwhile, in this embodiment of the invention, the depth measurement process and the aperture measurement image acquisition process share the same hardware platform. Through a clear logical sequence, it achieves rapid and automatic completion of measurements in both dimensions within a single clamping operation, meeting the efficiency requirement of "single aperture measurement time ≤ 60 seconds". The depth measurement utilizes the controller's existing high-precision reading function, eliminating the need to develop complex visual depth detection algorithms. This fully demonstrates the advantages of hardware and software co-design, simplifying system complexity while ensuring high performance.
[0120] In some embodiments, before proceeding to the actual micropore edge detection stage, the overall sharpness of the image, especially the sharpness of the micropore edges, can be objectively quantified to ensure that the image data used for subsequent detection and fitting is reliable and of high quality, thereby guaranteeing the accuracy of the final micropore parameter measurement results from the source. Therefore, after performing image enhancement on the original image, the method further includes:
[0121] The enhanced image is subjected to image quality assessment to obtain the assessment result;
[0122] If the evaluation result meets the preset conditions, the step of displaying the enhanced image is executed in response to the labeling operation on the enhanced image;
[0123] If the evaluation result does not meet the preset conditions, a preset prompt message will be displayed; the prompt message is used to suggest adjusting the acquisition parameters of the original image.
[0124] Since the accuracy of microaperture measurement is highly dependent on the integrity of edge information, in this embodiment of the invention, the enhanced image is subjected to image quality evaluation to obtain an evaluation result. The evaluation result includes an image sharpness score, which reflects the richness of edge and detail information in the image. Optionally, considering the stability requirements of microaperture measurement, the evaluation result may also include the fluctuation of the sharpness score over consecutive frames or statistical values (such as the variance or moving average of the scores from the most recent N frames) to evaluate the stability of the imaging system.
[0125] Calculating image sharpness scores can involve extracting high-frequency information from the image using differential operators and calculating its statistical features. For example, a sharpness calculation algorithm based on the Laplacian operator can be used. By performing a second-order differential on the image using the Laplacian operator, the response value can effectively reflect the intensity of edges and details in the image. Calculating the average value of this response value can serve as an objective and effective indicator of sharpness.
[0126] The process of calculating the sharpness score may include:
[0127] a. Image conversion: Convert the enhanced image into a grayscale image.
[0128] b. Downsampling: The grayscale image is downsampled twice (e.g., using the pyrDown function) to reduce the amount of data required for subsequent calculations and to allow the algorithm to focus more on the main structural features in the image.
[0129] c. Noise suppression: Apply Gaussian blur (e.g., using a 3x3 convolution kernel) to the downsampled image to suppress any noise that may interfere with the sharpness assessment.
[0130] d. Laplace transform: The second derivative of the image is calculated using a 5x5 kernel Laplace operator to obtain the Laplace response image.
[0131] e. Scoring Calculation: Calculate the mean of the absolute values of the Laplacian response image and use this mean as the sharpness score for the current frame. The calculation formula can be expressed as: Sharpness Score = mean(|Laplacian(I)|).
[0132] Optionally, considering that the feature scale corresponding to the best sharpness may be different for micropores of different sizes, the downsampling number or the convolution kernel size of the Laplacian operator can be adaptively selected before or after downsampling based on the estimated micropore aperture pixel size, so that the evaluation focuses more on key features related to the target size.
[0133] A sharpness threshold can be preset (e.g., SHARPNESS_THRESHOLD=3500) to determine whether the evaluation result meets the preset conditions. If the sharpness score is higher than or equal to the threshold, the evaluation result is determined to meet the preset conditions, indicating that the current image sharpness is sufficient to support high-precision measurement. At this time, the subsequent steps of "displaying the enhanced image and responding to the labeling operation on the enhanced image" are executed normally.
[0134] If the sharpness score is below the threshold, the evaluation result is deemed not to meet the preset conditions, indicating that the image may be blurry, and direct measurement would introduce a large error. In this case, the marking process will not proceed or will be paused, and a preset prompt message will be displayed on the user interface. This prompt message is used to intuitively guide the user to check and adjust the acquisition parameters of the original image, such as prompting "Image is blurry, please check camera focus or lighting conditions." Optionally, the prompt message can also be specific adjustment suggestions, such as prompting "Please increase light intensity" when the score remains too low, or prompting "Please check if the device is stable" when the score fluctuates drastically.
[0135] It is understood that the sharpness assessment algorithm is not limited to the Laplacian mean method described above. In other optional implementations, to obtain an assessment effect more sensitive to the details of micro-hole edges, the Tenengrad gradient method can be used instead. This method may include calculating the Sobel gradients of the image in the X and Y directions, and may include calculating the sum of squares or the mean of the magnitudes as a sharpness score. This score is more sensitive to edges and has higher discriminative power, but the computational cost is relatively increased. Optionally, if higher computational efficiency is required and the image noise level is low, the more computationally simplified variance method can also be used. This method may include calculating the variance of the image grayscale values to assess the overall information content, significantly reducing the computational cost and still providing stable judgments in scenes with stable lighting. Optionally, considering that the variance method is not sensitive to grayscale changes in uniform background areas, it may also include first highlighting edge areas through a high-pass filter before calculating the variance to improve the targeting of the assessment.
[0136] This invention, through the introduction of a real-time, quantitative image quality assessment step, constructs a closed-loop quality control mechanism that can effectively intercept low-quality images caused by inaccurate focusing, environmental vibration, or sudden changes in illumination, avoid invalid manual marking and erroneous measurements, thereby significantly improving the reliability and data efficiency of the entire measurement process and reducing the time and cost waste caused by repeated detection.
[0137] In some embodiments, after image enhancement of the original image and before displaying the enhanced image, the method further includes:
[0138] The micropores are detected in the original image to obtain the reference position of the micropores in the original image;
[0139] The original image is cropped based on the reference position to obtain the image to be processed;
[0140] The image to be processed is enhanced to obtain the enhanced image.
[0141] In this invention, considering that when the original image has a large field of view or contains multiple microholes and complex backgrounds, it may be difficult to quickly mark and / or identify microholes, the present invention pre-locates the target microholes and extracts their areas to eliminate interference from irrelevant areas, concentrates computing resources to enhance and display key areas, and improves the targeting of subsequent image enhancement, the focus of the display area, and the convenience of manual marking.
[0142] Specifically, the reference location is used to identify the area where the microhole is located in the original image. This may include the bounding box where the microhole is located (such as the coordinates of the top left corner of the rectangle, its width, and height), or an estimate of the initial center pixel coordinates and radius pixel values of the microhole.
[0143] Microhole detection can include automatic detection algorithms based on image features. For example, a detection method based on Hough circle transform can be used. By performing edge detection on the image (e.g., using the Canny operator) and accumulating calculations in the parameter space, possible circular contours in the image can be automatically identified, and their center and radius can be output as reference positions.
[0144] Optionally, considering that the automatic detection algorithm may fail when the micropore edges are blurred or there is interference, micropore detection may also include providing a human-computer interaction interface that allows users to manually select or click on a low-resolution preview image to roughly determine the micropore area, and the system converts this manually specified area into the reference position.
[0145] Based on the reference position obtained in the preceding steps, the corresponding image region is cropped from the original image. For example, if the reference position is a bounding box, the rectangular region is directly cropped; if the reference position is the center and radius of a circle, a square region with a side length of twice the radius plus a certain margin (e.g., 20 pixels) can be cropped with the center of the circle as the center. This cropping operation can significantly reduce the image size that needs to be processed later.
[0146] The image enhancement process changes the target image from the complete original image to the cropped image to be processed. Since the image to be processed only contains the target micropore and its adjacent area, the image enhancement algorithm can focus more on optimizing the target area.
[0147] Optionally, considering the concentrated field of view of the image to be processed, the parameters of the image enhancement algorithm can be adjusted accordingly to obtain better results. For example, if the image enhancement algorithm adopts an adaptive illumination correction algorithm, the clip limit of CLAHE (Contrast Limited Adaptive Histogram Equalization) can be dynamically adjusted based on the gray-level distribution in the cropped area, thereby obtaining a contrast enhancement effect that is more adapted to the current local area.
[0148] This invention significantly reduces the amount of data required for subsequent image enhancement, quality assessment, and display processes by adding steps for locating and capturing the micro-hole region. By eliminating a large amount of irrelevant background interference, the image enhancement algorithm can more effectively target the micro-hole, improving edge enhancement and detail restoration. This lays a more solid foundation for subsequent high-precision marking and measurement. Furthermore, in the display stage, a magnified view containing only the target micro-hole is provided to the user, making the marking of edge points more intuitive and accurate, and reducing human error.
[0149] In some embodiments, the step of enhancing the original image to obtain an enhanced image includes:
[0150] The illumination channel of the original image is subjected to contrast-limited adaptive histogram equalization to obtain the equalized illumination channel.
[0151] The equalized illumination channel is blurred using a large Gaussian kernel to obtain the background illumination of the original image.
[0152] The equalized illumination channel is compared with the background illumination to obtain the corrected illumination channel corresponding to the original image.
[0153] The corrected illumination channel is merged with the original color channel of the original image to obtain the enhanced image.
[0154] To enhance the local contrast of the illumination channels and thus initially enhance details hidden in dark or bright areas, the original image can be converted from the BGR color space to the LAB color space. The LAB color space can effectively separate the brightness and color information of an image. Subsequently, three channels—L (brightness), A, and B—are separated. Contrast-limited adaptive histogram equalization (CLAHE) is applied to the L channel, which represents the illumination conditions. CLAHE, by dividing the image into blocks and performing local histogram equalization while limiting the magnitude of contrast amplification, can effectively enhance local details (such as the texture of the inner walls of micropores) while avoiding excessive noise amplification.
[0155] By applying Gaussian blur to the equalized L channel, its high-frequency detail components can be filtered out, resulting in a smooth image that primarily reflects slowly changing illumination distribution, i.e., background illumination. Optionally, a large convolutional kernel (e.g., 251x251 pixels) can be used for blurring to ensure sufficient averaging of local details and accurate estimation of macroscopic illumination non-uniformity.
[0156] The comparison operation may include dividing the equalized L channel by the background illumination to perform flat-field correction on the image, removing the influence of the illumination component from the image, thereby approximating the reflection component that should be presented under uniform illumination. After the division operation, normalization processing can be performed to adjust the result to a suitable numerical range (such as 0-255) to form the corrected L channel.
[0157] Finally, the corrected L channel is merged with the previously separated and retained A and B color channels to form a new LAB image, which is then converted back to the BGR color space to obtain the enhanced image with significantly improved illumination uniformity.
[0158] Understandably, illumination correction algorithms are not limited to the combination of CLAHE and flat-field correction performed in LAB space. Among other alternative implementations, to achieve better illumination unevenness reduction, especially in scenarios with strong reflections from the inner walls of micro-holes, the Retinex algorithm (such as Multi-Scale Retinex, MSR) can be used. By simulating the constancy principle of human vision, MSR attempts to decompose the image into "illumination components" and "reflection components," primarily focusing on processing the illumination component to achieve enhancement, resulting in superior performance.
[0159] Alternatively, if extremely high processing speed is required and the ambient lighting conditions are relatively stable, a more computationally simplified global histogram equalization algorithm can be used. This method directly redistributes the grayscale histogram of the entire image, reducing computational complexity and quickly improving the overall contrast of the image.
[0160] This invention provides a targeted image enhancement method by focusing on the separation and correction of the illumination channel. It can effectively suppress or eliminate uneven illumination of the inner wall caused by the position of the light source and the geometry of the micropore, so that the contrast of the micropore edge in different areas tends to be consistent, greatly improving the visibility and continuity of edge information. This provides higher quality and more consistent images for subsequent manual labeling or automatic identification, directly contributing to the improvement of the final aperture parameter measurement accuracy.
[0161] In some embodiments, the step of enhancing the original image to obtain an enhanced image includes:
[0162] The original image is subjected to edge-preserving filtering to obtain the filtered image;
[0163] Calculate the gradient magnitude of the original image to obtain the gradient magnitude image corresponding to the original image;
[0164] The filtered image and the normalized gradient magnitude image are fused according to a preset weight to obtain the enhanced image.
[0165] In order to enhance the contour details of the micro-hole edges while suppressing noise and preserving smooth areas, and to solve the problems of edge blurring and insufficient contrast caused by the material of the micro-hole inner wall, minor imperfections, or imaging resolution limitations, this embodiment of the invention performs edge-preserving filtering on the original image. This smooths out noise and minor textures in the image while maintaining the important edge structures from being blurred. The edge-preserving filtering may include the use of anisotropic diffusion filters, bilateral filters, or guided filters.
[0166] Optionally, a detail enhancement filter can be used. This filter controls the size of the neighborhood considered during filtering through the parameter sigma_s, and controls the degree of edge preservation through the parameter sigma_r, thereby smoothing non-edge areas while sharpening and highlighting edge details to obtain the preliminarily enhanced filtered image.
[0167] Gradient magnitude images are used to characterize the edge strength and orientation information of all regions in an image. Calculating gradient magnitude can involve using the Sobel operator to calculate the gradient of the image in the X and Y directions, respectively. Then, based on the gradient values in the X and Y directions, the gradient magnitude of each pixel is calculated, typically using the formula: Gradient magnitude = sqrt(G_x² + G_y²), where G_x and G_y are the gradient values in the X and Y directions, respectively. The resulting gradient magnitude image directly reflects the saliency of the edge at that location based on the pixel value.
[0168] The gradient magnitude image is normalized, linearly mapping its pixel values to between 0 and 255 to facilitate fusion with the filtered image. Then, the filtered image and the normalized gradient magnitude image are weighted and fused. In a preferred implementation, the preset weights are: 85% for the filtered image and 15% for the normalized gradient magnitude image. This weighting allocation, while preserving most of the original image's true information, selectively superimposes strong edge signals, resulting in a significantly sharper and more prominent edge contour in the final enhanced image compared to the original image.
[0169] It is understood that the implementation of the aforementioned detail enhancement is not limited to the specific algorithms and weights described above. Among other alternative implementations, to achieve a more natural edge enhancement effect, unsharp masking can be used instead. This involves creating an edge mask by subtracting a blurred version from the original image, and then weighted and superimposed this mask back onto the original image. This method has lower computational cost, and the degree of enhancement can be flexibly controlled through the mask weights.
[0170] Alternatively, if an extreme edge prominence effect is desired, especially for low-contrast edges, a strategy based on multi-scale gradient fusion can be used instead. Specifically, a strategy based on multi-scale gradient fusion can include calculating gradient magnitude images at different scales (such as through a Gaussian pyramid) and fusing them, thereby enhancing both coarse and fine edges simultaneously, but the computational complexity will increase accordingly.
[0171] The fusion weights can be adaptively adjusted according to image characteristics. For example, when the overall gradient magnitude of the image is generally low (the edges are generally blurred), the fusion weights of the gradient magnitude images can be appropriately increased (e.g., from 15% to 20% or 25%) to apply stronger edge enhancement.
[0172] This invention, through weighted fusion of edge-preserving filtering and original gradient information, effectively enhances the sharpness and continuity of micropore edges, making previously blurred or broken edges clear and complete. This greatly facilitates accurate marking by the human eye in subsequent steps and provides a higher-quality data foundation for potential automatic edge detection algorithms. This directly reduces the uncertainty of edge localization, thus providing a crucial guarantee for ultimately achieving micron-level precision aperture measurement.
[0173] In some embodiments, the number of edge coordinate points is at least three; the step of fitting the edge coordinate points to obtain the edge contour of the micropore in the enhanced image, and determining the pore size parameter of the micropore based on the edge contour, includes:
[0174] The pixel center coordinates and pixel radius of the smallest circumscribed circle of the at least three marker points are obtained by fitting the at least three marker points using the inner circumference method.
[0175] Based on the calibration parameters of the acquisition device for the original image, the coordinates of the pixel center and the pixel radius are converted to obtain the aperture parameters of the micropore.
[0176] Among them, discrete user-marked points can be used to reconstruct the complete circular outline of the micropore through a robust geometric algorithm, and with the help of camera calibration technology, the pixel size in the image can be accurately converted into the real physical size, thereby obtaining high-precision aperture parameters.
[0177] The most probable circular boundary is calculated from user-marked discrete points. The principle of the inner circle method is to find a circle with the smallest area that completely encloses all points for a given set of planar points. The system calls this algorithm (e.g., through the cv2.minEnclosingCircle function in the OpenCV library), takes all user-marked edge coordinates as input, and outputs the center pixel coordinates (cx, cy) and pixel radius (radius) of the smallest circumscribed circle. This circle is the fitted micropore edge contour.
[0178] Optionally, considering that there may be random deviations in a single user marking, the method may further include: receiving a series of edge coordinate points generated by multiple marking operations by the user on the same micropore; then performing statistical analysis on these points (e.g., removing obvious outliers through clustering algorithms, or calculating the median of the coordinates of all points); and finally performing minimum circumcircle fitting based on the filtered or statistically stable set of points, thereby improving the anti-interference ability and repeatability accuracy of the fitting results.
[0179] Based on the calibration parameters of the acquisition device for the original image, the coordinates of the pixel center and the pixel radius are converted to obtain the aperture parameters of the micropore.
[0180] After obtaining pixel-level contour parameters, they need to be converted into physically meaningful dimensions. The calibration parameters of the acquisition device should include at least the pixel size of the camera sensor (e.g., 0.0022 mm / pixel) and the magnification of the optical lens (e.g., 4.0x). The conversion formula can be:
[0181] Physical diameter = (2 × pixel radius × pixel size) / magnification;
[0182] The aperture parameter may also include the physical center position calculated from the pixel center coordinates, which is used for the relative position analysis of multi-hole components.
[0183] It is understood that the fitting and measurement strategy is not limited to the methods based on manual marking and the minimum circumcircle. Optionally, to achieve fully automated measurement and improve batch inspection efficiency, the Kohoff circle detection algorithm can also be used, thereby eliminating the need for manual marking by the user and enabling automatic searching and fitting of circular contours in the image. This is particularly suitable for scenarios such as online inspection on production lines, but its reliability is highly dependent on image quality. Typically, the sharpness score of the enhanced image is required to be no less than a preset value, such as 4000, and the micropore edges must be intact and free from obvious interference.
[0184] Correspondingly, if the micropore has slight shape defects during actual processing or appears elliptical in imaging, an ellipse fitting algorithm can be used to fit the optimal ellipse through discrete points and calculate its major and minor axes. The average value can be taken as the equivalent diameter or an early warning can be issued when the ellipticity exceeds the tolerance. In the non-ideal case where there are slight defects at the edge of the micropore, the accuracy of ellipse fitting can be significantly improved compared to the minimum circumcircle algorithm.
[0185] In an optional embodiment, automatic triggering measurement can be used to further enhance the level of automation. Specifically, the reference position of the micropore in the image can be automatically located first by an image recognition algorithm (such as template matching or feature detection). Then, the system automatically performs image cropping, enhancement, and quality assessment. When the assessment result meets the preset conditions, the Hough circle detection or ellipse fitting algorithm is automatically called to complete the measurement, without any manual intervention.
[0186] This invention provides a micro-hole measurement solution that balances accuracy and robustness by clearly defining the technical path of minimum circumcircle fitting combined with calibration conversion. While ensuring micron-level measurement accuracy, it provides a variety of optional fitting and automation strategies, enabling the technical solution to flexibly adapt to the needs of various application scenarios, from laboratory research and development to batch testing in industrial settings.
[0187] In one exemplary embodiment, such as Figure 5 As shown, the system upon which the workpiece measurement method is based may include: an image acquisition module, responsible for controlling the industrial camera hardware to capture and acquire raw images. This module is the system's data input terminal.
[0188] Image preprocessing module: Responsible for enhancing the acquired raw images to obtain enhanced images, thereby improving image quality and laying the foundation for subsequent analysis.
[0189] Image quality assessment module: responsible for calculating image quality such as sharpness score in real time, monitoring the quality stability of input images, and ensuring the reliability of measurement data.
[0190] Core measurement module: Responsible for responding to the labeling operation on the enhanced image, thereby performing fitting calculations to obtain the physical size of the micropores.
[0191] Main control and UI module: As the control center and interactive interface of the system, it is responsible for scheduling other modules, processing user input, and displaying measurement results and system status.
[0192] like Figure 6 As shown, the data processing timing process based on the above system may include:
[0193] The raw image data is generated by the image acquisition module and sent to the image preprocessing module for enhancement. The processed image is then sent in parallel to the image quality assessment module and the core measurement module. The outputs of the quality assessment module (sharpness score) and the core measurement module (center, radius, diameter) are both sent to the main control and UI module for integrated display and logic control.
[0194] To better illustrate the interaction process of this invention's embodiments, please refer to... Figures 7-10 , Figure 7 This is a schematic diagram of the original image in a workpiece measurement method in another embodiment; Figure 8 This is a schematic diagram of the image to be processed in a workpiece measurement method in another embodiment; Figure 9 This is a schematic diagram of marker points in an enhanced image in a workpiece measurement method according to another embodiment; Figure 10 This is a schematic diagram of the edge profile of a microhole obtained by fitting in a workpiece measurement method in another embodiment.
[0195] Among them, such as Figure 7 As shown, the original image in the interactive interface only shows a hole on the material surface, but due to processing precision and defects, the shape of the hole is not regular or complete. After pressing the measurement button (e.g., "c"), the program automatically captures the original image of the hole area (e.g., ...). Figure 8And by having the operator click on three points on the boundary of the hole with the mouse, the system automatically fits a circle (e.g. Figure 9 After pressing the spacebar to confirm, the calibrated image will be displayed on the main interface (e.g., ...). Figure 10 At this point, the diameter of the circle can be obtained through the data feedback in the upper left corner.
[0196] It should be understood that although the steps in the flowcharts of the embodiments described above are shown sequentially according to the arrows, these steps are not necessarily executed in the order indicated by the arrows. Unless explicitly stated herein, there is no strict order restriction on the execution of these steps, and they can be executed in other orders. Moreover, at least some steps in the flowcharts of the embodiments described above may include multiple steps or multiple stages. These steps or stages are not necessarily completed at the same time, but can be executed at different times. The execution order of these steps or stages is not necessarily sequential, but can be performed alternately or in turn with other steps or at least some of the steps or stages in other steps. It is understood that the steps in different embodiments can be freely combined as needed, and all non-contradictory solutions formed by such combinations are within the scope of protection of this application.
[0197] Based on the same inventive concept, this application also provides a workpiece micro-hole measuring device for implementing the workpiece micro-hole measuring method described above. The solution provided by this device is similar to the solution described in the above method; therefore, the specific limitations of one or more workpiece micro-hole measuring device embodiments provided below can be found in the limitations of the workpiece micro-hole measuring method described above, and will not be repeated here.
[0198] In one exemplary embodiment, such as Figure 11 As shown, a workpiece micro-hole measuring device 300 is provided, comprising:
[0199] The acquisition module 302 is used to acquire images of the target workpiece in response to a micro-hole measurement request for the target workpiece, and obtain the original image of the target workpiece.
[0200] The enhancement module 304 is used to enhance the original image to obtain an enhanced image of the target workpiece; the image enhancement includes at least one of illumination unevenness correction and detail enhancement processing;
[0201] The marking module 306 is used to display the enhanced image and responds to a marking operation on the enhanced image; the marking operation is used to mark the edge coordinate points of the microholes in the target workpiece;
[0202] The fitting module 308 is used to fit the edge coordinate points to obtain the edge contour of the micropore in the enhanced image, and to determine the pore size parameter of the micropore based on the edge contour.
[0203] Each module in the aforementioned workpiece micro-hole measuring device can be implemented entirely or partially through software, hardware, or a combination thereof. These modules can be embedded in the processor of a computer device in hardware form or independent of it, or stored in the memory of a computer device in software form, so that the processor can call and execute the operations corresponding to each module.
[0204] In one exemplary embodiment, a computer device is provided, which may be a terminal, and its internal structure diagram may be as follows: Figure 12 As shown, the computer device includes a processor, memory, input / output interface, communication interface, display unit, and input device. The processor, memory, and input / output interface are connected via a system bus, and the communication interface, display unit, and input device are also connected to the system bus via the input / output interface. The processor provides computational and control capabilities. The memory includes non-volatile storage media and internal memory. The non-volatile storage media stores the operating system and computer programs. The internal memory provides an environment for the operation of the operating system and computer programs in the non-volatile storage media. The input / output interface is used for exchanging information between the processor and external devices. The communication interface is used for wired or wireless communication with external terminals; wireless communication can be achieved through Wi-Fi, mobile cellular networks, Near Field Communication (NFC), or other technologies. When the computer program is executed by the processor, it implements a method for measuring micro-holes in a workpiece. The display unit is used to form a visually visible image and can be a display screen, projection device, or virtual reality imaging device. The display screen can be an LCD screen or an e-ink screen. The input device of the computer device can be a touch layer covering the display screen, or buttons, trackballs, or touchpads set on the casing of the computer device, or external keyboards, touchpads, or mice, etc.
[0205] Those skilled in the art will understand that Figure 12 The structure shown is merely a block diagram of a portion of the structure related to the present application and does not constitute a limitation on the computer device to which the present application is applied. Specific computer devices may include more or fewer components than those shown in the figure, or combine certain components, or have different component arrangements.
[0206] In one exemplary embodiment, a computer device is provided, including a memory and a processor, wherein the memory stores a computer program, and the processor executes the computer program to implement the steps included in any of the aforementioned workpiece micro-hole measurement method embodiments.
[0207] In one embodiment, a computer-readable storage medium is provided having a computer program stored thereon, which, when executed by a processor, implements the steps included in any of the aforementioned workpiece micro-hole measurement method embodiments.
[0208] In one embodiment, a computer program product is provided, including a computer program that, when executed by a processor, implements the steps included in any of the aforementioned workpiece micro-hole measurement method embodiments.
[0209] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, data stored, data displayed, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties, and the collection, use and processing of the relevant data must comply with relevant regulations.
[0210] Those skilled in the art will understand that all or part of the processes in the methods of the above embodiments can be implemented by a computer program instructing related hardware. The computer program can be stored in a non-volatile computer-readable storage medium, and when executed, it can include the processes of the embodiments of the above methods. Any references to memory, databases, or other media used in the embodiments provided in this application can include at least one of non-volatile memory and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetic random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory can include random access memory (RAM) or external cache memory, etc. By way of illustration and not limitation, RAM can take many forms, such as Static Random Access Memory (SRAM) or Dynamic Random Access Memory (DRAM). The databases involved in the embodiments provided in this application may include at least one type of relational database and non-relational database. Non-relational databases may include, but are not limited to, blockchain-based distributed databases. The processors involved in the embodiments provided in this application may be general-purpose processors, central processing units, graphics processing units, digital signal processors, programmable logic devices, quantum computing-based data processing logic devices, artificial intelligence (AI) processors, etc., and are not limited to these.
[0211] The technical features of the above embodiments can be combined in any way. For the sake of brevity, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this application.
[0212] The embodiments described above are merely illustrative of several implementation methods of this application, and while the descriptions are specific and detailed, they should not be construed as limiting the scope of this patent application. It should be noted that those skilled in the art can make various modifications and improvements without departing from the concept of this application, and these all fall within the protection scope of this application. Therefore, the protection scope of this application should be determined by the appended claims.
Claims
1. A method for measuring micro-holes in a workpiece, characterized in that, The method includes: In response to a micropore measurement request for a target workpiece, an image of the target workpiece is acquired to obtain an original image of the target workpiece; The original image is enhanced to obtain an enhanced image of the target workpiece; the image enhancement includes at least one of illumination unevenness correction and detail enhancement processing; The enhanced image is displayed in response to a marking operation on the enhanced image; the marking operation is used to mark the edge coordinates of the microholes in the target workpiece. The edge contour of the micropore in the enhanced image is obtained by fitting the edge coordinate points, and the pore size parameter of the micropore is determined based on the edge contour.
2. The method according to claim 1, characterized in that, After performing image enhancement on the original image, the method further includes: The enhanced image is subjected to image quality assessment to obtain the assessment result; If the evaluation result meets the preset conditions, the step of displaying the enhanced image is executed in response to the labeling operation on the enhanced image; If the evaluation result does not meet the preset conditions, a preset prompt message will be displayed; the prompt message is used to suggest adjusting the acquisition parameters of the original image.
3. The method according to claim 1, characterized in that, After image enhancement of the original image and before displaying the enhanced image, the method further includes: The micropores are detected in the original image to obtain the reference position of the micropores in the original image; The original image is cropped based on the reference position to obtain the image to be processed; The image to be processed is enhanced to obtain the enhanced image.
4. The method according to claim 1, characterized in that, The step of enhancing the original image to obtain the enhanced image includes: The illumination channel of the original image is subjected to contrast-limited adaptive histogram equalization to obtain the equalized illumination channel. The equalized illumination channel is blurred using a large Gaussian kernel to obtain the background illumination of the original image. The equalized illumination channel is compared with the background illumination to obtain the corrected illumination channel corresponding to the original image. The corrected illumination channel is merged with the original color channel of the original image to obtain the enhanced image.
5. The method according to claim 1, characterized in that, The step of enhancing the original image to obtain the enhanced image includes: The original image is subjected to edge-preserving filtering to obtain the filtered image; Calculate the gradient magnitude of the original image to obtain the gradient magnitude image corresponding to the original image; The filtered image and the normalized gradient magnitude image are fused according to a preset weight to obtain the enhanced image.
6. The method according to claim 1, characterized in that, The number of edge coordinate points is at least three; the process of fitting the edge coordinate points to obtain the edge contour of the micropore in the enhanced image, and determining the pore size parameter of the micropore based on the edge contour, includes: The pixel center coordinates and pixel radius of the smallest circumscribed circle of the at least three marker points are obtained by fitting the at least three marker points using the inner circumference method. Based on the calibration parameters of the acquisition device for the original image, the coordinates of the pixel center and the pixel radius are converted to obtain the aperture parameters of the micropore.
7. A workpiece micro-hole measuring device, characterized in that, The device includes: The acquisition module is used to acquire images of the target workpiece in response to a micro-hole measurement request for the target workpiece, and obtain the original image of the target workpiece. An enhancement module is used to enhance the original image to obtain an enhanced image of the target workpiece; the image enhancement includes at least one of illumination unevenness correction and detail enhancement processing; A marking module is used to display the enhanced image and responds to a marking operation on the enhanced image; the marking operation is used to mark the edge coordinates of microholes in the target workpiece; The fitting module is used to fit the edge coordinate points to obtain the edge contour of the micropore in the enhanced image, and to determine the pore size parameter of the micropore based on the edge contour.
8. A computer device comprising a memory and a processor, wherein the memory stores a computer program, characterized in that, When the processor executes the computer program, it implements the steps of the method according to any one of claims 1 to 6.
9. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by a processor, it implements the steps of the method according to any one of claims 1 to 6.
10. A computer program product, comprising a computer program, characterized in that, When the computer program is executed by a processor, it implements the steps of the method according to any one of claims 1 to 6.