CN113935998A - Rubber and plastic part mottling detection method based on machine vision - Google Patents

Rubber and plastic part mottling detection method based on machine vision Download PDF

Info

Publication number
CN113935998A
CN113935998A CN202111541545.XA CN202111541545A CN113935998A CN 113935998 A CN113935998 A CN 113935998A CN 202111541545 A CN202111541545 A CN 202111541545A CN 113935998 A CN113935998 A CN 113935998A
Authority
CN
China
Prior art keywords
target
rubber
point
frequency point
plastic part
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.)
Granted
Application number
CN202111541545.XA
Other languages
Chinese (zh)
Other versions
CN113935998B (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.)
Hubei Jiake Intelligent Control Equipment Co ltd
Original Assignee
Wuhan Parker Rubber And Plastic Products 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 Wuhan Parker Rubber And Plastic Products Co ltd filed Critical Wuhan Parker Rubber And Plastic Products Co ltd
Priority to CN202111541545.XA priority Critical patent/CN113935998B/en
Publication of CN113935998A publication Critical patent/CN113935998A/en
Application granted granted Critical
Publication of CN113935998B publication Critical patent/CN113935998B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T7/00Image analysis
    • G06T7/0002Inspection of images, e.g. flaw detection
    • G06T7/0004Industrial image inspection
    • GPHYSICS
    • G01MEASURING; TESTING
    • G01NINVESTIGATING OR ANALYSING MATERIALS BY DETERMINING THEIR CHEMICAL OR PHYSICAL PROPERTIES
    • G01N21/00Investigating or analysing materials by the use of optical means, i.e. using sub-millimetre waves, infrared, visible or ultraviolet light
    • G01N21/84Systems specially adapted for particular applications
    • G01N21/88Investigating the presence of flaws or contamination
    • G01N21/8851Scan or image signal processing specially adapted therefor, e.g. for scan signal adjustment, for detecting different kinds of defects, for compensating for structures, markings, edges
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F18/00Pattern recognition
    • G06F18/20Analysing
    • G06F18/22Matching criteria, e.g. proximity measures
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F18/00Pattern recognition
    • G06F18/20Analysing
    • G06F18/23Clustering techniques
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T5/00Image enhancement or restoration
    • G06T5/10Image enhancement or restoration using non-spatial domain filtering
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T7/00Image analysis
    • G06T7/10Segmentation; Edge detection
    • G06T7/136Segmentation; Edge detection involving thresholding
    • GPHYSICS
    • G01MEASURING; TESTING
    • G01NINVESTIGATING OR ANALYSING MATERIALS BY DETERMINING THEIR CHEMICAL OR PHYSICAL PROPERTIES
    • G01N21/00Investigating or analysing materials by the use of optical means, i.e. using sub-millimetre waves, infrared, visible or ultraviolet light
    • G01N21/84Systems specially adapted for particular applications
    • G01N21/88Investigating the presence of flaws or contamination
    • G01N21/8851Scan or image signal processing specially adapted therefor, e.g. for scan signal adjustment, for detecting different kinds of defects, for compensating for structures, markings, edges
    • G01N2021/8887Scan or image signal processing specially adapted therefor, e.g. for scan signal adjustment, for detecting different kinds of defects, for compensating for structures, markings, edges based on image processing techniques
    • 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/20048Transform domain processing
    • G06T2207/20056Discrete and fast Fourier transform, [DFT, FFT]

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Data Mining & Analysis (AREA)
  • Computer Vision & Pattern Recognition (AREA)
  • Life Sciences & Earth Sciences (AREA)
  • General Engineering & Computer Science (AREA)
  • Evolutionary Computation (AREA)
  • Evolutionary Biology (AREA)
  • Bioinformatics & Computational Biology (AREA)
  • Bioinformatics & Cheminformatics (AREA)
  • Artificial Intelligence (AREA)
  • Health & Medical Sciences (AREA)
  • Signal Processing (AREA)
  • Chemical & Material Sciences (AREA)
  • Analytical Chemistry (AREA)
  • Biochemistry (AREA)
  • General Health & Medical Sciences (AREA)
  • Immunology (AREA)
  • Pathology (AREA)
  • Quality & Reliability (AREA)
  • Image Analysis (AREA)

Abstract

The invention relates to the technical field of machine vision, in particular to a method for detecting speckles of a rubber and plastic part based on machine vision. Firstly, acquiring a rubber and plastic image and carrying out threshold segmentation on the rubber and plastic image to obtain a plurality of target threshold segmentation graphs; carrying out Fourier transform on each target threshold segmentation graph to obtain a spectrogram, and acquiring a plurality of target frequency points in each spectrogram; selecting two secondary frequency point groups from the target frequency points in each spectrogram; fusing the secondary frequency points of each spectrogram to obtain two target points; obtaining a minimum period area from the target point, and dividing the rubber and plastic part image into a plurality of period areas according to the minimum period area; and calculating the light offset group of each period region according to the gray level histogram of each period region, and obtaining the mottled region according to the density of the light offset group. According to the embodiment of the invention, the rubber and plastic part image is divided into a plurality of periodic areas under the condition of uneven illumination, so that the accuracy of identification of the mottled areas is improved.

Description

