Height repairing method and device combined with mask area, equipment and medium

By selecting the mask area and curvature information to determine the standard height value, and combining morphological operations and edge curvature coefficients, the problem of rapid and accurate height repair of transparent objects is solved, making it suitable for inspection scenarios such as PCB boards.

CN121660930APending Publication Date: 2026-03-13GUANGZHOU LEICHEN INTELLIGENT EQUIP TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-08-26
Publication Date
2026-03-13

AI Technical Summary

Technical Problem

Existing technologies struggle to quickly and accurately restore the height data of highly transparent objects under test, especially due to imaging collapse issues with crystal devices on PCBs, resulting in poor detection performance.

Method used

By acquiring the height and color image data of the object under test, the mask area is selected, feature points are selected using curvature information and standard height values ​​are determined, and height restoration is performed based on this information. The restoration and adjustment are then combined with morphological operations and edge curvature coefficients.

Benefits of technology

It enables rapid and accurate restoration of highly transparent objects, improving the integrity and accuracy of detection results. It is applicable to various scenarios, including objects with markings or patterns.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121660930A_ABST
    Figure CN121660930A_ABST
Patent Text Reader

Abstract

The invention discloses a height repairing method and device combined with a mask area, equipment and a medium, and belongs to the technical field of image processing. The method comprises the following steps: acquiring height image data and color image data of a to-be-measured object; performing threshold screening on the color image data to obtain a mask area of the to-be-detected object; determining curvature information of the height image data in the mask area; selecting feature points according to curvature information in the mask area, and determining a standard height value according to height data of the feature points; and performing height repair on the mask region of the height image data based on the standard height value. According to the technical scheme, the area range for height repairing can be accurately determined by obtaining the mask area of the to-be-detected object, the standard height value is determined according to the curvature information, height repairing is conducted on the mask area based on the standard height value, and the accurate height repairing result of the to-be-detected object can be rapidly obtained.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application belongs to the field of image processing technology, specifically relating to a method, apparatus, device, and medium for height restoration of a masked region. Background Technology

[0002] Currently, PCBs (Printed Circuit Boards) are an indispensable core component of various smart devices. Three-dimensional reconstruction of PCBs provides a data foundation for subsequent PCB inspection. Automated optical inspection technology can be used to acquire three-dimensional images of the object under test.

[0003] However, there are many different types of devices on the PCB board, which will encounter various imaging problems. For example, imaging collapse caused by objects with high transparency (such as crystal devices). Because of the high transparency of such objects, the structured light used by automatic optical inspection technology can easily be projected over the surface of the crystal device, so that the height data measured at the structured light projection position is actually the height value of the background area of ​​the crystal device, which cannot meet the inspection requirements.

[0004] Currently, there is no method for height restoration of objects with high transparency. Therefore, how to achieve fast and accurate height restoration of objects with high transparency is a problem that urgently needs to be solved by those in the field. Summary of the Invention

[0005] The purpose of this application is to provide a method, apparatus, device, and medium for height restoration by combining a mask area, which can quickly and accurately restore the height data of the object under test.

[0006] In a first aspect, embodiments of this application provide a height restoration method combining a mask region, the method comprising:

[0007] Acquire height and color image data of the object under test;

[0008] The color image data is subjected to threshold filtering to obtain the mask area of ​​the object to be tested;

[0009] Determine the curvature information of the height image data in the mask region;

[0010] Feature points are selected based on the curvature information in the mask area, and standard height values ​​are determined based on the height data of the feature points.

[0011] Height restoration is performed on the masked area of ​​the height image data based on the standard height value.

[0012] The beneficial effect of this solution is that by obtaining the mask area of ​​the object to be tested, the area range for height repair can be accurately determined. By determining the standard height value based on the curvature information and performing height repair on the mask area based on the standard height value, a relatively accurate height repair result of the object to be tested can be obtained quickly.

[0013] Furthermore, threshold filtering is performed on the color image data to obtain the mask region of the object to be tested, including:

[0014] The color image data is threshold-filtered according to a pre-set color channel threshold, and at least one pixel region is selected from the color image data.

[0015] Define the pixel region with the largest outline as the target pixel region;

[0016] Morphological operations are performed on the target pixel region to obtain the mask region of the object under test.

[0017] The beneficial effect of this scheme is that by determining the pixel region with the largest outline within the color channel threshold as the target pixel region, the pixel region with the highest probability of being represented as the object under test can be obtained. By performing morphological operations on the target pixel region, noise at the outline of the target pixel region can be removed, and the marking pattern on the object under test in the target pixel region can be filled, thereby obtaining a clearer and more accurate representation of the object under test, which is helpful for subsequent height restoration processing.

[0018] Further, determining the curvature information of the height image data in the mask region includes:

[0019] Obtain the spatial curvature distribution of the height image data;

[0020] Background points are filtered out from the height image data based on the mask area to obtain the curvature information of the height image data in the mask area;

[0021] Accordingly, feature points are selected based on the curvature information in the mask region, and standard height values ​​are determined based on the height data of the feature points, including:

[0022] The pixel point whose curvature information in the mask region is maximized is determined as the feature point;

[0023] If the height data of the feature point is greater than the preset standard lower limit, then the height value of the feature point is determined as the standard height value;

[0024] If the height data of the feature point is not greater than the preset standard lower limit, then the preset reference height is determined as the standard height value.

[0025] The beneficial effect of this solution is that by determining the pixel with the maximum curvature information in the mask area as the feature point, the overall degree of collapse of the object under test can be directly determined. By determining the preset reference height as the standard height value when the height data of the feature point is not greater than the preset standard lower limit, a reference standard can be provided for subsequent height repair processing when there is no actual data reference.

[0026] Furthermore, height restoration is performed on the masked region of the height image data based on the standard height value, including:

[0027] Based on the standard height value, the mask area of ​​the height image data is assigned a height value to obtain the height restoration result of the object to be tested in the height image data.

[0028] The beneficial effect of this solution is that by assigning height values ​​to the mask area of ​​the height image data based on standard height values, it is possible to achieve rapid overall height restoration of the object under test, and prevent the height restoration result of the object under test from being too smooth, thereby improving the accuracy of the restoration.

[0029] Furthermore, the height restoration of the masked region of the height image data based on the standard height value also includes:

[0030] The mask area is subjected to morphological etching to obtain an etched mask area;

[0031] The difference between the etched mask region and the mask region is defined as the mask edge region;

[0032] Obtain the predetermined edge curvature coefficient;

[0033] Based on the edge curvature coefficient and the standard height value, a height value is assigned to the edge region of the mask to obtain the height restoration result of the edge position of the object under test in the height image data.

[0034] The beneficial effect of this scheme is that by assigning height values ​​to the mask edge region based on the edge curvature coefficient and standard height value, the height restoration result of the edge position of the object under test in the height image data can be obtained, improving the integrity of the height restoration result and making the height restoration result closer to the actual object under test.

[0035] Furthermore, the height restoration of the masked region of the height image data based on the standard height value also includes:

