An industrial color adaptive high point recognition method and system

CN122597392APending Publication Date: 2026-08-18WUHAN HEAVY MACHINE TOOL GRP
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202611017695.3
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-07-09
Publication Date
2026-08-18

AI Technical Summary

Technical Problem

[0007]本发明要解决的技术问题是:在复杂工业表面显点图像中,显点颜色变化较大、背景干扰较强、灰黑或银黑真实高点容易漏检、相邻显点容易粘连,以及显点区域难以稳定转化为高点坐标的问题

Benefits of technology

[0020]与现有方法相比,本发明的改进重点不在简单叠加图像处理算子,而在于针对机床刮研显点图像中颜色变化大、背景干扰强、灰黑或银黑显点易漏检、相邻显点易粘连以及高点坐标难以稳定生成等问题,形成一套相互配合的工业颜色自适应识别流程。

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122597392A_ABST
    Figure CN122597392A_ABST
Patent Text Reader

Abstract

The application discloses an industrial color adaptive high point recognition method and system. The method converts a complex highlight image into a highlight area mask and a high point coordinate through multi-color prior, adaptive seed classification fusion, connected domain filtering, distance transformation narrow connection cutting, dark high point supplementary inspection, boundary correction and uniform point distribution based on area and distance transformation. Compared with traditional threshold segmentation, ordinary connected domain processing, early black spot counting method and general graph cut segmentation method, the application emphasizes multi-color adaptation in the highlight image, gray and black high point missing compensation, adhesion area separation and coordinate uniform output, and can provide more stable visual input for subsequent artificial review, process analysis or automatic processing.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the fields of industrial visual inspection, machine tool scraping point recognition, image processing, and surface contact state analysis, and particularly to an industrial color adaptive high point recognition and uniform point distribution method for scraping points on heavy machine tools. Background Technology

[0002] Scraping typically involves mating the surfaces together to reveal high points, then removing the raised portions to achieve high shape, position, and fit accuracy. Traditional scraping relies heavily on manual observation of the color, area, density, and distribution of these points; the identification results are significantly affected by the operator's experience, lighting conditions, and the condition of the coloring material.

[0003] In existing automated scraping or grinding solutions, technologies acquire workpiece surface images using cameras, light sources, laser sensors, or motion control mechanisms, and use these images to locate high points to be scraped or to assist in automated scraping. However, existing solutions mostly focus on mechanical execution structures, visual positioning modules, or machining trajectory control. They lack targeted image response construction, candidate gating, dark color supplementation, boundary correction, and uniform point distribution methods for identifying high points in scraped point images under various color states such as red, blue, gray-black, and silver-black, especially robust identification when gray-black or silver-black points are confused with holes, shadows, reflections, scratches, and background textures.

[0004] Traditional image segmentation methods, such as fixed grayscale thresholds, HSV color thresholds, or Otsu thresholds, are relatively simple to implement, but typically rely on stable grayscale or color differences between the target and the background. In machine tool scraping and revealing point images, the color of the revealed points is affected by the coloring material, coating thickness, surface roughness, metallic reflection, and ambient lighting. Fixed threshold methods are prone to missed detections or false detections. While general graph cut or GrabCut-like methods can optimize foreground and background boundaries, they are usually geared towards general foreground extraction tasks and still require appropriate foreground, background seeds, or interaction information. They cannot directly solve the problems of multi-color recognition, dark high-point supplementation, and high-point coordinate generation in scraping and revealing points.

[0005] Under the influence of red lead powder, blue oil, or other color developing media, the highlighted areas do not always appear as highly saturated red or blue. On some heavy-duty guide rails, slides, inlays, or scraped surfaces, the highlighted areas may exhibit characteristics of silver-gray, gray-black, dark gray, or low-saturation cool gray. These areas are similar in brightness to metallic reflections, machining textures, oil stain shadows, hole edges, and localized scratches, making it easy to miss or misdetect them if relying solely on a fixed color threshold or a single dark color threshold.

[0006] Therefore, there is still a need for an industrial color-adaptive high-point recognition method that can adapt to multiple point colors and simultaneously handle the issues of missed detection of dark high points, separation of narrow adhesions, and uniform generation of high-point coordinates. Summary of the Invention

[0007] The technical problem this invention aims to solve is: in complex industrial surface point images, there are issues such as significant variations in point color, strong background interference, easy omission of true high points (grayish-black or silver-black), easy adhesion of adjacent points, and difficulty in stably converting point regions into high point coordinates. This problem should not be understood as a simple threshold selection problem, nor as a simple boundary segmentation problem, but rather as a continuous processing problem encompassing point color response, candidate region selection, omission compensation, region separation, and high point coordinate generation.

[0008] To address the aforementioned technical problems, this invention provides an industrial color-adaptive high-point recognition method. This method first acquires and preprocesses a visible point image of the workpiece surface; then, it constructs a color prior score map based on the target visible point color type, and generates a high-point response map based on the color prior score map. The high-point response map can be obtained directly from the color prior score map, or it can be obtained by automatically generating foreground and background seed regions, establishing a visible point classification model, and fusing the classification model output with the color prior score map.

[0009] To address the issue that gray-black or silver-black highlights are easily affected by background textures, holes, shadows, reflections, and processing scratches, this invention establishes a local background reference. Instead of judging highlights solely based on absolute pixel brightness, it comprehensively assesses whether pixels, relative to the local background, exhibit characteristics such as less red, less yellow, low saturation, cool grayness, and local darkness. Furthermore, through gray-black candidate hard gating, the saturation range, brightness range, and local darkness constraint directly apply to the candidate area, thereby suppressing false detections caused by light gray backgrounds, metallic reflections, and texture scratches.

[0010] After obtaining the high-point response map, this invention obtains candidate display point regions through adaptive segmentation, and combines connected component filtering, narrow connection truncation, dark high-point supplementation, and boundary correction to obtain corrected display point regions. Finally, this invention determines the number of high points and their coordinates based on the area of ​​the corrected display point regions, the effective internal area, the maximum internal distance, and the high-point response score, and outputs the display point region mask and the high-point coordinates.

[0011] This invention provides an industrial color adaptive high-point recognition method, comprising: Acquire a dotted image of the surface of the workpiece to be inspected and preprocess it to obtain a preprocessed image; Based on the target display point color type, a color prior score map is constructed for the preprocessed image, wherein the target display point color type includes at least one of blue display point, red display point, gray-black display point or silver-black display point. A high-point response map is generated based on the color prior score map; wherein the high-point response map is obtained by normalizing the color prior score map, or by fusing the color prior score map with the point classification results obtained based on the foreground seed region and the background seed region; Adaptive segmentation is performed on the high-point response map to obtain the initial candidate display point region; Based on the initial candidate display point region, candidate region constraints and region corrections are performed to obtain the corrected display point region; wherein, the candidate region constraints include at least one of color constraints, brightness constraints, saturation constraints or difference constraints relative to the local background, and the region correction includes at least one of connected component filtering, dark high point supplementation, boundary correction or narrow connection truncation. The number of high points and their coordinates are determined based on the area of ​​the corrected display area, the internal distance transformation value, and the high point response score. Output the mask of the display area and the coordinates of the high point.

[0012] Furthermore, when constructing the color prior score map of gray-black or silver-black visible points, based on the preprocessed image and its local background, the neutral gray feature of the current pixel, as well as at least two of the following features relative to the local background: red component attenuation feature, yellow component attenuation feature, saturation decrease feature, brightness darkening feature, and cold color difference feature, are calculated. The at least two features are then weighted and fused to obtain the color prior score map of gray-black or silver-black visible points. Furthermore, the local background is obtained by locally smoothing at least one of the a and b channels in the Lab color space and the saturation and brightness channels in the HSV color space of the preprocessed pixel image; the red component attenuation feature, yellow component attenuation feature, saturation decrease feature, or brightness darkening feature is the difference feature between the current pixel and its local background.

[0013] Furthermore, a foreground seed region is determined based on the high percentile response region in the color prior score map, and a background seed region is determined based on the portion of the low percentile response region in the color prior score map that is far from the foreground seed region; a point classification model is established based on the pixel-level feature vectors corresponding to the foreground seed region and the background seed region to obtain a classification score map; The pixel-level feature vector includes at least two of the following: hue feature, saturation feature, brightness feature, Lab color component feature, color prior score feature, and color channel difference feature; the point classification model includes a probability model, distance model, statistical classification model, or machine learning classification model based on the estimation of the foreground seed region and the background seed region.

[0014] Furthermore, the adaptive segmentation includes: determining a low threshold and a high threshold based on the high-point response map to obtain a low-threshold region and a high-threshold region; retaining the low-threshold region connected to the high-threshold region as an initial candidate display point region; and reducing the offset of the high threshold relative to the low threshold when the area ratio of the high-threshold region to the low-threshold region is lower than a preset ratio.

[0015] Furthermore, when the target display point color type is gray-black display point or silver-black display point, the candidate region constraint includes gray-black candidate hard gating; the gray-black candidate hard gating includes: filtering the initial candidate display point region based on at least two of the candidate pixel saturation, minimum brightness, maximum brightness, and brightness darkening difference relative to the local background.

[0016] Furthermore, the connected component filtering specifically involves: calculating the area, aspect ratio, fill rate, convex hull compactness, average response score, and response score difference between the connected component and its surrounding annular background region for each connected component in the candidate display point region, and determining whether to retain the connected component based on at least two of the above parameters.

[0017] Furthermore, the connected component filtering includes a strict filtering mode; in the strict filtering mode, the connected component is retained only when the average response score of the connected component meets a first preset condition and the difference in response score between the connected component and its surrounding annular background region meets a second preset condition; a filtering threshold different from that for non-boundary connected components is applied to connected components located within a preset range of the image boundary.

[0018] Furthermore, the number of high points is determined based on the area, effective internal area, and maximum internal distance of the corrected display area; when the area of ​​the corrected display area is less than a first threshold, the maximum internal distance is less than a second threshold, or the effective internal area is less than a third threshold, a single high point is output for the corrected display area; when the corrected display area satisfies the multi-point condition, uniform candidate points are generated within it, the uniform candidate points are attracted to the local optimal response position, and the coordinates of the target number of high points are selected based on distance constraints, response score constraints, or the farthest point selection strategy.

[0019] The present invention also provides an industrial color adaptive high-point recognition system, comprising: a processor and a memory, wherein the memory is used to store program instructions, and the processor is used to call the program instructions in the memory to execute an industrial color adaptive high-point recognition method as described in the above technical solution.

