Vision detection system for detection of the appearance of a shaped smart card
Patent Information
- Application Number
- CN202611134549.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-07-29
- Publication Date
- 2026-10-16
AI Technical Summary
然而,这些方案通常采用固定参数设置,未考虑智能卡尺寸差异,当卡片面积变化时,检测的一致性和边缘区域的有效性难以保障
[0013] The beneficial effects of this invention are as follows: (1) Through the grid correction module, the actual area of the smart card is actively acquired before the reference grid structured light is projected, and dynamically compared with the preset standard area. When the card area deviates from the standard value, the system automatically calculates the magnification or reduction coefficient and adaptively corrects the reference grid specifications. This mechanism breaks through the dependence of traditional machine vision on fixed templates, ensuring that the grid pattern projected onto the card surface always matches the card size, effectively avoiding edge detection blind spots or pattern distortion caused by differences in card area. At the same time, by adopting the strategy of only needing to correct the first time in the same batch, detection efficiency is taken into account while ensuring detection accuracy. This adaptive correction method enables the system to stably cope with the online detection needs of various irregularly shaped cards, significantly improving the consistency of detection.
Smart Images

Figure CN122928811A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of visual inspection technology, and more specifically to a visual inspection system for inspecting the appearance of irregularly shaped smart cards. Background Technology
[0002] Due to their unique contours and non-standard sizes, irregularly shaped smart cards are increasingly widely used in finance, telecommunications, and other fields. Their appearance quality directly affects product functionality and lifespan. Currently, the appearance inspection of these cards mainly relies on manual visual inspection or traditional machine vision comparison. Manual methods are inefficient and highly subjective, making them difficult to meet the needs of mass production. Traditional machine vision, based on conventional image template matching, has poor adaptability to the reflections, curvature changes, and irregular edges of irregularly shaped card surfaces. It is prone to misjudging normal surface textures as defects or missing real defects, leading to significant risks in product quality control.
[0003] To address the aforementioned issues, some solutions have introduced sophisticated surface morphology acquisition methods to improve detection accuracy. However, these solutions typically employ fixed parameter settings and fail to consider variations in smart card size. When card area changes, the consistency of detection and the effectiveness of edge regions become difficult to guarantee. More critically, existing algorithms have relatively simple judgment logic, often outputting only a binary conclusion of "pass" or "fail," lacking the ability to classify defect types and effectively distinguish specific defects. This not only affects the accurate rejection of defective products but also makes it difficult to provide targeted improvement guidance for production processes. Therefore, there is an urgent need for a detection solution that can adapt to card size and accurately identify and distinguish multiple types of appearance defects. Summary of the Invention
[0004] The purpose of this invention is to provide a visual inspection system for the appearance inspection of irregularly shaped smart cards, thereby solving the above-mentioned technical problems.
[0005] The objective of this invention can be achieved through the following technical solutions: A visual inspection system for inspecting the appearance of irregularly shaped smart cards includes: Mesh Correction Module: Place the smart card at a designated position on the table and project a preset mesh structure light onto the surface of the smart card. The reference mesh size of the mesh structure light is N×N, where N represents the preset length. Obtain the size of the smart card and correct the mesh structure light based on the size. Data acquisition module: Acquires an image of the smart card surface projected with a grid pattern, obtains the grid lines in the image, identifies the grid intersections and records them as point N. i,j Point N i,j The grid intersection point in the i-th row and j-th column represents all the grid lines and grid intersection points collected in this study, which are recorded as the grid pattern to be detected. Standard comparison module: Obtain a preset standard template pattern, extract grid lines and grid intersections from the standard template pattern and record them as auxiliary lines and auxiliary points, and generate auxiliary lines and auxiliary points equivalently in the grid pattern to be detected; Visual inspection module: Pixel detection is performed along each auxiliary line. If the auxiliary line is in contact with the grid line and the auxiliary point coincides with the grid intersection point, but there are missing pixels on the grid line, the smart card is scratched. The grid where the missing pixels are located is recorded as the scratched area. If the pixels of the grid line are continuous, but the grid line and the auxiliary line do not completely overlap, the grid line that does not completely overlap is recorded as an offset line. The offset distance between the grid intersection point on the offset line and the auxiliary point is obtained. If the offset distance is greater than or equal to the preset offset threshold, it is recorded as an abnormal point. When the proportion of abnormal points on any offset line exceeds λ, the smart card is output as having a bend, where λ represents the preset judgment coefficient.
[0006] As a further aspect of the present invention: in the aforementioned mesh correction module, the method for correcting the light rays of the mesh structure based on size specifications includes: Preset standard area S sta Given the area fluctuation value s, obtain the area S of one side of the smart card. If S sta -s≤S≤S sta If +s, no correction will be made; If S>S sta +s, calculate the magnification factor I=floor[(SS sta The baseline grid size is corrected to (γ×I×N)×(γ×I×N). If S < S sta -s, calculate the reduction factor J=floor[(|SS sta | / s], which corrects the baseline grid size to [N / (J×γ)]×[N / (J×γ)], where γ represents the preset scaling factor, γ>1, and floor represents rounding the data down.
[0007] As a further aspect of the present invention: in the grid correction module, the height of the smart card is adjusted to ensure that the surface of the smart card remains horizontal when a preset checkerboard structured light is projected onto the surface of the smart card.
[0008] As a further aspect of the present invention: in the data acquisition module, the total number A of grid intersections in the grid pattern to be detected is obtained, and the total number B of auxiliary points in the standard template pattern is obtained. If A≠B, the subsequent operation is stopped, and the presence of a hole in the smart card is output.
[0009] As a further aspect of the present invention: the missing grid intersections are obtained by comparing with the auxiliary points in the standard template pattern and are recorded as missing points. The grids adjacent to the missing points are recorded as the areas where the holes are located.
[0010] As a further aspect of the present invention: in the grid correction module, when a preset checkerboard structure light is projected onto the surface of the smart card, the ambient light intensity is always kept at a preset value.
[0011] As a further aspect of the present invention: in the grid correction module, when projecting grid structure light onto the surface of smart cards in the same batch, grid structure light correction is performed only on the first smart card to be tested, and the correction is repeated after the testing of the entire batch of smart cards is completed.
[0012] As a further aspect of the present invention: In the aforementioned visual inspection module, when a defect is found on the surface of the smart card, the smart card is rotated horizontally by 90° and the inspection is repeated three times. If the output result does not change, it is output; if the output result is different, the staff is prompted to conduct a re-inspection. The standard template pattern is rotated synchronously after the smart card is rotated horizontally by 90°.
[0013] The beneficial effects of this invention are as follows: (1) Through the grid correction module, the actual area of the smart card is actively acquired before the reference grid structured light is projected, and dynamically compared with the preset standard area. When the card area deviates from the standard value, the system automatically calculates the magnification or reduction coefficient and adaptively corrects the reference grid specifications. This mechanism breaks through the dependence of traditional machine vision on fixed templates, ensuring that the grid pattern projected onto the card surface always matches the card size, effectively avoiding edge detection blind spots or pattern distortion caused by differences in card area. At the same time, by adopting the strategy of only needing to correct the first time in the same batch, detection efficiency is taken into account while ensuring detection accuracy. This adaptive correction method enables the system to stably cope with the online detection needs of various irregularly shaped cards, significantly improving the consistency of detection.
[0014] (2) To address the shortcomings of existing detection algorithms, which have simple judgment logic and only output binary conclusions without the ability to distinguish defect types, a multi-level comparison mechanism was constructed, ranging from the continuity of grid line pixels to the offset of grid intersection points. The visual inspection module inspects pixels one by one along the auxiliary lines of the standard template. If there are missing pixels in the grid line but the shape matches, it is accurately identified as a scratch defect. If the grid line is continuous but offset from the auxiliary line, the offset distance of the intersection point is further calculated. If it exceeds the threshold, it is identified as a bending abnormality. In addition, by comparing the difference in the total number of grid intersection points and auxiliary points, hole defects can be quickly identified. This hierarchical judgment logic can not only output whether a defect exists, but also clearly distinguish different defect types such as scratches, bends, and holes, providing accurate improvement basis for the production process. It effectively overcomes the limitation of traditional solutions that only judge good or bad without distinguishing the cause, and improves the pertinence of defect classification and rejection. Attached Figure Description
[0015] The invention will now be further described with reference to the accompanying drawings.
[0016] Figure 1 This is a schematic diagram of the structure of the visual inspection system for the appearance inspection of irregularly shaped smart cards according to the present invention; Figure 2 This is a flowchart illustrating the visual inspection system for the appearance inspection of irregularly shaped smart cards according to the present invention. Detailed Implementation
[0017] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.
[0018] Please see Figure 1 As shown, the present invention is a visual inspection system for the appearance inspection of irregularly shaped smart cards, comprising: Mesh Correction Module: Place the smart card at a designated position on the table and project a preset mesh structure light onto the surface of the smart card. The reference mesh size of the mesh structure light is N×N, where N represents the preset length. Obtain the size of the smart card and correct the mesh structure light based on the size. Data acquisition module: Acquires an image of the smart card surface projected with a grid pattern, obtains the grid lines in the image, identifies the grid intersections and records them as point N. i,j Point N i,j The grid intersection point in the i-th row and j-th column represents all the grid lines and grid intersection points collected in this study, which are recorded as the grid pattern to be detected. Standard comparison module: Obtain a preset standard template pattern, extract grid lines and grid intersections from the standard template pattern and record them as auxiliary lines and auxiliary points, and generate auxiliary lines and auxiliary points equivalently in the grid pattern to be detected; Visual inspection module: Pixel detection is performed along each auxiliary line. If the auxiliary line is in contact with the grid line and the auxiliary point coincides with the grid intersection point, but there are missing pixels on the grid line, the smart card is scratched. The grid where the missing pixels are located is recorded as the scratched area. If the pixels of the grid line are continuous, but the grid line and the auxiliary line do not completely overlap, the grid line that does not completely overlap is recorded as an offset line. The offset distance between the grid intersection point on the offset line and the auxiliary point is obtained. If the offset distance is greater than or equal to the preset offset threshold, it is recorded as an abnormal point. When the proportion of abnormal points on any offset line exceeds λ, the smart card is output as having a bend, where λ represents the preset judgment coefficient.
[0019] It should be noted that, firstly, the system places the smart card to be tested in the designated positioning area on the testing platform, ensuring the card surface is flat and its position is fixed. To accommodate the size differences of various irregularly shaped cards, the system first obtains the actual area S of the card surface before projecting structured light, and simultaneously presets a standard area S0. sta And the allowable fluctuation value s. When S is at S sta Within the ±s range, the initial reference grid size N×N remains unchanged. If S is greater than the upper limit, the magnification factor I is calculated, and the reference grid is corrected to (γ×I×N)×(γ×I×N). If S is less than the lower limit, the reduction factor J is calculated, and the grid is corrected to [N / (J×γ)]×[N / (J×γ)]. After correction, the system projects the corrected grid structure onto the card surface. To ensure projection quality, the smart card height must be pre-adjusted to keep the surface level, and the ambient light intensity must be stabilized at a preset low illumination value to avoid external light interfering with the clarity of the grid image. For irregularly shaped cards in the same production batch, only the first card undergoes the above area comparison and grid correction. Subsequent cards use the same specifications until the entire batch is inspected, at which point recalibration is performed, thereby improving inspection efficiency while ensuring accuracy.
[0020] Next, the data acquisition section uses the image of the projected grid pattern on the card surface. The projected grid can be an orthogonal linear grid or a checkerboard grid. After acquiring the image, edge detection and Hough transform are used to extract all grid lines, and the intersection points of each grid line are identified and denoted as point N. i,j All extracted grid lines and intersections form the grid pattern to be detected. If some grid lines are unclear due to card surface reflection or local dirt, the system can automatically adjust the exposure time and gain to ensure complete extraction; if extraction still fails after multiple adjustments, manual intervention will be prompted.
[0021] Subsequently, the system calls a pre-stored standard template pattern. This template is derived from an ideal grid image of a defect-free card of the same specification under the same projection conditions, and is already marked with auxiliary lines and points. In actual inspection, the system generates auxiliary lines and points in the grid pattern to be inspected that are identical to the template, based on the actual position and size of the grid pattern to be inspected, thus achieving point-to-point correspondence between the measured pattern and the standard template. Before generating auxiliary lines, the system first counts the total number A of intersections in the grid pattern to be inspected and the total number B of auxiliary points in the standard template. If A ≠ B, the subsequent inspection is immediately terminated, and the card is directly determined to have holes or missing areas, with the missing locations recorded as defective areas. If the numbers are the same, the comparison continues.
[0022] Next, the system proceeds to the defect classification and judgment stage. The system performs pixel continuity detection along each auxiliary line. If the auxiliary line aligns with the corresponding grid line, and the auxiliary point coincides with the grid intersection, but several pixels are missing from the grid line (i.e., discontinuous points appear), then this is classified as a scratch defect, and the grid area containing the missing pixels is marked as a scratch area. If the grid line has continuous pixels without breaks, but the entire grid line does not completely coincide with the auxiliary line, but rather shows overall or partial offset, then the grid line is marked as an offset line. For each grid intersection on the offset line, the offset distance between it and the corresponding auxiliary point is calculated. If this distance is greater than a preset offset threshold, the point is recorded as an anomaly. When the proportion of anomalies on an offset line exceeds a preset judgment coefficient, the system outputs that the smart card has a bending defect. If all offset distances are less than the threshold, the deformation in this area is considered within the allowable range, and the card is not rejected.
[0023] Finally, to eliminate misjudgments caused by chance, after the system initially identifies a defect in the card, it rotates the smart card horizontally by 90° while simultaneously rotating the standard template pattern, repeating the entire inspection process three times. If the three outputs are completely consistent, the defect type and location are finally confirmed; if the three results are not identical, the system prompts staff to conduct a manual review. Furthermore, for cards identified as having holes, since the number of intersections is mismatched, they are directly deemed unqualified and no further rotational re-inspection is performed.
[0024] The entire inspection process, through size-adaptive projection, multi-level mesh comparison, and a re-inspection mechanism, achieves accurate identification and classification of defects such as scratches, bends, and holes in irregularly shaped smart cards. This effectively overcomes the shortcomings of traditional manual visual inspection, such as low efficiency, poor adaptability of machine vision, and inability to distinguish defect types. The system's various steps are closely integrated, and parameters can be flexibly adjusted according to actual needs, exhibiting high robustness and engineering practicality.
[0025] In another preferred embodiment of the present invention, the method for correcting the light rays of the grid structure based on size specifications includes: Preset standard area S sta Given the area fluctuation value s, obtain the area S of one side of the smart card. If S sta -s≤S≤S sta If +s, no correction will be made; If S>S sta +s, calculate the magnification factor I=floor[(SS sta The baseline grid size is corrected to (γ×I×N)×(γ×I×N). If S < S sta -s, calculate the reduction factor J=floor[(|SS sta| / s], which corrects the baseline grid size to [N / (J×γ)]×[N / (J×γ)], where γ represents the preset scaling factor, γ>1, and floor represents rounding the data down.
[0026] It is worth noting that conventional fixed-grid projection cannot adapt to significant fluctuations in card area. When the area is too large, the grid coverage is incomplete, and edge areas are missed; when the area is too small, the grid is too sparse, resulting in insufficient local detail resolution. This solution intelligently determines the direction of area offset by setting a standard area and a fluctuation range, and calculates the magnification factor I or reduction factor J respectively to dynamically adjust the baseline grid size. The introduction of a floor operation ensures the discreteness of the size correction, avoiding system oscillations caused by continuous fine adjustments; ensuring that the corrected grid always completely covers the card surface with appropriate density. This mechanism allows the same detection algorithm to stably adapt to various irregular card sizes without manual parameter resetting, significantly improving the system's versatility and online detection efficiency.
[0027] In another preferred embodiment of the present invention, the height of the smart card is adjusted to ensure that the surface of the smart card remains horizontal when a preset checkerboard structured light is projected onto the surface of the smart card.
[0028] Understandably, by actively adjusting the height of the smart card, the card surface is kept level at all times, eliminating the distortion and perspective error of the grid pattern projection caused by tilting. This ensures that the actual distribution of the projected checkerboard structured light on the card surface is strictly consistent with the theoretical model, thereby ensuring that the grid line position of the acquired image truly reflects the defects on the card surface and avoiding misjudgments caused by tilting.
[0029] In another preferred embodiment of the present invention, the total number A of grid intersections in the grid pattern to be detected is obtained, and the total number B of auxiliary points in the standard template pattern is obtained. If A≠B, the subsequent operation is stopped and the smart card is output as having a hole.
[0030] It is important to note that efficient coarse screening of pore defects is achieved by quickly calculating the difference in the number of grid intersections and standard template auxiliary points. If the numbers do not match, the subsequent complex comparison process is terminated, avoiding unnecessary calculations and significantly saving inspection time and computing power. At the same time, this judgment logic clearly distinguishes pores from other defect types such as scratches and bends, enhancing the system's defect classification capabilities, providing direct evidence for production process traceability, and improving overall inspection efficiency.
[0031] In another preferred embodiment of the present invention, the missing grid intersections are obtained by comparing with the auxiliary points in the standard template pattern and are recorded as missing points. The grids adjacent to the missing points are recorded as the areas where the holes are located.
[0032] It should be noted that, based on the determination of the existence of the hole, the spatial location of the hole area is further achieved by locating the missing point and marking adjacent grids. This upgrade from determining the presence or absence to location marking provides clear regional guidance for subsequent repair or process adjustments.
[0033] In another preferred embodiment of the present invention, when projecting a preset checkerboard structure light onto the surface of the smart card, the ambient light intensity is always kept at a preset value.
[0034] In another preferred embodiment of the present invention, when projecting grid structure light onto the surface of smart cards in the same batch, the grid structure light is corrected only for the first smart card to be tested, and the correction is repeated after the testing of the entire batch of smart cards is completed.
[0035] In another preferred embodiment of the present invention, when there is a defect on the surface of the smart card, the smart card is rotated horizontally by 90° and the test is repeated three times. If the output result does not change, the card is output; if the output result is different, the staff is prompted to re-examine the card. The standard template pattern is rotated synchronously after the smart card is rotated horizontally by 90°.
[0036] It is worth noting that a multi-angle redundancy verification mechanism improves the reliability and credibility of defect detection conclusions while reducing the risk of misjudgment. Defects such as scratches and bends on the surface of smart cards are often directionally sensitive. Some minute scratches may be masked or blurred under specific lighting angles or projection directions because they are parallel to the grid lines, leading to missed or incorrect detections in the initial inspection. This solution requires rotating the card horizontally by 90° and repeating the inspection three times, simultaneously rotating the standard template pattern each time to maintain a consistent comparison benchmark and ensure that defects in different directions are effectively captured. If the four results are completely consistent, the defect judgment is highly certain and can be directly output; if the results are inconsistent, it indicates the presence of factors such as edge blurring, directional interference, or random noise, prompting manual review. This avoids rigid misjudgments by the automated system and provides quality inspectors with a point of entry for verification.
[0037] Furthermore, this re-inspection mechanism improves the system's fault tolerance by trading time for accuracy without increasing hardware costs, making it particularly suitable for the final inspection of high-value, irregularly shaped cards. Simultaneously, the consistency comparison of the four inspection results can serve as a self-diagnostic basis for system stability. Frequent inconsistencies suggest the need to check for potential problems such as light source attenuation, card surface contamination, or positioning deviations, thus achieving quality monitoring of the inspection system itself.
[0038] The foregoing has provided a detailed description of one embodiment of the present invention, but this description is merely a preferred embodiment and should not be construed as limiting the scope of the invention. All equivalent variations and modifications made within the scope of the present invention should still fall within the scope of the present invention.
Claims
1. A visual inspection system for inspecting the appearance of irregularly shaped smart cards, characterized in that, include: Mesh Correction Module: Place the smart card at a designated position on the table and project a preset mesh structure light onto the surface of the smart card. The reference mesh size of the mesh structure light is N×N, where N represents the preset length. Obtain the size of the smart card and correct the mesh structure light based on the size. Data acquisition module: Acquires an image of the smart card surface projected with a grid pattern, obtains the grid lines in the image, identifies the grid intersections and records them as point N. i,j Point N i,j The grid intersection point in the i-th row and j-th column represents all the grid lines and grid intersection points collected in this study, which are recorded as the grid pattern to be detected. Standard comparison module: Obtain a preset standard template pattern, extract grid lines and grid intersections from the standard template pattern and record them as auxiliary lines and auxiliary points, and generate auxiliary lines and auxiliary points equivalently in the grid pattern to be detected; Visual inspection module: Pixel detection is performed along each auxiliary line. If the auxiliary line is in contact with the grid line and the auxiliary point coincides with the grid intersection point, but there are missing pixels on the grid line, the smart card is scratched. The grid where the missing pixels are located is recorded as the scratched area. If the pixels of the grid line are continuous, but the grid line and the auxiliary line do not completely overlap, the grid line that does not completely overlap is recorded as an offset line. The offset distance between the grid intersection point on the offset line and the auxiliary point is obtained. If the offset distance is greater than or equal to the preset offset threshold, it is recorded as an abnormal point. When the proportion of abnormal points on any offset line exceeds λ, the smart card is output as having a bend, where λ represents the preset judgment coefficient.
2. The visual inspection system for inspecting the appearance of irregularly shaped smart cards according to claim 1, characterized in that, In the aforementioned mesh correction module, the method for correcting the light rays of the mesh structure based on size specifications includes: Preset standard area S sta Given the area fluctuation value s, obtain the area S of one side of the smart card. If S sta -s≤S≤S sta If +s, no correction will be made; If S>S sta +s, calculate the magnification factor I=floor[(SS sta The baseline grid size is corrected to (γ×I×N)×(γ×I×N). If S < S sta -s, calculate the reduction factor J=floor[(|SS sta | / s], which corrects the baseline grid size to [N / (J×γ)]×[N / (J×γ)], where γ represents the preset scaling factor, γ>1, and floor represents rounding the data down.
3. The visual inspection system for inspecting the appearance of irregularly shaped smart cards according to claim 1, characterized in that, In the aforementioned grid correction module, the height of the smart card is adjusted to ensure that the surface of the smart card remains horizontal when a preset checkerboard structured light is projected onto the surface of the smart card.
4. The visual inspection system for inspecting the appearance of irregularly shaped smart cards according to claim 1, characterized in that, In the data acquisition module, the total number A of grid intersections in the grid pattern to be detected is obtained, and the total number B of auxiliary points in the standard template pattern is obtained. If A≠B, the subsequent operation is stopped and the smart card is output as having a hole.
5. The visual inspection system for inspecting the appearance of irregularly shaped smart cards according to claim 4, characterized in that, The missing grid intersections are obtained by comparing them with the auxiliary points in the standard template pattern. These are recorded as missing points, and the grids adjacent to the missing points are recorded as the areas where holes are located.
6. The visual inspection system for inspecting the appearance of irregularly shaped smart cards according to claim 1, characterized in that, In the aforementioned grid correction module, when a preset checkerboard structured light is projected onto the surface of the smart card, the ambient light intensity is always kept at a preset value.
7. The visual inspection system for inspecting the appearance of irregularly shaped smart cards according to claim 1, characterized in that, In the aforementioned grid correction module, when projecting grid structure light onto the surface of smart cards in the same batch, grid structure light correction is performed only on the first smart card to be tested, and the correction is repeated after the testing of the entire batch of smart cards is completed.
8. The visual inspection system for inspecting the appearance of irregularly shaped smart cards according to claim 1, characterized in that, In the aforementioned visual inspection module, when a defect is found on the surface of the smart card, the smart card is rotated horizontally by 90° and the inspection is repeated three times. If the output result does not change, it is output; if the output result is different, the staff is prompted to re-inspect. The standard template pattern is rotated synchronously after the smart card is rotated horizontally by 90°.