[0036] Obtain the preset depth adjustment coefficient for the logo pattern.

[0037] Based on the preset depth adjustment coefficient and the mask area, the height of the marking pattern on the object to be tested is restored.

[0038] The beneficial effect of this solution is that by adjusting the coefficient according to the preset depth to repair the height of the marking pattern on the object under test, the solution can accurately repair the object with marking pattern, thus expanding the applicable scenarios of this solution.

[0039] Furthermore, based on the preset depth adjustment coefficient and the mask area, the height of the marking pattern on the object under test is restored, including:

[0040] The fine-tuning matrix of the marking pattern is determined according to the preset depth adjustment coefficient;

[0041] Multiply the color information of each pixel in the mask area with the fine-tuning matrix to obtain the height adjustment value of the mark pattern in the mask area;

[0042] The height data of the marking pattern included in the mask area is adjusted based on the adjusted height value to obtain the height restoration result of the marking pattern on the object under test.

[0043] The beneficial effect of this solution is that by determining the fine-tuning matrix of the marking pattern according to the preset depth adjustment coefficient, and adjusting the height data of the marking pattern included in the mask area according to the fine-tuning matrix, the accuracy of repairing the height data of the marking pattern position on the object under test can be further improved.

[0044] Secondly, embodiments of this application provide a height restoration device for a combined mask region, the device comprising:

[0045] The data acquisition module is used to acquire height image data and color image data of the object under test;

[0046] The mask region acquisition module is used to perform threshold filtering on the color image data to obtain the mask region of the object to be tested;

[0047] A curvature information determination module is used to determine the curvature information of the height image data in the mask region;

[0048] The standard height determination module is used to select feature points based on the curvature information in the mask area and determine the standard height value based on the height data of the feature points.

[0049] The height restoration module is used to restore the height of the masked area of ​​the height image data based on the standard height value.

[0050] The beneficial effect of this solution is that by obtaining the mask area of ​​the object to be tested, the area range for height repair can be accurately determined. By determining the standard height value based on the curvature information and performing height repair on the mask area based on the standard height value, a relatively accurate height repair result of the object to be tested can be obtained quickly.

[0051] Furthermore, the mask region acquisition module is specifically used for:

[0052] The color image data is threshold-filtered according to a pre-set color channel threshold, and at least one pixel region is selected from the color image data.

[0053] Define the pixel region with the largest outline as the target pixel region;

[0054] Morphological operations are performed on the target pixel region to obtain the mask region of the object under test.

[0055] The beneficial effect of this scheme is that by determining the pixel region with the largest outline within the color channel threshold as the target pixel region, the pixel region with the highest probability of being represented as the object under test can be obtained. By performing morphological operations on the target pixel region, noise at the outline of the target pixel region can be removed, and the marking pattern on the object under test in the target pixel region can be filled, thereby obtaining a clearer and more accurate representation of the object under test, which is helpful for subsequent height restoration processing.

[0056] Furthermore, the curvature information determination module is specifically used for:

[0057] Obtain the spatial curvature distribution of the height image data;

[0058] Background points are filtered out from the height image data based on the mask area to obtain the curvature information of the height image data in the mask area;

[0059] Accordingly, the standard height determination module is specifically used for:

[0060] The pixel point whose curvature information in the mask region is maximized is determined as the feature point;

[0061] If the height data of the feature point is greater than the preset standard lower limit, then the height value of the feature point is determined as the standard height value;

[0062] If the height data of the feature point is not greater than the preset standard lower limit, then the preset reference height is determined as the standard height value.

[0063] The beneficial effect of this solution is that by determining the pixel with the maximum curvature information in the mask area as the feature point, the overall degree of collapse of the object under test can be directly determined. By determining the preset reference height as the standard height value when the height data of the feature point is not greater than the preset standard lower limit, a reference standard can be provided for subsequent height repair processing when there is no actual data reference.

[0064] Furthermore, the height repair module is specifically used for:

[0065] Based on the standard height value, the mask area of ​​the height image data is assigned a height value to obtain the height restoration result of the object to be tested in the height image data.

[0066] The beneficial effect of this solution is that by assigning height values ​​to the mask area of ​​the height image data based on standard height values, it is possible to achieve rapid overall height restoration of the object under test, and prevent the height restoration result of the object under test from being too smooth, thereby improving the accuracy of the restoration.

[0067] Furthermore, the height repair module is also used for:

[0068] The mask area is subjected to morphological etching to obtain an etched mask area;

[0069] The difference between the etched mask region and the mask region is defined as the mask edge region;

[0070] Obtain the predetermined edge curvature coefficient;

[0071] Based on the edge curvature coefficient and the standard height value, a height value is assigned to the edge region of the mask to obtain the height restoration result of the edge position of the object under test in the height image data.

[0072] The beneficial effect of this scheme is that by assigning height values ​​to the mask edge region based on the edge curvature coefficient and standard height value, the height restoration result of the edge position of the object under test in the height image data can be obtained, improving the integrity of the height restoration result and making the height restoration result closer to the actual object under test.

[0073] Furthermore, the height repair module is also used for:

[0074] Obtain the preset depth adjustment coefficient for the logo pattern.

[0075] Based on the preset depth adjustment coefficient and the mask area, the height of the marking pattern on the object to be tested is restored.

[0076] The beneficial effect of this solution is that by adjusting the coefficient according to the preset depth to repair the height of the marking pattern on the object under test, the solution can accurately repair the object with marking pattern, thus expanding the applicable scenarios of this solution.

[0077] Furthermore, the height repair module is also used for:

[0078] The fine-tuning matrix of the marking pattern is determined according to the preset depth adjustment coefficient;

[0079] Multiply the color information of each pixel in the mask area with the fine-tuning matrix to obtain the height adjustment value of the mark pattern in the mask area;

[0080] The height data of the marking pattern included in the mask area is adjusted based on the adjusted height value to obtain the height restoration result of the marking pattern on the object under test.

[0081] The beneficial effect of this solution is that by determining the fine-tuning matrix of the marking pattern according to the preset depth adjustment coefficient, and adjusting the height data of the marking pattern included in the mask area according to the fine-tuning matrix, the accuracy of repairing the height data of the marking pattern position on the object under test can be further improved.

[0082] Thirdly, embodiments of this application provide an electronic device including a processor, a memory, and a program or instructions stored in the memory and executable on the processor, wherein the program or instructions, when executed by the processor, implement the steps of the method described in the first aspect.

[0083] Fourthly, embodiments of this application provide a readable storage medium on which a program or instructions are stored, which, when executed by a processor, implement the steps of the method described in the first aspect.

[0084] Fifthly, embodiments of this application provide a chip, the chip including a processor and a communication interface, the communication interface being coupled to the processor, the processor being used to run programs or instructions to implement the method as described in the first aspect.

[0085] In this embodiment, height image data and color image data of the object to be tested are acquired; threshold filtering is performed on the color image data to obtain a mask region of the object to be tested; curvature information of the height image data in the mask region is determined; feature points are selected based on the curvature information in the mask region, and a standard height value is determined based on the height data of the feature points; height restoration is performed on the mask region of the height image data based on the standard height value. The technical solution provided in this embodiment, by combining edge information for weighted calculation and using adaptive gain for fusion calculation, can dynamically adjust according to the height distribution characteristics of different regions, making the fusion of height values ​​smoother and more accurate. Attached Figure Description

[0086] Figure 1 This is a schematic flowchart of the height restoration method for the combined mask area provided in the embodiments of this application;

[0087] Figure 2 This is a schematic flowchart of the height restoration method for the combined mask area provided in the embodiments of this application;

[0088] Figure 3 This is an example diagram of the mask area of ​​the object under test provided in an embodiment of this application;

[0089] Figure 4 This is a schematic flowchart of the height restoration method for the combined mask area provided in the embodiments of this application;

[0090] Figure 5 This is a schematic flowchart of the height restoration method for the combined mask area provided in the embodiments of this application;

[0091] Figure 6 This is a schematic diagram of the structure of the height repair device for the combined mask area provided in the embodiments of this application;

[0092] Figure 7 This is a schematic diagram of the structure of the electronic device provided in the embodiments of this application. Detailed Implementation

[0093] To make the objectives, technical solutions, and advantages of this application clearer, specific embodiments of this application will be described in further detail below with reference to the accompanying drawings. It should be understood that the specific embodiments described herein are merely for explaining this application and not for limiting it. It should also be noted that, for ease of description, only the parts relevant to this application are shown in the drawings, not all of them. Before discussing exemplary embodiments in more detail, it should be mentioned that some exemplary embodiments are described as processes or methods depicted as flowcharts. Although the flowcharts describe operations (or steps) as sequential processes, many of these operations can be performed in parallel, concurrently, or simultaneously. Furthermore, the order of the operations can be rearranged. The process can be terminated when its operation is completed, but may also have additional steps not included in the drawings. The process can correspond to a method, function, procedure, subroutine, subprogram, etc.

[0094] The technical solutions of the embodiments of this application will be clearly described below with reference to the accompanying drawings. Obviously, the described embodiments are only some, not all, of the embodiments of this application. All other embodiments obtained by those skilled in the art based on the embodiments of this application are within the scope of protection of this application.

[0095] The terms "first," "second," etc., used in the specification and claims of this application are used to distinguish similar objects and not to describe a specific order or sequence. It should be understood that such use of data can be interchanged where appropriate so that embodiments of this application can be implemented in orders other than those illustrated or described herein, and the objects distinguished by "first," "second," etc., are generally of the same class and the number of objects is not limited; for example, a first object can be one or more. Furthermore, in the specification and claims, "and / or" indicates at least one of the connected objects, and the character " / " generally indicates that the preceding and following objects are in an "or" relationship.

[0096] The following description, in conjunction with the accompanying drawings, details the height repair method, apparatus, equipment, and medium for the combined mask area provided in this application through specific embodiments and application scenarios.

[0097] Currently, automated optical inspection technology can be used to reconstruct a 3D object and obtain a 3D image of the object. However, if an object has high transparency, the structured light used in automated optical inspection technology can pass through the object, resulting in a large area of ​​height collapse in the 3D image of the object.

[0098] In existing technologies, smoothing filtering techniques can be used to repair the height data of objects in a 3D image. However, if the height data of the object has large-area collapse, multiple iterations of smoothing filtering are required, and the repair effect is not stable. Especially when height collapse also exists at the object's edges, the height data at the edges cannot be restored normally. Smoothing filtering is a signal processing technique used to remove noise from signals, smooth signals, enhance signal features, or extract information of interest.

[0099] Furthermore, the height data of objects in the 3D image can be repaired by integrating color image information based on a deep learning model. However, this method requires a large amount of sample data for training, and actual abnormal data samples are difficult to collect. Moreover, this method places high demands on the computer's learning and processing capabilities, making it difficult to achieve. Deep learning models are machine learning models that use multi-layered neural networks to learn complex patterns and features in data.

[0100] Understandably, existing technologies suffer from drawbacks such as poor robustness, long development cycles, and unstable results, making it difficult to meet actual production and testing needs.

[0101] To address the aforementioned shortcomings, this application obtains a mask region representing the object under test and performs height repair based on the height data of the maximum curvature point within the mask region or a preset reference height. This simplifies the repair operation, improves repair efficiency, expands the applicable scenarios, and, by adjusting the height repair result according to the fine-tuning matrix, makes the height repair result more complete and realistic.

[0102] Figure 1 This is a schematic flowchart of the height restoration method for the combined mask area provided in the embodiments of this application.

[0103] like Figure 1 As shown, the specific steps include the following:

[0104] S101, acquire the height image data and color image data of the object to be measured;

[0105] Firstly, this solution can be used in scenarios where automated optical inspection technology is used for 3D reconstruction to highly repair areas with imaging anomalies. Based on this scenario, it's understandable that the implementing entity for this solution can be a smart terminal with image recognition and data processing capabilities, such as a mobile phone, tablet, or desktop computer; no further limitations are imposed here.

[0106] The object under test can refer to an object that requires 3D reconstruction, especially an object with high transparency. As an example, the object under test in this solution can refer to a crystal device on a PCB board.

[0107] Here, height image data refers to an image where each pixel includes height data; that is, the imaging result obtained after 3D reconstruction using automated optical inspection technology, which can be represented by a HeightMap. The height data can refer to the height difference between the position corresponding to that pixel and the background area. As an example, the background area can refer to the substrate of the aforementioned PCB board.

[0108] In one embodiment, height image data can be acquired by using automated optical inspection technology. Specifically, the basic process of automated optical inspection technology includes: projecting a specific light structure onto the object to be measured using a light projector, capturing the light structure pattern formed on the surface of the object using a camera, and determining the height data of the object by analyzing the deformation of the light structure on the surface of the object.

[0109] Color image data can refer to RGB images, which can be represented using an ImageMap. Specifically, an RGB image is an image containing information from three channels: R (red), G (green), and B (blue). Rich colors and details are presented by combining the brightness values ​​of these three color channels.

[0110] In one embodiment, color image data can be acquired via a camera. The basic process of a camera acquiring color image data includes: an optical sensor located behind the camera lens converts light entering through the lens into an electrical signal; a photosensitive element in the optical sensor detects the intensity, color, etc., of the light and converts it into a voltage signal; an analog-to-digital converter converts the continuously changing analog voltage signal into digital form for further processing and storage; an image processor processes and enhances the digital signal, including color correction, contrast adjustment, and noise reduction, to improve image quality and clarity; the camera compresses the color image data to reduce the space and bandwidth required for storage and transmission; and the processed and compressed color image data is output to the computer's microprocessor chip via an interface (such as USB, HDMI, and Ethernet cable).