[0020] Compared with existing methods, the improvement of this invention does not focus on simply superimposing image processing operators, but rather on forming a set of industrial color adaptive recognition processes that work together to address problems such as large color changes, strong background interference, easy omission of gray-black or silver-black points in machine tool scraping point images, easy adhesion of adjacent points, and difficulty in stably generating high point coordinates.

[0021] This invention first constructs a multi-color prior score map based on the target visible point color, enabling the method to adapt to different visible point states such as red, blue, gray-black, or silver-black, reducing the sensitivity of fixed grayscale thresholds or single color thresholds to illumination, coating thickness, and surface condition. Based on this, the invention automatically generates foreground and background seed regions using the color prior score map and establishes a visible point classification model, allowing the discrimination boundary between visible points and background to adaptively adjust with the current image, thereby reducing reliance on manual parameter tuning.

[0022] To address the issue that gray-black or silver-black highlights against a red lead powder background are easily confused with holes, dark textures, shadows, reflections, and scratches, this invention no longer relies solely on red or blue highlight features. Instead, it comprehensively utilizes features such as low red, low yellow, low saturation, localized darkening, non-redness, and a tendency towards cool gray to construct gray-black or silver-black highlight responses, thereby improving the recall capability of low-saturation gray-black highlights. Simultaneously, this invention employs hard gating of gray-black candidates and strict connected component filtering, ensuring that constraints such as saturation, brightness range, localized darkness, average response score, and surrounding background contrast work together on the candidate region to eliminate false detections caused by light gray textures, processing scratches, and reflective areas.

[0023] To address the issue of some local dark high points potentially being missed during the main segmentation process, this invention incorporates a dark high point supplementation step. This step replenishes some true dark high points beyond the main detection results and limits new false detections through conditions such as area, response score, and local luminosity difference. To address the problem of adjacent visible points being connected by narrow color regions, this invention utilizes distance transformation to extract the thick kernel portion of the candidate region. This thick kernel region is then used as a seed to grow or backfill within the candidate visible point region, thereby severing narrow connections while preserving the main body of the visible point and reducing the possibility of multiple visible points being mistakenly merged into one region. To address the issue of visible point boundary expansion or overcutting, this invention further employs flexible graph cutting for boundary correction and incorporates an area ratio backoff mechanism to improve boundary stability.

[0024] Furthermore, this invention not only outputs a mask for the visible region, but also determines the number and coordinates of high points based on the area of ​​the modified visible region, the effective internal area, the maximum internal tangent distance, and the high point response score. For visible regions with small areas or insufficient internal effective areas, a single high point is output; for large visible regions that meet the multi-point condition, a more uniform distribution of high point coordinates is generated through a hexagonal grid candidate point, local adsorption, and farthest point selection strategy.

[0025] The aforementioned technical features work synergistically: multi-color priors improve the reliability of the initial response; adaptive seed classification enhances on-site adaptability; candidate hard gating and strict connected component filtering reduce false detections of background textures; dark-color supplementary detection improves the recall rate of gray-black or silver-black visible points; flexible graph cutting and narrow connection severing improve regional boundary and adhesion problems; and uniform point distribution further transforms the visible point region into high-point coordinates that can be directly used for process judgment, manual verification, or subsequent robotic scraping. Overall, this invention can improve the robustness of recognition and the stability of high-point coordinate generation in complex scraping visible point images. Attached Figure Description

[0026] Figure 1 This is a flowchart of the overall process of the method of the present invention, which shows the overall process of image input, preprocessing, color prior construction, seed generation, classification fusion, region segmentation, region correction, uniform point distribution and result output.

[0027] Figure 2 This is a schematic diagram illustrating a specific implementation example of the recognition effect of the present invention under different display point color types; wherein, the top row is the original display point image, the bottom row is the corresponding display point area detection result, and the green overlay area represents the identified display point area; from left to right, they correspond to blue display points, red display points, and gray-black / silver-black display points, respectively.

[0028] Figure 3 A flowchart for constructing and classifying multi-color priors is provided, illustrating the process of extracting RGB, HSV, and Lab color features from the input point image, constructing blue, red, and gray / silver-black point priors respectively, and further generating foreground seed regions, background seed regions, classification score maps, and fused high-point response maps. (a) shows the input point image, (b) shows the multi-color (using the most challenging silver-gray as an example) point prior score map, (c) shows the overlay of the foreground and background seed regions, (d) shows the classification score map output by the point classification model, and (e) shows the high-point response map after fusing the color prior score map and the classification score map.

[0029] Figure 4 The flowchart for correcting silver-gray high-point instances in candidate display regions illustrates the process of connected component filtering, distance transformation, thick kernel region extraction, narrow connection severing, dark high-point supplementation, merging, and final region correction for candidate display regions. (a) shows the candidate display region before region correction; (b) shows the distance transformation map of the candidate display region; (c) shows the region result after narrow connection severing; (d) shows the dark high-point supplementation region; and (e) shows the final display region after connected component filtering, boundary correction, and region correction. Detailed Implementation

[0030] To make the objectives, technical solutions, and advantages of this invention clearer, the technical solutions of this invention will be clearly and completely described below with reference to the accompanying drawings and embodiments. Obviously, the described embodiments are only some, not all, of the embodiments of this invention. All other embodiments obtained by those skilled in the art based on the embodiments of this invention without creative effort are within the scope of protection of this invention.