Rubber and plastic part mottling detection method based on machine vision
Technical Field
The invention relates to the technical field of machine vision, in particular to a method for detecting speckles of a rubber and plastic part based on machine vision.
Background
In the process of molding the rubber and plastic part, because the surface of the rubber and plastic part reappears the cavity surface of the mold, when the surface of the mold has surface defects such as scratches, micropores and the like, or the surface of the cavity has oil stains, water, a release agent which is not properly selected and the temperature of the mold is not proper, the surface gloss of the rubber and plastic part is poor, even the surface is dark and obvious spots appear. It is therefore necessary to carry out a mottling test on the surface of the rubber-plastic part after it has been produced.
At present, the common method for detecting defects or spots on an image is as follows: and dividing the image into a plurality of classes according to the pixel points by using a threshold segmentation method. However, the camera can clearly acquire the surface image of the rubber and plastic part by adding the light source during the speckle detection, and the light source generally adopts a lateral light source for illumination, so that the overall brightness of the area close to the light source is higher, the surface brightness of the rubber and plastic part is not uniform, and all areas on the surface of the rubber and plastic part cannot be accurately identified by using a threshold segmentation method.
Disclosure of Invention
In order to solve the technical problems, the invention aims to provide a machine vision-based method for detecting the speckles of the rubber and plastic part, which adopts the following technical scheme:
collecting a rubber and plastic part image, wherein the rubber and plastic part image contains periodic patterns; dividing the rubber and plastic part image by using different threshold values to obtain a plurality of target threshold value division graphs and corresponding division effectiveness;
performing Fourier transform on each target threshold segmentation graph to obtain a spectrogram; selecting a maximum value point and target frequency points around the maximum value point from a plurality of initial frequency points of each spectrogram, and acquiring Gaussian distribution of each target frequency point by using the maximum value point to obtain a theoretical amplitude of the target frequency point; calculating the reliability of each target frequency point according to the difference value between the real amplitude value obtained by the spectrogram and the theoretical amplitude value; selecting target frequency points which are symmetrically distributed on a preset angle in a frequency spectrogram as initial frequency point groups, wherein the product of the reliability mean value and the real amplitude mean value of each target frequency point in the initial frequency point groups is a probability to be selected, and selecting two secondary frequency point groups in each frequency spectrogram according to the probability to be selected; obtaining two target points of the multiple target threshold segmentation graphs according to the segmentation effectiveness, the probability to be selected and the secondary frequency point group of the multiple target threshold segmentation graphs; obtaining a minimum periodic area of the rubber and plastic part image from the target point, and dividing the rubber and plastic part image into a plurality of periodic areas according to the minimum periodic area;
acquiring a gray level histogram of each period region, and constructing a gray level frequency sequence according to the gray level histogram; and calculating the illumination offset groups of each period area and the adjacent period area by using the gray frequency sequence, and obtaining the spot area according to the density of the illumination offset groups.
Preferably, the segmenting the rubber and plastic part image by using different threshold values to obtain a plurality of target threshold segmentation maps and corresponding segmentation effectiveness comprises:
performing threshold segmentation on the rubber and plastic part image by using a plurality of thresholds to obtain a plurality of initial threshold segmentation images;
obtaining the connected domain area range of each initial threshold segmentation graph, wherein the reciprocal of the connected domain area range is the segmentation effectiveness;
the initial threshold segmentation map corresponding to the segmentation effectiveness greater than the preset segmentation effectiveness threshold is a target threshold segmentation map.
Preferably, the selecting of the maximum value point and the target frequency points around the maximum value point from the plurality of initial frequency points of each spectrogram includes:
each spectrogram has a plurality of initial frequency points; acquiring maximum value points in the initial frequency points based on a plurality of initial frequency points in each spectrogram;
constructing Gaussian distribution corresponding to each maximum point according to the maximum points and the amplitudes of the initial frequency points around the maximum points; obtaining the variance and the mean of Gaussian distribution corresponding to each maximum value point by using an EM (effective-energy-efficient) algorithm, and obtaining a variance range by using the variance; and taking the maximum value point as a center, and acquiring initial frequency points positioned in a variance range as target frequency points, wherein the target frequency points comprise the maximum value point.
Preferably, the calculating the reliability of each target frequency point according to the difference between the real amplitude obtained from the spectrogram and the theoretical amplitude includes:
the reliability calculation formula is as follows:
Figure 100002_DEST_PATH_IMAGE002
wherein,
Figure 100002_DEST_PATH_IMAGE004
is as follows
Figure 100002_DEST_PATH_IMAGE006
The reliability of individual target frequency points;
Figure 100002_DEST_PATH_IMAGE008
is as follows
Figure 938095DEST_PATH_IMAGE006
The real amplitude of each target frequency point;
Figure 100002_DEST_PATH_IMAGE010
is as follows
Figure 998455DEST_PATH_IMAGE006
Theoretical amplitude of each target frequency point.
Preferably, the selecting, as the initial frequency point group, target frequency points symmetrically distributed at a preset angle in the spectrogram includes:
constructing a rectangular coordinate system by taking the central point of each spectrogram as an origin, a horizontal line passing through the origin as a horizontal axis and a vertical line passing through the origin as a longitudinal axis; and selecting target frequency points which are symmetrical in a preset angle in a rectangular coordinate system as an initial frequency point group, wherein the initial frequency point group comprises a first initial frequency point group and a second initial frequency point group.
Preferably, the selecting two secondary frequency point groups in each spectrogram according to the candidate probability includes:
the secondary frequency point groups comprise a first secondary frequency point group and a second secondary frequency point group;
based on the plurality of first initial frequency point groups and the plurality of second initial frequency point groups, selecting the first initial frequency point group with the maximum probability of candidate as a first secondary frequency point group, and selecting the second initial frequency point group with the maximum probability of candidate as a second secondary frequency point group.
Preferably, the obtaining two target points of the multiple target threshold segmentation maps according to the segmentation effectiveness, the candidate probability and the secondary frequency point groups of the multiple target threshold segmentation maps includes:
the target points include a first target point and a second target point;
acquiring a first product of the segmentation effectiveness corresponding to each target threshold segmentation graph, the candidate probability corresponding to the first frequency point group and the frequency point coordinate corresponding to the first frequency point group, and summing the first products corresponding to the multiple target threshold segmentation graphs to obtain a first product sum; obtaining a second product of the segmentation effectiveness corresponding to each target threshold segmentation graph and the probability to be selected corresponding to the first frequency point group, and summing the second products corresponding to the multiple target threshold segmentation graphs to obtain a second product sum; the ratio of the first product sum to the second product sum is the absolute value of the abscissa of the first target point, and the ordinate of the first target point is 0;
obtaining a third product of the segmentation effectiveness corresponding to each target threshold segmentation graph, the candidate probability corresponding to the second secondary frequency point group and the frequency point coordinates corresponding to the second secondary frequency point group, and summing the third products corresponding to the multiple target threshold segmentation graphs to obtain a third product; obtaining a fourth product of the segmentation effectiveness corresponding to each target threshold segmentation graph and the probability to be selected corresponding to the first frequency point group, and summing the fourth products corresponding to the multiple target threshold segmentation graphs to obtain a fourth product sum; the ratio of the third product sum to the fourth product sum is an absolute value of a vertical coordinate of a second target point, and a horizontal coordinate of the second target point is 0.
Preferably, the obtaining a minimum periodic area of the rubber-plastic image from the target point, and dividing the rubber-plastic image into a plurality of periodic areas according to the minimum periodic area includes:
the reciprocal of the absolute value of the abscissa of the first target point is the length of the minimum period region; the reciprocal of the absolute value of the ordinate of the second target point is the width of the minimum period region;
and dividing the rubber and plastic part image into a plurality of periodic areas according to the minimum periodic area by taking the first pixel point at the upper left of the rubber and plastic part image as a starting point.
Preferably, the calculating, by using the gray frequency sequence, the set of illumination offsets of each period region and the adjacent period region includes:
the gray frequency sequence is circularly shifted for multiple times to obtain a shift sequence;
calculating sequence similarity of a plurality of shift sequences of each period region and gray frequency sequences of four adjacent period regions, and acquiring minimum sequence similarity corresponding to each period region and each adjacent period region, wherein each period region corresponds to four minimum sequence similarities; and constructing an illumination offset group corresponding to each period region according to the minimum sequence similarity.
Preferably, the obtaining the speckle region according to the density of the illumination offset group includes:
clustering the illumination offset group to obtain a plurality of clustering categories, wherein the clustering categories comprise a plurality of discrete points and a plurality of clusters;
acquiring a cluster group with the most illumination offset groups as a target cluster group; calculating the Manhattan distance from the discrete point to the central point of the target cluster group, and calculating the probability of the speckles according to the Manhattan distance; and the periodic region corresponding to the discrete point of the spot probability which is greater than the preset spot probability threshold is a spot region.
The embodiment of the invention at least has the following beneficial effects:
the embodiment of the invention utilizes a machine vision technology to collect the rubber and plastic part image and carry out threshold segmentation on the rubber and plastic part image to obtain a plurality of target threshold segmentation graphs and corresponding segmentation effectiveness. Carrying out Fourier transform on each target threshold segmentation graph to obtain a frequency spectrogram, acquiring a plurality of target frequency points in each frequency spectrogram, and screening secondary frequency point groups from the target frequency points; and the secondary frequency point groups are obtained by screening the target frequency points in each spectrogram, removing unreliable non-periodic or low-reliability frequency points, and finally obtaining two secondary frequency point groups in each spectrogram, wherein the two secondary frequency point groups respectively reflect the longitudinal periodicity and the transverse periodicity. Fusing the secondary frequency point groups corresponding to each spectrogram to obtain target points, obtaining the minimum period region of the rubber and plastic part image from the target points, and dividing the rubber and plastic part image into a plurality of period regions according to the minimum period region; the resulting minimum periodic areas are periodic areas such that each minimum periodic area contains a periodic pattern in the image of the rubber-plastic element. Acquiring a gray level histogram of each period region, calculating an illumination offset group corresponding to each period region according to the gray level histogram, obtaining a mottled region according to the intensity of the illumination offset group, and evaluating the quality of the rubber and plastic part according to the occupied area of the mottled region. The method comprises the steps of obtaining a minimum period area of a rubber and plastic part image by using a spectrogram, accurately segmenting a threshold value of the rubber and plastic part image under the condition that the surface brightness of the rubber and plastic part is not uniform, and determining a mottled area in the rubber and plastic part image through an illumination offset set of each period area. The purpose that the spot area cannot be accurately determined due to inaccurate threshold segmentation is achieved.
Drawings
In order to more clearly illustrate the embodiments of the present invention or the technical solutions and advantages of the prior art, the drawings used in the description of the embodiments or the prior art will be briefly described below, it is obvious that the drawings in the following description are only some embodiments of the present invention, and other drawings can be obtained by those skilled in the art without creative efforts.
FIG. 1 is a flow chart of a method for detecting speckles in a rubber-plastic member based on machine vision according to an embodiment of the present invention;
FIG. 2 is a flowchart illustrating steps for obtaining a thresholded segmentation image of a target according to an embodiment of the present invention;
FIG. 3 is a flowchart illustrating a step of acquiring a target point and dividing a rubber image into a plurality of periodic areas according to the target point according to an embodiment of the present invention;
FIG. 4 is a flowchart illustrating steps for obtaining a mottled area according to one embodiment of the present invention;
FIG. 5 is a schematic diagram of a periodic region provided by an embodiment of the present invention;
FIG. 6 is a schematic diagram illustrating an image of a rubber-plastic device after threshold segmentation by selecting different thresholds according to an embodiment of the present invention;
fig. 7 is a schematic diagram of a rubber-plastic image before and after fourier transform according to an embodiment of the present invention.
Detailed Description
In order to further illustrate the technical means and effects of the present invention adopted to achieve the predetermined objects, the following detailed description of the method for detecting the mottling of the rubber-plastic part based on machine vision, the specific implementation manner, structure, features and effects thereof according to the present invention, with reference to the accompanying drawings and the preferred embodiments, is provided. In the following description, different "one embodiment" or "another embodiment" refers to not necessarily the same embodiment. Furthermore, the particular features, structures, or characteristics may be combined in any suitable manner in one or more embodiments.
Unless defined otherwise, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this invention belongs.
The embodiment of the invention provides a specific implementation method of a rubber and plastic part mottling detection method based on machine vision, which is suitable for a rubber and plastic part mottling detection scene. The surface of the rubber and plastic part comprises a plurality of patterns, and the patterns in the transverse and longitudinal directions are periodic. A gray camera is arranged above the rubber and plastic part and used for collecting images of the rubber and plastic part, and the optical axis of the gray camera is perpendicular to the surface of the rubber and plastic part. Meanwhile, an irradiation light source is also arranged above the rubber and plastic part, the irradiation light source can be randomly arranged at the left upper part, the right upper part and the like of the rubber and plastic part, and the irradiation intensity of the irradiation light source is uniform. The method aims to solve the problem that a proper threshold value is difficult to find for segmentation when the rubber and plastic image is segmented due to the fact that the surface brightness of the rubber and plastic image is not uniform. According to the embodiment of the invention, Fourier transform is carried out on a plurality of threshold segmentation maps to convert the threshold segmentation maps into the frequency spectrograms, frequency points of the frequency spectrograms are screened to obtain the minimum period region of the rubber part image, accurate threshold segmentation is carried out on the rubber part image under the condition that the surface brightness of the rubber part is not uniform, and then the mottled region in the rubber part image is determined through the illumination offset group of each period region. The purpose that the spot area cannot be accurately determined due to inaccurate threshold segmentation is achieved.
The specific scheme of the machine vision-based rubber and plastic piece mottling detection method provided by the invention is specifically described below with reference to the accompanying drawings.
Referring to fig. 1, a flow chart of steps of a method for detecting speckles in a rubber-plastic member based on machine vision according to an embodiment of the present invention is shown, where the method includes the following steps:
step S100, collecting a rubber and plastic part image, wherein the rubber and plastic part image comprises periodic patterns; and dividing the rubber and plastic part image by using different threshold values to obtain a plurality of target threshold value division graphs and corresponding division effectiveness.
And acquiring a rubber part image by using a gray-scale camera, wherein the rubber part image comprises periodic patterns. The gray scale camera is used for collecting the image of the plastic part because the gray scale camera has more comprehensive response to photons with different wavelengths, and the detailed representation of the light flux and the image is better than that of a color camera.
When the mottling detection is carried out, the irradiation light source generally adopts a lateral light source for illumination, the image illumination intensity of the rubber and plastic image is not uniform for the whole rubber and plastic image, but because the proportion of a periodic pattern in the rubber and plastic image is very small, the illumination belonging to the same period area can be considered to be approximately uniform.
When the irradiation light source uniformly irradiates each area of the image of the rubber and plastic part, the illumination intensity of each periodic area is the same for the periodic patterns on the rubber and plastic part; for the lateral light source, the lateral light source is unevenly irradiated on the rubber and plastic part, wherein the illumination belonging to the same period area is considered to be approximately even, and the illumination intensity difference between each period area and the adjacent period area in the whole rubber and plastic part image is also similar, because the light source emitted by the illumination light source is even if the lateral light source is used for illumination, and the illumination intensity difference corresponding to each period is very small; when the illumination difference between any periodic region and the adjacent periodic region is large, or the illumination intensity difference corresponding to other periodic regions is large, the probability that the periodic region is a speckle region is considered to be large. It should be noted that the periodic region refers to an imaging region of a single pattern which is tightly arranged when the light is uniformly illuminated on the image of the rubber-plastic member, and referring to fig. 5, the selected portion of each white frame is a periodic region.
Since the patterns of the rubber parts are various in actual production and the distances between the camera and the rubber parts are also various, the situation that if only the artificially given periodic area is used, the pattern cannot be adapted to all detection conditions can be caused, and when the pattern or the distance between the camera and the rubber part is changed, the pattern with a complete period can not be obtained by using the artificially given periodic area. The embodiment of the invention aims to automatically obtain a proper periodic area according to the actual condition of each rubber and plastic part image, and the proper periodic area contains a complete pattern. Obtaining a proper periodic area, and firstly, finding a proper threshold segmented rubber and plastic part image to analyze the rubber and plastic part image. Referring to fig. 2, the step of obtaining the target threshold segmentation image specifically includes:
step S110, performing threshold segmentation on the rubber and plastic part image by using a plurality of thresholds to obtain a plurality of initial threshold segmentation maps.
And performing threshold segmentation on the acquired rubber and plastic part image by using a plurality of different thresholds to obtain a plurality of initial threshold segmentation maps. The plurality of different threshold values are arbitrary values from the gradation value 0 to 255 in the embodiment of the present invention. The threshold segmentation refers to setting the pixel values of all the pixel points larger than the threshold to be 1, and setting the pixel values of all the pixel points smaller than the threshold to be 0. Each threshold corresponds to an initial threshold segmentation map. Referring to fig. 6, the image corresponding to a in fig. 6 is an original rubber and plastic image, and the images corresponding to b, c, d, and e are four segmentation result diagrams obtained by respectively performing threshold segmentation on the original rubber and plastic image by using four different thresholds.
For a plurality of initial threshold segmentation maps, a plurality of target threshold segmentation maps need to be screened out from the initial threshold segmentation maps, the target threshold segmentation maps can reflect patterns on the rubber and plastic part more clearly, the screened initial threshold segmentation maps often segment the rubber and plastic part image into too large or too small areas, the threshold segmentation maps are less helpful for determining proper periodic areas, and therefore the threshold segmentation maps are firstly screened out.
And step S120, acquiring the connected domain area range of each initial threshold segmentation graph, wherein the reciprocal of the connected domain area range is the segmentation effectiveness.
And analyzing the connected domains of each initial threshold segmentation graph to obtain a plurality of connected domains, and calculating the area of each connected domain, wherein the area of each connected domain is the number of pixel points in each connected domain in the embodiment of the invention. And acquiring the maximum connected domain area and the minimum connected domain area of each initial threshold segmentation graph to obtain the connected domain area range corresponding to each initial threshold segmentation graph.
When the connected domain area range is too large, the threshold corresponding to the initial threshold segmentation graph after threshold segmentation is reflected to be not suitable, and because the patterns on the rubber and plastic image are periodic patterns, the threshold segmentation area in the threshold segmentation graph which is desired to be obtained by the embodiment of the invention is uniform, so the connected domain area range is as small as possible. The smaller the area difference of the connected domain is, the stronger the corresponding segmentation effectiveness is, namely, the periodic patterns of the images of the rubber and plastic parts can be reflected. That is, for an initial threshold segmentation map with strong segmentation effectiveness, the area difference of different connected domains in the initial threshold segmentation map is not too large, if the area difference is too large, the information contained in the threshold segmentation result map is invalid, so the area difference of the connected domains and the segmentation effectiveness of the initial threshold segmentation map are reflected by the area difference of the connected domains.
The reciprocal of the connected domain area range is the segmentation effectiveness.
First, the
Figure DEST_PATH_IMAGE012
Segmentation effectiveness of a sheet-initial threshold segmentation map
Figure DEST_PATH_IMAGE014
The calculation formula of (2) is as follows:
Figure DEST_PATH_IMAGE016
wherein,
Figure DEST_PATH_IMAGE018
is as follows
Figure 611183DEST_PATH_IMAGE012
Expanding the maximum connected domain area of the initial threshold segmentation graph;
Figure DEST_PATH_IMAGE020
is as follows
Figure 731586DEST_PATH_IMAGE012
Opening the minimum connected domain area of the initial threshold segmentation graph;
Figure DEST_PATH_IMAGE022
is as follows
Figure 104799DEST_PATH_IMAGE012
The connected domain area of the tensor initial threshold segmentation map is extremely poor.
Each initial threshold segmentation map has a respective segmentation validity.
In step S130, the initial threshold segmentation map corresponding to the segmentation effectiveness greater than the preset segmentation effectiveness threshold is the target threshold segmentation map.
Obtaining the segmentation effectiveness of each initial threshold segmentation graph, and presetting a segmentation effectiveness threshold
Figure DEST_PATH_IMAGE024
. Comparing the segmentation effectiveness corresponding to each initial threshold segmentation graph with a preset segmentation effectiveness threshold value:
when in use
Figure DEST_PATH_IMAGE026
When the initial threshold segmentation maps are invalid, removing the threshold segmentation maps;
when in use
Figure DEST_PATH_IMAGE028
When the corresponding initial threshold segmentation maps are valid, these threshold segmentation maps are retained, wherein,
Figure 827904DEST_PATH_IMAGE014
is as follows
Figure 376697DEST_PATH_IMAGE012
Segmentation effectiveness of a sheet-initial threshold segmentation map
Figure 933580DEST_PATH_IMAGE014
(ii) a These retained initial threshold segmentation maps serve as target threshold segmentation maps. In the embodiment of the invention, the preset segmentation effectiveness threshold is the reciprocal of half of the total area of the rubber and plastic image, and in other embodiments, the implementer can adjust the threshold according to the actual situation.
Step S200, carrying out Fourier transform on each target threshold segmentation graph to obtain a spectrogram; selecting a maximum value point and target frequency points around the maximum value point from a plurality of initial frequency points of each spectrogram, and acquiring Gaussian distribution of each target frequency point by using the maximum value point to obtain a theoretical amplitude of the target frequency point; calculating the reliability of each target frequency point according to the difference value of the real amplitude and the theoretical amplitude obtained by the spectrogram; selecting target frequency points which are symmetrically distributed on a preset angle in a frequency spectrogram as an initial frequency point group, taking the product of the reliability mean value and the real amplitude mean value of each target frequency point in the initial frequency point group as a probability to be selected, and selecting two secondary frequency point groups in each frequency spectrogram according to the probability to be selected; obtaining two target points of the multiple target threshold segmentation graphs according to the segmentation effectiveness, the candidate probability and the secondary frequency point group of the multiple target threshold segmentation graphs; and obtaining the minimum period area of the rubber and plastic part image from the target point, and dividing the rubber and plastic part image into a plurality of period areas according to the minimum period area.
And carrying out Fourier transform on each reserved target threshold segmentation graph to obtain a spectrogram, wherein each target threshold segmentation graph corresponds to one spectrogram. Referring to fig. 7, a left graph in fig. 7 is an image of a rubber and plastic part without fourier transform, and a right graph in fig. 7 is a frequency spectrum graph of the left graph after fourier transform, wherein each frequency spectrum graph has a plurality of initial frequency points. It should be noted that the distance from each initial frequency point in the spectrogram to the center point of the spectrogram is the frequency corresponding to the initial frequency point; the direction from the center point of the spectrogram to the initial frequency point is the direction of the plane wave; the gray value of the initial frequency point is the amplitude of the initial frequency point.
And screening a plurality of target frequency points from the plurality of initial frequency points, and acquiring the theoretical amplitude corresponding to each target frequency point. The purpose of screening out the target frequency point is to further obtain the frequency point capable of reflecting the minimum period of the image of the rubber and plastic part.
According to the priori knowledge, if the rubber and plastic part image is formed by vertical periodic black and white stripes, the black and white stripes of the rubber and plastic part image can be imagined as waves, the pixel point value is used as the fluctuation height, and then a horizontal left or right black wave can be obtained; if the rubber and plastic part image is formed by horizontal periodic black and white stripes, the black and white stripes of the rubber and plastic part image can be imagined as waves, and the pixel point value is taken as the fluctuation height, so that a vertically upward or downward black wave can be obtained; the black wave curve may be a superposition of a number of sine waves of different frequencies, or may be a sine wave.
If the pixel point value of the image of the plastic part is a sine wave in the horizontal direction, two horizontal and symmetrical frequency points are arranged on a spectrogram corresponding to the image of the plastic part; if the rubber and plastic image is composed of horizontal periodic black and white stripes, the pixel point value of the rubber and plastic image can be considered to be a vertical sine wave, and two vertical and symmetrical frequency points are arranged on a spectrogram corresponding to the rubber and plastic image. In the embodiment of the invention, the rubber and plastic part image has periodicity in the horizontal direction and also has periodicity in the vertical direction, so that the periodic region in the embodiment of the invention corresponds to two frequency points which are symmetrical in the horizontal direction and two frequency points which are symmetrical in the vertical direction in a frequency spectrogram.
Referring to fig. 3, two target points capable of reflecting the minimum period area of the image of the rubber part are obtained, and the image of the rubber part is divided into a plurality of period areas according to the target points, specifically:
step S210, a plurality of initial frequency points and target frequency points in each spectrogram are obtained, the theoretical amplitude of each target frequency point is obtained by using the maximum value point in the initial frequency points, and the reliability of each target frequency point is calculated according to the difference value between the real amplitude and the theoretical amplitude obtained by the spectrograms.
Each spectrogram has a plurality of initial frequency points, which are caused by that the target threshold segmentation map may have a certain periodicity in other directions besides the horizontal and vertical directions, or the pixel values at the pattern boundary of the periodic pattern of the target threshold segmentation map have a certain regularity deviation, so that the pixel values at the pattern boundary exhibit another periodicity regularity.
Based on a plurality of initial frequency points in each spectrogram, maximum value points in the initial frequency points are obtained, and a plurality of maximum value points exist in each spectrogram.
And for the maximum value points in each spectrogram, constructing Gaussian distribution corresponding to each maximum value point by using the amplitude values of the maximum value points and the initial frequency points around the maximum value points. And obtaining the variance and the mean of Gaussian distribution corresponding to each maximum point by using an EM (effective velocity) algorithm, wherein each maximum point corresponds to one Gaussian distribution. Variance of Gaussian distribution corresponding to each maximum point
Figure DEST_PATH_IMAGE030
Obtaining variance range, in the embodiment of the present invention, setting the variance range to
Figure DEST_PATH_IMAGE032
In other embodiments, the range may be adjusted by the implementer according to the actual situation.
For each spectrogram, the position of each maximum value point is taken as the center to obtain the position of each maximum value pointRange of difference
Figure 528510DEST_PATH_IMAGE032
The initial frequency points in the frequency domain are target frequency points, wherein the target frequency points comprise maximum value points.
And obtaining the theoretical amplitude of each target frequency point according to the Gaussian distribution corresponding to each maximum value point. And after the Gaussian distribution corresponding to each maximum point is obtained, substituting the distance between each target frequency point and the corresponding maximum point into the Gaussian distribution corresponding to the maximum point to obtain the theoretical amplitude of the target frequency point.
And calculating the reliability of each target frequency point according to the difference value between the real amplitude and the theoretical amplitude obtained by the spectrogram, wherein the real amplitude is obtained from the gray value corresponding to the frequency point in the spectrogram.
The first part is
Figure 461831DEST_PATH_IMAGE006
The reliability calculation formula of each target frequency point is as follows:
Figure DEST_PATH_IMAGE002A
wherein,
Figure 458605DEST_PATH_IMAGE008
is as follows
Figure 186390DEST_PATH_IMAGE006
The real amplitude of each target frequency point;
Figure 675140DEST_PATH_IMAGE010
is as follows
Figure 536786DEST_PATH_IMAGE006
Theoretical amplitude of each target frequency point.
The smaller the difference between the real amplitude and the theoretical amplitude corresponding to the target frequency point is, the greater the corresponding reliability is, and the greater the probability that the target frequency point belongs to the frequency point in the initial frequency point group is.
Step S220, selecting target frequency points which are symmetrically distributed on a preset angle in the frequency spectrogram as an initial frequency point group, taking the product of the reliability mean value and the real amplitude mean value of each target frequency point in the initial frequency point group as a candidate probability, and selecting two secondary frequency point groups in each frequency spectrogram according to the candidate probability.
And for each spectrogram, constructing a rectangular coordinate system by taking the central point of each spectrogram as an origin, a horizontal line passing through the origin as a horizontal axis and a vertical line passing through the origin as a vertical axis.
The position coordinates of each target frequency point in the spectrogram are acquired, and because the rubber and plastic part image is required to be acquired in the embodiment of the invention in a longitudinal and transverse periodicity mode, only two symmetrical points of the target frequency points which are on the transverse axis and the longitudinal axis of the rectangular coordinate system and are symmetrical about the original point are required to be selected from the target frequency points as the initial frequency point group to be selected in the embodiment of the invention.
Target frequency points symmetrical in a preset angle in a rectangular coordinate system are selected as initial frequency point groups, and the preset angles are 0 degree, 90 degrees, 180 degrees and 270 degrees in the embodiment of the invention. Namely, selecting target frequency points which are symmetrical on a horizontal axis and a vertical axis in a rectangular coordinate as initial frequency point groups, wherein the initial frequency point groups comprise a first initial frequency point group and a second initial frequency point group, and the first initial frequency point group is the target frequency points which are symmetrical on the horizontal axis; the second initial frequency point group is a target frequency point which is symmetrical on the longitudinal axis, and because the target frequency point coordinates in each initial frequency point group are symmetrical, each initial frequency point group comprises two target frequency points.
And the product of the reliability mean value and the real amplitude mean value of each target frequency point in the initial frequency point group is the probability to be selected.
The first part is
Figure DEST_PATH_IMAGE034
Probability of candidate of initial frequency point group
Figure DEST_PATH_IMAGE036
The calculation formula of (2) is as follows:
Figure DEST_PATH_IMAGE038
wherein,
Figure DEST_PATH_IMAGE040
is as follows
Figure 856909DEST_PATH_IMAGE034
In the initial frequency point group
Figure DEST_PATH_IMAGE042
Reliability of each target frequency point;
Figure DEST_PATH_IMAGE044
is as follows
Figure 349070DEST_PATH_IMAGE034
In the initial frequency point group
Figure DEST_PATH_IMAGE046
Reliability of each target frequency point;
Figure DEST_PATH_IMAGE048
is as follows
Figure 793958DEST_PATH_IMAGE034
And the real amplitude mean value of the target frequency points in the initial frequency point group.
And acquiring the candidate probabilities corresponding to the plurality of first initial frequency point groups and the candidate probabilities corresponding to the plurality of second initial frequency point groups. And screening two secondary frequency point groups from the plurality of first initial frequency point groups and the plurality of second initial frequency point groups according to the probability to be selected. The secondary frequency point groups comprise a first secondary frequency point group and a second secondary frequency point group.
Specifically, for each spectrogram, based on a plurality of first initial frequency point groups and a plurality of second initial frequency point groups, the first initial frequency point group with the highest probability to be selected serves as a first secondary frequency point group; and the second initial frequency point group with the maximum candidate probability is used as a second secondary frequency point group.
And step S230, obtaining two target points of the multiple target threshold segmentation maps according to the segmentation effectiveness, the candidate probability and the secondary frequency point groups of the multiple target threshold segmentation maps.
The frequency spectrogram corresponding to each target threshold segmentation graph has a first secondary frequency point group and a second secondary frequency point group. And fusing the two secondary frequency point groups in each spectrogram to obtain a target point which can reflect the minimum positive period and is required by the embodiment of the invention. The target points comprise a first target point and a second target point, the first target point reflects the longitudinal periodicity of the rubber and plastic image, and the second target point reflects the transverse periodicity of the rubber and plastic image.
And acquiring a first product of the segmentation effectiveness corresponding to each target threshold segmentation graph, the candidate probability corresponding to the first frequency point group and the frequency point coordinate corresponding to the first frequency point group, and summing the first products corresponding to the multiple target threshold segmentation graphs to obtain a first product sum.
And obtaining a second product of the segmentation effectiveness corresponding to each target threshold segmentation graph and the candidate probability corresponding to the first frequency point group, and summing the second products corresponding to the multiple target threshold segmentation graphs to obtain a second product sum.
The ratio of the first product sum to the second product sum is the absolute value of the abscissa of the first target point, the ordinate of the first target point is 0, and the absolute value of the abscissa fused with the first target point is obtained by fusing the coordinates of the first frequency point groups of the multiple target threshold segmentation maps.
Absolute value of abscissa of the first target point
Figure DEST_PATH_IMAGE050
Comprises the following steps:
Figure DEST_PATH_IMAGE052
wherein,
Figure DEST_PATH_IMAGE054
is as follows
Figure DEST_PATH_IMAGE056
Opening the segmentation effectiveness of the target threshold segmentation map;
Figure DEST_PATH_IMAGE058
is as follows
Figure 993382DEST_PATH_IMAGE056
Opening the candidate probability of the first frequency point group of the target threshold segmentation graph;
Figure DEST_PATH_IMAGE060
is as follows
Figure 840116DEST_PATH_IMAGE056
Opening absolute values of abscissas of a first time frequency point group of the target threshold segmentation graph;
Figure DEST_PATH_IMAGE062
the number of graphs to segment for the target threshold.
And acquiring a third product of the segmentation effectiveness corresponding to each target threshold segmentation graph, the candidate probability corresponding to the second secondary frequency point group and the frequency point coordinates corresponding to the second secondary frequency point group, and summing the third products corresponding to the multiple target threshold segmentation graphs to obtain a third product.
And obtaining a fourth product of the segmentation effectiveness corresponding to each target threshold segmentation graph and the candidate probability corresponding to the second frequency point group, and summing the fourth products corresponding to the multiple target threshold segmentation graphs to obtain a fourth product sum.
The ratio of the third product sum to the fourth product sum is the absolute value of the ordinate of the second target point, the abscissa of the second target point is 0, and the absolute value of the ordinate fused with the second target point is obtained by fusing the second secondary frequency point group coordinates of the multiple target threshold segmentation maps.
Absolute value of ordinate of the second target point
Figure DEST_PATH_IMAGE064
Comprises the following steps:
Figure DEST_PATH_IMAGE066
wherein, among others,
Figure 503178DEST_PATH_IMAGE054
is as follows
Figure 825575DEST_PATH_IMAGE056
Opening the segmentation effectiveness of the target threshold segmentation map;
Figure DEST_PATH_IMAGE068
is as follows
Figure 638810DEST_PATH_IMAGE056
Opening the candidate probability of the second frequency point group of the target threshold segmentation graph;
Figure DEST_PATH_IMAGE070
is as follows
Figure 464684DEST_PATH_IMAGE056
Opening absolute values of vertical coordinates of a second secondary frequency point group of the target threshold segmentation graph;
Figure 970752DEST_PATH_IMAGE062
the number of graphs to segment for the target threshold.
The first time frequency point groups of the multiple target threshold segmentation graphs are fused to obtain a first target point, and the coordinate of the first target point is
Figure DEST_PATH_IMAGE072
Obtaining a second target point after the second frequency point groups of the multiple target threshold segmentation graphs are fused, wherein the coordinate of the second target point is
Figure DEST_PATH_IMAGE074
In all secondary frequency point groups, the target threshold segmentation graph with high effectiveness and the secondary frequency point group with higher candidate probability are more worthy of being trusted, so that the target point is determined by weighting the effectiveness and the candidate probability together.
Step S240, obtaining a minimum period area of the rubber and plastic image from the target point, and dividing the rubber and plastic image into a plurality of period areas according to the minimum period area.
Because the distance from the frequency point to the center point of the spectrogram in the spectrogram is the frequency corresponding to the frequency point. The first target point obtained by final calculation is only the abscissa, and the ordinate is 0; the second target point is only ordinate, with 0 on the abscissa. Therefore, the absolute value of the abscissa of the first target point and the absolute value of the ordinate of the second target point are distances corresponding to the two target points, i.e., frequencies corresponding to the two target points.
The first target point can reflect the transverse minimum period in the rubber and plastic part image, and the second target point can reflect the longitudinal minimum period in the rubber and plastic part image.
Since the frequency and the period are inversely related, the period can be represented by the inverse of the frequency.
The reciprocal of the absolute value of the abscissa of the first target point is the length of the minimum period region, and the reciprocal of the absolute value of the ordinate of the second target point is the width of the minimum period region, that is, the minimum period region is obtained.
And dividing the rubber and plastic part image into a plurality of periodic regions according to the obtained minimum periodic region by taking the first pixel point at the upper left of the rubber and plastic part image as a starting point.
Step S300, acquiring a gray level histogram of each period region, and constructing a gray level frequency sequence according to the gray level histogram; and calculating the illumination offset groups of each period area and the adjacent period areas by utilizing the gray frequency sequence, and obtaining the spot areas according to the density degree of the illumination offset groups.
After the rubber and plastic part is divided into a plurality of periodic areas, the illumination offset of each area is calculated according to the divided periodic areas, and the mottled areas are obtained. The illumination offset refers to a condition that illumination of each periodic region changes relative to four periodic regions adjacent to the periodic region in the vertical and horizontal directions. Because the patterns of the rubber-plastic parts in each periodic area are the same, under the condition of uniform illumination, the illumination offset of each periodic area corresponding to the adjacent area of each periodic area is the same or similar, and it should be noted that even if the illumination light source adopts a side light source for illumination, the illumination can be considered to be approximately uniform.
Referring to fig. 4, the step of obtaining the mottle area specifically includes:
step S310, acquiring a gray level histogram of each period area, and constructing a gray level frequency sequence according to the gray level histogram.
And acquiring a gray level histogram of each period region in the image of the rubber and plastic part, and constructing a gray level frequency sequence corresponding to each period region by taking the gray level as a serial number and the frequency of the occurrence of the gray level as a value. Each period region corresponds to a gray frequency sequence.
In step S320, the gray frequency sequence is used to calculate the set of illumination offsets for each period region and the adjacent period regions.
Obtaining gray scale of rubber and plastic part image
Figure DEST_PATH_IMAGE076
Generating a shift step interval
Figure DEST_PATH_IMAGE078
Each integer in the shift step interval is extracted as a shift step, i.e. the step of each shift is increased by 1. The grayscale frequency sequence is cyclically shifted, for example, the grayscale frequency sequence is shifted by 1 step in the first shift, the grayscale frequency sequence is shifted by 2 steps in the second shift (2 nd shift), … …, and the grayscale frequency sequence is shifted by n steps in the nth shift. And taking the shifted gray frequency sequence as a shift sequence. And circularly shifting the gray frequency sequence for multiple times to obtain multiple shift sequences.
Calculating sequence similarity of a plurality of shift sequences of each period region and gray frequency sequences of four adjacent period regions, and acquiring minimum sequence similarity corresponding to each period region and each adjacent period region, wherein each period region corresponds to four minimum sequence similarities; and constructing an illumination offset group corresponding to each period region according to the minimum sequence similarity.
If each periodic area is taken as a coordinate point and placed in a rectangular coordinate system, the abscissa of the rectangular coordinate system is the number of rows of the periodic area from the lower left corner in the rubber-plastic image, and the ordinate of the rectangular coordinate system is the number of columns of the periodic area from the lower left corner in the rubber-plastic image, namely the periodic area pair of the lowest layer in the rubber-plastic imageThe corresponding abscissa is 1, the ordinate corresponding to the periodic region of the leftmost layer is 1, the row and column positions of the periodic region in the image of the rubber and plastic part are corresponding coordinate positions, the periodic region of the lower left corner of the image is taken as a starting point, the coordinate of the periodic region of the lower left corner is (1, 1), and each periodic region corresponds to a rectangular coordinate. Taking the periodic region w as an example, let the rectangular coordinate of the periodic region w be
Figure DEST_PATH_IMAGE080
The rectangular coordinates corresponding to four adjacent periodic regions, i.e. the upper, the lower, the left and the right, of the periodic region w are respectively
Figure DEST_PATH_IMAGE082
Acquiring gray frequency sequences of four adjacent periodic regions of a periodic region w, namely an upper periodic region, a lower periodic region, a left periodic region and a right periodic region and a plurality of shift sequences of the periodic region w.
Sequence similarity of a plurality of shift sequences of the period region w and gray frequency sequences of four adjacent period regions is calculated.
Current cycle region number
Figure DEST_PATH_IMAGE084
The shift sequence obtained by the secondary shift and the periodic region
Figure DEST_PATH_IMAGE086
Sequence similarity of gray frequency sequences of adjacent periodic regions
Figure DEST_PATH_IMAGE088
The calculation formula of (2) is as follows:
Figure DEST_PATH_IMAGE090
wherein,
Figure DEST_PATH_IMAGE092
for the current cycle region
Figure 108341DEST_PATH_IMAGE084
The shift sequence obtained by the secondary shift and the periodic region
Figure 725267DEST_PATH_IMAGE086
The regular distance between the two sequences of the gray frequency sequences of the adjacent periodic regions after the gray frequency sequences are processed by a dynamic time regular algorithm;
Figure DEST_PATH_IMAGE094
for the current cycle region
Figure 680015DEST_PATH_IMAGE084
The shift sequence obtained by the secondary shift and the periodic region
Figure 356984DEST_PATH_IMAGE086
L2 distance of the gray frequency sequence of adjacent periodic regions.
And acquiring the minimum sequence similarity corresponding to each period region w and each adjacent period region, and acquiring the shift step corresponding to the minimum sequence similarity, wherein the shift step is the illumination offset of the adjacent period region.
For coordinates above the periodic region w of
Figure DEST_PATH_IMAGE096
The corresponding minimum sequence similarity of the adjacent periodic regions is obtained, and the step length corresponding to the minimum sequence similarity is set as follows:
Figure DEST_PATH_IMAGE098
then the corresponding coordinate
Figure 263760DEST_PATH_IMAGE096
The illumination offset of the adjacent periodic region is
Figure 809011DEST_PATH_IMAGE098
For the coordinates below the periodic region w of
Figure DEST_PATH_IMAGE100
The corresponding minimum sequence similarity of the adjacent periodic regions is obtained, and the step length corresponding to the minimum sequence similarity is set as follows:
Figure DEST_PATH_IMAGE102
then the corresponding coordinate
Figure 219264DEST_PATH_IMAGE100
The illumination offset of the adjacent periodic region is
Figure 191768DEST_PATH_IMAGE102
To the left of the periodic region w
Figure DEST_PATH_IMAGE104
The corresponding minimum sequence similarity of the adjacent periodic regions is obtained, and the step length corresponding to the minimum sequence similarity is set as follows:
Figure DEST_PATH_IMAGE106
then the corresponding coordinate
Figure 320261DEST_PATH_IMAGE104
The illumination offset of the adjacent periodic region is
Figure 403624DEST_PATH_IMAGE106
To the right of the periodic region w
Figure DEST_PATH_IMAGE108
The corresponding minimum sequence similarity of the adjacent periodic regions is obtained, and the step length corresponding to the minimum sequence similarity is set as follows:
Figure DEST_PATH_IMAGE110
then the corresponding coordinate
Figure 199541DEST_PATH_IMAGE108
The illumination offset of the adjacent periodic region is
Figure 811788DEST_PATH_IMAGE110
Then the final corresponding illumination offset group of the periodic region w is:
Figure DEST_PATH_IMAGE112
and acquiring an illumination offset group corresponding to each period area, wherein each period area has the illumination offset group corresponding to each period area.
And step S330, obtaining a mottled area according to the density of the illumination offset group.
In the embodiment of the present invention, a single fixed light source is used, and if there is no mottle on the image of the rubber member, the set of illumination offsets of the regions on each image of the rubber member should be similar. The spot area is determined according to the density of the illumination offset group, or the spot area is determined according to the dissimilarity of the illumination offset groups of the current area and other areas.
And for the illumination offset groups corresponding to the plurality of periodic regions, clustering the illumination offset groups by using a density clustering algorithm (DBSCAN) to obtain a plurality of clustering categories, wherein the clustering categories comprise a plurality of discrete points and a plurality of clusters.
The rough probability of the periodic area corresponding to the discrete points is the flower spot area, and the flower spot probability that the periodic area corresponding to each discrete point is the flower spot area is calculated. Specifically, the cluster with the largest illumination offset group is obtained as the target cluster. And calculating the Manhattan distance (L1 distance) from each discrete point to the central point of the target cluster, and calculating the probability of the speckles according to the Manhattan distance. The farther the discrete point is from the cluster center point, the lower the similarity between the discrete point and the cluster is reflected, and the greater the speckle probability that the periodic region corresponding to the discrete point is the speckle region.
The first part is
Figure 958736DEST_PATH_IMAGE034
Mottle probability of discrete points
Figure DEST_PATH_IMAGE114
The calculation formula of (2) is as follows:
Figure DEST_PATH_IMAGE116
wherein,
Figure DEST_PATH_IMAGE118
is as follows
Figure 783472DEST_PATH_IMAGE034
The corresponding manhattan distances of the discrete points.
Presetting the probability threshold of mottle
Figure DEST_PATH_IMAGE120
When is coming into contact with
Figure DEST_PATH_IMAGE122
And when the pattern is printed, the periodic area corresponding to the discrete point is not the mottled area.
When in use
Figure DEST_PATH_IMAGE124
And when the pattern is printed, the periodic area corresponding to the discrete point is not the mottled area. In the embodiment of the present invention, the preset mottle probability threshold is 0.73, and in other embodiments, the threshold may be adjusted by an implementer according to actual situations.
And comparing the plaque probability of each discrete point with a preset plaque probability to obtain a plaque area.
And acquiring the spot area of the spot area, and calculating the ratio of the spot area to obtain the spot degree.
And when the mottling degree is larger than the preset mottling degree threshold value, the quality of the rubber and plastic part is considered to be not in accordance with the requirement, and the re-melting and re-manufacturing are required. In the embodiment of the present invention, the threshold of the mottle degree is preset to be 0.3, and in other embodiments, the threshold may be adjusted by an implementer according to actual situations.
And when the mottling degree is less than or equal to the preset mottling degree threshold value, the quality of the rubber and plastic part is considered to meet the requirement, and the rubber and plastic part can be delivered from a factory.
In summary, the embodiment of the present invention utilizes the machine vision technology to acquire the rubber-plastic image and perform threshold segmentation on the rubber-plastic image to obtain a plurality of target threshold segmentation maps and corresponding segmentation effectiveness. Carrying out Fourier transform on each target threshold segmentation graph to obtain a spectrogram, acquiring a plurality of initial frequency points and target frequency points in each spectrogram, screening initial frequency point groups and secondary frequency point groups from the target frequency points, fusing the secondary frequency point groups corresponding to each spectrogram to obtain target points, obtaining a minimum period region of the rubber and plastic part image from the target points, and dividing the rubber and plastic part image into a plurality of period regions according to the minimum period region. Acquiring a gray level histogram of each period region, calculating an illumination offset group corresponding to each period region according to the gray level histogram, obtaining a mottled region according to the intensity of the illumination offset group, and evaluating the quality of the rubber and plastic part according to the occupied area of the mottled region. The method comprises the steps of obtaining a minimum period area of a rubber and plastic part image by using a spectrogram, accurately segmenting a threshold value of the rubber and plastic part image under the condition that the surface brightness of the rubber and plastic part is not uniform, and determining a mottled area in the rubber and plastic part image through an illumination offset set of each period area. The purpose that the spot area cannot be accurately determined due to inaccurate threshold segmentation is achieved.
It should be noted that: the precedence order of the above embodiments of the present invention is only for description, and does not represent the merits of the embodiments. And specific embodiments thereof have been described above. Other embodiments are within the scope of the following claims. In some cases, the actions or steps recited in the claims may be performed in a different order than in the embodiments and still achieve desirable results. In addition, the processes depicted in the accompanying figures do not necessarily require the particular order shown, or sequential order, to achieve desirable results. In some embodiments, multitasking and parallel processing may also be possible or may be advantageous.
The embodiments in the present specification are described in a progressive manner, and the same and similar parts among the embodiments are referred to each other, and each embodiment focuses on the differences from the other embodiments.
The above description is only for the purpose of illustrating the preferred embodiments of the present invention and is not to be construed as limiting the invention, and any modifications, equivalents, improvements and the like that fall within the spirit and principle of the present invention are intended to be included therein.