[0111] In one embodiment, after acquiring the height image data and color image data of the object to be measured, the height image data and color image data are aligned in position so that each pixel in the height image data is uniquely associated with a pixel in the color image data, and the association relationship is that the two pixels simultaneously correspond to the same position in reality.

[0112] S102, perform threshold filtering on the color image data to obtain the mask area of ​​the object to be tested;

[0113] The mask region can refer to the pixel region representing the object to be measured, determined based on color image data. The image including the mask region can be represented using a mask. crystal The representation is as follows: Specifically, if the value of a pixel is 0, then the pixel represents the background area; if the value of a pixel is 1, then the pixel represents the object being measured.

[0114] In one embodiment, the method of obtaining the mask region of the object to be tested by thresholding the color image data can be achieved by thresholding the color image data according to a pre-set color channel threshold, selecting at least one pixel region in the color image data, determining the pixel region with the largest outline as the target pixel region, and performing morphological operations on the target pixel region to obtain the mask region of the object to be tested.

[0115] S103, determine the curvature information of the height image data in the mask area;

[0116] Curvature information can be used to describe the rate of change of height data at each pixel.

[0117] In one embodiment, the curvature information of the height image data in the mask region can be determined by acquiring the spatial curvature distribution of the height image data, filtering out background points based on the mask region, and obtaining the curvature information of the height image data in the mask region.

[0118] S104, Select feature points based on the curvature information in the mask area, and determine the standard height value based on the height data of the feature points;

[0119] In this context, a feature point can refer to the pixel in the height image data that represents the most severe degree of height data collapse. Specifically, the most severe degree of height data collapse can be understood as the largest difference between the actual height data and the real height value.

[0120] In one embodiment, the method of selecting feature points based on the curvature information in the mask region can be to determine the pixel point with the maximum curvature information in the mask region as the feature point.

[0121] The standard height value can be a reference standard height value used as the basis for height restoration of the mask area of ​​the height image data.

[0122] In one embodiment, the method for determining the standard height value based on the height data of the feature point can be as follows: if the height data of the feature point is greater than a preset lower standard limit, then the height value of the feature point is determined as the standard height value; if the height data of the feature point is not greater than the preset lower standard limit, then the preset reference height is determined as the standard height value.

[0123] S105, perform height restoration on the mask area of ​​the height image data based on the standard height value.

[0124] In one embodiment, the method of height restoration of the mask region of the height image data based on the standard height value can be achieved by assigning a height value to the mask region of the height image data based on the standard height value, thereby obtaining the height restoration result of the object to be measured in the height image data.

[0125] The technical solution provided in this application embodiment acquires height image data and color image data of an object to be tested; performs threshold filtering on the color image data to obtain a mask region of the object to be tested; determines the curvature information of the height image data in the mask region; selects feature points based on the curvature information in the mask region, and determines a standard height value based on the height data of the feature points; and performs height restoration on the mask region of the height image data based on the standard height value. The above-described height restoration method combining the mask region allows for precise determination of the area to be restored by obtaining the mask region of the object to be tested. By determining the standard height value based on the curvature information and performing height restoration on the mask region based on the standard height value, a relatively accurate height restoration result for the object to be tested can be quickly obtained.

[0126] Figure 2 This is a schematic flowchart of the height restoration method for the combined mask area provided in the embodiments of this application.

[0127] like Figure 2 As shown, the specific steps include the following:

[0128] S201, acquire the height image data and color image data of the object to be measured;

[0129] S202, perform threshold filtering on the color image data according to a preset color channel threshold, and filter out at least one pixel region in the color image data;

[0130] Wherein, the color channel threshold can be the range of values ​​for the three channels R (Red), G (Green), and B (Blue) in the color image data, representing a pixel that may be an object to be measured. It can be expressed as [th...]. R ,th G ,th BThe color channel threshold can be preset based on the actual color of the object under test. Specifically, the actual RGB values ​​of the object under test are first obtained, and the color channel threshold is determined based on the actual RGB values ​​and the preset upper and lower fluctuation ranges. It is understandable that the smaller the preset upper and lower fluctuation range, the greater the probability that the selected pixels represent the object under test. At the same time, pixels whose RGB values ​​deviate significantly from the actual RGB values ​​due to external factors such as lighting, but which actually represent the object under test, are also more likely to be filtered out.

[0131] In one embodiment, the method of threshold filtering of color image data based on a preset color channel threshold can be achieved by obtaining the RGB values ​​of each pixel in the color image data, setting the value of pixels whose RGB values ​​are within the color channel threshold to 1, and setting the value of pixels whose RGB values ​​are not within the color channel threshold to 0.

[0132] Here, a pixel region can refer to a region consisting of at least one adjacent pixel. Further, after thresholding, all pixels within the obtained pixel region are set to 1. The image obtained after thresholding can be masked. RGB To express.

[0133] In one embodiment, determining at least one pixel region in color image data can be achieved by defining each adjacent pixel with a value of 1 as a pixel region.

[0134] S203, the pixel region with the largest outline is determined as the target pixel region;

[0135] Here, the outline can refer to a closed curve formed by the outermost pixels of a pixel region.

[0136] Here, the target pixel region can refer to the pixel region that is ultimately determined as a whole representing a test object. The image including the target pixel region can be represented using a Mask. max To express.

[0137] In one embodiment, the method of determining the pixel region with the largest contour as the target pixel region can be by determining the internal area of ​​the contour of each pixel region and determining the pixel region corresponding to the contour with the largest internal area as the target pixel region.

[0138] S204, Perform morphological operations on the target pixel region to obtain the mask region of the object under test;

[0139] Morphological operations refer to methods that extract useful information or modify image features based on the image's shape and structure through a series of operations. These operations can include opening, closing, morphological gradient, top-hat, and black-hat operations. Specifically, the morphological operation described in this solution can be an opening operation that involves first performing morphological erosion followed by morphological dilation.

[0140] Morphological erosion is an image processing technique based on mathematical morphology. By defining a structuring element, a series of erosion operations are performed on the image to achieve functions such as image segmentation, noise reduction, and edge detection.

[0141] In one embodiment, the morphological erosion process can be performed by comparing the structuring element with the target pixel region pixel by pixel. If a pixel matches the corresponding pixel in the structuring element (i.e., both pixels have a value of 1), the pixel is retained; otherwise, the value of the pixel is set to 0. After all pixels in the target pixel region have been compared, the remaining pixels form the mask region.

[0142] Morphological dilation is an image processing technique based on mathematical morphology. By defining a structuring element, it performs a series of dilation operations on an image to enlarge the shape and size of objects in the original image, making them more complete. The size of the structuring element used in morphological dilation can be pre-set based on the size of the markings on the object being measured.

[0143] The marking pattern refers to the pattern used for marking on the object under test. Understandably, the actual RGB values ​​of the marking pattern are generally not within the color channel threshold. After threshold filtering, the pixel value at the marking pattern is 0; after morphological dilation processing, the pixel value of the marking pattern is 1, and it is considered part of the object under test.