[0031] This invention is mainly used for the automatic identification of visible points on the surface of a workpiece after treatment with red lead powder, blue oil, colorants, or other coloring media, to obtain a mask of the visible point area and the coordinates of the high points. For example... Figure 1 As shown, this embodiment of the invention provides an industrial color adaptive high-point recognition and uniform point distribution method for machine tool scraping and highlighting points, including the following steps: S1, acquire a dot image of the surface of the workpiece to be inspected, and preprocess the dot image to obtain a preprocessed image; Let p be the pixel position in the input image, where p can represent two-dimensional coordinates (x, y). The input color image is denoted as I(p), with three color channels: R(p), G(p), and B(p). To reduce the influence of illumination-induced color cast, gray-world white balance can be used.

[0032] I(p) = , R'(p) = R(p) m / m_R, G'(p) = G(p) m / m_G, B'(p) = B(p) m / m_B; Where m_R, m_G, and m_B represent the average values ​​of the three color channels R, G, and B, respectively, and m represents the average value of the three. After white balance, further local contrast enhancement, background lighting correction, or noise reduction can be performed.

[0033] In the aforementioned steps, basic preprocessing such as gray-world white balance is performed in the original RGB color space of the input image. To simultaneously utilize hue, saturation, brightness, and color contrast, this invention converts the image from the RGB color space to both the HSV and Lab color spaces. The HSV channels are denoted as H(p), S(p), and V(p), and the Lab channels are denoted as L(p), a(p), and b(p). H(p) is used to calculate the distance between the pixel and the target color center hue; S_H(p) and V(p) are used to characterize the pixel's saturation and brightness, respectively; and L(p), a(p), and b(p) are used to characterize brightness and color contrast. To avoid confusion between the HSV saturation channel S_H(p) and the subsequent high-point response map S(p), this paper denotes the HSV saturation as S_H(p).

[0034] Subsequently, the normalization operator N is calculated to unify features of different dimensions, such as hue distance, saturation, brightness, Lab component, color channel difference, and local background difference, into the same numerical range for subsequent weighted fusion.

[0035] N(X) = (X - min(X)) / (max(X) - min(X) + eps); Where N represents the normalization operator, X represents any feature to be normalized, and eps represents the smallest positive number to prevent the denominator from being zero.

[0036] Secondly, in order to calculate the hue response of the target color and avoid distance calculation errors caused by the breaks at both ends of the hue wheel for colors such as red, the following calculations are performed: d_H(H, H_0) = min(|H - H_0|, H_m - |H - H_0|); Where d_H represents the hue ring distance, H_0 represents the center hue of the target color, and H_m represents the hue period. This definition avoids distance calculation errors caused by breaks in the hue ring at the ends of colors like red.

[0037] S2, construct a color prior score map for the preprocessed image according to the target display point color type, wherein the target display point color type includes at least one of blue display point, red display point, gray-black display point or silver-black display point; Based on the HSV channel, Lab channel, hue ring distance, and normalization operator mentioned above, feature maps for different color types can be constructed. For blue or red highlights, the feature map can include the hue response calculated by d_H, the saturation response obtained by S_H(p), the brightness response obtained by V(p) or L(p), the color contrast response obtained by a(p) and b(p), and the color channel difference response obtained by R(p), G(p), and B(p). For gray-black or silver-black highlights, the feature map can include the low saturation response, local brightness darkening response, neutral gray response, non-red response, and cool color difference response. After being normalized by N, each feature map is weighted and fused to obtain a color prior score map.

[0038] Color prior score maps are used to highlight pixels that may be prominent against complex backgrounds. Different feature combinations can be selected for different prominent pixel colors.

[0039]

[0040]

[0041]

[0042] in, This represents the value at pixel position p. , , These represent prior fractional plots for blue, red, gray-black, or silver-black points, respectively. , , These represent the k-th feature under the corresponding color type; , , These represent the corresponding weights.

[0043] The characteristics of the blue highlight may include the blue hue response obtained in the previous step, the blue opposing component in Lab color space, the enhancement of the blue channel relative to the red and green channels, and saturation characteristics. The characteristics of the red highlight may include the red hue response, the red opposing component in Lab color space, the enhancement of the red channel relative to the green and blue channels, the magenta opposing component, and saturation characteristics.

[0044] The characteristic of gray-black or silver-black spots This is a key distinguishing feature of the present invention. Such highlights should not be judged solely by brightness thresholds, but should be considered in conjunction with characteristics such as neutral gray, low saturation, red component attenuation, yellow component attenuation, brightness darkening, non-redness, and cool color difference. The calculation formula is as follows:

[0045] in, to These correspond to neutral gray features, low saturation features, red component attenuation features, yellow component attenuation features, brightness darkening features, non-red features, and cool color difference features, respectively. Specifically, the neutral gray feature characterizes whether the three color channels of a pixel are similar, and can be obtained based on the degree of difference between the three channels R(p), G(p), and B(p); the low saturation feature characterizes whether the pixel color is close to gray, and can be obtained based on the saturation channel S_H(p) in the HSV color space; the red component attenuation feature characterizes the degree to which a pixel is less red relative to a red background, and can be obtained based on the difference between R(p) and G(p) and B(p); the yellow component attenuation feature characterizes the degree to which a pixel is less yellow, and can be obtained based on the b(p) channel or a combination of RGB channels in the Lab color space; the brightness darkening feature characterizes whether a pixel is darker relative to the local background, and can be obtained based on the difference between the local background brightness V_l(p) and the current pixel brightness V(p); the non-red feature characterizes the degree of enhancement of the green and blue channels relative to the red channel; and the cool color difference feature characterizes the tendency of a pixel to be cool gray, and can be obtained based on the difference between the blue channel and the red channel or the blue tendency in the Lab color space.

