CN117115151B - SIM card seat defect identification method based on machine vision - Google Patents

SIM card seat defect identification method based on machine vision Download PDF

Info

Publication number
CN117115151B
CN117115151B CN202311368027.1A CN202311368027A CN117115151B CN 117115151 B CN117115151 B CN 117115151B CN 202311368027 A CN202311368027 A CN 202311368027A CN 117115151 B CN117115151 B CN 117115151B
Authority
CN
China
Prior art keywords
point
pixel
pixel point
analyzed
points
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN202311368027.1A
Other languages
Chinese (zh)
Other versions
CN117115151A (en
Inventor
张永峰
王志军
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Shenzhen Mup Industrial Co ltd
Original Assignee
Shenzhen Mup Industrial Co ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Shenzhen Mup Industrial Co ltd filed Critical Shenzhen Mup Industrial Co ltd
Priority to CN202311368027.1A priority Critical patent/CN117115151B/en
Publication of CN117115151A publication Critical patent/CN117115151A/en
Application granted granted Critical
Publication of CN117115151B publication Critical patent/CN117115151B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T7/00Image analysis
    • G06T7/0002Inspection of images, e.g. flaw detection
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T7/00Image analysis
    • G06T7/10Segmentation; Edge detection
    • G06T7/13Edge detection
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T7/00Image analysis
    • G06T7/60Analysis of geometric attributes
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06VIMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
    • G06V10/00Arrangements for image or video recognition or understanding
    • G06V10/70Arrangements for image or video recognition or understanding using pattern recognition or machine learning
    • G06V10/762Arrangements for image or video recognition or understanding using pattern recognition or machine learning using clustering, e.g. of similar faces in social networks
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T2207/00Indexing scheme for image analysis or image enhancement
    • G06T2207/10Image acquisition modality
    • G06T2207/10004Still image; Photographic image
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T2207/00Indexing scheme for image analysis or image enhancement
    • G06T2207/20Special algorithmic details
    • G06T2207/20004Adaptive image processing
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T2207/00Indexing scheme for image analysis or image enhancement
    • G06T2207/20Special algorithmic details
    • G06T2207/20081Training; Learning
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T2207/00Indexing scheme for image analysis or image enhancement
    • G06T2207/20Special algorithmic details
    • G06T2207/20084Artificial neural networks [ANN]
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T2207/00Indexing scheme for image analysis or image enhancement
    • G06T2207/20Special algorithmic details
    • G06T2207/20112Image segmentation details
    • G06T2207/20164Salient point detection; Corner detection

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • Computer Vision & Pattern Recognition (AREA)
  • General Physics & Mathematics (AREA)
  • Artificial Intelligence (AREA)
  • Geometry (AREA)
  • Health & Medical Sciences (AREA)
  • Quality & Reliability (AREA)
  • Computing Systems (AREA)
  • Databases & Information Systems (AREA)
  • Evolutionary Computation (AREA)
  • General Health & Medical Sciences (AREA)
  • Medical Informatics (AREA)
  • Software Systems (AREA)
  • Multimedia (AREA)
  • Image Analysis (AREA)

Abstract

The invention relates to the technical field of image processing, and provides a SIM card holder defect identification method based on machine vision, which comprises the following steps: acquiring a card seat image and a spring piece area; acquiring the wear distribution density corresponding to the pixel points; acquiring a light flow point and a light flow adjacent point, and further acquiring a reflection roughness index corresponding to each pixel point in the spring piece area; acquiring a light flow point cluster, and further acquiring reflection abnormal density corresponding to each pixel point in the spring piece area; obtaining deformation score coefficients corresponding to the pixel points; and acquiring abnormal contribution degrees corresponding to the pixel points, further acquiring self-adaptive scales corresponding to the spring sheet areas, and acquiring a card seat enhanced image according to the self-adaptive scales corresponding to the spring sheet areas, thereby completing defect identification of the SIM card seat. The invention aims to solve the problem that the defect identification effect of the conventional SIM card holder is not ideal.

Description

SIM card seat defect identification method based on machine vision
Technical Field
The invention relates to the technical field of image processing, in particular to a SIM card seat defect identification method based on machine vision.
Background
A SIM is a removable integrated circuit card used in mobile communications to identify a subscriber identity, store subscriber data, authenticate encryption, and provide mobile network services. The SIM card seat is a component structure for inserting and fixing the SIM card, and can play roles in connecting and fixing the SIM card, transmitting data and realizing authentication management of the SIM state in the mobile communication equipment. When the SIM card seat has defects, the connection between the SIM card and the mobile communication equipment is directly affected. Because the spring piece in the SIM card holder is the main contact part when the SIM card is plugged in and pulled out, the long-time use or frequent plugging can lead to the abrasion of the spring piece to be aggravated, and the problem that the signal transmission is unstable or the normal connection cannot be realized is caused, so that the image of the SIM card holder can be processed, and whether the SIM card holder has defects can be timely identified.
When the image of the SIM card seat is processed, the image of the SIM card seat needs to be enhanced in order to improve the accuracy of defect identification, and in order to reduce the introduction of noise and improve the illumination compensation effect in the image enhancement processing process, the image of the SIM card seat can be subjected to image enhancement processing by using an SSR single-scale retina algorithm. However, the degree of dependence of the SSR single-scale retina algorithm on the scale parameters is large, and the image enhancement effect is not ideal due to the unsuitable scale parameters, so that the defect identification effect of the SIM card holder is not ideal.
Disclosure of Invention
The invention provides a machine vision-based SIM card holder defect identification method, which aims to solve the problem that the existing SIM card holder defect identification effect is not ideal, and adopts the following technical scheme:
one embodiment of the invention provides a SIM card seat defect identification method based on machine vision, which comprises the following steps:
acquiring a card seat image, and acquiring a spring piece area according to the card seat image;
acquiring a first window corresponding to each pixel point in the spring piece area, and acquiring the wear distribution density corresponding to the pixel points according to the first window corresponding to the pixel points;
acquiring a light source point in a first window corresponding to each pixel point in a spring plate area, acquiring the outermost edge and the first pixel point in the spring plate area, acquiring a reflection path corresponding to each pixel point in the spring plate area, acquiring a light flow point and a light flow adjacent point, and further acquiring a reflection roughness index corresponding to each pixel point in the spring plate area; acquiring an optical flow point cluster, and acquiring reflection abnormal density corresponding to each pixel point in a spring piece area; obtaining deformation score coefficients corresponding to the pixel points according to the reflection roughness index and the reflection abnormal density corresponding to each pixel point in the spring piece area;
obtaining abnormal contribution degrees corresponding to the pixel points according to the wear distribution density and the deformation score coefficient corresponding to each pixel point in the spring plate area, obtaining self-adaptive scales corresponding to the spring plate area according to the abnormal contribution degrees corresponding to each pixel point, obtaining a card seat enhanced image according to the self-adaptive scales corresponding to the spring plate area, and further completing defect identification of the SIM card seat.
Further, the method for obtaining the first window corresponding to each pixel point in the spring piece area and obtaining the wear distribution density corresponding to the pixel point according to the first window corresponding to the pixel point includes the following specific steps:
respectively establishing a window taking a first preset threshold value as a side length by taking each pixel point contained in the spring leaf area as a center, and recording the established window as a first window of the central pixel point;
acquiring angular points in the spring piece area;
counting the number of corner points contained in a first window corresponding to each pixel point in the spring piece area;
acquiring a kernel density estimated value corresponding to each corner point in the first window;
taking each corner point in the first window as a corner point to be analyzed, and recording the average value of Euclidean distances between the corner point to be analyzed and all the corner points except the corner point to be analyzed in the first window as the corner distance of the corner point to be analyzed;
the ratio of the kernel density estimated value of the corner point in the first window to the angular distance of the corner point is recorded as a first ratio corresponding to the corner point;
and marking the sum of first ratios corresponding to the corner points contained in the first window corresponding to the pixel points in the spring piece area as the wear distribution density corresponding to the pixel points in the spring piece area.
Further, the specific method for obtaining the light source point in the first window corresponding to each pixel point in the spring piece area includes:
and respectively taking each pixel point in the spring piece area as a pixel point to be analyzed, marking the pixel point with the largest gray value in the first window corresponding to the pixel point to be analyzed as a light source point corresponding to the pixel point to be analyzed, and marking one of the pixel points with the largest gray value selected randomly as the light source point corresponding to the pixel point to be analyzed when a plurality of the largest gray values are arranged in the first window.
Further, the method for obtaining the outermost edge and the first pixel point in the spring sheet area, obtaining the reflection path corresponding to each pixel point in the spring sheet area, and obtaining the optical flow point and the optical flow adjacent point includes the following specific steps:
converting the card seat image into a gray image, and recording the acquired gray image as the card seat gray image;
carrying out semantic segmentation on the gray level image of the clamping seat to obtain a spring piece region;
edge detection is carried out on the gray level image of the clamping seat, and the edge in the spring piece area is obtained;
counting the number of pixel points contained in each edge of the spring sheet area, and marking the closed edge with the largest number of pixel points contained in the spring sheet area as the outermost edge;
marking the pixel points contained on the outermost edge as first pixel points;
when a first pixel point is contained in a first window corresponding to the pixel point to be analyzed, each first pixel point contained in the first window is respectively connected with a light source point corresponding to the pixel point to be analyzed, and each line segment obtained through connection is marked as a reflection path corresponding to the pixel point to be analyzed;
when the first window corresponding to the pixel to be analyzed does not contain the first pixel, the pixel with the largest Euclidean distance between the light source point corresponding to the pixel to be analyzed in the first window is marked as a second pixel, and the line segment connecting the second pixel and the light source point corresponding to the pixel to be analyzed is marked as a reflection path corresponding to the pixel to be analyzed;
numbering each pixel point on the reflection path from one end of the light source point of the reflection path corresponding to the pixel point to be analyzed;
each pixel point on the reflection path is marked as a path point to be analyzed, and the pixel points with numbers adjacent to the numbers of the path points to be analyzed and larger than the numbers of the path points to be analyzed are marked as adjacent path points of the path points to be analyzed;
when the gray value of the path point to be analyzed is smaller than that of the adjacent path point of the path point to be analyzed, marking the adjacent path point of the path point to be analyzed as an optical flow point corresponding to the pixel point to be analyzed, marking the path point to be analyzed as an optical flow adjacent point corresponding to the pixel point to be analyzed, and simultaneously stopping comparing the gray values between the pixel points on the reflection path corresponding to the pixel point to be analyzed.
Further, the specific method for obtaining the reflective roughness index corresponding to each pixel point in the spring piece area includes:
counting the number of reflection paths contained in a first window corresponding to the pixel points in the spring piece area;
the difference value between the gradient value of the adjacent point of the optical flow and the gradient value of the optical flow point in the same reflection path corresponding to the pixel point in the spring piece area is recorded as a first difference value corresponding to the reflection path;
and marking the sum of the first differences corresponding to all the reflection paths contained in the first window corresponding to the pixel points in the spring piece area as the reflection roughness index corresponding to the pixel points.
Further, the method for obtaining the optical flow point cluster and obtaining the reflection abnormal density corresponding to each pixel point in the spring piece area comprises the following specific steps:
clustering all the optical flow points to obtain an optical flow point cluster;
the sum of the number of the optical flow points contained in all the optical flow point clusters is recorded as a first sum value;
when a plurality of optical flow points contained in a first window corresponding to the pixel points to be analyzed correspond to different optical flow point cluster clusters, selecting an optical flow point cluster corresponding to the optical flow points contained in the first window, and marking the optical flow point cluster with the largest number contained in the selected optical flow point cluster as the optical flow point cluster corresponding to the pixel points to be analyzed;
when the optical flow points contained in the first window corresponding to the pixel points to be analyzed correspond to the same optical flow point cluster, the corresponding optical flow point cluster is marked as the optical flow point cluster corresponding to the pixel points to be analyzed;
the ratio of the number of the optical flow points contained in the optical flow point cluster corresponding to the pixel point to the first sum value is recorded as a second ratio corresponding to the pixel point;
marking the sum of the second ratio and the first adjustment factor as a second sum value corresponding to the pixel point;
and recording the product of the second sum value corresponding to the pixel point and the ratio of the number of the light flow points contained in the first window corresponding to the pixel point to the number of the pixel points contained in the first window as the reflection abnormal density corresponding to the pixel point.
Further, the method for obtaining the deformation score coefficient corresponding to the pixel point according to the reflection roughness index and the reflection abnormal density corresponding to each pixel point in the spring piece area comprises the following specific steps:
and (3) recording the product of the reflection roughness index and the reflection abnormal density corresponding to each pixel point in the spring piece area as a deformation score coefficient corresponding to the pixel point.
Further, the method for obtaining the abnormal contribution degree corresponding to the pixel points according to the wear distribution density and the deformation score coefficient corresponding to each pixel point in the spring piece area comprises the following specific steps:
marking the sum of the wear distribution density corresponding to each pixel point in the spring piece area and the first adjustment factor as a third sum value corresponding to the pixel point;
marking the sum of the deformation score coefficient corresponding to each pixel point in the spring piece area and the first adjustment factor as a fourth sum value corresponding to the pixel point;
and (3) marking the linear normalized value of the product of the third sum value and the fourth sum value corresponding to the pixel point as the abnormal contribution degree corresponding to the pixel point.
Further, the method for obtaining the self-adaptive scale corresponding to the spring piece region according to the abnormal contribution degree corresponding to each pixel point comprises the following specific steps:
the product of the average value of the abnormal contribution degrees corresponding to all the pixel points contained in the spring piece area and the second range threshold value is recorded as a first product corresponding to the spring piece area;
and marking the rounded value of the difference value of the first product of the first range threshold value and the first product corresponding to the spring piece area as the self-adaptive scale corresponding to the spring piece area.
Further, the method for obtaining the enhanced image of the card seat according to the self-adaptive scale corresponding to the spring sheet area, and further completing the defect identification of the SIM card seat comprises the following specific steps:
taking the self-adaptive scale corresponding to each spring leaf area as the value of a scale parameter, and respectively processing each spring leaf area in the cassette gray level image by using an image enhancement algorithm to obtain a cassette enhanced image;
inputting the card seat enhanced image into a neural network, and obtaining the defect type of the SIM card seat corresponding to the card seat enhanced image.
The beneficial effects of the invention are as follows:
the invention extracts a spring piece area which is easy to generate defects from an image of a SIM card seat, firstly, according to the characteristic that the light reflection phenomenon of the position of the defect such as deformation, abrasion and the like of the spring piece is larger than the difference of a normal spring piece, the abrasion distribution density corresponding to each pixel point is evaluated; secondly, evaluating deformation score coefficients corresponding to each pixel point according to the characteristics of the light flow band at the edge of the position where the spring piece has the defect; then, according to the wear distribution density and deformation score coefficient corresponding to each pixel point in the spring sheet area, obtaining the abnormal contribution degree corresponding to the pixel points, and obtaining accurate evaluation of the abnormal degree of each pixel point in the SIM card seat spring sheet area, namely the strength of each pixel point position to be enhanced, so that the accuracy of the subsequent identification of the defects of the SIM card seat is improved; according to the method, the self-adaptive scale corresponding to the spring piece area is obtained according to the abnormal contribution degree corresponding to each pixel point, the card seat enhancement image is obtained according to the self-adaptive scale corresponding to the spring piece area, the image enhancement effect of the image of the SIM card seat is improved, the problem of insufficient defect recognition precision caused by poor image quality is solved, further the defect recognition of the SIM card seat is completed according to the card seat enhancement image, the accuracy of the defect recognition of the SIM card seat is further improved, and the problem of unsatisfactory defect recognition effect of the conventional SIM card seat is solved.
Drawings
In order to more clearly illustrate the embodiments of the invention or the technical solutions of the prior art, the drawings which are used in the description of the embodiments or the prior art will be briefly described, it being obvious that the drawings in the description below are only some embodiments of the invention, and that other drawings can be obtained according to these drawings without inventive faculty for a person skilled in the art.
Fig. 1 is a flowchart of a method for identifying a defect of a SIM card holder based on machine vision according to an embodiment of the present invention;
fig. 2 is a schematic diagram of a reflection path.
Detailed Description
The following description of the embodiments of the present invention will be made clearly and completely with reference to the accompanying drawings, in which it is apparent that the embodiments described are only some embodiments of the present invention, but not all embodiments. All other embodiments, which can be made by those skilled in the art based on the embodiments of the invention without making any inventive effort, are intended to be within the scope of the invention.
Referring to fig. 1, a flowchart of a method for identifying a defect of a SIM card holder based on machine vision according to an embodiment of the present invention is shown, where the method includes the following steps:
and S001, acquiring a card seat image, and acquiring a spring piece area according to the card seat image.
And setting a CCD camera, so that the CCD camera can shoot from top to bottom, and acquiring an image of the SIM card holder by using the CCD camera. And denoising the image of the SIM card holder by using wavelet transformation to avoid noise interference in the image of the SIM card holder, and marking the denoised image of the SIM card holder as a card holder image which is an RGB image. Converting the card seat image into a gray image, and recording the acquired gray image as the card seat gray image. The method for denoising the image of the SIM card holder by using wavelet transformation is a known technique and will not be described in detail.
Inputting the card seat gray level image into a PSPNet multi-scale semantic segmentation network to obtain a spring piece area, wherein the spring piece area is the corresponding area of the SIM card seat spring piece in the card seat gray level image. The loss function of the PSPNet multi-scale semantic segmentation network selects a cross entropy loss function, the optimization algorithm selects RMSProp, and the construction and training process of the PSPNet multi-scale semantic segmentation network is a known technology and is not repeated.
Thus, a leaf spring region is obtained.
Step S002, a first window corresponding to each pixel point in the spring piece area is obtained, and the abrasion distribution density corresponding to the pixel points is obtained according to the first window corresponding to the pixel points.
The spring piece in the metal part of the SIM card seat is easy to generate defects such as deformation and abrasion, when the spring piece area is worn or deformed, the light reflection phenomenon of the position of the defect in the spring piece area obtained under the light source is greatly different from the normal light reflection phenomenon, and an obvious brighter part appears, so that each pixel point in the spring piece area is analyzed.
And detecting the gray level image of the clamping seat by using Harris angular points to obtain angular points in the spring piece area.
And respectively taking each pixel point contained in the spring piece area as a center, establishing a window taking a first preset threshold value as a side length, and recording the established window as a first window of the central pixel point, wherein the empirical value of the first preset threshold value is 5. And counting the number of corner points contained in a first window corresponding to each pixel point in the spring piece area. And acquiring a kernel density estimation value corresponding to each corner point in the first window by using a KDE kernel density estimation method. The kernel function of kernel density estimation selects gaussian kernel function, the bandwidth of kernel function is 3×3, and the method of estimating kde kernel density is a known technique and will not be described again.
And respectively taking each corner point in the first window as a corner point to be analyzed, and recording the average value of Euclidean distances between the corner point to be analyzed and all the corner points except the corner point to be analyzed in the first window as the angular distance of the corner point to be analyzed.
And acquiring the wear distribution density corresponding to each pixel point in the spring piece area according to the data.
In the method, in the process of the invention,is the pixel point in the spring sheet area>A corresponding wear distribution density; />Is pixel dot +.>The number of corner points contained in the corresponding first window; />Is pixel dot +.>The corresponding first window contains +.>Kernel density estimation values corresponding to the corner points, wherein +.>;/>Is pixel dot +.>The corresponding first window contains +.>Angular distances corresponding to the angular points.
And taking one-half of the angular distance corresponding to the angular point contained in the first window as the weight of the kernel density estimated value corresponding to the angular point, and acquiring the contribution value of the angular point to the wear distribution density corresponding to the central pixel point.
When the number of corner points contained in the first window corresponding to the pixel points in the spring piece area is less than or equal to 1, the abrasion distribution density corresponding to the pixel points is 0.
When the kernel density estimated value corresponding to the corner point contained in the first window corresponding to the pixel point is larger, the more other corner points distributed around the corner point are, the more likely the corner point is a wearing area, namely the more likely the pixel point is in the wearing area, the greater the wearing distribution density corresponding to the pixel point is, and the greater the degree of detail enhancement on the position of the pixel point is.
So far, the wear distribution density corresponding to each pixel point in the spring piece area is obtained.
Step S003, acquiring a light source point in a first window corresponding to each pixel point in a spring plate area, acquiring the outermost edge and the first pixel point in the spring plate area, acquiring a reflection path corresponding to each pixel point in the spring plate area, acquiring a light flow point and a light flow adjacent point, and further acquiring a reflection roughness index corresponding to each pixel point in the spring plate area; acquiring an optical flow point cluster, and acquiring reflection abnormal density corresponding to each pixel point in a spring piece area; and obtaining deformation score coefficients corresponding to the pixel points according to the reflection roughness index and the reflection abnormal density corresponding to each pixel point in the spring piece area.
The surface of the spring piece is smoother in a normal state, and the light can generate a specular reflection phenomenon on the surface of the spring piece. When the surface deformation is caused by the defect of the spring piece, the surface of the spring piece is not smooth any more, and an optical flow band is generated at the edge of the deformation area. Meanwhile, when the surface defects of the spring piece are more obvious, the surface smoothness of the spring piece is smaller, and the optical flow belt area is larger.
And (3) using a Canny edge detection operator to the gray level image of the clamping seat to obtain the edge in the spring piece area. The Canny edge detection is a known technique, and will not be described in detail. Counting the number of pixel points contained in each edge of the spring sheet area, and recording the closed edge with the largest number of pixel points contained in the spring sheet area as the outermost edge. And marking the pixel points contained on the outermost edge as first pixel points.
And respectively taking each pixel point in the spring piece area as a pixel point to be analyzed, and recording the pixel point with the maximum gray value in the first window corresponding to the pixel point to be analyzed as a light source point corresponding to the pixel point to be analyzed. When the maximum gray value in the first window is more than one, one of the pixel points with the maximum gray value is randomly selected, and the randomly selected pixel point is marked as the light source point corresponding to the pixel point to be analyzed.
When the first window corresponding to the pixel point to be analyzed contains first pixel points, each first pixel point contained in the first window is respectively connected with the light source point corresponding to the pixel point to be analyzed, and each line segment obtained through connection is marked as a reflection path corresponding to the pixel point to be analyzed. When the first pixel point is not contained in the first window corresponding to the pixel point to be analyzed, the pixel point with the largest Euclidean distance between the light source point corresponding to the pixel point to be analyzed in the first window is marked as a second pixel point, and a line segment connecting the second pixel point and the light source point corresponding to the pixel point to be analyzed is marked as a reflection path corresponding to the pixel point to be analyzed. A schematic diagram of the reflection path is shown in fig. 2.
And obtaining a reflection path corresponding to the pixel points to be analyzed, starting from one end of a light source point of the reflection path, and numbering each pixel point on the reflection path. And respectively marking each pixel point on the reflection path as a path point to be analyzed, and marking the pixel points with numbers adjacent to the numbers of the path points to be analyzed and larger than the numbers of the path points to be analyzed as adjacent path points of the path points to be analyzed. When the gray value of the path point to be analyzed is smaller than that of the adjacent path point of the path point to be analyzed, marking the adjacent path point of the path point to be analyzed as an optical flow point corresponding to the pixel point to be analyzed, marking the path point to be analyzed as an optical flow adjacent point corresponding to the pixel point to be analyzed, and simultaneously stopping comparing the gray values between the pixel points on the reflection path corresponding to the pixel point to be analyzed. Gradient values of the optical flow points and the optical flow adjacent points are obtained. The light flow point is the position of the abnormal light reflection condition in the spring piece area.
And obtaining a reflection roughness index corresponding to each pixel point in the spring piece area.
In the method, in the process of the invention,is the pixel point in the spring sheet area>A corresponding reflective roughness index; />Is pixel dot +.>The number of reflection paths contained within the corresponding first window; />Is pixel dot +.>Corresponding->Gradient values of adjacent points of the optical flow on the reflection path, wherein +.>;/>Is pixel dot +.>Corresponding->Gradient values of optical flow points on the strip reflection path.
When the gradient value difference between the adjacent point of the optical flow and the optical flow point on the first window internal reflection path corresponding to the pixel point in the spring piece area is larger, the light reflection degree at the optical flow point is larger, the reflection roughness index corresponding to the pixel point is larger, namely, the light reflection abnormality degree of the pixel point is higher, the position of the pixel point on the surface of the spring piece is smoother, and the detail characteristic of the position of the pixel point is enhanced.
And clustering all the optical flow points by using a DBSCAN clustering algorithm with 5 as a critical domain radius and 5 as the minimum sample point number in the neighborhood to obtain a plurality of optical flow point clustering clusters. And counting the number of the optical flow points contained in each optical flow point cluster.
When a plurality of optical flow points contained in a first window corresponding to the pixel points to be analyzed correspond to different optical flow point cluster clusters, selecting an optical flow point cluster corresponding to the optical flow points contained in the first window, and marking the optical flow point cluster with the largest number in the first window as the optical flow point cluster corresponding to the pixel points to be analyzed. When the optical flow points contained in the first window corresponding to the pixel points to be analyzed correspond to the same optical flow point cluster, the corresponding optical flow point cluster is marked as the optical flow point cluster corresponding to the pixel points to be analyzed.
And obtaining the reflection abnormal density corresponding to each pixel point in the spring piece area.
In the method, in the process of the invention,is the pixel point in the spring sheet area>Corresponding reflection anomaly density; />Is pixel dot +.>The number of the corresponding optical flow points contained in the first window; />Is pixel dot +.>The number of the pixel points contained in the corresponding first window; />Is pixel dot +.>The number of the optical flow points contained in the corresponding optical flow point cluster; />The sum of the number of the optical flow points contained in all the optical flow point clusters is used; />For the first adjustment factor, the empirical value is 1.
When the number of optical flow points in the pixel window is larger, the light reflection abnormal condition of the first window corresponding to the pixel point is more serious, the pixel point is more likely to correspond to the deformation area of the SIM card seat, and at the moment, the reflection abnormal density corresponding to the pixel point is larger. When the ratio of the number of the optical flow points contained in the optical flow point cluster corresponding to the pixel point to the sum of the numbers of the optical flow points contained in all the optical flow point clusters is larger, the light reflection abnormality of the first window corresponding to the pixel point is more serious, the pixel point is more likely to correspond to the deformation area of the SIM card holder, and at the moment, the reflection abnormality density corresponding to the pixel point is larger.
And obtaining deformation score coefficients corresponding to the pixel points according to the reflection roughness index and the reflection abnormal density corresponding to each pixel point in the spring piece area.
In the method, in the process of the invention,is the pixel point in the spring sheet area>A corresponding deformation score coefficient; />Is pixel dot +.>Corresponding reflection anomaly density; />Is pixel dot +.>Corresponding reflective asperity index.
When the reflection roughness index and the reflection anomaly density corresponding to the pixel point in the spring piece area are larger, the deformation score coefficient corresponding to the pixel point is larger, namely the light reflection anomaly condition at the pixel point is more serious, and the pixel point is more likely to correspond to the deformation area of the SIM card seat.
So far, the deformation score coefficient corresponding to each pixel point in the spring piece area is obtained.
Step S004, obtaining abnormal contribution degrees corresponding to the pixel points according to the wear distribution density and the deformation score coefficient corresponding to each pixel point in the spring plate area, obtaining self-adaptive scales corresponding to the spring plate area according to the abnormal contribution degrees corresponding to each pixel point, obtaining a card seat enhancement image according to the self-adaptive scales corresponding to the spring plate area, and further completing defect identification of the SIM card seat.
And acquiring abnormal contribution degree corresponding to each pixel point in the spring piece area.
In the method, in the process of the invention,is the pixel point in the spring sheet area>Corresponding abnormal contribution degree; />Is pixel dot +.>A corresponding wear distribution density; />Is pixel dot +.>A corresponding deformation score coefficient; />The function is a linear normalization function and is used for normalizing the numerical value in a bracket; />For the first adjustment factor, the empirical value is 1.
When the wear distribution density corresponding to the pixel point is larger, the pixel point is more likely to be located at the wear position of the SIM card seat, and at this time, the abnormal contribution degree corresponding to the pixel point is larger, namely finer detail enhancement should be performed on the pixel point position. When the deformation score coefficient corresponding to the pixel point is larger, the degree of abnormal light reflection at the position of the pixel point is higher, and at this time, the degree of abnormal contribution corresponding to the pixel point is larger, namely the position of the pixel point is more likely to be a deformation region of the spring piece, and the detail information at the pixel point is more likely to be enhanced.
When an SSR single-scale retina algorithm is used for processing an image, the empirical value range of the scale parameter is generallyThe edge holding effect in the processed image is more remarkable when the scale value is smaller, and the low-illumination problem improvement effect in the processed image is more remarkable when the scale value is larger. And acquiring the self-adaptive scale corresponding to each spring piece region according to the abnormal contribution degree corresponding to the pixel points in the spring piece region.
In the method, in the process of the invention,is a leaf area +.>Corresponding adaptive dimensions; />An empirical value of 100 for the first range threshold; />For a second range threshold, the empirical value is 20; />Is a leaf area +.>The average value of the abnormal contribution degrees corresponding to all the pixel points contained in the pixel points; />As a rounding function, it acts as a rounding value to the value in brackets.
When the average value of abnormal contribution degrees corresponding to all pixel points contained in the spring piece area is larger, the adaptive scale corresponding to the spring piece area is larger, and the improvement effect on the low-illumination problem in the spring piece area is more remarkable.
And taking the self-adaptive scale corresponding to each spring leaf area as the value of a scale parameter, and respectively carrying out image enhancement on each spring leaf area in the cassette gray level image by using an SSR single-scale retina algorithm to obtain a cassette enhanced image. The image enhancement by using the SSR single-scale retina algorithm is a known technology and will not be described in detail.
Inputting the card seat enhanced image into a ResNet neural network model, and obtaining the defect type of the SIM card seat corresponding to the card seat enhanced image, wherein a loss function of the ResNet neural network model adopts a cross entropy loss function, an optimization algorithm adopts Adam, label data is marked by human beings, and labels comprise abrasion, deformation, no defects and the like. The construction and training process of the ResNet neural network model is a known technology and will not be described in detail.
So far, the defect identification of the SIM card seat is completed.
The above description is only of the preferred embodiments of the present invention and is not intended to limit the invention, but any modifications, equivalent substitutions, improvements, etc. within the principles of the present invention should be included in the scope of the present invention.

Claims (8)

1. The SIM card seat defect identification method based on machine vision is characterized by comprising the following steps of:
acquiring a card seat image, and acquiring a spring piece area according to the card seat image;
acquiring a first window corresponding to each pixel point in the spring piece area, and acquiring the wear distribution density corresponding to the pixel points according to the first window corresponding to the pixel points;
acquiring a light source point in a first window corresponding to each pixel point in a spring plate area, acquiring the outermost edge and the first pixel point in the spring plate area, acquiring a reflection path corresponding to each pixel point in the spring plate area, acquiring a light flow point and a light flow adjacent point, and further acquiring a reflection roughness index corresponding to each pixel point in the spring plate area; acquiring an optical flow point cluster, and acquiring reflection abnormal density corresponding to each pixel point in a spring piece area; obtaining deformation score coefficients corresponding to the pixel points according to the reflection roughness index and the reflection abnormal density corresponding to each pixel point in the spring piece area;
acquiring abnormal contribution degrees corresponding to the pixel points according to the wear distribution density and the deformation score coefficient corresponding to each pixel point in the spring plate area, acquiring self-adaptive scales corresponding to the spring plate area according to the abnormal contribution degrees corresponding to each pixel point, acquiring a card seat enhanced image according to the self-adaptive scales corresponding to the spring plate area, and further completing defect identification of the SIM card seat;
the method for acquiring the outermost edge and the first pixel point in the spring piece area, the reflection path corresponding to each pixel point in the spring piece area, and the optical flow point and the optical flow adjacent point comprises the following specific steps: converting the card seat image into a gray image, and recording the acquired gray image as the card seat gray image; carrying out semantic segmentation on the gray level image of the clamping seat to obtain a spring piece region; edge detection is carried out on the gray level image of the clamping seat, and the edge in the spring piece area is obtained; counting the number of pixel points contained in each edge of the spring sheet area, and marking the closed edge with the largest number of pixel points contained in the spring sheet area as the outermost edge; marking the pixel points contained on the outermost edge as first pixel points; when a first pixel point is contained in a first window corresponding to the pixel point to be analyzed, each first pixel point contained in the first window is respectively connected with a light source point corresponding to the pixel point to be analyzed, and each line segment obtained through connection is marked as a reflection path corresponding to the pixel point to be analyzed; when the first window corresponding to the pixel to be analyzed does not contain the first pixel, the pixel with the largest Euclidean distance between the light source point corresponding to the pixel to be analyzed in the first window is marked as a second pixel, and the line segment connecting the second pixel and the light source point corresponding to the pixel to be analyzed is marked as a reflection path corresponding to the pixel to be analyzed; numbering each pixel point on the reflection path from one end of the light source point of the reflection path corresponding to the pixel point to be analyzed; each pixel point on the reflection path is marked as a path point to be analyzed, and the pixel points with numbers adjacent to the numbers of the path points to be analyzed and larger than the numbers of the path points to be analyzed are marked as adjacent path points of the path points to be analyzed; when the gray value of the path point to be analyzed is smaller than that of the adjacent path point of the path point to be analyzed, marking the adjacent path point of the path point to be analyzed as an optical flow point corresponding to the pixel point to be analyzed, marking the path point to be analyzed as an optical flow adjacent point corresponding to the pixel point to be analyzed, and simultaneously stopping comparing the gray values between the pixel points on the reflection path corresponding to the pixel point to be analyzed;
the specific method for obtaining the reflection roughness index corresponding to each pixel point in the spring piece area comprises the following steps: counting the number of reflection paths contained in a first window corresponding to the pixel points in the spring piece area; the difference value between the gradient value of the adjacent point of the optical flow and the gradient value of the optical flow point in the same reflection path corresponding to the pixel point in the spring piece area is recorded as a first difference value corresponding to the reflection path; and marking the sum of the first differences corresponding to all the reflection paths contained in the first window corresponding to the pixel points in the spring piece area as the reflection roughness index corresponding to the pixel points.
2. The machine vision-based SIM card holder defect identification method of claim 1, wherein the specific method for obtaining the first window corresponding to each pixel in the leaf spring area and obtaining the wear distribution density corresponding to the pixel according to the first window corresponding to the pixel includes:
respectively establishing a window taking a first preset threshold value as a side length by taking each pixel point contained in the spring leaf area as a center, and recording the established window as a first window of the central pixel point;
acquiring angular points in the spring piece area;
counting the number of corner points contained in a first window corresponding to each pixel point in the spring piece area;
acquiring a kernel density estimated value corresponding to each corner point in the first window;
taking each corner point in the first window as a corner point to be analyzed, and recording the average value of Euclidean distances between the corner point to be analyzed and all the corner points except the corner point to be analyzed in the first window as the corner distance of the corner point to be analyzed;
the ratio of the kernel density estimated value of the corner point in the first window to the angular distance of the corner point is recorded as a first ratio corresponding to the corner point;
and marking the sum of first ratios corresponding to the corner points contained in the first window corresponding to the pixel points in the spring piece area as the wear distribution density corresponding to the pixel points in the spring piece area.
3. The machine vision-based SIM card holder defect identification method of claim 1, wherein the acquiring the light source point in the first window corresponding to each pixel point in the leaf spring area includes the following specific steps:
and respectively taking each pixel point in the spring piece area as a pixel point to be analyzed, marking the pixel point with the largest gray value in the first window corresponding to the pixel point to be analyzed as a light source point corresponding to the pixel point to be analyzed, and marking one of the pixel points with the largest gray value selected randomly as the light source point corresponding to the pixel point to be analyzed when a plurality of the largest gray values are arranged in the first window.
4. The machine vision-based SIM card holder defect identification method of claim 1, wherein the obtaining the optical flow point cluster to obtain the reflection anomaly density corresponding to each pixel point in the spring sheet area includes the following specific steps:
clustering all the optical flow points to obtain an optical flow point cluster;
the sum of the number of the optical flow points contained in all the optical flow point clusters is recorded as a first sum value;
when a plurality of optical flow points contained in a first window corresponding to the pixel points to be analyzed correspond to different optical flow point cluster clusters, selecting an optical flow point cluster corresponding to the optical flow points contained in the first window, and marking the optical flow point cluster with the largest number contained in the selected optical flow point cluster as the optical flow point cluster corresponding to the pixel points to be analyzed;
when the optical flow points contained in the first window corresponding to the pixel points to be analyzed correspond to the same optical flow point cluster, the corresponding optical flow point cluster is marked as the optical flow point cluster corresponding to the pixel points to be analyzed;
the ratio of the number of the optical flow points contained in the optical flow point cluster corresponding to the pixel point to the first sum value is recorded as a second ratio corresponding to the pixel point;
marking the sum of the second ratio and the first adjustment factor as a second sum value corresponding to the pixel point;
and recording the product of the second sum value corresponding to the pixel point and the ratio of the number of the light flow points contained in the first window corresponding to the pixel point to the number of the pixel points contained in the first window as the reflection abnormal density corresponding to the pixel point.
5. The machine vision-based SIM card holder defect identification method of claim 1, wherein the obtaining the deformation score coefficient corresponding to each pixel point according to the reflection roughness index and the reflection anomaly density corresponding to each pixel point in the spring sheet area includes the following specific steps:
and (3) recording the product of the reflection roughness index and the reflection abnormal density corresponding to each pixel point in the spring piece area as a deformation score coefficient corresponding to the pixel point.
6. The machine vision-based SIM card holder defect identification method of claim 1, wherein the obtaining the abnormal contribution degree corresponding to the pixel points according to the wear distribution density and the deformation score coefficient corresponding to each pixel point in the spring sheet area includes the following specific steps:
marking the sum of the wear distribution density corresponding to each pixel point in the spring piece area and the first adjustment factor as a third sum value corresponding to the pixel point;
marking the sum of the deformation score coefficient corresponding to each pixel point in the spring piece area and the first adjustment factor as a fourth sum value corresponding to the pixel point;
and (3) marking the linear normalized value of the product of the third sum value and the fourth sum value corresponding to the pixel point as the abnormal contribution degree corresponding to the pixel point.
7. The machine vision-based SIM card holder defect identification method of claim 1, wherein the obtaining the adaptive scale corresponding to the spring piece region according to the abnormal contribution degree corresponding to each pixel point includes the following specific steps:
the product of the average value of the abnormal contribution degrees corresponding to all the pixel points contained in the spring piece area and the second range threshold value is recorded as a first product corresponding to the spring piece area;
and marking the rounded value of the difference value of the first product of the first range threshold value and the first product corresponding to the spring piece area as the self-adaptive scale corresponding to the spring piece area.
8. The method for identifying defects of a SIM card holder based on machine vision according to claim 1, wherein the method for obtaining the card holder enhanced image according to the adaptive scale corresponding to the spring sheet area, and further completing the identification of the defects of the SIM card holder comprises the following specific steps:
taking the self-adaptive scale corresponding to each spring leaf area as the value of a scale parameter, and respectively processing each spring leaf area in the cassette gray level image by using an image enhancement algorithm to obtain a cassette enhanced image;
inputting the card seat enhanced image into a neural network, and obtaining the defect type of the SIM card seat corresponding to the card seat enhanced image.
CN202311368027.1A 2023-10-23 2023-10-23 SIM card seat defect identification method based on machine vision Active CN117115151B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202311368027.1A CN117115151B (en) 2023-10-23 2023-10-23 SIM card seat defect identification method based on machine vision

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202311368027.1A CN117115151B (en) 2023-10-23 2023-10-23 SIM card seat defect identification method based on machine vision

Publications (2)

Publication Number Publication Date
CN117115151A CN117115151A (en) 2023-11-24
CN117115151B true CN117115151B (en) 2024-02-02

Family

ID=88805882

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202311368027.1A Active CN117115151B (en) 2023-10-23 2023-10-23 SIM card seat defect identification method based on machine vision

Country Status (1)

Country Link
CN (1) CN117115151B (en)

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103106663A (en) * 2013-02-19 2013-05-15 公安部第三研究所 Method for detecting defect of subscriber identity module (SIM) card based on image processing in computer system
CN111300144A (en) * 2019-11-25 2020-06-19 上海大学 Automatic detection method for tool wear state based on image processing
CN114022518A (en) * 2022-01-05 2022-02-08 深圳思谋信息科技有限公司 Method, device, equipment and medium for acquiring optical flow information of image
WO2022247840A1 (en) * 2021-05-26 2022-12-01 奥比中光科技集团股份有限公司 Light source spectrum and multispectral reflectivity image acquisition methods and apparatuses, and electronic device
CN116433666A (en) * 2023-06-14 2023-07-14 江西萤火虫微电子科技有限公司 Board card line defect online identification method, system, electronic equipment and storage medium

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103106663A (en) * 2013-02-19 2013-05-15 公安部第三研究所 Method for detecting defect of subscriber identity module (SIM) card based on image processing in computer system
CN111300144A (en) * 2019-11-25 2020-06-19 上海大学 Automatic detection method for tool wear state based on image processing
WO2022247840A1 (en) * 2021-05-26 2022-12-01 奥比中光科技集团股份有限公司 Light source spectrum and multispectral reflectivity image acquisition methods and apparatuses, and electronic device
CN114022518A (en) * 2022-01-05 2022-02-08 深圳思谋信息科技有限公司 Method, device, equipment and medium for acquiring optical flow information of image
CN116433666A (en) * 2023-06-14 2023-07-14 江西萤火虫微电子科技有限公司 Board card line defect online identification method, system, electronic equipment and storage medium

Also Published As

Publication number Publication date
CN117115151A (en) 2023-11-24

Similar Documents

Publication Publication Date Title
CN114862862A (en) Pump body cold shut defect identification method and system based on image processing
CN115082481B (en) Image enhancement method for gear
CN117011292B (en) Method for rapidly detecting surface quality of composite board
CN106503644B (en) Glasses attribute detection method based on edge projection and color characteristic
CN116740058B (en) Quality detection method for solid state disk matched wafer
CN110728185B (en) Detection method for judging existence of handheld mobile phone conversation behavior of driver
CN116485797A (en) Artificial intelligence-based paint color difference rapid detection method
CN115511907B (en) Scratch detection method for LED screen
CN117218122B (en) Watch shell quality detection method based on image data
CN117173158B (en) Intelligent detection method and system for quality of precise connector
CN116912261A (en) Plastic mold injection molding surface defect detection method
CN114529538A (en) Textile surface defect detection method based on artificial intelligence and Gaussian mixture model
CN115239736B (en) Method for monitoring quality of mixed material of abrasive layer for production of diamond-impregnated wheel
CN115330758A (en) Welding quality detection method based on denoising processing
CN112364801A (en) Dynamic threshold face recognition method
CN117422712A (en) Plastic master batch visual detection method and system based on image filtering processing
CN114119603A (en) Image processing-based snack box short shot defect detection method
CN117522864B (en) European pine plate surface flaw detection method based on machine vision
CN115029704A (en) Intelligent control method and device for stainless steel pickling process
CN117115151B (en) SIM card seat defect identification method based on machine vision
CN117705815B (en) Printing defect detection method based on machine vision
CN116843581B (en) Image enhancement method, system, device and storage medium for multi-scene graph
CN115994870B (en) Image processing method for enhancing denoising
CN115254674B (en) Bearing defect sorting method
CN115862121A (en) Face rapid matching method based on multimedia resource library

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant