A visual detection device and method for knife corner production and processing

CN123015412APending Publication Date: 2026-10-30SHANDONG JUNING MASCH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202611121204.X
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-07-27
Publication Date
2026-10-30

AI Technical Summary

Technical Problem

[0003]然而,在现场视觉检测实践中发现,由于硬质合金刀具的刃面具有较高光学反射率,经夹具、防护结构等非预期镜面反射会在图像中形成紧邻真实刃边的次级虚影,该次级虚影的强度及位置受工件表面状态和检测环境变动影响,常规的固定阈值或一次性背景校正方式难以将其与真实刃口边缘稳定区分,由此导致亚像素边缘定位过程中参与拟合的数据点被虚影误导而产生偏移,使得同一刀具在相邻检测中得到的角度测量值出现不可忽略的波动,导致合格品被误判或实际角度偏差未能被检出

Benefits of technology

[0044]1.通过调节平行背光源的发光强度并计算不同照明条件下梯度方向分布的相异度,将次级虚影对光照变化的非线性响应转化为可量化的虚影响应评估参量,使得紧邻真实刃边的寄生像斑被赋予区别于真实几何边缘的数值特征,从而为后续精确分离提供了可靠依据,将虚影响应评估参量转化为相异度标量场并沿梯度方向与垂直梯度方向提取主曲率,借助真实刃边在相异度标量场中固有的带状低值延伸形态和脊状曲率响应,以曲率极性与幅值关系联合标量值约束完成像素级筛选,避免了单纯依赖灰度阈值或固定模板在处理镜面反射引起的缓变虚影时出现的误判。

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN123015412A_ABST
    Figure CN123015412A_ABST
Patent Text Reader

Abstract

The application discloses a kind of visual detection device and method for knife angle production and processing, specifically relates to image recognition technical field, for solving the problem that the secondary shadow of real blade edge is formed by unexpected reflection due to high reflectivity of blade surface in cemented carbide tool visual detection, resulting in fluctuation and misjudgment of knife angle measurement value;It is through collecting original gray image under parallel backlight illumination and calculating gradient direction atlas, adjusting backlight luminous intensity to obtain gradient direction distribution vector under different illumination conditions, to construct virtual impact response evaluation parameter by distribution dissimilarity and map as dissimilarity scalar field, extract principal curvature along gradient direction and perpendicular gradient direction in dissimilarity scalar field, utilize ridge feature and scalar value constraint to screen out the pixel set corresponding to real blade edge, then carry out iterative straight line fitting to the pixel set to obtain blade edge straight line and calculate the knife angle.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of image recognition technology, and more specifically, to a visual inspection device and method for the production and processing of knife corners. Background Technology

[0002] In the mass production of cemented carbide cutting tools, the detection of geometric parameters such as the wedge angle, rake angle, and clearance angle has widely adopted machine vision-based non-contact optical measurement methods to replace traditional visual comparison with templates. The basic process is as follows: after the tool to be tested is positioned on the fixture, the projection contour of the cutting edge is obtained through a parallel backlight. An industrial camera captures the image, and then the cutting edge is extracted through image processing and fitted with a straight line or contour line. Finally, the cutting angle value is calculated. Since the cutting angle parameters directly affect cutting performance and tool life, full inspection within tens of micrometers of accuracy is required in production, and the tool must be stable enough to adapt to continuous operation of the production line.

[0003] However, in field visual inspection practice, it has been found that due to the high optical reflectivity of the cutting surface of cemented carbide tools, unexpected specular reflections from fixtures, protective structures, etc., will form secondary ghost images in the image that are close to the real cutting edge. The intensity and position of these secondary ghost images are affected by changes in the workpiece surface condition and the inspection environment. Conventional fixed thresholds or one-time background correction methods are difficult to stably distinguish them from the real cutting edge. As a result, the data points involved in the fitting process during sub-pixel edge positioning are misled by the ghost images and become offset. This causes non-negligible fluctuations in the angle measurement values ​​obtained by the same tool in adjacent inspections, leading to the misjudgment of qualified products or the failure to detect the actual angle deviation. Summary of the Invention

[0004] In order to overcome the above-mentioned defects of the prior art, the present invention provides a visual inspection device and method for the production and processing of knife corners to solve the problems mentioned in the background art.

[0005] To achieve the above objectives, the present invention provides the following technical solution:

[0006] A visual inspection method for manufacturing knife corners includes the following steps:

[0007] S1: Acquire the raw grayscale image of the cutting edge of the tool under parallel backlight illumination by an industrial camera;

[0008] S2: Calculate the gradient direction field of the original grayscale image to generate a gradient direction map. Each pixel in the gradient direction map has a corresponding gradient direction.

[0009] S3: Adjust the luminous intensity of the parallel backlight, acquire at least two images under different illumination intensities and generate corresponding gradient direction maps, extract the gradient direction distribution vector of the neighboring region of each pixel under different illumination intensities, and calculate the distribution dissimilarity between the two gradient direction distribution vectors as a virtual influence evaluation parameter.

[0010] S4: Map the virtual influence response evaluation parameters to a dissimilarity scalar field, calculate the principal curvature along its gradient direction and perpendicular to its gradient direction at each pixel position in the dissimilarity scalar field, determine the pixels with ridge-like features in the principal curvature combination and dissimilarity scalar values ​​lower than the neighborhood mean as the pixels corresponding to the real edge and retain them, remove the remaining pixels, and obtain the pixel set corresponding to the real edge.

[0011] S5: Fit the edge of the corresponding real cutting edge to the pixel set, and calculate the cutting angle based on the fitted cutting edge line.

[0012] Furthermore, S1 includes:

[0013] The tool to be tested is clamped on the fixture at the testing station, and the parallel backlight is turned on so that the parallel beam emitted by the parallel backlight is projected onto the cutting edge of the tool and forms a projected profile.

[0014] An industrial camera is used to expose and capture the projected contour, obtaining a raw grayscale image that includes the actual blade edge projection and secondary ghost images formed by reflections from the fixture or protective structure.

[0015] Furthermore, S2 includes:

[0016] Calculate the horizontal and vertical gradients pixel by pixel in the original grayscale image;

[0017] The initial gradient direction angle is obtained by taking the arctangent of the ratio of the horizontal gradient to the vertical gradient;

[0018] The initial gradient direction angle is reduced to a preset angle range;

[0019] Local nonmaximum suppression is applied to the reduced gradient direction angle to obtain the gradient direction corresponding to each pixel.

[0020] The gradient directions of all pixels are summarized to form a gradient direction map.

[0021] Furthermore, S3 includes:

[0022] While keeping the tool clamping state unchanged, the luminous intensity of the parallel backlight is adjusted to a first intensity value, triggering the industrial camera to acquire a first illumination intensity image. Gradient direction field calculation is performed on the first illumination intensity image to obtain a first gradient direction map. Then, the luminous intensity of the parallel backlight is adjusted to a second intensity value that is different from the first intensity value, triggering the industrial camera to acquire a second illumination intensity image. Gradient direction field calculation is performed on the second illumination intensity image to obtain a second gradient direction map.

[0023] For each pixel in the first gradient orientation map, count the frequency of the gradient orientation of all pixels within a preset neighborhood window centered on the corresponding pixel falling into each orientation interval, and construct the first gradient orientation distribution vector. For the same pixel position in the second gradient orientation map, count the frequency of the gradient orientation of all pixels within a neighborhood window of the same size centered on the corresponding pixel falling into the same orientation interval, and construct the second gradient orientation distribution vector.

[0024] For each pixel, calculate the Bartholomew's distance between its first gradient direction distribution vector and its second gradient direction distribution vector, and use the Bartholomew's distance as the virtual influence response evaluation parameter for the corresponding pixel.

[0025] Furthermore, constructing the first gradient direction distribution vector and the second gradient direction distribution vector includes: dividing the preset angle interval into several direction intervals, determining the direction interval affiliation of the gradient direction of each pixel within the preset neighborhood window, counting the number of pixels falling into each direction interval, using the number of pixels in each direction interval to form vector elements, and arranging them in sequence to generate the gradient direction distribution vector. The first gradient direction distribution vector and the second gradient direction distribution vector use the same direction interval division method and the same vector element arrangement order.

[0026] Furthermore, S4 includes:

[0027] The virtual effect evaluation parameter value of each pixel is directly assigned as the dissimilarity scalar value of the corresponding pixel, and the dissimilarity scalar values ​​of all pixels together constitute the dissimilarity scalar field.

[0028] For each pixel position in the dissimilarity scalar field, a local neighborhood window centered on the corresponding pixel position is constructed. A quadratic surface is fitted within the local neighborhood window. The principal curvature along the gradient direction is obtained from the second-order partial derivative of the quadratic surface in the gradient direction, and the principal curvature in the vertical gradient direction is obtained from the second-order partial derivative of the quadratic surface in the vertical gradient direction.

[0029] Traverse all pixels in the dissimilarity scalar field, and determine the pixels that simultaneously satisfy the following conditions: the principal curvature along the gradient direction is negative, the absolute value of the principal curvature perpendicular to the gradient direction is less than the absolute value of the principal curvature along the gradient direction, and the dissimilarity scalar value is lower than the average value of the dissimilarity scalar values ​​of all pixels in the local neighborhood window is the pixel corresponding to the real edge. Then, add the pixels corresponding to the real edge to the pixel set one by one, and remove the pixels that do not meet the conditions.

[0030] Further, calculating the principal curvature along the gradient direction and the principal curvature perpendicular to the gradient direction includes: performing least-squares surface fitting on the dissimilarity scalar values ​​of each pixel within the local neighborhood window to obtain the coefficients of the quadratic surface equation; constructing a Hessian matrix from the coefficients of the quadratic surface equation; performing eigenvalue decomposition on the Hessian matrix; and substituting the unit vectors in the gradient direction and the unit vectors perpendicular to the gradient direction into the quadratic expression to obtain the principal curvature along the gradient direction and the principal curvature perpendicular to the gradient direction.

[0031] Furthermore, S5 includes:

[0032] Extract the coordinates of all pixels in the pixel set corresponding to the actual blade edge, and perform principal component analysis on the coordinates;

[0033] The direction of the eigenvector corresponding to the largest eigenvalue is used as the initial cutting edge direction;

[0034] Calculate the distance from each pixel coordinate to the initial straight line fitted along the initial blade direction, remove pixels whose distance exceeds the preset threshold, and perform principal component analysis and fit a straight line again on the remaining pixel coordinates;

[0035] Repeat the elimination and fitting process until the pixel coordinate set no longer changes to obtain the cutting edge line. The angle between the cutting edge line and the pre-calibrated reference direction is taken as the cutting angle.

[0036] Furthermore, removing pixels whose distance exceeds a preset threshold includes: calculating the vertical distance of each pixel coordinate to the initial straight line, weighting the median of all vertical distances and the absolute deviation of the median, using the weighted combination result as the threshold, and determining the pixel coordinates whose vertical distance is greater than the threshold as deviation points and removing them.

[0037] On the other hand, the present invention provides a visual inspection device for the production and processing of knife corners, comprising the following modules:

[0038] The image acquisition module is used to acquire raw grayscale images of the cutting edge of the tool under parallel backlight illumination by an industrial camera.

[0039] The orientation generation module is used to calculate the gradient orientation field of the original grayscale image and generate a gradient orientation map. Each pixel in the gradient orientation map has a corresponding gradient orientation.

[0040] The parameter evaluation module is used to adjust the luminous intensity of the parallel backlight, acquire at least two images under different illumination intensities and generate corresponding gradient direction maps, extract the gradient direction distribution vector of the neighboring region of each pixel under different illumination intensities, and calculate the distribution dissimilarity between the two gradient direction distribution vectors as a virtual influence response evaluation parameter.

[0041] The pixel filtering module is used to map the virtual influence response evaluation parameters into a dissimilarity scalar field, calculate the principal curvature along its gradient direction and perpendicular to its gradient direction at each pixel position in the dissimilarity scalar field, determine the pixels with ridge-like features in the principal curvature combination and dissimilarity scalar values ​​lower than the neighborhood mean as the pixels corresponding to the real edge and retain them, and remove the remaining pixels to obtain the pixel set corresponding to the real edge.

[0042] The fitting calculation module is used to fit the edge of the corresponding real cutting edge pixel set and calculate the cutting angle based on the fitted cutting edge line.

[0043] Compared with the prior art, the present invention has the following beneficial effects:

[0044] 1. By adjusting the luminous intensity of the parallel backlight and calculating the dissimilarity of the gradient direction distribution under different lighting conditions, the nonlinear response of the secondary ghost image to changes in illumination is transformed into a quantifiable ghost image response evaluation parameter. This allows the parasitic image spot adjacent to the real edge to be given numerical characteristics that are different from the real geometric edge, thus providing a reliable basis for subsequent accurate separation. The ghost image response evaluation parameter is transformed into a dissimilarity scalar field, and the principal curvature is extracted along the gradient direction and the perpendicular gradient direction. With the help of the inherent band-like low-value extension shape and ridge-like curvature response of the real edge in the dissimilarity scalar field, pixel-level screening is completed by combining the curvature polarity and amplitude relationship with scalar value constraints. This avoids misjudgment when dealing with slowly varying ghost images caused by specular reflection by simply relying on grayscale thresholds or fixed templates.

[0045] 2. The pixel set of the true cutting edge retains the true direction and contour of the cutting edge in spatial distribution, eliminating ghost pixels whose position fluctuates with illumination. This ensures that the subsequent cutting edge fitting process is not disturbed by parasitic reflections. The fitted cutting edge straight line can stably reflect the actual geometric orientation of the cutting edge. In continuous production inspection, when facing changes in the surface condition of the fixture and fluctuations in the inspection environment, there is no need to recalibrate or manually set the mask. Consistent tool angle measurement results can be obtained at different inspection times. This reduces the angle measurement fluctuations and misjudgments caused by secondary ghost images, and improves the measurement reliability of the vision inspection system in the mass production scenario of carbide tools. Attached Figure Description

[0046] Figure 1 This is a flowchart of a visual inspection method for blade corner production processing according to the present invention;

[0047] Figure 2 This is a schematic diagram of the structure of a visual inspection device for the production and processing of knife corners according to the present invention. Detailed Implementation

[0048] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those of ordinary skill in the art without creative effort are within the scope of protection of the present invention.

[0049] Example 1: Figure 1 The present invention provides a visual inspection method for the production and processing of knife corners, which includes the following steps:

[0050] S1: Acquire the raw grayscale image of the cutting edge of the tool under parallel backlight illumination by an industrial camera;

[0051] S2: Calculate the gradient direction field of the original grayscale image to generate a gradient direction map. Each pixel in the gradient direction map has a corresponding gradient direction.

[0052] S3: Adjust the luminous intensity of the parallel backlight, acquire at least two images under different illumination intensities and generate corresponding gradient direction maps, extract the gradient direction distribution vector of the neighboring region of each pixel under different illumination intensities, and calculate the distribution dissimilarity between the two gradient direction distribution vectors as a virtual influence evaluation parameter.

[0053] S4: Map the virtual influence response evaluation parameters to a dissimilarity scalar field, calculate the principal curvature along its gradient direction and perpendicular to its gradient direction at each pixel position in the dissimilarity scalar field, determine the pixels with ridge-like features in the principal curvature combination and dissimilarity scalar values ​​lower than the neighborhood mean as the pixels corresponding to the real edge and retain them, remove the remaining pixels, and obtain the pixel set corresponding to the real edge.

[0054] S5: Fit the edge of the corresponding real cutting edge to the pixel set, and calculate the cutting angle based on the fitted cutting edge line.

[0055] In the specific implementation of S1, based on the geometric characteristics and clamping reference requirements of the tool to be tested at the testing station, a fixture with a clamping interface adapted to the shank of the tool to be tested is selected. The fixture is fixed to the bearing platform of the testing station with bolts, so that the positioning surface of the fixture is in contact with the reference reference surface of the bearing platform. The tool to be tested is pushed in along the guide groove of the clamping interface of the fixture until the front stop surface of the tool to be tested abuts against the axial limiting step provided in the fixture. Then, the clamping mechanism of the fixture is locked, so that the tool to be tested is constrained in all six spatial degrees of freedom. The part of the tool to be tested where the cutting edge is located extends outside the fixture and faces the direction of the parallel backlight emission window. The testing station's support platform is pre-calibrated for horizontality and verticality. The calibration method is as follows: with the tool unloaded, a standard cubic block is attached to the fixture's positioning surface. The positional deviation of the light spot reflected from the reference surface of the block in the parallel and vertical directions within the industrial camera's field of view is used for adjustment. This ensures that the tilt deviation of the fixture's positioning surface in the direction of the industrial camera's imaging optical axis is less than the set allowable value, thereby guaranteeing that the spatial geometric relationship between the cutting edge of the tool under test, the parallel backlight, and the industrial camera meets the measurement repeatability requirements after each clamping.

[0056] A parallel backlight is activated. The backlight uses an array of LEDs, an optical diffuser, and a collimating lens group to create an illumination path, emitting an approximately parallel beam that is projected onto the cutting edge of the tool under test. Because the cutting edge of the tool is made of cemented carbide and has a low surface roughness, it exhibits specular reflection characteristics. The parallel beam is blocked by the tool body at the edge contour boundary, forming a high-contrast projection contour at the boundary between the transmission and blocking areas. The light intensity distribution of the projection contour abruptly changes at the geometric shadow boundary; this projection contour is captured by an industrial camera. To reduce the interference of ambient stray light on the contrast of the projection contour, a light shield is placed between the parallel backlight and the testing station. The light shield has a light-passing hole corresponding to the industrial camera lens. The angle between the principal ray direction of the parallel beam and the optical axis of the industrial camera is determined according to the type of tool angle being measured: when measuring the wedge angle of the tool, the principal ray direction of the parallel beam is set to be coplanar with the preset normal plane of the corresponding measured cutting surface and symmetrically configured with respect to the optical axis of the industrial camera, so that the projected contour of the cutting edge reflects the true contour shape of the cutting edge within the normal plane.

[0057] After the cutting edge of the tool under test is projected by a parallel backlight, an industrial camera captures the projection profile to obtain a raw grayscale image. The industrial camera uses a global shutter complementary metal-oxide-semiconductor sensor and is equipped with a telecentric lens. The telecentric lens ensures that the magnification of the projection profile remains constant despite small changes in object distance, reducing measurement deviations caused by repeated positioning errors during clamping. During exposure acquisition, the exposure time of the industrial camera is set according to the current luminous intensity of the parallel backlight so that the grayscale value of the pixel containing the actual edge projection in the tool's projection profile region falls within a preset range of the sensor's linear response range, for example, between 40 and 200. The gain is maintained at the baseline gain value to avoid amplifying the sensor's noise floor. The acquired raw grayscale image is stored as a pixel array, with each pixel carrying a grayscale value. The pixel coordinate system of the raw grayscale image has its origin at the top left corner, the horizontal direction to the right as the positive x-axis, and the vertical direction downwards as the positive y-axis, providing a spatial reference frame for subsequent gradient direction calculations.

[0058] The obtained original grayscale image contains both the true cutting edge projection and a secondary ghost image. The formation path of the secondary ghost image is as follows: some light emitted from the parallel backlight continues to propagate after passing through the cutting edge contour boundary and is projected onto the metal clamping surface of the fixture or the surface of the protective structure of the inspection station. Over long-term use, the surfaces of the metal clamping surface of the fixture and the protective structure of the inspection station exhibit a semi-mirror reflection state due to chip erosion or cleaning. Some light is reflected and then illuminates the area near the cutting edge of the tool under test from different angles, becoming a secondary illumination source. This forms a parasitic image spot on the industrial camera sensor with an intensity lower than the true cutting edge projection and a position very close to the true cutting edge projection; this is the secondary ghost image. The grayscale distribution of the secondary ghost image on the original grayscale image is smoother and has no fixed boundary than the true cutting edge projection. The specific location and intensity of the secondary ghost image are related to the wear condition of the fixture surface and the cleanliness of the surface of the protective structure of the inspection station, and therefore vary between different production batches and different inspection times. The true edge projection appears as a steep grayscale transition zone along the actual geometric contour of the cutting edge in the original grayscale image. The direction of the true edge projection is consistent with the direction of the cutting edge of the tool under test. The secondary ghost image generates additional secondary grayscale fluctuations outside the grayscale transition zone of the true edge projection. The true edge projection and the secondary ghost image partially overlap at the pixel scale, together constituting the original image information to be separated in subsequent processing.

[0059] In the specific implementation of S2, when calculating the horizontal and vertical gradients pixel by pixel in the original grayscale image, the pixel coordinate system of the original grayscale image is used as the reference. For a pixel I(x, y) with coordinates x and y in the original grayscale image, half of the difference between the grayscale values ​​of its horizontal left-side neighbor I(x-1, y) and its horizontal right-side neighbor I(x+1, y) is taken as the horizontal gradient of that pixel. Similarly, half of the difference between the grayscale values ​​of its vertically lower-side neighbor I(x, y-1) and its vertically upper-side neighbor I(x, y+1) is taken as the vertical gradient of that pixel. For pixels at the boundaries of the original grayscale image, the gradient is approximated by the difference in grayscale values ​​of adjacent pixels on one side. After traversing all pixels of the original grayscale image, each pixel obtains a horizontal gradient value and a vertical gradient value. The adjacent pixel interval used when calculating the horizontal and vertical gradients is one pixel width, which is directly taken from the pixel spacing of the original grayscale image. The sign of the horizontal gradient indicates whether the gray value increases or decreases in the horizontal direction, and the sign of the vertical gradient indicates whether the gray value increases or decreases in the vertical direction. The horizontal and vertical gradients together constitute the two-dimensional gradient vector of each pixel.

[0060] When determining the initial gradient direction angle by taking the arctangent of the ratio of the horizontal to the vertical gradient, for each pixel, the ratio of the vertical to the horizontal gradient is taken and used as input to the arctangent function to calculate the initial gradient direction angle in radians. When the absolute value of the horizontal gradient is zero and the absolute value of the vertical gradient is not zero, the initial gradient direction angle is set to +90 degrees or -90 degrees depending on the sign of the vertical gradient. When the vertical gradient is greater than 0, the initial gradient direction angle is set to +90 degrees; when the vertical gradient is less than 0, the initial gradient direction angle is set to -90 degrees. When the absolute values ​​of both the horizontal and vertical gradients are zero, the pixel is marked as a pixel with no gradient direction, and pixels marked as having no gradient direction are skipped in subsequent frequency statistics for direction intervals. The numerical range of all obtained initial gradient direction angles covers the interval from -180 degrees to +180 degrees.

[0061] When reducing the initial gradient direction angle to a preset angle range, the preset angle range is set to a continuous range from 0 degrees to 180 degrees. The reduction method is as follows: for each initial gradient direction angle, if the initial gradient direction angle is less than 0 degrees, add 180 degrees to the initial gradient direction angle to obtain the reduced gradient direction angle; if the initial gradient direction angle is greater than or equal to 0 degrees and less than 180 degrees, keep the initial gradient direction angle unchanged as the reduced gradient direction angle; if the initial gradient direction angle is equal to 180 degrees, set the reduced gradient direction angle to 0 degrees. This processing is based on the non-directionality of the cutting edge direction, that is, two edge directions that differ by 180 degrees physically correspond to the same cutting edge straight line. All reduced gradient direction angles fall within the preset angle range of 0 degrees to 180 degrees.

[0062] When performing local non-maximum suppression on the reduced gradient direction angle to obtain the gradient direction corresponding to each pixel, a local neighborhood window centered on that pixel is obtained for each pixel in the original grayscale image. The side length of the local neighborhood window is determined according to the width of the grayscale transition band of the blade projection contour. The width of the grayscale transition band of the blade projection contour is obtained by counting the number of pixels that the grayscale of the region where the actual blade projection is located in the original grayscale image spans from the dark area to the bright area. The side length of the local neighborhood window is set to the same number of pixels as the width of the grayscale transition band. For example, when the width of the grayscale transition band is 3 pixels, the side length of the local neighborhood window is set to 3 pixels. Within a local neighborhood window, the gradient magnitude of the center pixel is calculated. The gradient magnitude is the square root of the sum of the squares of the horizontal and vertical gradients of the pixel. The reduced gradient direction angle of the center pixel is used as a reference direction. Along the line containing the reference direction, the positions of two adjacent pixels of the center pixel along the reference direction are determined within the local neighborhood window. Similarly, along the vertical reference direction, the positions of two adjacent pixels of the center pixel along the vertical reference direction are determined within the local neighborhood window. The gradient magnitudes of the two adjacent pixels along the reference direction and the two adjacent pixels along the vertical reference direction are calculated respectively. If the gradient magnitude of the center pixel is greater than the gradient magnitudes of the two adjacent pixels along the reference direction and the two adjacent pixels along the vertical reference direction, then the reduced gradient direction angle of the center pixel is retained as the gradient direction corresponding to the center pixel. If the gradient magnitude of the center pixel does not satisfy the above comparison relationship, then the center pixel is marked as a gradient direction suppression pixel. Gradient direction suppression pixels do not carry effective gradient direction information in the gradient direction map.

[0063] When summing the gradient directions of all pixels to form a gradient orientation map, each pixel in the original grayscale image is traversed. If the pixel is not marked as a gradient orientation suppressed pixel and not marked as a pixel without gradient direction after local non-maximum suppression, the value of the gradient direction corresponding to the pixel and the coordinate position of the pixel in the original grayscale image are recorded in the gradient orientation map. If the pixel is marked as a gradient orientation suppressed pixel after local non-maximum suppression, or if the pixel was marked as a pixel without gradient direction in the previous gradient direction angle reduction process, then the coordinate position of the pixel in the gradient orientation map is recorded as an invalid mark. An invalid mark indicates that the pixel position does not provide valid gradient direction information. The gradient orientation map maintains the same pixel array size and coordinate system definition as the original grayscale image in terms of data structure. The pixel coordinate system of the gradient orientation map has its origin at the top left corner, with the positive x-axis pointing horizontally to the right and the positive y-axis pointing vertically downwards, consistent with the pixel coordinate system definition of the original grayscale image. Each pixel in the gradient orientation map carrying effective gradient direction information stores a gradient direction value within the range of 0 to 180 degrees. These gradient direction values ​​are stored in floating-point format to preserve angular resolution accuracy. The gradient orientation map serves as the direct input for calculating the virtual influence evaluation parameters under subsequent adjustments to the luminous intensity of the parallel backlight. The spatial distribution of pixels carrying effective gradient direction information in the gradient orientation map corresponds to the skeletonized direction information of the blade projection contour and the secondary ghost image region in the original grayscale image.

[0064] In the specific implementation of S3, while keeping the clamping state of the tool under test unchanged, the luminous intensity of the parallel backlight is adjusted to a first intensity value, triggering the industrial camera to acquire a first illumination intensity image. Gradient direction field calculation is performed on the first illumination intensity image to obtain a first gradient direction map. Then, the luminous intensity of the parallel backlight is adjusted to a second intensity value that is different from the first intensity value, triggering the industrial camera to acquire a second illumination intensity image. Gradient direction field calculation is performed on the second illumination intensity image to obtain a second gradient direction map. The luminous intensity of the parallel backlight is achieved by changing the driving current. The first intensity value is determined as follows: Before formal data acquisition, the parallel backlight is driven with an initial driving current to obtain a test image. The average pixel grayscale value of the local area where the actual blade edge projection is located in the test image is calculated. The average pixel grayscale value is compared with the midpoint value of the linear range of the industrial camera sensor response. If the average pixel grayscale value is lower than the midpoint value, the driving current is increased; if the average pixel grayscale value is higher than the midpoint value, the driving current is decreased. This adjustment is repeated until the difference between the average pixel grayscale value and the midpoint value enters a preset tolerance range. The driving current at this point is taken as the first intensity value. The second intensity value is determined as follows: Based on the driving current corresponding to the first intensity value, the driving current is further increased until the average pixel grayscale value of the local area where the actual blade edge projection is located in the test image reaches near the upper limit of the linear range of the sensor response, and the difference between the average pixel grayscale value and the upper limit value is within another preset tolerance range. The driving current at this point is taken as the second intensity value. The difference between the first and second intensity values ​​ensures that the changes in the grayscale distribution and position of the secondary ghost image due to the nonlinear response of the reflection path to the light source intensity in the two acquired images are sufficient to be detected by subsequent gradient direction distribution vector statistics. The exposure times for acquiring the first illumination intensity image and the second illumination intensity image are set independently according to their respective illumination intensities, ensuring that the grayscale value of the pixel containing the actual blade edge projection in each image does not exceed the linear range of the sensor response. The process of performing gradient direction field calculation on the first illumination intensity image to obtain the first gradient direction map is exactly the same as the method of performing gradient direction field calculation on the original grayscale image in S2, including: calculating the horizontal and vertical gradients pixel by pixel in the first illumination intensity image; obtaining the initial gradient direction angle by taking the arctangent of the ratio of the horizontal to the vertical gradients; reducing the initial gradient direction angle to a preset angle range of 0 to 180 degrees; performing local non-maximum suppression on the reduced gradient direction angle to obtain the gradient direction corresponding to each pixel; and summarizing the gradient directions of all pixels to form the first gradient direction map. During the summarization, pixels marked as gradient direction suppression pixels after local non-maximum suppression and pixels marked as pixels without gradient direction during the direction angle reduction process are recorded as invalid marks in the first gradient direction map. The process of performing gradient direction field calculation on the second illumination intensity image to obtain the second gradient direction map is exactly the same as the process of obtaining the first gradient direction map.The first gradient orientation map and the second gradient orientation map each maintain the same pixel array size as the original grayscale image, and the pixel coordinate system is defined with the upper left corner of their respective maps as the origin, the horizontal direction to the right as the positive x-axis, and the vertical direction downward as the positive y-axis. The pixels carrying effective gradient direction information store gradient direction values ​​in the range of 0 degrees to 180 degrees. The positions of the pixels marked with invalidity in the first gradient orientation map and the pixels marked with invalidity in the second gradient orientation map do not participate in the subsequent frequency statistics of the direction interval.

[0065] For each pixel in the first gradient direction map, the frequency of gradient directions falling into each direction interval for all pixels within a preset neighborhood window centered on the corresponding pixel is counted, constructing a first gradient direction distribution vector. For the same pixel position in the second gradient direction map, the frequency of gradient directions falling into the same direction interval for all pixels within a preset neighborhood window of the same size centered on the corresponding pixel is counted, constructing a second gradient direction distribution vector. The preset neighborhood window is a regular square window. The side length of the preset neighborhood window is set according to the width of the grayscale transition band of the blade projection contour and the maximum expected offset between the secondary ghost image and the real blade edge projection. The method of obtaining it is: multiply the number of pixels of the grayscale transition band width by a coefficient and then round it down. The coefficient is determined by the ratio of the maximum expected offset between the secondary ghost image and the real blade edge projection to the grayscale transition band width plus a margin. For example, the side length can be set to twice the grayscale transition band width plus one pixel width. When constructing the first gradient direction distribution vector, the preset angle range from 0 degrees to 180 degrees is divided into multiple direction intervals. The number of direction intervals is determined according to the required ghost image recognition sensitivity; the larger the number of direction intervals, the higher the ghost image recognition sensitivity. For example, 0 degrees to 180 degrees are divided into 18 direction intervals, with each direction interval spanning 10 degrees. For each pixel within the preset neighborhood window, its recording status in the first gradient direction map is checked: if the pixel is recorded as an invalid marker, it is not counted in the frequency of any direction interval; if the pixel carries a valid gradient direction value, the direction interval to which the gradient direction value falls is determined, and the frequency count of the corresponding direction interval is incremented by one. After traversing all pixels within the preset neighborhood window, the cumulative frequency of each direction interval is obtained. According to the arrangement order of the direction intervals from the interval corresponding to 0 degrees to the interval corresponding to 180 degrees, the cumulative frequency of each direction interval is used as vector elements to construct the first gradient direction distribution vector. When constructing the second gradient direction distribution vector, for the same pixel position in the second gradient direction map, the same preset neighborhood window size, the same direction interval division method, and the same vector element arrangement order as when constructing the first gradient direction distribution vector are used to generate the second gradient direction distribution vector. The same frequency statistics rules are applied. If the corresponding pixel position is located near the image boundary in the gradient direction map, causing part of the preset neighborhood window to exceed the effective pixel range of the gradient direction map, the excess part is considered to have no pixel supply, and only the pixels actually covered within the window are counted for frequency. The lengths of both the first and second gradient direction distribution vectors are equal to the number of direction intervals, and the elements in the vectors are non-negative integers.

[0066] For each pixel, calculate the Barthel distance between the first gradient direction distribution vector and the second gradient direction distribution vector, and use the Barthel distance as the virtual influence evaluation parameter for the corresponding pixel. The calculation process is as follows: First, normalize the first gradient direction distribution vector to a first probability distribution vector. The normalization method is to count the total number of valid pixels included in the frequency statistics within a preset neighborhood window. If the total number of valid pixels is zero, the virtual influence evaluation parameter for that pixel is directly set to zero and subsequent calculations are skipped. If the total number of valid pixels is greater than zero, divide each element of the first gradient direction distribution vector by the total number of valid pixels to obtain the first probability distribution vector. Perform the same normalization operation on the second gradient direction distribution vector to obtain the second probability distribution vector. Calculate the Barthel coefficients of the first and second probability distribution vectors. The Barthel coefficients are calculated as follows: For each direction interval, take the square root of the probability value of the first probability distribution vector in that direction interval, and then take the square root of the probability value of the second probability distribution vector in that direction interval. Multiply the two square roots to obtain a product. Sum the products of all direction intervals to obtain the sum, which is the Barthel coefficient. The Bach distance is obtained by taking the inverse cosine of the Bach coefficient; that is, the Bach distance is equal to the result of applying the inverse cosine function to the Bach coefficient. When the Bach coefficient is 1, the Bach distance is zero, indicating that the two probability distributions are completely identical. The virtual influence evaluation parameter for the corresponding pixel is the numerical value of the Bach distance. At the pixel position corresponding to the real edge projection, since the spatial position of the real edge projection remains fixed under two different lighting intensities, the distribution structure of the gradient direction within its preset neighborhood window remains almost unchanged between the two acquisitions. The first probability distribution vector and the second probability distribution vector are highly similar, and the Bach distance approaches zero. At the pixel position corresponding to the secondary ghost image, the intensity change and positional drift of the secondary ghost image cause a significant change in the distribution structure of the gradient direction within its preset neighborhood window between the two acquisitions. The dissimilarity between the first probability distribution vector and the second probability distribution vector increases, and the Bach distance is significantly greater than zero. By performing the above steps for each pixel, a virtual influence evaluation parameter is generated for each pixel in the original grayscale image. This virtual influence evaluation parameter serves as the input data for the subsequent mapping dissimilarity scalar field.

[0067] In the specific implementation of S4, the virtual influence response evaluation parameter value of each pixel is directly assigned as the dissimilarity scalar value of the corresponding pixel. The dissimilarity scalar values ​​of all pixels together constitute the dissimilarity scalar field. The assignment process is performed pixel by pixel. The virtual influence response evaluation parameter of the corresponding pixel calculated in S3 is taken, and the original value of the virtual influence response evaluation parameter of the corresponding pixel is assigned to the corresponding pixel as its dissimilarity scalar value. No scaling or offset processing is performed, so that the spatial distribution of the dissimilarity scalar value is strictly consistent with the spatial distribution of the virtual influence response evaluation parameter. In terms of data structure, the dissimilarity scalar field is a two-dimensional numerical array with the same pixel array size as the original grayscale image. The pixel coordinate system of the dissimilarity scalar field is defined with the upper left corner of the dissimilarity scalar field as the origin, the horizontal direction to the right as the positive x-axis, and the vertical direction downward as the positive y-axis, consistent with the definition of the pixel coordinate system of the original grayscale image. In the dissimilarity scalar field, the pixels in the region where the real edge projection is located have a dissimilarity scalar value that tends to zero because the gradient direction distribution is nearly unchanged under the two illumination intensities. The pixels in the region where the secondary ghost image is located have a dissimilarity scalar value that is greater than zero because the gradient direction distribution changes under the two illumination intensities. Furthermore, in the boundary region between the secondary ghost image and the real edge projection, the dissimilarity scalar value exhibits a band-like structure that transitions from low to high values.

[0068] For each pixel location in the dissimilarity scalar field, a local neighborhood window centered on the corresponding pixel location is constructed. A quadratic surface is fitted within the local neighborhood window. The principal curvature along the gradient direction is obtained from the second-order partial derivative of the quadratic surface in the gradient direction, and the principal curvature perpendicular to the gradient direction is obtained from the second-order partial derivative of the quadratic surface in the perpendicular gradient direction. The local neighborhood window is a regular square window. The side length of the local neighborhood window is set according to the width of the strip-shaped low-value region formed by the projection of the actual edge in the dissimilarity scalar field. The width of the strip-shaped low-value region is obtained by counting the number of consecutive pixels in the region where the dissimilarity scalar value of the actual edge projection is located in the dissimilarity scalar field that are lower than a preset low-value threshold. The side length of the local neighborhood window is set to the number of pixels equal to the width of the strip-shaped low-value region. For example, when the width of the strip-shaped low-value region is 3 pixels, the side length of the local neighborhood window is set to 3 pixels. By performing least-squares surface fitting on the dissimilarity scalar values ​​of each pixel within the local neighborhood window, the coefficients of the quadratic surface equation are obtained. The quadratic surface equation is a second-order polynomial with pixel coordinates x and y as independent variables, calculated as: f(x,y)=ax 2 +by 2+cxy+dx+ey+f; where f(x,y) represents the dissimilarity scalar value of the quadratic surface at coordinates (x,y), x and y represent pixel coordinates, and a, b, c, d, e, and f represent the coefficients to be fitted. During fitting, the x and y coordinates of each pixel within the local neighborhood window in the dissimilarity scalar field, along with their dissimilarity scalar values, are used as known data points. An overdetermined system of equations is constructed, and the coefficients a, b, c, d, e, and f are solved using the least squares method. The solution criterion is that the sum of the squares of the differences between the calculated values ​​of the quadratic surface at each known data point and the actual dissimilarity scalar values ​​is minimized.

[0069] The Hessian matrix is ​​constructed from the coefficients of the quadratic surface equation. The Hessian matrix is ​​a 2x2 symmetric matrix, calculated as: H 11 =∂ 2 f / ∂x 2 =2a,H 12 =H 21 =∂ 2 f / ∂x∂y=c,H 22 =∂ 2 f / ∂y 2 =2b; where H 11 H represents the element in the first row and first column of the Hessian matrix. 12 H represents the element in the first row and second column of the Hessian matrix. 21 H represents the element in the second row and first column of the Hessian matrix. 22 Let represent the element in the second row and second column of the Hessian matrix. Eigenvalue decomposition of the Hessian matrix yields two eigenvalues ​​and two corresponding eigenvectors. The eigenvalue decomposition is expressed as: H = VΛV ᵀ Where H represents the Hessian matrix, V represents the eigenvector matrix, Λ represents the eigenvalue diagonal matrix, and ᵀ represents the transpose. The two eigenvalues ​​represent the principal curvature values ​​of the surface in two orthogonal directions, and the corresponding two eigenvectors represent the direction vectors in the two orthogonal directions. The gradient direction corresponding to the pixel position is extracted from the gradient direction map of S2. The gradient direction unit vector and the perpendicular gradient direction unit vector are substituted into the quadratic expression to calculate the principal curvature along the gradient direction and the principal curvature perpendicular to the gradient direction, respectively. The gradient direction unit vector is calculated from the gradient direction angle recorded by the corresponding pixel in the gradient direction map. The x-component of the gradient direction unit vector is equal to the cosine of the gradient direction angle, and the y-component is equal to the sine of the gradient direction angle. The perpendicular gradient direction unit vector is obtained by rotating the gradient direction unit vector by 90 degrees. The x-component of the perpendicular gradient direction unit vector is equal to the negative y-component of the gradient direction unit vector, and the y-component is equal to the x-component of the gradient direction unit vector.

[0070] The principal curvature along the gradient direction is expressed as: κ∥=u x 2 H 11 +2u x uyH 12 +uy 2 H 22 Where κ∥ represents the principal curvature along the gradient direction, and u x Let represent the x-component of the unit vector in the gradient direction, and uy represent the y-component of the unit vector in the gradient direction.

[0071] The principal curvature in the vertical gradient direction is calculated as: κ⊥=v x 2 H 11 +2v x vyH 12 +vy 2 H 22 Where κ⊥ represents the principal curvature perpendicular to the gradient direction, and v x vy represents the x-component of the unit vector perpendicular to the gradient direction, and vy represents the y-component of the unit vector perpendicular to the gradient direction. For pixels marked as invalid or suppressed in the gradient direction map, since they do not carry a valid gradient direction in the gradient direction map, the principal curvature along the gradient direction and the principal curvature perpendicular to the gradient direction are not distinguished in definition.

[0072] Iterate through all pixels in the dissimilarity scalar field. For each pixel, check if the principal curvature along the gradient direction is negative. If it is not negative, the corresponding pixel is identified as a secondary ghost image and removed. If the principal curvature along the gradient direction is negative, check if the absolute value of the principal curvature perpendicular to the gradient direction is less than the absolute value of the principal curvature along the gradient direction. If the absolute value of the principal curvature perpendicular to the gradient direction is not less than the absolute value of the principal curvature along the gradient direction, the corresponding pixel is identified as a secondary ghost image and removed. If the principal curvature along the gradient direction is negative and the absolute value of the principal curvature perpendicular to the gradient direction is less than the absolute value of the principal curvature along the gradient direction... If both conditions are met, continue to obtain the dissimilarity scalar value of all pixels within the local neighborhood window centered on the corresponding pixel. Calculate the average of the dissimilarity scalar values ​​of all pixels within the local neighborhood window as the neighborhood mean of the corresponding pixel. Check whether the dissimilarity scalar value of the corresponding pixel is lower than the neighborhood mean of the corresponding pixel. If the dissimilarity scalar value of the corresponding pixel is lower than the neighborhood mean of the corresponding pixel, then the corresponding pixel is determined to be the pixel corresponding to the real edge and is included in the pixel set corresponding to the real edge. If the dissimilarity scalar value of the corresponding pixel is not lower than the neighborhood mean of the corresponding pixel, then the corresponding pixel is determined to be the pixel corresponding to the secondary ghost image and is removed. Pixels corresponding to the actual cutting edge appear as a band-shaped low-value region extending along the cutting edge direction in the dissimilarity scalar field. A negative principal curvature along the gradient direction within this band-shaped low-value region indicates a ridge-like curvature along the gradient direction. The absolute value of the principal curvature perpendicular to the gradient direction is less than the absolute value of the principal curvature along the gradient direction, indicating that the curvature along the cutting edge direction is less than that along the gradient direction, conforming to the ridge-like characteristic. Pixels corresponding to secondary ghost images are scattered or short line segments in the dissimilarity scalar field, not satisfying the ridge-like characteristic. For pixels marked as invalid or suppressed in the gradient direction map, since the principal curvature along the gradient direction and the principal curvature perpendicular to the gradient direction cannot be obtained, the corresponding pixels are directly identified as secondary ghost image pixels and discarded. After traversing all pixels in the dissimilarity scalar field and completing the judgment, all pixels that are assigned to the pixel set corresponding to the real edge are used as the filtered output. Each pixel in the pixel set corresponding to the real edge retains its coordinate position and correspondence in the original grayscale image.

[0073] In the specific implementation of S5, the coordinates of all pixels in the pixel set corresponding to the real cutting edge are extracted, and principal component analysis is performed on the coordinates. The coordinate position of each pixel in the pixel set corresponding to the real cutting edge in the original grayscale image has been preserved and transferred by S4. During extraction, the x and y coordinates of all pixels in the pixel set corresponding to the real cutting edge are used as the horizontal and vertical coordinates of the two-dimensional data points, respectively, to form a two-dimensional point set. The process of performing principal component analysis on a two-dimensional point set is as follows: Calculate the average x-coordinate and average y-coordinate of all data points in the two-dimensional point set to obtain the centroid coordinates of the two-dimensional point set; subtract the average x-coordinate from the average y-coordinate of each data point in the two-dimensional point set, and subtract the average y-coordinate from the average y-coordinate to obtain the centered two-dimensional point set; construct the covariance matrix of the centered two-dimensional point set, which is a 2x2 symmetric matrix. The element in the first row and first column of the covariance matrix is ​​the variance of the centered x-coordinate, and the element in the second row and second column is the variance of the centered y-coordinate. The elements in the first row and second column of the covariance matrix and the element in the second row and first column of the covariance matrix represent the covariance of the centered x-coordinate and y-coordinate; perform eigenvalue decomposition on the covariance matrix to obtain two eigenvalues ​​and two corresponding eigenvectors. The two eigenvalues ​​are sorted by numerical value. The eigenvector corresponding to the larger eigenvalue corresponds to the direction of the greatest extension of the data point distribution in the two-dimensional point set, and the eigenvector corresponding to the smaller eigenvalue corresponds to the direction perpendicular to the direction of the greatest extension of the data point distribution.

[0074] The direction of the eigenvector corresponding to the largest eigenvalue is used as the initial cutting edge direction. The eigenvector corresponding to the largest eigenvalue is the eigenvector corresponding to the larger eigenvalue obtained from eigenvalue decomposition. The initial cutting edge direction is represented by the direction angle of the eigenvector corresponding to the largest eigenvalue in the pixel coordinate system of the original grayscale image. The direction angle is calculated by taking the arctangent of the ratio of the y-component to the x-component of the eigenvector corresponding to the largest eigenvalue, and then expressing the direction angle in radians. The initial cutting edge direction provides an initial direction estimate for subsequent line fitting.

[0075] Calculate the distance from each pixel coordinate to the initial straight line fitted along the initial cutting edge direction. Pixels whose distance exceeds a preset threshold are removed. Principal component analysis is then performed again on the remaining pixel coordinates to fit a straight line. The initial straight line fitted along the initial cutting edge direction is constructed as follows: using the centroid coordinates of the two-dimensional point set as a point on the line, and the initial cutting edge direction as the line direction, the equation of the initial straight line is determined in the pixel coordinate system of the original grayscale image. Calculate the perpendicular distance from the coordinates of each pixel in the pixel set corresponding to the real cutting edge to the initial straight line. The perpendicular distance is calculated as the Euclidean distance from the pixel coordinate point to the initial straight line. The preset threshold is set based on the statistical distribution of the perpendicular distances from all pixel coordinates in the pixel set corresponding to the real cutting edge to the initial straight line. The preset threshold is set as follows: sort all perpendicular distances in ascending order of value, take the median of the sorted perpendicular distance sequence, calculate the absolute deviation of each sorted perpendicular distance from the median, take the median of the absolute deviation sequence as the median absolute deviation, and add the median and the median absolute deviation multiplied by a preset multiple. The sum is used as the preset threshold. The preset multiplier is set based on the scattering width of the pixel coordinates of the pixel set corresponding to the actual cutting edge on both sides of the cutting edge line. The scattering width is reflected by the distribution of the vertical distances from the pixel coordinates of the pixel set corresponding to the actual cutting edge to the line determined by the centroid coordinates and the initial cutting edge direction. The preset multiplier marks pixels whose vertical distance is outside the main area of ​​the scattering width as deviation points. For example, the preset multiplier is set to 5. Pixel coordinates with a vertical distance greater than a preset threshold are identified as deviation points and discarded. The remaining pixel coordinates after removing deviation points constitute the pixel coordinate set for the second fitting.

[0076] Principal component analysis (PCA) is performed again on the second fitted pixel coordinate set, following the same process as the first PCA. This yields the covariance matrix, eigenvalues, and eigenvectors of the second fit. The direction of the eigenvector corresponding to the largest eigenvalue is used as the cutting edge direction for the second fit. A second straight line is constructed using the centroid coordinates of the second fitted pixel coordinate set and the cutting edge direction. The perpendicular distance from each pixel coordinate in the second fitted pixel coordinate set to the second straight line is calculated. Based on this perpendicular distance, a preset threshold is reset in the same manner, and pixels exceeding the reset threshold are removed. The remaining pixel coordinates form the pixel coordinate set for the third fit. This process of removal and fitting is repeated. Each iteration includes: performing PCA on the current pixel coordinate set, constructing the current straight line, calculating the perpendicular distance from each pixel coordinate in the current pixel coordinate set to the current straight line, setting a current preset threshold based on the statistical distribution of the current perpendicular distance, removing pixels with a perpendicular distance greater than the current preset threshold, and using the remaining pixels as the pixel coordinate set for the next iteration. The termination condition for repeated execution is: the pixel coordinates in the current pixel coordinate set are completely consistent with the pixel coordinates in the pixel coordinate set of the previous iteration. That is, the current pixel coordinate set has converged because the pixel coordinate set has not changed in two adjacent iterations.

[0077] When the set of pixel coordinates no longer changes, the straight line constructed in the last iteration is taken as the cutting edge line. The cutting edge line is represented by a linear equation in the pixel coordinate system of the original grayscale image. The cutting edge line passes through the centroid of the pixel coordinate set from the last iteration, and its direction is consistent with the direction of the eigenvector corresponding to the largest eigenvalue obtained from the last iteration of principal component analysis. The angle between the cutting edge line and the pre-calibrated reference direction is taken as the tool angle. The pre-calibrated reference direction is determined during the debugging phase of the inspection station. The determination method is as follows: a standard tool with a known tool angle is fixed to the fixture in the same clamping method as the tool to be tested. Operations S1 to S4 and the cutting edge line fitting operation are performed to obtain the direction of the standard tool's cutting edge line in the pixel coordinate system of the original grayscale image. The direction of the standard tool's cutting edge line is taken as the pre-calibrated reference direction, and the pre-calibrated reference direction is stored in the inspection program. The knife angle is calculated as follows: the difference between the direction angle of the cutting edge straight line in the pixel coordinate system of the original grayscale image and the angle of the pre-calibrated reference direction is calculated, and the absolute value of the difference is taken as the knife angle. The knife angle is the corresponding angle among the wedge angle, front angle or back angle of the tool under test, which depends on the angle setting between the main ray direction of the parallel beam and the optical axis of the industrial camera in the optical path configuration of the detection station and the type of knife angle to be tested.

[0078] Example 2: Figure 2A schematic diagram of a visual inspection device for cutting edge manufacturing is provided according to the present invention. The visual inspection device for cutting edge manufacturing includes the following modules:

[0079] The image acquisition module is used to acquire raw grayscale images of the cutting edge of the tool under parallel backlight illumination by an industrial camera.

[0080] The orientation generation module is used to calculate the gradient orientation field of the original grayscale image and generate a gradient orientation map. Each pixel in the gradient orientation map has a corresponding gradient orientation.

[0081] The parameter evaluation module is used to adjust the luminous intensity of the parallel backlight, acquire at least two images under different illumination intensities and generate corresponding gradient direction maps, extract the gradient direction distribution vector of the neighboring region of each pixel under different illumination intensities, and calculate the distribution dissimilarity between the two gradient direction distribution vectors as a virtual influence response evaluation parameter.

[0082] The pixel filtering module is used to map the virtual influence response evaluation parameters into a dissimilarity scalar field, calculate the principal curvature along its gradient direction and perpendicular to its gradient direction at each pixel position in the dissimilarity scalar field, determine the pixels with ridge-like features in the principal curvature combination and dissimilarity scalar values ​​lower than the neighborhood mean as the pixels corresponding to the real edge and retain them, and remove the remaining pixels to obtain the pixel set corresponding to the real edge.

[0083] The fitting calculation module is used to fit the edge of the corresponding real cutting edge pixel set and calculate the cutting angle based on the fitted cutting edge line.

[0084] All calculations involved in the embodiments are dimensionless numerical calculations, and the preset parameters and thresholds in the calculations are set by those skilled in the art according to the actual situation.

[0085] The above embodiments can be implemented, in whole or in part, by software, hardware, firmware, or any other combination thereof. When implemented using software, the above embodiments can be implemented, in whole or in part, in the form of a computer program product.

[0086] Those skilled in the art will recognize that the modules and algorithm steps of the various examples described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are implemented in hardware or software depends on the specific application and inventive constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of this application.

[0087] In addition, the functional modules in the various embodiments of this application can be integrated into one processing module, or each module can exist physically separately, or two or more modules can be integrated into one module.

[0088] In the several embodiments provided in this application, it should be understood that the disclosed systems, apparatuses, and methods can be implemented in other ways. For example, the apparatus embodiments described above are merely illustrative; for instance, the division of modules is only a logical functional division, and in actual implementation, there may be other division methods. For example, multiple modules or components may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the coupling or direct coupling or communication connection shown or discussed may be through some interfaces; the indirect coupling or communication connection between apparatuses or modules may be electrical, mechanical, or other forms.

[0089] The above description is merely a specific embodiment of this application, but the scope of protection of this application is not limited thereto. Any variations or substitutions that can be easily conceived by those skilled in the art within the scope of the technology disclosed in this application should be included within the scope of protection of this application. Therefore, the scope of protection of this application should be determined by the scope of the claims.

[0090] In conclusion, the above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of the present invention should be included within the protection scope of the present invention.

Claims