[0046] P(p) = λ N(P_c(p)) + (1 - λ) N(P_l(p)); Where P represents the final color prior score map, and λ represents the fusion weight. P_c(p) represents the color discrimination prior, and P_l(p) represents the prior after local background correction. The color discrimination prior P_c(p) is mainly calculated from the color attributes of the current pixel itself, and may include at least one of hue response, saturation response, brightness response, RGB channel difference response, and Lab color contrast response; the prior P_l(p) after local background correction is mainly calculated from the difference between the current pixel and its surrounding local background, and may include at least one of the brightness darkening difference, saturation difference, red component attenuation difference, yellow component attenuation difference, and cool color difference difference relative to the local background. For gray-black or silver-black highlights, retaining a certain color discrimination prior helps to avoid excessive amplification of local textures.

[0047] S3, Generate a high-point response map based on the color prior score map; wherein, the high-point response map is obtained by normalizing the color prior score map, or by fusing the color prior score map with the point classification results obtained based on the foreground seed region and the background seed region; Fixed thresholds are difficult to adapt to different batches, different lighting conditions, and different workpiece surfaces. Therefore, this invention automatically selects reliable foreground and background seeds from the color prior score map of the current image.

[0048] T_f = Q(P, q_f),T_b = Q(P, q_b); M_f = {p | P(p) ≥ T_f, C_f(p) = 1}; M_b = {p | P(p) ≤ T_b, p Dilate(M_f)}; Where T_f represents the foreground threshold, T_b represents the background threshold, Q represents the percentile function, q_f and q_b represent the foreground and background percentiles respectively, M_f represents the foreground seed region, M_b represents the background seed region, and C_f(p) represents the color gating condition, indicating whether pixel position p meets the color gating condition of the target display point color constraint. When C_f(p)=1, it means that the pixel meets the basic requirements of the target display point color type in terms of color attributes; when C_f(p)=0, it means that the pixel does not meet the target display point color constraint and is not used as a candidate pixel for the foreground seed. Dilate(M_f) represents the extended region obtained after morphological dilation of the foreground seed region M_f. By requiring that the background seed pixel p does not belong to Dilate(M_f), the background seed region can be kept away from the foreground seed region, avoiding the misselection of the foreground edge or the transition region adjacent to the foreground as the background seed, thereby improving the stability of the display point classification model.

[0049] Subsequently, a feature vector f(p) is extracted for each pixel. The feature vector may include the sine and cosine of hue, saturation, brightness, Lab color components, and color prior score. A point classification model is established using foreground and background seeds (in this embodiment, the point classification model includes a probability model, distance model, statistical classification model, or machine learning classification model estimated based on the foreground and background seed regions), resulting in a classification score map.

[0050] f(p) = [cos H(p), sin H(p), S(p), V(p), a(p), b(p), P(p)]^T; S_c(p) = log Pr(f(p) | θ_f) - log Pr(f(p) | θ_b); S(p) = α P(p) + (1 - α) N(S_c(p)); Here, θ_f and θ_b represent the model parameters for the foreground and background categories, respectively. Specifically, feature vectors f(p) are extracted from each pixel in the foreground seed region M_f. Based on the feature distribution of these foreground seed pixels, the foreground category model parameters θ_f are estimated using a Gaussian statistical model or mean. The same applies to the background. Thus, the visible point classification model can adaptively update according to the visible point color, background state, and lighting conditions in the current image. S_c represents the classification score map, S represents the fused high-point response map, and α represents the fusion weight of the color prior and the classification score. Pr(f(p) | θ_b) represents the probability of observing pixel feature f(p) under the foreground model parameters θ_f. That is, the degree to which pixel p resembles a "visible foreground". N represents the normalization process.

[0051] S4, Adaptively segment the high-point response map to obtain the initial candidate display point region; A dual-threshold hysteresis segmentation is applied to the high-point response map. The low threshold is used to ensure regional continuity, while the high threshold is used to ensure the reliability of the core region.

[0052] M_l = {p | S(p) ≥ T_l},M_h = {p | S(p) ≥ T_h}; M_0 = Conn(M_l, M_h); Where T_l represents the low threshold, T_h represents the high threshold, M_l represents the low threshold region, M_h represents the high threshold region, and M_0 represents the candidate display point region that is retained after being connected to the high threshold region. If the area of ​​M_h relative to M_l is too small, for example, only 1% to 5%, then the offset of T_h relative to T_l is reduced. For example, if the offset is 4, it can be adjusted to 3 or 2 and M_h is recalculated to reduce the possibility of the true display point core region being missed due to the high threshold being too strict. Conn(M_l, M_h) represents the connectivity preservation operation, which is used to retain the part of the low threshold region M_l that is connected to the high threshold region M_h. Specifically, the low threshold region M_l can be analyzed for connectivity first; if a certain connected component intersects with the high threshold region M_h, then the connected component is retained; if a certain connected component is not connected to the high threshold region M_h, then it is discarded. The resulting M_0 is the initial candidate display point region.

[0053] S5, based on the initial candidate display point region, perform candidate region constraints and region correction to obtain the corrected display point region; wherein, the candidate region constraints include at least one of color constraints, brightness constraints, saturation constraints or difference constraints relative to the local background, and the region correction includes at least one of connected component filtering, dark high point supplementation, boundary correction or narrow connection cutoff. 5.1, Hard gating and strict connected component filtering for gray-black or silver-black candidates; When segmenting gray-black or silver-black points using only the high-point response map, light gray textures, metallic reflections, processing scratches, or local shadows may still enter the candidate region. Therefore, this invention, after adaptive segmentation, further sets a candidate hard gate for the gray-black or silver-black candidate regions, allowing color and local background difference constraints to directly affect the candidate point regions.

[0054] Let the saturation and brightness in the HSV color space be S_H(p) and V(p), respectively, and the local background brightness be V_l(p). Then the local shadow difference is: ΔV(p) = V_l(p) - V(p); The gray-black or silver-black candidate hard gate can be represented as: G_g(p) = 1 when S_H(p) ≤ τ_s, V_min ≤ V(p) ≤ V_max, and ΔV(p) ≥ τ_v; otherwise G_g(p) = 0.

[0055] Where τ_s represents the maximum saturation threshold, V_min and V_max represent the lower and upper limits of brightness, respectively, and τ_v represents the minimum darkness threshold relative to the local background. For the initial candidate display point region M_0, the candidate region after hard gating is: M_g = M_0 ∩ G_g; By using the aforementioned hard gating, saturation, brightness range, and local darkness constraints can be directly introduced into the candidate region generation process, thereby suppressing false detections caused by light gray backgrounds, reflective textures, and scratches.

[0056] Subsequently, connected component analysis is performed on the candidate display point regions. For the i-th connected component C_i, the area A_i, aspect ratio R_i, fill rate F_i, convex hull compactness Q_i, region average response S_i, and annular background response difference Δ_i are calculated.

[0057] Δ_i = mean(S(p), p ∈ C_i) - mean(S(p), p ∈ Ring(C_i)); By filtering based on area, shape, compactness, and response contrast, false detection areas such as excessively small noise, fine scratches, hole edges, and image boundary interference can be eliminated. Here, mean represents the average value, and Ring(C_i) represents the annular neighborhood region surrounding the i-th connected region C_i, used to estimate the local background response near this connected region. It can be obtained by morphological dilation of the connected region C_i.

[0058] Furthermore, in the connected component filtering process, the present invention can employ a strict filtering mode. For the i-th connected component C_i, if its average response score is S_i and the difference in response score between it and the surrounding annular background region is Δ_i, then the strict filtering condition can be expressed as: Keep(C_i) = 1, when S_i ≥ τ_m and Δ_i ≥ τ_c; otherwise Keep(C_i) = 0.

[0059] Here, Keep() is a binary judgment function, τ_m represents the average response score threshold, and τ_c represents the local contrast threshold. Compared to methods that only require either the average response score or local contrast to meet one of the criteria, the strict filtering mode can further eliminate texture regions with high response but lacking local contrast, as well as noisy regions with obvious local contrast but insufficient overall pixel response.

[0060] For connected components located within a preset range of image boundaries, a different threshold combination can be used compared to that used for non-boundary connected components: Keep_b(C_i) = 1 when S_i ≥ τ_bm and Δ_i ≥ τ_bc; otherwise Keep_b(C_i) = 0.

[0061] Here, τ_bm and τ_bc represent the average response score threshold and local contrast threshold of the boundary connected region, respectively. By setting independent judgment conditions for the boundary region, false detections caused by edge occlusion, boundary reflection, and clipped boundaries can be reduced.

[0062] 5.2 Narrow connection termination based on distance transformation; Multiple real-world points may be connected by very narrow color channels. Directly connected component analysis can mistakenly treat these points as a single entity. Therefore, this invention utilizes distance transformation to distinguish between the main body of points and narrow connections.

[0063] D(p) = min_{q ∈ M_0} ||p - q||_2; K = {p | p ∈ M_0, D(p) ≥ τ_d}; M_1 = Grow(K, M_0); Where D represents the distance from the pixel inside the candidate region to the boundary, K represents the thick kernel region, τ_d represents the distance threshold, and Grow(K, M_0) represents the restricted region growth operation. That is, using the thick kernel region K as the seed region and the original candidate region M_0 as the growth constraint region, K is expanded or backfilled within the range of M_0 to obtain region M_1. Since the distance from the boundary to the narrow connected region is small, it is usually not selected into the thick kernel region K. Therefore, after restricted region growth, the narrow connections in the original candidate region can be weakened or cut off, thereby reducing the situation where multiple adjacent visible points are mistakenly merged into a single connected region.

[0064] 5.3, Re-inspection of dark high points; To reduce false positives, the main detection branch is usually conservative and may miss some true dark or silver-black high points. This invention sets up a dark high point supplementary detection branch in addition to the main detection result (i.e., the result obtained after region segmentation).

[0065] ΔV(p) = V_l(p) - V(p); C_c(p) = B(p) - R(p),C_n(p) = (G(p) + B(p)) / 2 - R(p); M_d = {p | p G_m, A_d(p) = 1, S(p) ≥ T_d or ΔV(p) ≥ τ_v}; Where V_l represents local background brightness, ΔV represents local darkness, C_c represents cool color difference, C_n represents non-redness, G_m represents the protected area of ​​the main detection mask, derived from the expansion of the main detection result, and A_d represents the color constraint condition for dark candidates. Color constraints may include low saturation, medium to low brightness (e.g., when the value range is 0 to 255, the threshold can be set to below 80 to 130), and cool color difference or non-redness (which can be determined based on the difference between RGB channels or the difference between color channels in the Lab color space).

[0066] After obtaining the dark candidate regions, a preset response score enhancement value is assigned to the dark candidate regions obtained from the supplementary detection of dark high points. Then, further filtering is performed based on area, average response score, and average local occultation. Finally, it is merged with the main detection result (the visible region mask obtained after segmentation and region correction of the main detection branch). Area is used to exclude excessively small fragments and excessively large shadow areas; average response score is used to ensure that the region still has visible point features; and average local occultation is used to ensure that the region is indeed darker than the surrounding background. The dark candidate region is retained only when all three conditions are met. This can recover dark but real high points while avoiding the introduction of a large number of holes, scratches, and shadows.

[0067] 5.4, ​​Boundary Correction; For candidate regions with wide boundaries or contiguous backgrounds, a local region of interest can be constructed and boundary correction can be performed. One implementation method is to use a graph cut model, using high-response regions as foreground seeds and outer annular regions and low-response regions as background seeds.

[0068] ; in, The label representing pixel p The data can be represented by a negative logarithmic mapping from the high-point response scores. β represents the smoothing weight between adjacent pixels, and β represents the smoothing term weight. The region C_i′ is obtained after graph cut. To avoid over-pruning, the area ratio r_i can be used for verification.

[0069] r_i = Area(C_i′) / (Area(C_i) + eps); Where Area represents the region area. If r_i is lower than the preset lower limit, it will revert to the region before correction; otherwise, the boundary correction result will be retained.

[0070] S6. Determine the number of high points and their coordinates based on the area of ​​the corrected display area, the internal distance transformation value, and the high point response score; The mask for the visible region can only represent the range; the coordinates of the elevation points are also needed for actual analysis. For each corrected visible region C_i, this invention determines the number of elevation points based on the region area, the effective internal area, and the maximum internal distance.

[0071] D_i(p) = min_{q ∈ C_i} ||p - q||_2; V_i = {p | p ∈ C_i, D_i(p) ≥ τ_e}; n_i = min(round(A_i / A_0), floor(Area(V_i) / A_p), n_max); Where D_i represents the inscribed distance of the i-th region. C_i represents the set of adjacent edge pixels inside and outside region C_i, V_i represents the effective internal region, τ_e represents the effective internal distance threshold, which is a certain proportion of the target minimum width, A_i represents the region area, A_0 represents the average region area corresponding to each point, A_p represents the minimum effective internal area required for each point, and n_max represents the maximum number of points allowed in a single region. n_i represents the number of high points that the i-th corrected display point region C_i finally needs to output. If the region area, maximum inscribed distance, or effective internal area is insufficient, a single high point is output.

[0072] For a single-point region, select the location that is far from the boundary and has a high response as the high point. For a multi-point region, first generate hexagonal grid candidate points (uniform candidate points) in the effective internal region, then snap the candidate points to the local optimal response location, and finally select the coordinates of the target number of high points based on distance constraints, response score constraints, or the farthest point selection strategy.

[0073] Q_i(p) = (1 - μ) N(D_i(p)) + μ N(S(p)); J(p) = λ_d N(D_i(p)) + λ_s N(S(p)) + λ_p(1 - ||p - p_0||_2 / ρ); O(p) = η N(d(p, P_s)) + (1 - η) N(Q_i(p)); Where Q_i represents the high point position score, μ represents the fusion weight between the distance and response terms, with a value ranging from 0 to 1, J represents the local adsorption target of the candidate point, λ_d, λ_s, and λ_p represent the weights of the distance, response, and position constraints, respectively, and the sum of the three is 1, O represents the farthest point screening target; p_0 represents the initial candidate point of the hexagonal grid, ρ represents the adsorption radius, P_s represents the set of selected high points, d(p,P_s) represents the minimum distance from candidate point p to the set of selected points, and η represents the fusion weight between the uniform distribution term and the position quality term, with a value ranging from 0 to 1.

[0074] S7 outputs the mask of the display area and the coordinates of the high point.

[0075] The mask of visible areas and the coordinates of high points output in this embodiment can be used for scraping quality evaluation, manual verification, counting of visible points, and robot scraping path planning. In robot scraping scenarios, the coordinates of high points can be mapped to the machining target points of the robot end effector through camera calibration and workpiece coordinate system transformation, thereby providing a data foundation for subsequent automatic scraping.

[0076] This invention provides an industrial color-adaptive high-point recognition and uniform point distribution method for machine tool scraping and highlighting. This method transforms complex highlighting images into highlighting region masks and high-point coordinates through multi-color priors, adaptive seed classification fusion, connected component filtering, distance transformation to cut narrow connections, dark-colored high-point supplementation, boundary correction, and uniform point distribution based on area and distance transformations.

[0077] Compared to traditional threshold segmentation, ordinary connected component processing, early black spot counting methods, and general graph cut segmentation methods, this invention places greater emphasis on multi-color adaptation, gray-black high point omission compensation, adhesion region separation, and uniform coordinate output in the scraped and revealed point image, which can provide a more stable visual input for subsequent manual verification, process analysis, or automated processing.