[0144] In one embodiment, morphological dilation can be performed by comparing the pixels in the structuring element with the pixels in the target pixel region after morphological erosion, and setting the value of the pixel in the target pixel region corresponding to the pixel in the structuring element to 1.

[0145] Figure 3 This is an example diagram of the mask area of ​​the object under test provided in an embodiment of this application. For example... Figure 3 As shown, white represents a pixel with a value of 1, and black represents a pixel with a value of 0. The Mask obtained by threshold filtering is... RGBWithin the largest white area, there are black "CK" characters and solid circles; these "CK" characters and solid circles constitute the identification pattern. The largest white area in the center (i.e., the pixel area with the largest outline) is determined as the target pixel area, and the smaller white areas around it turn black, resulting in the Mask. max ; for Mask max Mask is obtained by performing morphological etching and morphological expansion treatments. crystal It can be seen that Mask crystal The white area in the middle is closer to the edge of the mask. max The edges of the white areas in the mask are smoother, and the mask... max The black CK characters and solid circles in the mask are filled with white. crystal The white area in the image is a solid whole.

[0146] As an example, if the content of the logo is characters or the aforementioned solid circle, the elliptic kernel operator can be used as the structural element for morphological dilation. The elliptic kernel operator is a type of kernel function for morphological operations in image processing. It has an elliptical shaped structural element, and the size and proportion of the ellipse can be adjusted as needed. The size of the elliptic kernel operator determines the degree and range of influence of the morphological operation; a larger elliptic kernel leads to a more extensive dilation and erosion effect, while a smaller kernel produces more subtle changes. For example, for the aforementioned black CK characters and solid circle, the ellipse size could be 7×7.

[0147] S205, determine the curvature information of the height image data in the mask area;

[0148] S206, Select feature points based on the curvature information in the mask area, and determine the standard height value based on the height data of the feature points;

[0149] S207, perform height restoration on the mask area of ​​the height image data based on the standard height value.

[0150] This method identifies the pixel region with the largest outline that is within the color channel threshold as the target pixel region, thus obtaining the pixel region most likely to represent the object under test. By performing morphological operations on the target pixel region, noise at the outline of the target pixel region can be removed, and the marking pattern on the object under test in the target pixel region can be filled, thereby obtaining a clearer and more accurate representation of the object under test, which is helpful for subsequent height restoration processing.

[0151] Figure 4 This is a schematic flowchart of the height restoration method for the combined mask area provided in the embodiments of this application. Figure 4 As shown, the specific steps include the following:

[0152] S401, acquire the height image data and color image data of the object to be measured;

[0153] S402, perform threshold filtering on the color image data to obtain the mask area of ​​the object to be tested;

[0154] S403, Obtain the spatial curvature distribution of the height image data;

[0155] Among them, spatial curvature distribution can be a geometric property that describes a surface or manifold, reflecting the local shape characteristics of the surface at different points.

[0156] In one embodiment, the spatial curvature distribution of height image data can be obtained by smoothing the height image data through mean filtering to obtain a filtered height image, and then performing Sobel operator calculations in the X and Y directions on the filtered height image to obtain a planar slope distribution. Finally, Sobel operator calculations in the X and Y directions are performed on the planar slope distribution to obtain the spatial curvature distribution. The Sobel operator is a commonly used edge detection operator that detects edges based on changes in the grayscale values ​​of the image, determining the position and direction of the edges by calculating the gradient value of each pixel in the image.

[0157] S404, Background points are filtered out from the height image data based on the mask area to obtain the curvature information of the height image data in the mask area;

[0158] Background point filtering can refer to filtering out the curvature information of pixels that do not belong to the object being tested.

[0159] In one embodiment, background point filtering of height image data based on a mask region can be achieved by multiplying the spatial curvature distribution with the image including the mask region. Specifically, in the image including the mask region, pixels in non-masked areas have a value of 0, and the result of multiplying them with the curvature information of that pixel is still 0. However, pixels in the mask region have a value of 1, and the result of multiplying them with the spatial curvature information of that pixel is equal to the curvature information of that pixel.

[0160] S405, the pixel point in the mask area where the curvature information is maximized is determined as the feature point;

[0161] Among them, the pixel with the maximum curvature information in the mask area can be represented as the pixel with the most severe collapse of the height data. Furthermore, it can be used to summarize the overall collapse degree of the object under test.

[0162] S406, identify whether the height data of the feature point is greater than a preset standard lower limit; if it is greater, then execute S407; if it is not greater, then execute S408.

[0163] The height data of the feature points can refer to the height data of the feature points in the filtered height image mentioned above.

[0164] The preset standard lower limit can be a height data lower limit that indicates that the overall collapse of the object under test is not serious. It can be preset based on the actual height value of the object under test.

[0165] S407, The height data of the feature point is determined as a standard height value;

[0166] If the height data of the feature points is greater than the lower limit of the preset standard, it indicates that the overall collapse of the object under test is not serious and is within the acceptable range of the detection requirements. Therefore, the height data of the feature points can be used as a reference standard for subsequent height repair processing.

[0167] S408, set the preset reference height as the standard height value;

[0168] If the height data of the feature points is not greater than the lower limit of the preset standard, it indicates that the overall collapse of the object under test is severe and not within the acceptable range of the detection requirements. Therefore, the height data of the feature points cannot be used as a reference standard for subsequent height repair processing.

[0169] The preset reference height can be a theoretical value of the height data, or it can be consistent with the actual height value of the object to be measured.

[0170] S409, perform height restoration on the mask area of ​​the height image data based on the standard height value.

[0171] This solution determines the overall degree of collapse of the object under test by identifying the pixel with the maximum curvature information in the mask area as the feature point. By determining the preset reference height as the standard height value when the height data of the feature point is not greater than the preset standard lower limit, a reference standard can be provided for subsequent height repair processing when there is no actual data reference.

[0172] Figure 5 This is a schematic flowchart of the height restoration method for the combined mask area provided in the embodiments of this application.

[0173] like Figure 5 As shown, the specific steps include the following:

[0174] S501, acquire the height image data and color image data of the object to be measured;

[0175] S502, perform threshold filtering on the color image data to obtain the mask area of ​​the object to be tested;

[0176] S503, determine the curvature information of the height image data in the mask area;

[0177] S504, Select feature points based on the curvature information in the mask area, and determine the standard height value based on the height data of the feature points;

[0178] S505, based on the standard height value, the mask area of ​​the height image data is assigned a height value to obtain the height restoration result of the object to be tested in the height image data.

[0179] In one embodiment, assigning height values ​​to the mask region of the height image data based on standard height values ​​can be achieved by assigning values ​​to each pixel within the mask region of the height image data according to a Gaussian distribution with the standard height value as the average. Specifically, this assignment can be done by generating a random number based on the Gaussian distribution formula as the height data for that pixel.

[0180] The Gaussian distribution is a probability distribution, also known as the normal distribution. The Gaussian distribution has the following characteristics: the distribution curve is bell-shaped, symmetrical, and the highest point is located at the mean μ; the central concentration of the distribution is represented by the standard deviation σ. The smaller the standard deviation, the narrower the curve and the more concentrated the distribution.