Claims (10)

1. A machine vision-based method for detecting speckles of a rubber and plastic part is characterized by comprising the following steps:
collecting a rubber and plastic part image, wherein the rubber and plastic part image contains periodic patterns; dividing the rubber and plastic part image by using different threshold values to obtain a plurality of target threshold value division graphs and corresponding division effectiveness;
performing Fourier transform on each target threshold segmentation graph to obtain a spectrogram; selecting a maximum value point and target frequency points around the maximum value point from a plurality of initial frequency points of each spectrogram, and acquiring Gaussian distribution of each target frequency point by using the maximum value point to obtain a theoretical amplitude of the target frequency point; calculating the reliability of each target frequency point according to the difference value between the real amplitude value obtained by the spectrogram and the theoretical amplitude value; selecting target frequency points which are symmetrically distributed on a preset angle in a frequency spectrogram as initial frequency point groups, wherein the product of the reliability mean value and the real amplitude mean value of each target frequency point in the initial frequency point groups is a probability to be selected, and selecting two secondary frequency point groups in each frequency spectrogram according to the probability to be selected; obtaining two target points of the multiple target threshold segmentation graphs according to the segmentation effectiveness, the probability to be selected and the secondary frequency point group of the multiple target threshold segmentation graphs; obtaining a minimum periodic area of the rubber and plastic part image from the target point, and dividing the rubber and plastic part image into a plurality of periodic areas according to the minimum periodic area;
acquiring a gray level histogram of each period region, and constructing a gray level frequency sequence according to the gray level histogram; and calculating the illumination offset groups of each period area and the adjacent period area by using the gray frequency sequence, and obtaining the spot area according to the density of the illumination offset groups.
2. The method for detecting the mottling of the rubber and plastic part based on the machine vision as claimed in claim 1, wherein the segmenting the rubber and plastic part image by using different threshold values to obtain a plurality of target threshold segmentation maps and corresponding segmentation effectiveness comprises:
performing threshold segmentation on the rubber and plastic part image by using a plurality of thresholds to obtain a plurality of initial threshold segmentation images;
obtaining the connected domain area range of each initial threshold segmentation graph, wherein the reciprocal of the connected domain area range is the segmentation effectiveness;
the initial threshold segmentation map corresponding to the segmentation effectiveness greater than the preset segmentation effectiveness threshold is a target threshold segmentation map.
3. The machine vision-based rubber and plastic part mottling detection method of claim 1, wherein the selecting of the maximum value point and the target frequency points around the maximum value point from the plurality of initial frequency points of each spectrogram comprises:
each spectrogram has a plurality of initial frequency points; acquiring maximum value points in the initial frequency points based on a plurality of initial frequency points in each spectrogram;
constructing Gaussian distribution corresponding to each maximum point according to the maximum points and the amplitudes of the initial frequency points around the maximum points; obtaining the variance and the mean of Gaussian distribution corresponding to each maximum value point by using an EM (effective-energy-efficient) algorithm, and obtaining a variance range by using the variance; and taking the maximum value point as a center, and acquiring initial frequency points positioned in a variance range as target frequency points, wherein the target frequency points comprise the maximum value point.
4. The machine vision-based rubber and plastic part mottling detection method of claim 1, wherein the calculating the reliability of each target frequency point according to the difference between the real amplitude and the theoretical amplitude obtained from the spectrogram comprises:
the reliability calculation formula is as follows:
Figure DEST_PATH_IMAGE002
wherein,
Figure DEST_PATH_IMAGE004
is as follows
Figure DEST_PATH_IMAGE006
The reliability of individual target frequency points;
Figure DEST_PATH_IMAGE008
is as follows
Figure 63432DEST_PATH_IMAGE006
The real amplitude of each target frequency point;
Figure DEST_PATH_IMAGE010
is as follows
Figure 12933DEST_PATH_IMAGE006
Theoretical amplitude of each target frequency point.
5. The machine vision-based rubber and plastic part mottling detection method of claim 1, wherein the selecting of the target frequency points symmetrically distributed on a preset angle in the spectrogram as an initial frequency point group comprises:
constructing a rectangular coordinate system by taking the central point of each spectrogram as an origin, a horizontal line passing through the origin as a horizontal axis and a vertical line passing through the origin as a longitudinal axis; and selecting target frequency points which are symmetrical in a preset angle in a rectangular coordinate system as an initial frequency point group, wherein the initial frequency point group comprises a first initial frequency point group and a second initial frequency point group.
6. The machine vision-based rubber and plastic part mottling detection method according to claim 5, wherein the selecting two secondary frequency point groups in each spectrogram according to the candidate probability comprises:
the secondary frequency point groups comprise a first secondary frequency point group and a second secondary frequency point group;
based on the plurality of first initial frequency point groups and the plurality of second initial frequency point groups, selecting the first initial frequency point group with the maximum probability of candidate as a first secondary frequency point group, and selecting the second initial frequency point group with the maximum probability of candidate as a second secondary frequency point group.
7. The machine vision-based rubber and plastic piece mottling detection method of claim 6, wherein the obtaining of the two target points of the multiple target threshold segmentation maps according to the segmentation effectiveness, the candidate probability and the secondary frequency point groups of the multiple target threshold segmentation maps comprises:
the target points include a first target point and a second target point;
acquiring a first product of the segmentation effectiveness corresponding to each target threshold segmentation graph, the candidate probability corresponding to the first frequency point group and the frequency point coordinate corresponding to the first frequency point group, and summing the first products corresponding to the multiple target threshold segmentation graphs to obtain a first product sum; obtaining a second product of the segmentation effectiveness corresponding to each target threshold segmentation graph and the probability to be selected corresponding to the first frequency point group, and summing the second products corresponding to the multiple target threshold segmentation graphs to obtain a second product sum; the ratio of the first product sum to the second product sum is the absolute value of the abscissa of the first target point, and the ordinate of the first target point is 0;
obtaining a third product of the segmentation effectiveness corresponding to each target threshold segmentation graph, the candidate probability corresponding to the second secondary frequency point group and the frequency point coordinates corresponding to the second secondary frequency point group, and summing the third products corresponding to the multiple target threshold segmentation graphs to obtain a third product; obtaining a fourth product of the segmentation effectiveness corresponding to each target threshold segmentation graph and the probability to be selected corresponding to the first frequency point group, and summing the fourth products corresponding to the multiple target threshold segmentation graphs to obtain a fourth product sum; the ratio of the third product sum to the fourth product sum is an absolute value of a vertical coordinate of a second target point, and a horizontal coordinate of the second target point is 0.
8. The method for detecting the mottling of the rubber and plastic part based on the machine vision as claimed in claim 7, wherein the step of obtaining the minimum period area of the image of the rubber and plastic part from the target point and dividing the image of the rubber and plastic part into a plurality of period areas according to the minimum period area comprises:
the reciprocal of the absolute value of the abscissa of the first target point is the length of the minimum period region; the reciprocal of the absolute value of the ordinate of the second target point is the width of the minimum period region;
and dividing the rubber and plastic part image into a plurality of periodic areas according to the minimum periodic area by taking the first pixel point at the upper left of the rubber and plastic part image as a starting point.
9. The machine vision-based rubber and plastic part mottling detection method as claimed in claim 1, wherein the calculating of the illumination offset group of each period area and the adjacent period area by using the gray frequency sequence comprises:
the gray frequency sequence is circularly shifted for multiple times to obtain a shift sequence;
calculating sequence similarity of a plurality of shift sequences of each period region and gray frequency sequences of four adjacent period regions, and acquiring minimum sequence similarity corresponding to each period region and each adjacent period region, wherein each period region corresponds to four minimum sequence similarities; and constructing an illumination offset group corresponding to each period region according to the minimum sequence similarity.
10. The machine vision-based rubber and plastic part mottling detection method as claimed in claim 1, wherein the obtaining of the mottling area according to the density of the illumination offset group comprises:
clustering the illumination offset group to obtain a plurality of clustering categories, wherein the clustering categories comprise a plurality of discrete points and a plurality of clusters;
acquiring a cluster group with the most illumination offset groups as a target cluster group; calculating the Manhattan distance from the discrete point to the central point of the target cluster group, and calculating the probability of the speckles according to the Manhattan distance; and the periodic region corresponding to the discrete point of the spot probability which is greater than the preset spot probability threshold is a spot region.
CN202111541545.XA 2021-12-16 2021-12-16 Rubber and plastic part mottling detection method based on machine vision Active CN113935998B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202111541545.XA CN113935998B (en) 2021-12-16 2021-12-16 Rubber and plastic part mottling detection method based on machine vision

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202111541545.XA CN113935998B (en) 2021-12-16 2021-12-16 Rubber and plastic part mottling detection method based on machine vision