[0078] In specific implementation, the method proposed in the technical solution of this invention can be automatically executed by those skilled in the art using computer software technology. System devices for implementing the method, such as computer-readable storage media storing the corresponding computer program of the technical solution of this invention and computer equipment including the computer program running the corresponding computer program, should also be within the protection scope of this invention.

[0079] This invention also provides an industrial color adaptive high-point recognition system, comprising: a processor and a memory, wherein the memory is used to store program instructions, and the processor is used to call the program instructions in the memory to execute an industrial color adaptive high-point recognition method as described in the above technical solution.

[0080] The specific embodiments described herein are merely illustrative of the spirit of the invention. Those skilled in the art to which this invention pertains may make various modifications or additions to the described specific embodiments or use similar methods to replace them, without departing from the spirit of the invention or exceeding the scope defined by the appended claims.

Claims

1. An industrial color adaptive high-point recognition method, characterized in that, include: Acquire a dotted image of the surface of the workpiece to be inspected and preprocess it to obtain a preprocessed image; Based on the target display point color type, a color prior score map is constructed for the preprocessed image, wherein the target display point color type includes at least one of blue display point, red display point, gray-black display point or silver-black display point. A high-point response map is generated based on the color prior score map; wherein the high-point response map is obtained by normalizing the color prior score map, or by fusing the color prior score map with the point classification results obtained based on the foreground seed region and the background seed region; Adaptive segmentation is performed on the high-point response map to obtain the initial candidate display point region; Based on the initial candidate display point region, candidate region constraints and region corrections are performed to obtain the corrected display point region; wherein, the candidate region constraints include at least one of color constraints, brightness constraints, saturation constraints or difference constraints relative to the local background, and the region correction includes at least one of connected component filtering, dark high point supplementation, boundary correction or narrow connection truncation. The number of high points and their coordinates are determined based on the area of ​​the corrected display area, the internal distance transformation value, and the high point response score. Output the mask of the display area and the coordinates of the high point.

2. The method according to claim 1, characterized in that: When constructing the color prior score map of gray-black or silver-black visible points, based on the preprocessed image and its local background, the neutral gray feature of the current pixel and at least two of the following features relative to the local background: red component attenuation feature, yellow component attenuation feature, saturation decrease feature, brightness darkening feature, and cool color difference feature are calculated. The at least two features are then weighted and fused to obtain the color prior score map of gray-black or silver-black visible points.

3. The method according to claim 2, characterized in that: The local background is obtained by locally smoothing at least one of the a and b channels in the Lab color space and the saturation and brightness channels in the HSV color space of the preprocessed pixel image; the red component attenuation feature, yellow component attenuation feature, saturation decrease feature or brightness darkening feature is the difference feature between the current pixel and its local background.

4. The method according to claim 1, characterized in that: The foreground seed region is determined based on the high percentile response region in the color prior score map, and the background seed region is determined based on the portion of the low percentile response region in the color prior score map that is far from the foreground seed region. Based on the pixel-level feature vectors corresponding to the foreground seed region and the background seed region, a point classification model is established to obtain a classification score map. The pixel-level feature vector includes at least two of the following: hue feature, saturation feature, brightness feature, Lab color component feature, color prior score feature, and color channel difference feature; the point classification model includes a probability model, distance model, statistical classification model, or machine learning classification model based on the estimation of the foreground seed region and the background seed region.

5. The method according to claim 1, characterized in that: The adaptive segmentation includes: determining a low threshold and a high threshold based on the high-point response map to obtain a low-threshold region and a high-threshold region; retaining the low-threshold region connected to the high-threshold region as an initial candidate display point region; and reducing the offset of the high threshold relative to the low threshold when the area ratio of the high-threshold region to the low-threshold region is lower than a preset ratio.

6. The method according to claim 1, characterized in that: When the target display point color type is gray-black display point or silver-black display point, the candidate region constraint includes gray-black candidate hard gating; The gray-black candidate hard gating includes: filtering the initial candidate display area based on at least two of the following: saturation of candidate pixels, minimum brightness, maximum brightness, and brightness darkening difference relative to the local background.

7. The method according to claim 1, characterized in that: The connected component filtering specifically involves: calculating the area, aspect ratio, fill rate, convex hull compactness, average response score, and response score difference between the connected component and its surrounding annular background region for each connected component in the candidate display point region; and determining whether to retain the connected component based on at least two of the above parameters.

8. The method according to claim 7, characterized in that: The connected component filtering includes a strict filtering mode; in the strict filtering mode, the connected component is retained only when the average response score of the connected component meets a first preset condition and the difference in response score between the connected component and its surrounding annular background region meets a second preset condition; a different filtering threshold is applied to connected components located within a preset range of the image boundary than to non-boundary connected components.

9. The method according to claim 1, characterized in that: The number of high points is determined based on the area, effective internal area, and maximum internal distance of the corrected display area. When the area of ​​the corrected display area is less than a first threshold, the maximum internal distance is less than a second threshold, or the effective internal area is less than a third threshold, a single high point is output for the corrected display area. When the corrected display area satisfies the multi-point condition, uniform candidate points are generated within it, and the uniform candidate points are attracted to the local optimal response position. The coordinates of the target number of high points are selected based on distance constraints, response score constraints, or the farthest point selection strategy.

10. An industrial color adaptive high-point recognition system, characterized in that, include: The processor and memory, wherein the memory is used to store program instructions, and the processor is used to call the program instructions in the memory to execute the industrial color adaptive high-point recognition method as described in any one of claims 1-9.