1. A visual inspection method for the production and processing of knife corners, characterized in that, Includes the following steps: S1: Acquire the raw grayscale image of the cutting edge of the tool under parallel backlight illumination by an industrial camera; S2: Calculate the gradient direction field of the original grayscale image to generate a gradient direction map. Each pixel in the gradient direction map has a corresponding gradient direction. S3: Adjust the luminous intensity of the parallel backlight, acquire at least two images under different illumination intensities and generate corresponding gradient direction maps, extract the gradient direction distribution vector of the neighboring region of each pixel under different illumination intensities, and calculate the distribution dissimilarity between the two gradient direction distribution vectors as a virtual influence evaluation parameter. S4: Map the virtual influence response evaluation parameters to a dissimilarity scalar field, calculate the principal curvature along its gradient direction and perpendicular to its gradient direction at each pixel position in the dissimilarity scalar field, determine the pixels with ridge-like features in the principal curvature combination and dissimilarity scalar values ​​lower than the neighborhood mean as the pixels corresponding to the real edge and retain them, remove the remaining pixels, and obtain the pixel set corresponding to the real edge. S5: Fit the edge of the corresponding real cutting edge to the pixel set, and calculate the cutting angle based on the fitted cutting edge line.

2. The visual inspection method for blade corner production processing according to claim 1, characterized in that, S1 includes: The tool to be tested is clamped on the fixture at the testing station, and the parallel backlight is turned on so that the parallel beam emitted by the parallel backlight is projected onto the cutting edge of the tool and forms a projected profile. An industrial camera is used to expose and capture the projected contour, obtaining a raw grayscale image that includes the actual blade edge projection and secondary ghost images formed by reflections from the fixture or protective structure.

3. The visual inspection method for blade corner production processing according to claim 1, characterized in that, S2 include: Calculate the horizontal and vertical gradients pixel by pixel in the original grayscale image; The initial gradient direction angle is obtained by taking the arctangent of the ratio of the horizontal gradient to the vertical gradient; The initial gradient direction angle is reduced to a preset angle range; Local nonmaximum suppression is applied to the reduced gradient direction angle to obtain the gradient direction corresponding to each pixel. The gradient directions of all pixels are summarized to form a gradient direction map.

4. The visual inspection method for blade corner production processing according to claim 1, characterized in that, S3 include: While keeping the tool clamping state unchanged, the luminous intensity of the parallel backlight is adjusted to a first intensity value, triggering the industrial camera to acquire a first illumination intensity image. Gradient direction field calculation is performed on the first illumination intensity image to obtain a first gradient direction map. Then, the luminous intensity of the parallel backlight is adjusted to a second intensity value that is different from the first intensity value, triggering the industrial camera to acquire a second illumination intensity image. Gradient direction field calculation is performed on the second illumination intensity image to obtain a second gradient direction map. For each pixel in the first gradient orientation map, count the frequency of the gradient orientation of all pixels within a preset neighborhood window centered on the corresponding pixel falling into each orientation interval, and construct the first gradient orientation distribution vector. For the same pixel position in the second gradient orientation map, count the frequency of the gradient orientation of all pixels within a neighborhood window of the same size centered on the corresponding pixel falling into the same orientation interval, and construct the second gradient orientation distribution vector. For each pixel, calculate the Bartholomew's distance between its first gradient direction distribution vector and its second gradient direction distribution vector, and use the Bartholomew's distance as the virtual influence response evaluation parameter for the corresponding pixel.

5. A visual inspection method for corner cutting production according to claim 4, characterized in that, Constructing the first gradient direction distribution vector and the second gradient direction distribution vector includes: dividing a preset angle interval into several direction intervals; determining the direction interval affiliation of the gradient direction of each pixel within a preset neighborhood window; counting the number of pixels falling into each direction interval; using the number of pixels in each direction interval to form vector elements; and arranging them in sequence to generate the gradient direction distribution vector. The first gradient direction distribution vector and the second gradient direction distribution vector use the same direction interval division method and the same vector element arrangement order.

6. The visual inspection method for blade corner production processing according to claim 1, characterized in that, S4 include: The virtual effect evaluation parameter value of each pixel is directly assigned as the dissimilarity scalar value of the corresponding pixel, and the dissimilarity scalar values ​​of all pixels together constitute the dissimilarity scalar field. For each pixel position in the dissimilarity scalar field, a local neighborhood window centered on the corresponding pixel position is constructed. A quadratic surface is fitted within the local neighborhood window. The principal curvature along the gradient direction is obtained from the second-order partial derivative of the quadratic surface in the gradient direction, and the principal curvature in the vertical gradient direction is obtained from the second-order partial derivative of the quadratic surface in the vertical gradient direction. Traverse all pixels in the dissimilarity scalar field, and determine the pixels that simultaneously satisfy the following conditions: the principal curvature along the gradient direction is negative, the absolute value of the principal curvature perpendicular to the gradient direction is less than the absolute value of the principal curvature along the gradient direction, and the dissimilarity scalar value is lower than the average value of the dissimilarity scalar values ​​of all pixels in the local neighborhood window is the pixel corresponding to the real edge. Then, add the pixels corresponding to the real edge to the pixel set one by one, and remove the pixels that do not meet the conditions.

7. A visual inspection method for blade corner production processing according to claim 6, characterized in that, The calculation of the principal curvature along the gradient direction and the principal curvature perpendicular to the gradient direction includes: performing least-squares surface fitting on the dissimilarity scalar values ​​of each pixel within the local neighborhood window to obtain the coefficients of the quadratic surface equation; constructing a Hessian matrix from the coefficients of the quadratic surface equation; performing eigenvalue decomposition on the Hessian matrix; and substituting the unit vectors in the gradient direction and the unit vectors perpendicular to the gradient direction into the quadratic expression to obtain the principal curvature along the gradient direction and the principal curvature perpendicular to the gradient direction.

8. A visual inspection method for blade corner production processing according to claim 1, characterized in that, S5 include: Extract the coordinates of all pixels in the pixel set corresponding to the actual blade edge, and perform principal component analysis on the coordinates; The direction of the eigenvector corresponding to the largest eigenvalue is used as the initial cutting edge direction; Calculate the distance from each pixel coordinate to the initial straight line fitted along the initial blade direction, remove pixels whose distance exceeds the preset threshold, and perform principal component analysis and fit a straight line again on the remaining pixel coordinates; Repeat the elimination and fitting process until the pixel coordinate set no longer changes to obtain the cutting edge line. The angle between the cutting edge line and the pre-calibrated reference direction is taken as the cutting angle.

9. A visual inspection method for corner cutting production according to claim 8, characterized in that, Pixels whose distance exceeds a preset threshold are removed by: calculating the vertical distance of each pixel coordinate to the initial line, weighting the median of all vertical distances and the absolute deviation of the median, using the weighted combination result as the threshold, and identifying pixel coordinates with a vertical distance greater than the threshold as deviation points and removing them.

10. A visual inspection device for corner cutting production, used to implement the visual inspection method for corner cutting as described in any one of claims 1-9, characterized in that, Includes the following modules: The image acquisition module is used to acquire raw grayscale images of the cutting edge of the tool under parallel backlight illumination by an industrial camera. The orientation generation module is used to calculate the gradient orientation field of the original grayscale image and generate a gradient orientation map. Each pixel in the gradient orientation map has a corresponding gradient orientation. The parameter evaluation module is used to adjust the luminous intensity of the parallel backlight, acquire at least two images under different illumination intensities and generate corresponding gradient direction maps, extract the gradient direction distribution vector of the neighboring region of each pixel under different illumination intensities, and calculate the distribution dissimilarity between the two gradient direction distribution vectors as a virtual influence response evaluation parameter. The pixel filtering module is used to map the virtual influence response evaluation parameters into a dissimilarity scalar field, calculate the principal curvature along its gradient direction and perpendicular to its gradient direction at each pixel position in the dissimilarity scalar field, determine the pixels with ridge-like features in the principal curvature combination and dissimilarity scalar values ​​lower than the neighborhood mean as the pixels corresponding to the real edge and retain them, and remove the remaining pixels to obtain the pixel set corresponding to the real edge. The fitting calculation module is used to fit the edge of the corresponding real cutting edge pixel set and calculate the cutting angle based on the fitted cutting edge line.