Publications (2)

Publication Number Publication Date
CN113935998A true CN113935998A (en) 2022-01-14
CN113935998B CN113935998B (en) 2022-03-22

Family

ID=79289050

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202111541545.XA Active CN113935998B (en) 2021-12-16 2021-12-16 Rubber and plastic part mottling detection method based on machine vision

Country Status (1)

Country Link
CN (1) CN113935998B (en)

Cited By (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114119613A (en) * 2022-01-26 2022-03-01 山东慧丰花生食品股份有限公司 Peanut seed selection method based on image processing
CN114372982A (en) * 2022-03-22 2022-04-19 山东泗水金阳光纸业有限公司 Method for detecting production abnormity of carbonless copy paper
CN114782693A (en) * 2022-06-17 2022-07-22 江苏乐尔环境科技股份有限公司 Health management system for industrial engineering equipment
CN115115864A (en) * 2022-08-26 2022-09-27 济宁安泰矿山设备制造有限公司 Dynamic balance testing method and system for pump precision rotor shaft
CN115239793A (en) * 2022-09-21 2022-10-25 精技电子(南通)有限公司 Intelligent control method and system for HDMI cable transmission and sorting
CN116823821A (en) * 2023-08-29 2023-09-29 成都中科卓尔智能科技集团有限公司 Chip mask defect detection method based on phase recovery

Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20080068587A1 (en) * 2006-09-19 2008-03-20 Ohara Inc. Surface defect detection method and surface defect inspection apparatus
CN106770321A (en) * 2016-12-08 2017-05-31 广东工业大学 A kind of plastic part defect inspection method interval based on multi thresholds
CN107220649A (en) * 2017-05-27 2017-09-29 江苏理工学院 A kind of plain color cloth defects detection and sorting technique
CN108830832A (en) * 2018-05-15 2018-11-16 佛山市南海区广工大数控装备协同创新研究院 A kind of plastic barrel surface defects detection algorithm based on machine vision
CN109781737A (en) * 2019-01-14 2019-05-21 佛山市南海区广工大数控装备协同创新研究院 A kind of detection method and its detection system of hose surface defect
CN111145165A (en) * 2019-12-30 2020-05-12 北京工业大学 Rubber seal ring surface defect detection method based on machine vision
CN112862800A (en) * 2021-02-25 2021-05-28 歌尔科技有限公司 Defect detection method and device and electronic equipment

Patent Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20080068587A1 (en) * 2006-09-19 2008-03-20 Ohara Inc. Surface defect detection method and surface defect inspection apparatus
CN106770321A (en) * 2016-12-08 2017-05-31 广东工业大学 A kind of plastic part defect inspection method interval based on multi thresholds
CN107220649A (en) * 2017-05-27 2017-09-29 江苏理工学院 A kind of plain color cloth defects detection and sorting technique
CN108830832A (en) * 2018-05-15 2018-11-16 佛山市南海区广工大数控装备协同创新研究院 A kind of plastic barrel surface defects detection algorithm based on machine vision
CN109781737A (en) * 2019-01-14 2019-05-21 佛山市南海区广工大数控装备协同创新研究院 A kind of detection method and its detection system of hose surface defect
CN111145165A (en) * 2019-12-30 2020-05-12 北京工业大学 Rubber seal ring surface defect detection method based on machine vision
CN112862800A (en) * 2021-02-25 2021-05-28 歌尔科技有限公司 Defect detection method and device and electronic equipment

Non-Patent Citations (3)

* Cited by examiner, † Cited by third party
Title
KUN LIU 等: ""A self-reference scheme based on structure-texture decomposition for crack defect detection with electroluminescence images"", 《2018 24TH INTERNATIONAL CONFERENCE ON AUTOMATION AND COMPUTING (ICAC)》 *
张涛 等: ""基于机器视觉的表面缺陷检测研究综述"", 《中国图象图形学报》 *
张王黎: ""基于机器视觉的塑料制品缺陷检测算法研究"", 《中国优秀博硕士学位论文全文数据库(硕士)信息科技辑》 *

Cited By (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114119613A (en) * 2022-01-26 2022-03-01 山东慧丰花生食品股份有限公司 Peanut seed selection method based on image processing
CN114119613B (en) * 2022-01-26 2022-04-22 山东慧丰花生食品股份有限公司 Peanut seed selection method based on image processing
CN114372982A (en) * 2022-03-22 2022-04-19 山东泗水金阳光纸业有限公司 Method for detecting production abnormity of carbonless copy paper
CN114782693A (en) * 2022-06-17 2022-07-22 江苏乐尔环境科技股份有限公司 Health management system for industrial engineering equipment
CN114782693B (en) * 2022-06-17 2022-09-02 江苏乐尔环境科技股份有限公司 Health management system for industrial engineering equipment
CN115115864A (en) * 2022-08-26 2022-09-27 济宁安泰矿山设备制造有限公司 Dynamic balance testing method and system for pump precision rotor shaft
CN115239793A (en) * 2022-09-21 2022-10-25 精技电子(南通)有限公司 Intelligent control method and system for HDMI cable transmission and sorting
CN116823821A (en) * 2023-08-29 2023-09-29 成都中科卓尔智能科技集团有限公司 Chip mask defect detection method based on phase recovery
CN116823821B (en) * 2023-08-29 2023-12-15 成都中科卓尔智能科技集团有限公司 Chip mask plate flaw detection method based on phase recovery

Also Published As

Publication number Publication date
CN113935998B (en) 2022-03-22

Similar Documents

Publication Publication Date Title
CN113935998B (en) Rubber and plastic part mottling detection method based on machine vision
US10317192B2 (en) Geometry measurement system, geometry measurement apparatus, and geometry measurement method
CN113688807B (en) Self-adaptive defect detection method, device, recognition system and storage medium
JP6099479B2 (en) Crack detection method
CN115311292A (en) Strip steel surface defect detection method and system based on image processing
CN115861291B (en) Chip circuit board production defect detection method based on machine vision
US20130202188A1 (en) Defect inspection method, defect inspection apparatus, program product and output unit
KR20120068128A (en) Method of detecting defect in pattern and apparatus for performing the method
CN115170669A (en) Identification and positioning method and system based on edge feature point set registration and storage medium
CN110910318A (en) Weak contrast schlieren small ball center calculation method for comprehensive diagnosis light path quick automatic collimation system
CN115170570B (en) Fabric fuzzing and pilling detection method based on gray level run matrix
CN115578389A (en) Defect detection method of groove MOS device
KR20180081820A (en) Registration and design in the die internal inspection Reduction of the noise caused by the peripheral part
JP2013238449A (en) Crack detection method
CN104331695A (en) Robust round identifier shape quality detection method
CN114450711A (en) Workpiece surface defect detection device and detection method, workpiece surface inspection system, and program
CN110807763A (en) Method and system for detecting ceramic tile surface bulge
JP2001077165A (en) Defect inspection method, its device, defect analysis method and its device
CN114187267B (en) Stamping part defect detection method based on machine vision
CN106951902B (en) Image binarization processing method and device
JP4730895B2 (en) Needle mark detection device and needle mark detection method
CN114689604A (en) Image processing method for optical detection of object to be detected with smooth surface and detection system thereof
CN109490252B (en) Concrete surface bubble analysis method and device
CN115205165B (en) Spraying method of anticorrosive material for industrial machine housing
CN116519640A (en) Method for measuring surface glossiness of silica gel key based on machine vision system

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
TR01 Transfer of patent right

Effective date of registration: 20240618

Address after: No. 201, 2nd Floor, Building 33, Hankou North Industrial City, Shekou Street, Huangpi District, Wuhan City, Hubei Province, 430000

Patentee after: Hubei Jiake Intelligent Control Equipment Co.,Ltd.

Country or region after: China

Address before: 430000 in Yangluo Street Industrial Park, Xinzhou District, Wuhan City, Hubei Province

Patentee before: Wuhan Parker rubber and plastic products Co.,Ltd.

Country or region before: China

TR01 Transfer of patent right