[0181] The Gaussian distribution formula is:

[0182] The height image data after assigning a height value to the mask area is the height restoration result.

[0183] This solution assigns height values ​​to the mask area of ​​the height image data based on standard height values, enabling rapid overall height restoration of the object under test. It also prevents the height restoration result from being too smooth, thus improving the accuracy of the restoration.

[0184] In one feasible embodiment, optionally, height restoration of the mask region of the height image data based on the standard height value further includes:

[0185] The mask area is subjected to morphological etching to obtain an etched mask area;

[0186] The difference between the etched mask region and the mask region is defined as the mask edge region;

[0187] Obtain the predetermined edge curvature coefficient;

[0188] Based on the edge curvature coefficient and the standard height value, a height value is assigned to the edge region of the mask to obtain the height restoration result of the edge position of the object under test in the height image data.

[0189] Here, the eroded mask area can refer to the mask area after morphological erosion processing. The image including the eroded mask area can be represented by a Mask. crystal express.

[0190] The mask edge region can refer to the pixel region representing the edge of the object to be measured, and can be represented by a mask. edge To express.

[0191] The etched mask region does not include the pixel region representing the edge of the object under test, while the mask region does include the pixel region representing the edge of the object under test. Therefore, the difference between the etched mask region and the mask region is the pixel region representing the edge of the object under test, i.e., the mask edge region.

[0192] The edge curvature coefficient is a parameter describing the degree of curvature of the edge of the object under test. A larger edge curvature coefficient indicates a smaller degree of curvature at the edge, resulting in a smaller difference between the height data of the edge and the height data of the upper surface of the object. The edge curvature coefficient can be predetermined based on the cross-sectional shape of the object. As an example, the edge curvature coefficient can be predetermined to be 0.99.

[0193] In one embodiment, the predetermined edge curvature coefficient can be obtained by inputting the edge curvature coefficient through a preset input window.

[0194] In one embodiment, the method of assigning height values ​​to the mask edge region based on the edge curvature coefficient and the standard height value can be achieved by multiplying the edge curvature coefficient by the mask edge region to obtain the relative height coefficient of the mask edge region, adding the relative height coefficient of the mask edge region to the mask region to obtain the height restoration coefficient of each pixel in the mask region, and multiplying the height restoration coefficient of each pixel in the mask region by the standard height value to obtain the height restoration result of the object under test. Since the height restoration result of the upper surface of the object under test is consistent with the standard height value after calculation, this method can also be regarded as adjusting the height restoration result of the edge position of the object under test.

[0195] This method assigns height values ​​to the mask edge region based on the edge curvature coefficient and standard height value, thereby obtaining the height restoration result of the edge position of the object under test in the height image data. This improves the completeness of the height restoration result and makes the height restoration result closer to the actual object under test.

[0196] In one feasible embodiment, optionally, height restoration of the mask region of the height image data based on the standard height value further includes:

[0197] Obtain the preset depth adjustment coefficient for the logo pattern.

[0198] Based on the preset depth adjustment coefficient and the mask area, the height of the marking pattern on the object to be tested is restored.

[0199] The preset depth adjustment coefficient can be a numerical value that indicates the degree to which the height data of the marker pattern rises or falls when the marker pattern is placed on the surface of the object being measured. For example, a preset depth adjustment coefficient greater than 1 indicates that the height data rises, and a preset depth adjustment coefficient less than 1 indicates that the height data falls.

[0200] In one embodiment, the preset depth adjustment coefficient for the marking pattern can be obtained by having the user pre-set the coefficient based on the process used when the marking pattern is applied to the surface of the object to be measured and the marking height, and then inputting the preset depth adjustment coefficient through a preset input window. For example, if the process used is printing, the height data at the marking pattern position will be raised, and the preset depth adjustment coefficient will be greater than 1; if the process used is laser engraving, the height data at the marking pattern position will be lowered, and the preset depth adjustment coefficient will be less than 1.

[0201] In one embodiment, the method for height restoration of the marking pattern on the object under test based on a preset depth adjustment coefficient and a mask area can be as follows: determine the marking pattern area based on the mask area, multiply the height restoration result of the marking pattern area by the preset depth adjustment coefficient, and obtain the final height restoration result of the marking pattern on the object under test.

[0202] In one feasible embodiment, optionally, the height of the marking pattern on the object to be tested is repaired according to the preset depth adjustment coefficient and the mask area, including:

[0203] The fine-tuning matrix of the marking pattern is determined according to the preset depth adjustment coefficient;

[0204] Multiply the color information of each pixel in the mask area with the fine-tuning matrix to obtain the height adjustment value of the mark pattern in the mask area;

[0205] The height data of the marking pattern included in the mask area is adjusted based on the height adjustment value to obtain the height restoration result of the marking pattern on the object under test.

[0206] The fine-tuning matrix can be a matrix [γ] with RGB channels as its elements. r ,γ g ,γb ] T This indicates the effect of the height data at the location of the marker pattern rising or falling on the values ​​of each channel. The fine-tuning matrix can be used with the Matrix tool. word To express.

[0207] In one embodiment, the method of determining the fine-tuning matrix of the logo pattern based on the preset depth adjustment coefficient can be achieved by determining the current fine-tuning matrix based on the current preset depth adjustment coefficient and a pre-built correlation between the preset depth adjustment coefficient and the fine-tuning matrix. The correlation between the preset depth adjustment coefficient and the fine-tuning matrix can be obtained by the user through adjustments based on the preset depth adjustment coefficient and the color of the logo pattern.

[0208] Color information can refer to the RGB values ​​of a pixel, which can be represented as [R,G,B]. Color information can be represented using an ImageMap.

[0209] The height adjustment value refers to the upward or downward movement of the height data at the marked pattern position relative to the height data of the upper surface of the object under test. The height adjustment value of each pixel in the mask area is equal to the product of the pixel's color information and the fine-tuning matrix. It can be understood that the height adjustment value of pixels in the non-marked pattern area of ​​the object under test is 0.

[0210] In one embodiment, the height restoration result of the marking pattern on the object under test can be obtained by subtracting the height adjustment value of each pixel from the height restoration result of each pixel included in the mask area. It is understood that since the height adjustment value of each pixel in the non-marking pattern area of ​​the object under test is 0, the height restoration result of each pixel in the non-marking pattern area of ​​the object under test, after calculation, is still consistent with the standard height value. Therefore, this method can be regarded as adjusting the height restoration result of the marking pattern on the object under test.

[0211] This solution determines the fine-tuning matrix of the marking pattern based on a preset depth adjustment coefficient, and adjusts the height data of the marking pattern included in the mask area according to the fine-tuning matrix, which can further improve the accuracy of repairing the height data of the marking pattern position on the object under test.

[0212] This solution can accurately repair objects with markings by adjusting the height of the markings on the object under test according to a preset depth adjustment coefficient, thus expanding the applicable scenarios of this solution.

[0213] Figure 6 This is a schematic diagram of the structure of the height repair device for the combined mask area provided in the embodiments of this application.

[0214] like Figure 6As shown, it specifically includes the following:

[0215] The data acquisition module 610 is used to acquire height image data and color image data of the object to be measured;

[0216] The mask region acquisition module 620 is used to perform threshold filtering on the color image data to obtain the mask region of the object to be tested;

[0217] Curvature information determination module 630 is used to determine the curvature information of the height image data in the mask area;

[0218] The standard height determination module 640 is used to select feature points based on the curvature information in the mask area and determine the standard height value based on the height data of the feature points.

[0219] The height restoration module 650 is used to restore the height of the mask area of ​​the height image data based on the standard height value.

[0220] The beneficial effect of this solution is that by obtaining the mask area of ​​the object to be tested, the area range for height repair can be accurately determined. By determining the standard height value based on the curvature information and performing height repair on the mask area based on the standard height value, a relatively accurate height repair result of the object to be tested can be obtained quickly.

[0221] Furthermore, the mask area acquisition module 620 is specifically used for:

[0222] The color image data is threshold-filtered according to a pre-set color channel threshold, and at least one pixel region is selected from the color image data.

[0223] Define the pixel region with the largest outline as the target pixel region;

[0224] Morphological operations are performed on the target pixel region to obtain the mask region of the object under test.

[0225] The beneficial effect of this scheme is that by determining the pixel region with the largest outline within the color channel threshold as the target pixel region, the pixel region with the highest probability of being represented as the object under test can be obtained. By performing morphological operations on the target pixel region, noise at the outline of the target pixel region can be removed, and the marking pattern on the object under test in the target pixel region can be filled, thereby obtaining a clearer and more accurate representation of the object under test, which is helpful for subsequent height restoration processing.

[0226] Furthermore, the curvature information determination module 630 is specifically used for:

[0227] Obtain the spatial curvature distribution of the height image data;

[0228] Background points are filtered out from the height image data based on the mask area to obtain the curvature information of the height image data in the mask area;

[0229] Accordingly, the standard height determination module 640 is specifically used for:

[0230] The pixel point whose curvature information in the mask region is maximized is determined as the feature point;

[0231] If the height data of the feature point is greater than the preset standard lower limit, then the height value of the feature point is determined as the standard height value;

[0232] If the height data of the feature point is not greater than the preset standard lower limit, then the preset reference height is determined as the standard height value.

[0233] The beneficial effect of this solution is that by determining the pixel with the maximum curvature information in the mask area as the feature point, the overall degree of collapse of the object under test can be directly determined. By determining the preset reference height as the standard height value when the height data of the feature point is not greater than the preset standard lower limit, a reference standard can be provided for subsequent height repair processing when there is no actual data reference.

[0234] Furthermore, the height repair module 650 is specifically used for:

[0235] Based on the standard height value, the mask area of ​​the height image data is assigned a height value to obtain the height restoration result of the object to be tested in the height image data.

[0236] The beneficial effect of this solution is that by assigning height values ​​to the mask area of ​​the height image data based on standard height values, it is possible to achieve rapid overall height restoration of the object under test, and prevent the height restoration result of the object under test from being too smooth, thereby improving the accuracy of the restoration.

[0237] Furthermore, the height repair module 650 is also used for:

[0238] The mask area is subjected to morphological etching to obtain an etched mask area;

[0239] The difference between the etched mask region and the mask region is defined as the mask edge region;

[0240] Obtain the predetermined edge curvature coefficient;

[0241] Based on the edge curvature coefficient and the standard height value, a height value is assigned to the edge region of the mask to obtain the height restoration result of the edge position of the object under test in the height image data.

[0242] The beneficial effect of this scheme is that by assigning height values ​​to the mask edge region based on the edge curvature coefficient and standard height value, the height restoration result of the edge position of the object under test in the height image data can be obtained, improving the integrity of the height restoration result and making the height restoration result closer to the actual object under test.

[0243] Furthermore, the height repair module 650 is also used for:

[0244] Obtain the preset depth adjustment coefficient for the logo pattern.

[0245] Based on the preset depth adjustment coefficient and the mask area, the height of the marking pattern on the object to be tested is restored.

[0246] The beneficial effect of this solution is that by adjusting the coefficient according to the preset depth to repair the height of the marking pattern on the object under test, the solution can accurately repair the object with marking pattern, thus expanding the applicable scenarios of this solution.

[0247] Furthermore, the height repair module 650 is also used for:

[0248] The fine-tuning matrix of the marking pattern is determined according to the preset depth adjustment coefficient;

[0249] Multiply the color information of each pixel in the mask area with the fine-tuning matrix to obtain the height adjustment value of the mark pattern in the mask area;

[0250] The height data of the marking pattern included in the mask area is adjusted based on the adjusted height value to obtain the height restoration result of the marking pattern on the object under test.

[0251] The beneficial effect of this solution is that by determining the fine-tuning matrix of the marking pattern according to the preset depth adjustment coefficient, and adjusting the height data of the marking pattern included in the mask area according to the fine-tuning matrix, the accuracy of repairing the height data of the marking pattern position on the object under test can be further improved.

[0252] The technical solution provided in this application includes a data acquisition module for acquiring height image data and color image data of the object under test; a mask region acquisition module for threshold filtering of the color image data to obtain a mask region of the object under test; a curvature information determination module for determining the curvature information of the height image data in the mask region; a standard height determination module for selecting feature points based on the curvature information in the mask region and determining a standard height value based on the height data of the feature points; and a height repair module for performing height repair on the mask region of the height image data based on the standard height value. The above-described height repair device, combined with a mask region, can accurately determine the area range for height repair by obtaining the mask region of the object under test. By determining the standard height value based on the curvature information and performing height repair on the mask region based on the standard height value, a relatively accurate height repair result for the object under test can be quickly obtained.

[0253] The height restoration device for the combined mask area in this application embodiment can be a device, or it can be a component, integrated circuit, or chip in a terminal. The device can be a mobile electronic device or a non-mobile electronic device. For example, mobile electronic devices can be mobile phones, tablets, laptops, PDAs, in-vehicle electronic devices, wearable devices, ultra-mobile personal computers (UMPCs), netbooks, or personal digital assistants (PDAs), etc., while non-mobile electronic devices can be servers, network attached storage (NAS), personal computers (PCs), televisions (TVs), ATMs, or self-service machines, etc. This application embodiment does not specifically limit the specific implementation.

[0254] The height restoration device for the combined mask area in this embodiment can be a device with an operating system. This operating system can be Android, iOS, or other possible operating systems; this embodiment does not specifically limit it.

[0255] The height repair device for the combined mask area provided in this application embodiment can realize the various processes implemented in the above method embodiments. To avoid repetition, it will not be described again here.

[0256] Figure 7 This is a schematic diagram of the structure of the electronic device provided in an embodiment of this application. For example... Figure 7As shown, this application embodiment also provides an electronic device 700, including a processor 701, a memory 702, and a program or instructions stored in the memory 702 and executable on the processor 701. When the program or instructions are executed by the processor 701, they implement the various processes of the above-described embodiment of the height restoration method for the combined mask area and achieve the same technical effect. To avoid repetition, they will not be described again here.

[0257] It should be noted that the electronic devices in the embodiments of this application include the mobile electronic devices and non-mobile electronic devices described above.

[0258] This application also provides a readable storage medium storing a program or instructions. When the program or instructions are executed by a processor, they implement the various processes of the above-described embodiment of the height restoration method for the combined mask region and achieve the same technical effect. To avoid repetition, they will not be described again here.

[0259] The processor is the processor in the electronic device described in the above embodiments. The readable storage medium includes computer-readable storage media, such as computer read-only memory (ROM), random access memory (RAM), magnetic disk, or optical disk.

[0260] This application embodiment also provides a chip, which includes a processor and a communication interface. The communication interface and the processor are coupled. The processor is used to run programs or instructions to implement the various processes of the above-described embodiment of the height restoration method for the combined mask area, and can achieve the same technical effect. To avoid repetition, it will not be described again here.

[0261] It should be understood that the chip mentioned in the embodiments of this application may also be referred to as a system-on-a-chip, system chip, chip system, or system-on-a-chip, etc.

[0262] It should be noted that, in this document, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Without further limitations, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes that element. Furthermore, it should be noted that the scope of the methods and apparatuses in the embodiments of this application is not limited to performing functions in the order shown or discussed, but may also include performing functions substantially simultaneously or in the reverse order, depending on the functions involved. For example, the described methods may be performed in a different order than described, and various steps may be added, omitted, or combined. Additionally, features described with reference to certain examples may be combined in other examples.

[0263] Through the above description of the embodiments, those skilled in the art can clearly understand that the methods of the above embodiments can be implemented by means of software plus necessary general-purpose hardware platforms. Of course, they can also be implemented by hardware, but in many cases the former is a better implementation method. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, can be embodied in the form of a computer software product. This computer software product is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk) and includes several instructions to cause a terminal (which may be a mobile phone, computer, server, or network device, etc.) to execute the methods described in the various embodiments of this application.

[0264] The embodiments of this application have been described above with reference to the accompanying drawings. However, this application is not limited to the specific embodiments described above. The specific embodiments described above are merely illustrative and not restrictive. Those skilled in the art can make many other forms under the guidance of this application without departing from the spirit and scope of the claims, and all of these forms are within the protection scope of this application.

[0265] The above description is merely a preferred embodiment and the technical principles employed in this application. This application is not limited to the specific embodiments described herein, and various obvious changes, readjustments, and substitutions that can be made by those skilled in the art will not depart from the scope of protection of this application. Therefore, although this application has been described in detail through the above embodiments, this application is not limited to the above embodiments, and may include more other equivalent embodiments without departing from the concept of this application, the scope of which is determined by the scope of the claims.

Claims

1. A height restoration method combining a mask region, characterized in that, The method includes: Acquire height and color image data of the object under test; The color image data is subjected to threshold filtering to obtain the mask area of ​​the object to be tested; Determine the curvature information of the height image data in the mask region; Feature points are selected based on the curvature information in the mask area, and standard height values ​​are determined based on the height data of the feature points. Height restoration is performed on the masked area of ​​the height image data based on the standard height value.

2. The height restoration method for the combined mask region according to claim 1, characterized in that, Threshold filtering is performed on the color image data to obtain the mask region of the object to be tested, including: The color image data is threshold-filtered according to a pre-set color channel threshold, and at least one pixel region is selected from the color image data. Define the pixel region with the largest outline as the target pixel region; Morphological operations are performed on the target pixel region to obtain the mask region of the object under test.

3. The height restoration method for the combined mask region according to claim 1, characterized in that, Determining the curvature information of the height image data in the mask region includes: Obtain the spatial curvature distribution of the height image data; Background points are filtered out from the height image data based on the mask area to obtain the curvature information of the height image data in the mask area; Accordingly, feature points are selected based on the curvature information in the mask region, and standard height values ​​are determined based on the height data of the feature points, including: The pixel point whose curvature information in the mask region is maximized is determined as the feature point; If the height data of the feature point is greater than the preset standard lower limit, then the height value of the feature point is determined as the standard height value; If the height data value of the feature point is not greater than the preset standard lower limit, then the preset reference height is determined as the standard height value.

4. The height restoration method for the combined mask region according to claim 1, characterized in that, Height restoration is performed on the masked region of the height image data based on the standard height value, including: Based on the standard height value, the mask area of ​​the height image data is assigned a height value to obtain the height restoration result of the object to be tested in the height image data.

5. The height restoration method for the combined mask region according to claim 1 or 4, characterized in that, Height restoration of the masked region of the height image data based on the standard height value also includes: The mask area is subjected to morphological etching to obtain an etched mask area; The difference between the etched mask region and the mask region is defined as the mask edge region; Obtain the predetermined edge curvature coefficient; Based on the edge curvature coefficient and the standard height value, a height value is assigned to the edge region of the mask to obtain the height restoration result of the edge position of the object under test in the height image data.

6. The height restoration method for the combined mask region according to claim 1 or 4, characterized in that, Height restoration of the masked region of the height image data based on the standard height value also includes: Obtain the preset depth adjustment coefficient of the logo pattern; Based on the preset depth adjustment coefficient and the mask area, the height of the marking pattern on the object to be tested is restored.

7. The height restoration method for the combined mask region according to claim 6, characterized in that, Based on the preset depth adjustment coefficient and the mask area, the height of the marking pattern on the object under test is restored, including: The fine-tuning matrix of the marking pattern is determined according to the preset depth adjustment coefficient; Multiply the color information of each pixel in the mask area with the fine-tuning matrix to obtain the height adjustment value of the mark pattern in the mask area; The height data of the marking pattern included in the mask area is adjusted based on the height adjustment value to obtain the height restoration result of the marking pattern on the object under test.

8. A height restoration device combining a mask region, characterized in that, The device includes: The data acquisition module is used to acquire height image data and color image data of the object under test; The mask region acquisition module is used to perform threshold filtering on the color image data to obtain the mask region of the object to be tested; A curvature information determination module is used to determine the curvature information of the height image data in the mask region; The standard height determination module is used to select feature points based on the curvature information in the mask area and determine the standard height value based on the height data of the feature points. The height restoration module is used to restore the height of the masked area of ​​the height image data based on the standard height value.

9. An electronic device, characterized in that, It includes a processor, a memory, and a program or instructions stored in the memory and executable on the processor, wherein the program or instructions, when executed by the processor, implement the steps of the height restoration method for the combined mask region as described in any one of claims 1-7.

10. A readable storage medium, characterized in that, The readable storage medium stores a program or instructions that, when executed by a processor, implement the steps of the height restoration method for the combined mask region as described in any one of claims 1-7.