CN115272299A - Sanitary mask defect identification method - Google Patents

Sanitary mask defect identification method Download PDF

Info

Publication number
CN115272299A
CN115272299A CN202211138972.8A CN202211138972A CN115272299A CN 115272299 A CN115272299 A CN 115272299A CN 202211138972 A CN202211138972 A CN 202211138972A CN 115272299 A CN115272299 A CN 115272299A
Authority
CN
China
Prior art keywords
straight line
line
wrinkle
value
mask
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.)
Withdrawn
Application number
CN202211138972.8A
Other languages
Chinese (zh)
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.)
Jiangsu Xinyuan Medical Technology Co ltd
Original Assignee
Jiangsu Xinyuan Medical Technology 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 Jiangsu Xinyuan Medical Technology Co ltd filed Critical Jiangsu Xinyuan Medical Technology Co ltd
Priority to CN202211138972.8A priority Critical patent/CN115272299A/en
Publication of CN115272299A publication Critical patent/CN115272299A/en
Withdrawn legal-status Critical Current

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
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06NCOMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
    • G06N3/00Computing arrangements based on biological models
    • G06N3/02Neural networks
    • G06N3/08Learning methods
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T7/00Image analysis
    • G06T7/10Segmentation; Edge detection
    • G06T7/11Region-based segmentation
    • 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
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06VIMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
    • G06V10/00Arrangements for image or video recognition or understanding
    • G06V10/40Extraction of image or video features
    • G06V10/44Local feature extraction by analysis of parts of the pattern, e.g. by detecting edges, contours, loops, corners, strokes or intersections; Connectivity analysis, e.g. of connected components
    • 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/764Arrangements for image or video recognition or understanding using pattern recognition or machine learning using classification, e.g. of video objects
    • 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/82Arrangements for image or video recognition or understanding using pattern recognition or machine learning using neural networks
    • 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/20021Dividing image into blocks, subimages or windows
    • 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]

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Computer Vision & Pattern Recognition (AREA)
  • Evolutionary Computation (AREA)
  • Software Systems (AREA)
  • Computing Systems (AREA)
  • Multimedia (AREA)
  • Artificial Intelligence (AREA)
  • Health & Medical Sciences (AREA)
  • General Health & Medical Sciences (AREA)
  • Medical Informatics (AREA)
  • Databases & Information Systems (AREA)
  • Data Mining & Analysis (AREA)
  • Molecular Biology (AREA)
  • General Engineering & Computer Science (AREA)
  • Mathematical Physics (AREA)
  • Life Sciences & Earth Sciences (AREA)
  • Quality & Reliability (AREA)
  • Computational Linguistics (AREA)
  • Biophysics (AREA)
  • Biomedical Technology (AREA)
  • Image Analysis (AREA)

Abstract

The invention relates to the technical field of mask defect identification, in particular to a sanitary mask defect identification method, which comprises the following steps: acquiring a mask gray image, extracting straight line segments, calculating the wrinkle value of the straight line segments according to gray features, recording the straight line segments with the wrinkle values larger than a threshold value as wrinkle line segments, recording collinear wrinkle line segments as wrinkle straight lines, and judging whether the mask has the defect of earband loss or not according to the number of the wrinkle line segments contained in the wrinkle straight lines; the method comprises the steps of obtaining the line segment length of a nose bridge strip area, and judging whether the mask has the defects of nose bridge strip loss and short nose bridge strip according to the line segment length and a line segment threshold; and processing the ear zone area by utilizing image thinning to obtain an ear zone line, and judging whether the mask has the ear zone junction defect or not according to the quantity of neighborhood pixels belonging to the ear zone line in the neighborhood of each pixel on the ear zone line. The invention can accurately identify the defects of the mask, is not influenced by subjective factors, and can ensure the quality of products.

Description

Sanitary mask defect identification method
Technical Field
The invention relates to the technical field of mask defect identification, in particular to a sanitary mask defect identification method.
Background
The demand of the mask is sharply increased recently, chinese national standards make clear regulations and requirements on manufacturing materials, quality standards and the like of the mask, and the quality of the mask is in charge of the health safety of users and the competitiveness of medical enterprises. In order to avoid the unqualified mask from entering the consumer market, the quality of the produced mask needs to be detected. The main defects of the existing mask generally include missing of a nose bridge strip, short and small nose bridge strip, broken ear bands, ear band knots, missing of the ear bands, welding spot deviation and the like.
Because gauze mask cost of manufacture is lower, assembly line operation and sanitary quality require highly, present gauze mask detects mainly to rely on artifical screening to be the main. The manual detection ensures the product quality through multi-station repeated detection, has the advantages of high sensitivity, wide application range and the like, but the manual detection method is easily influenced by subjective factors such as technical quality, working experience, visual resolution, fatigue and the like of inspectors, lacks accuracy and standardization and cannot ensure normal product quality.
Disclosure of Invention
In order to solve the technical problems, the invention aims to provide a sanitary mask defect identification method, which adopts the following technical scheme:
acquiring a mask gray level image, and extracting a straight line on the mask gray level image to be recorded as a straight line to be analyzed; calculating the gray value average value of pixel points on each straight line to be analyzed to obtain a first gray value average value; respectively marking lines which pass through all pixel points on the straight line to be analyzed and are vertical to the straight line to be analyzed as limb lines corresponding to all pixel points; respectively calculating the mean value of the gray values of pixel points intersected with the corresponding limb lines on two sides of each pixel point on the straight line to be analyzed to obtain a second gray mean value and a third gray mean value; calculating the fold value of the straight line to be analyzed according to the first, second and third gray average values;
setting a wrinkle threshold value, and recording a straight line to be analyzed with a wrinkle value larger than the wrinkle threshold value as a wrinkle line segment; acquiring a linear equation of a straight line where each wrinkle line segment is located, and calculating a parameter offset value between the two wrinkle line segments according to a slope and an intercept corresponding to the linear equation of each wrinkle line segment; marking the wrinkle line segment with the parameter offset value smaller than the parameter offset threshold value as a collinear wrinkle line segment; if no or only two fold line segments are collinear fold line segments of the same straight line, the mask has the defect of ear band loss;
if more than two fold line segments are collinear fold line segments of the same straight line, acquiring two collinear fold line segment end points which are closest to the same straight line; determining an initial growing point according to the end point, and obtaining a wrinkle region by using a region growing algorithm; calculating the mean value of the gray values of the pixel points on all collinear fold line segments, and performing threshold segmentation to obtain a nose bridge region after re-assigning the pixel values of the pixel points in the fold region by using the mean value of the gray values;
and extracting a straight line segment in the nose bridge strip area, wherein if the length of the straight line segment is less than a first line segment threshold value, the mask has the defect that the nose bridge strip is missing, and if the length of the straight line segment is less than a second line segment threshold value, the mask has the defect that the nose bridge strip is short.
Preferably, the straight line to be analyzed and the straight line segment in the nose bridge strip area are extracted by using hough transform straight line detection.
Preferably, the method for acquiring the wrinkle value specifically includes:
Figure 141796DEST_PATH_IMAGE002
wherein the content of the first and second substances,
Figure 100002_DEST_PATH_IMAGE003
representing the wrinkle value of the line to be analyzed,
Figure 606407DEST_PATH_IMAGE004
the mean value of the gray value of the pixel points on the straight line to be analyzed is represented, p represents the median value of the gray value of the pixel points on the mask gray image,
Figure 100002_DEST_PATH_IMAGE005
and
Figure 995931DEST_PATH_IMAGE006
respectively representing the mean value of the gray values of the pixel points intersected with the corresponding limb lines on the two sides of each pixel point on the straight line to be analyzed.
Preferably, the method for acquiring the parameter offset value specifically comprises:
Figure 453457DEST_PATH_IMAGE008
wherein, the first and the second end of the pipe are connected with each other,
Figure 100002_DEST_PATH_IMAGE009
representing the parameter offset value between the wrinkle line segment i and the wrinkle line segment j,
Figure 674354DEST_PATH_IMAGE010
and
Figure 100002_DEST_PATH_IMAGE011
respectively representing the slope and intercept corresponding to the straight line equation of the straight line on which the wrinkle line segment i is positioned,
Figure 372183DEST_PATH_IMAGE012
and
Figure 100002_DEST_PATH_IMAGE013
respectively representing the slope and intercept corresponding to the straight line equation of the straight line on which the wrinkle line segment j is positioned.
Preferably, the determining an initial growth point according to the end point and obtaining a wrinkle region by using a region growth algorithm specifically includes:
connecting the end points of the two collinear fold line segments to obtain an ear belt line segment, and calculating the gray average value of pixel points on the ear belt line segment to obtain a fold threshold; respectively obtaining pixel points with preset lengths vertically above and below the end points of the two collinear fold line segments, and marking the pixel points as initial growth points; the growth rule is set as follows: the gray value of the pixel points is larger than the folding threshold, and the gray value difference value between the pixel points is smaller than a preset threshold; and obtaining a wrinkle region by using a region growing algorithm according to the initial growing point and the growing rule.
Preferably, the preset length is obtained by:
and acquiring intercept parameters corresponding to a linear equation of a straight line where the collinear fold line segments are located, calling the same straight line where the collinear fold line segments belong as a fold straight line, calculating the mean value of the intercept parameters corresponding to all the collinear fold line segments on the fold straight line, and obtaining the preset length according to the difference value of the mean values of the intercept parameters corresponding to the preset number of fold straight lines.
Preferably, after the pixel values of the pixel points in the wrinkle region are reassigned by using the gray value mean, the method further includes: and performing threshold segmentation to obtain an ear zone region.
Preferably, the method further comprises:
classifying the ear zone regions by using a clustering algorithm to obtain a left ear zone class and a right ear zone class; combining the ear zone areas in the same category, and respectively obtaining a left ear zone line and a right ear zone line by utilizing image thinning; neighborhood pixel points in eight neighborhoods of all pixel points on the left ear zone line and the right ear zone line are respectively obtained, and if the neighborhood pixel points corresponding to all the pixel points with the number larger than the preset number belong to the left ear zone line and the right ear zone line, the mask has the defect of ear zone knots.
The embodiment of the invention at least has the following beneficial effects:
the method comprises the steps of screening straight lines with special gray scale characteristics in the range of a wrinkle area on an image, recording the straight lines as wrinkle straight lines, and judging whether the mask has the defect of earband loss according to the number of wrinkle line segments contained in the wrinkle straight lines; judging whether the mask has the defects of missing of the nose bridge strip and short nose bridge strip according to the line segment length and the line segment threshold of the nose bridge strip region; processing the ear zone area by utilizing image thinning to obtain an ear zone line, and judging whether the mask has ear zone junction defects or not according to the quantity of neighborhood pixels belonging to the ear zone line in the neighborhood of each pixel on the ear zone line; and judging whether the mask has the defect of ear band welding spot deviation according to the maximum and minimum row coordinates of the pixel points in the ear band area. The invention combines the defect morphological characteristics of various unqualified masks, specifically analyzes, can accurately identify the defects of the masks, is not influenced by subjective factors, can ensure the quality of products, can finish the identification work of the defects of the sanitary masks without training a classification model by adopting a huge neural network with a complicated image set, and has higher defect identification efficiency.
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 identifying defects of a sanitary mask according to the present invention.
Detailed Description
In order to further explain the technical means and effects of the present invention adopted to achieve the predetermined objects, the following detailed description of the defect identification method of a sanitary mask according to the present invention, the specific implementation, structure, features and effects thereof will be made with reference to the accompanying drawings and preferred embodiments. In the following description, the different references to "one embodiment" or "another embodiment" do not necessarily refer to 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 following describes a specific scheme of the sanitary mask defect identification method provided by the invention in detail with reference to the accompanying drawings.
Referring to fig. 1, a flow chart of a method for identifying defects of a sanitary mask according to an embodiment of the present invention is shown, the method including the following steps:
acquiring a mask gray image, and extracting a straight line on the mask gray image to be recorded as a straight line to be analyzed; calculating the gray value average value of pixel points on each straight line to be analyzed to obtain a first gray value average value; respectively marking lines which pass through all pixel points on the straight line to be analyzed and are vertical to the straight line to be analyzed as limb lines corresponding to all pixel points; respectively calculating the mean value of the gray values of pixel points intersected with the corresponding limb lines on two sides of each pixel point on the straight line to be analyzed to obtain a second gray mean value and a third gray mean value; and calculating the wrinkle value of the straight line to be analyzed according to the first, second and third gray level mean values.
Firstly, an industrial camera is used for collecting images of a common medical disposable sanitary mask, a linear collecting frame is divided in a visual field range, the mask is placed in a square collecting frame with the same size as the mask, and the normal pose of the mask is ensured. And preprocessing the acquired mask image, filtering noise in the image by adopting a median filter, and enhancing the gray contrast of the image by adopting histogram equalization to obtain the mask gray image. The size of the acquisition frame is mxn, and the size of the acquired mask image is mxn.
It should be noted that the ordinary medical disposable sanitary mask is generally of a four-side sealing structure, that is, the periphery of the mask is provided with a series of square perforated areas which are uniformly arranged and used for fixing ear bags and sealing a nose bridge strip and an outer layer, a filter layer and an inner layer of the mask. Wherein, the region of punching of gauze mask is for piling up into the structure, and the upside of gauze mask contains bridge of the nose strip region, and the downside contains LOGO region, and the left side and the right side of gauze mask have the same hole size and interval. The fold area of the mask penetrates through the center area of the mask, and the center area of the mask comprises two fold lines. The ear belts are fixed at the two side end points of the left side and the right side perforated areas. The mask generally has the defects of short nose bridge strips, missing ear belts, broken ear belts, ear belt knots, welding spot deviation and the like.
Then, a straight line on the mask gray level image is extracted by utilizing Hough transformation straight line detection and recorded as a straight line to be analyzed, and the gray level mean value of pixel points on the straight line to be analyzed is calculated and recorded as a first gray level mean value. And then the vertical line passing through each pixel point on the straight line to be analyzed and making the straight line to be analyzed is recorded as the limb line corresponding to each pixel point. For example, the coordinate of a pixel point on the line to be analyzed is
Figure 186686DEST_PATH_IMAGE014
Let the equation of the line to be analyzed where the pixel point is located be
Figure DEST_PATH_IMAGE015
Where x and y are the row and column coordinates of the straight line. The equation of the limb line corresponding to the pixel point is
Figure 995373DEST_PATH_IMAGE016
And respectively calculating the mean value of the gray values of the pixel points intersected with the corresponding limb lines on the two sides of each pixel point on the straight line to be analyzed to obtain a second gray mean value and a third gray mean value. In this embodiment, the line to be analyzed divides the limb line corresponding to each pixel point into two parts, and 10 pixel points are respectively selected on two sides of the limb line corresponding to each pixel point on the line to be analyzed. And if the limb line intersects with four vertexes of the pixel point, skipping the pixel point, and continuously searching the next pixel point meeting the conditions in the direction far away from the straight line to be analyzed on the limb line until a sufficient number of pixel points are selected. And then calculating the mean value of the gray values of the pixels selected at the two sides of the limb line corresponding to each pixel point on the straight line to be analyzed, and recording the mean value as a second gray mean value and a third gray mean value. For example, a straight line to be analyzed includes five pixels, and the gray value average of the pixels on the left limb line of the five pixels is calculated respectively to obtain a second gray value average. And calculating the gray value average value of the pixel points on the limb line on the right side of the five pixel points to obtain a third gray value average value.
Finally, the mask gray image can be divided into deep area pixels and shallow area pixels by using a threshold segmentation algorithm, wherein the gray value of the deep area pixels is smaller, and the gray value of the shallow area pixels is larger. Specifically, in this embodiment, a gray histogram of a mask gray image is obtained, a gray median is obtained according to the gray histogram, a pixel point with a gray value smaller than the gray median is referred to as a deep pixel, and a pixel point with a gray value larger than the gray median is referred to as a shallow pixel.
Calculating the wrinkle value of the line to be analyzed according to the first, second and third gray level mean values, and expressing the wrinkle value as follows by using a formula:
Figure 523307DEST_PATH_IMAGE002
wherein the content of the first and second substances,
Figure 64140DEST_PATH_IMAGE003
representing the wrinkle value of the line to be analyzed,
Figure 552891DEST_PATH_IMAGE004
the mean value of the gray values of the pixel points on the straight line to be analyzed, namely the first mean value of the gray values, p represents the median value of the gray values of the pixel points on the mask gray image,
Figure 86640DEST_PATH_IMAGE005
and
Figure 219812DEST_PATH_IMAGE006
respectively representing the mean value of the gray values of the pixel points intersected with the corresponding limb line on the two sides of each pixel point on the straight line to be analyzed, namely a second gray mean value and a third gray mean value.
Setting a wrinkle threshold value, and recording a straight line to be analyzed with a wrinkle value larger than the wrinkle threshold value as a wrinkle line segment; acquiring a linear equation of a straight line where each wrinkle line segment is located, and calculating a parameter offset value between the two wrinkle line segments according to a slope and an intercept corresponding to the linear equation of each wrinkle line segment; marking the wrinkle line segment with the parameter offset value smaller than the parameter offset threshold value as a collinear wrinkle line segment; if no or only two fold line segments are collinear fold line segments of the same straight line, the mask has the defect of ear band loss.
Firstly, it should be noted that the gray value of the pixel points in the wrinkle region of the mask is small, two straight lines with large gray values are arranged in the middle of the wrinkle region, and a plurality of straight lines are extracted by using hough transform straight line detection.
Specifically, if the difference between the first gray average corresponding to the line to be analyzed and the median of the gray values is larger, and the gray contrast between the pixels on the line to be analyzed and the pixels on the two sides of the line to be analyzed is larger (the gray of the pixel point on the line to be analyzed is shallow, and the gray of the pixel point in the neighborhood around the line to be analyzed is deep), the fold value of the line to be analyzed is larger. In this embodiment, a wrinkle threshold is obtained by using an atrazine threshold segmentation algorithm, and a straight line to be analyzed, whose wrinkle value is greater than the wrinkle threshold, is recorded as a wrinkle line segment.
Then, it is considered that the ear bands on both sides of the normal sanitary mask without defects can block part of straight lines belonging to the range of the fold area, namely, the situation that the straight lines belong to the same straight line but a plurality of spaced line segments are extracted in the process of extracting the straight lines can occur. Based on which the resulting straight lines are subjected to collinear detection.
Acquiring a linear equation of a straight line where each wrinkle line segment is located, calculating a parameter offset value between two wrinkle line segments according to a slope and an intercept corresponding to the linear equation of each wrinkle line segment, and expressing the parameter offset value by a formula as follows:
Figure 446394DEST_PATH_IMAGE008
wherein, the first and the second end of the pipe are connected with each other,
Figure 422441DEST_PATH_IMAGE009
representing the parameter offset value between the wrinkle line segment i and the wrinkle line segment j,
Figure 256753DEST_PATH_IMAGE010
and
Figure 759278DEST_PATH_IMAGE011
respectively represents the slope and intercept corresponding to the linear equation of the straight line on which the fold line segment i is positioned,
Figure 563286DEST_PATH_IMAGE012
and
Figure 839678DEST_PATH_IMAGE013
respectively representing the slope and intercept corresponding to the straight line equation of the straight line on which the wrinkle line segment j is positioned.
Finally, in this embodiment, the value of the parameter offset threshold is set to 5. If the parameter offset value between the two fold line segments is smaller than the parameter offset threshold value, the two fold line segments are marked as collinear line segments, and it can be shown that the two line segments belong to the same straight line.
Because the ear belt can shield part of straight lines in the range of the wrinkle area, and further the wrinkle straight line with special gray scale characteristics is divided into a plurality of line segments, the ear belt missing defect and other defects can be distinguished according to the number of the segments into which the wrinkle straight line is divided. If no or only two fold line segments are collinear fold line segments of the same straight line, the mask has the defect of ear band loss. When the ear belts on the left side and the right side of the sanitary mask are all lost, the situation that the ear belt lines shield straight lines in the fold area range cannot exist on the mask gray level image, so the detected straight lines are all complete fold straight lines, and no fold line segment is on the same straight line. When the mask is only provided with the left ear strap or the right ear strap, only one ear strap line is arranged on the gray level image of the mask to divide the straight line in the fold area into two parts, so that two fold lines are arranged on the same straight line.
If more than two fold line segments are collinear fold line segments of the same straight line, acquiring two collinear fold line segment end points which are closest to the same straight line; determining an initial growing point according to the end point, and obtaining a wrinkle region by using a region growing algorithm; and calculating the mean value of the gray values of the pixel points on all collinear fold line segments, and performing threshold segmentation to obtain the nose bridge area after re-assigning the pixel values of the pixel points in the fold area by using the mean value of the gray values.
Specifically, if more than two fold line segments are collinear fold line segments of the same straight line, it indicates that the ear band has a partial straight line in the range of the fold area which causes the occlusion of the sanitary mask, and at least three fold line segments are on the same straight line, which indicates that the left and right ear bands of the currently detected sanitary mask are not missing, so that other types of defects can be identified.
And acquiring two collinear fold line segment end points which are closest to each other on the same straight line, connecting the two collinear fold line segment end points to obtain an ear belt line segment, and calculating the gray average value of pixel points on the ear belt line segment to obtain a fold threshold. In this embodiment, the end points of the two collinear fold line segments closest to each other are taken as the intersection points of the ear band and the fold line in the fold region. Respectively obtaining four pixel points which are vertically above and below the end points of the two collinear fold line segments by preset lengths, and recording the four pixel points as initial growth points; the growth rule is set as follows: the gray value of the pixel points is larger than the folding threshold, and the gray value difference value between the pixel points is smaller than a preset threshold; and obtaining a wrinkle region by using a region growing algorithm according to the initial growing point and the growing rule. The region growing method is a well-known technique and will not be described in detail herein.
The preset length obtaining method comprises the following steps:
and acquiring intercept parameters corresponding to a linear equation of the straight lines where the collinear fold line segments are located, calling the same straight line where the collinear fold line segments belong as a fold straight line, calculating the mean value of the intercept parameters corresponding to all the collinear fold line segments on the fold straight line, and obtaining the preset length according to one half of the difference value of the mean values of the intercept parameters corresponding to the preset number of fold straight lines.
It should be noted that, because the normal pose is adopted for photographing the sanitary mask, the fold straight line is approximately in the horizontal direction, and the distance between the two fold straight lines can be represented by the difference between the intercepts corresponding to the linear equation. According to practical situations, in the common medical disposable hygienic mask studied in this embodiment, there are two specific lines with special gray scale features in the central area of the mask, and the preset number of fold lines are two fold lines.
And calculating the gray average value of the pixel points on all collinear fold line segments, and re-assigning the pixel values of the pixel points in the fold area by using the average value to obtain the mask filling image. The mask filling image is used for removing a wrinkle area with deep gray scale, only an ear band area and a nose bridge strip area are left, and an implementer can also select other suitable pixel values to fill the wrinkle area, intend to remove the wrinkle area, only the ear band area and the nose bridge strip area are left, and further identify other defects. And (4) segmenting the mask filling image by using an Otsu threshold segmentation method to obtain a nose bridge strip region and an earband region.
And step four, extracting a straight line segment in the nose bridge strip area, wherein if the length of the straight line segment is smaller than a first line segment threshold value, the mask has the defect that the nose bridge strip is missing, and if the length of the straight line segment is smaller than a second line segment threshold value, the mask has the defect that the nose bridge strip is short.
First, considering a case where an intersection may occur between the ear band and the nose bridge strip, the intersection in the region obtained by image segmentation is identified and cross-divided. And extracting straight line segments in the nose bridge strip area by using a Hough transform straight line detection algorithm, wherein if the lengths of the extracted straight line segments are smaller than a first line segment threshold value, the defect that the nose bridge strip is missing is caused if no longer straight line segment exists in the nose bridge strip area. If the lengths of the extracted straight line sections are smaller than the threshold value of the second line section, the fact that the straight line sections exist in the nose bridge strip area is proved, but the lengths of the straight line sections are not long, and the defect that the nose bridge strip of the sanitary mask is short and small is caused.
In this embodiment, the value of the first line segment threshold is 0.1n, n is the size of the acquisition frame when the mask image is acquired, the value of the second line segment threshold is 0.6n, and the implementer of the value of the line segment threshold can also set the length of the nose bridge strip relative to the mask according to the production standard referred by the mask manufacturer.
The straight line segment which is larger than the threshold value of the second line segment is obtained and is marked as a nose bridge strip straight line, namely, a straight line with a certain length exists on the mask, and the mask is indicated to contain the nose bridge strip, so that other types of defects can be identified. Because the nose bridge strip has certain width, then need find the complete region at nose bridge strip place to take the parting line that is on a parallel with nose bridge strip straight line and the same with its length in its both sides as the benchmark with nose bridge strip straight line, increase gradually the distance of parting line and nose bridge strip straight line. If the number of the pixels intersected with the nose bridge strip area by the dividing line is larger than 0.5n, the distance between the dividing line and the nose bridge strip straight line is continuously increased, and otherwise, the dividing line is considered to reach the boundary of the nose bridge strip area. And connecting corresponding end points of the finally obtained two side dividing lines to obtain a complete nose bridge strip area. And the set pixel value is selected to fill the finally obtained nose bridge strip area so as to remove the area containing the nose bridge strip, so that the area with deeper gray scale in the image only remains the ear zone area.
And then, classifying the ear band regions by using a DBSCAN clustering algorithm to obtain independent and mutually disjoint ear band regions which are respectively marked as a left ear band type and a right ear band type. In the present embodiment, the radius Eps =3 is set, and the other is the number threshold value MinPts =5. Since the ear band region may intersect the nose bridge strip, removing the nose bridge strip region results in the ear band region being divided into segments. It is necessary to merge the ear band regions belonging to the same ear band. Namely, after the ear zone areas in the same category are combined, the left ear zone line and the right ear zone line are respectively obtained by utilizing image thinning. The image thinning is a short term for a process of reducing lines of an image from a multi-pixel width to a unit pixel width, and is a known technology, and is not described herein in detail.
Whether the ear band area has the ear band knot or not can be judged by utilizing whether the cross point exists on the ear band line or not. Neighborhood pixels in eight neighborhoods of all pixels on the left ear zone line and the right ear zone line are respectively obtained, and if the neighborhood pixels corresponding to the pixels with the number larger than the preset number belong to the left ear zone line and the right ear zone line, the mask has the defect of ear zone knots. In this embodiment, the value of the preset number is 2, that is, in eight neighborhoods of pixels on the ear zone line, if more than two neighborhood pixels also belong to the ear zone line, it is indicated that the pixel is a node, that is, the mask has an ear zone node defect.
Finally, because left side and right side ear zone are symmetrical structure, the direction in the ear zone region that the corresponding position is different, and the direction change in the adjacent ear zone region of same ear zone is less, calculates its hessian matrix that corresponds to each pixel in every ear zone region in this embodiment, specifically is:
Figure 980809DEST_PATH_IMAGE018
wherein, the first and the second end of the pipe are connected with each other,
Figure DEST_PATH_IMAGE019
Figure 885312DEST_PATH_IMAGE020
Figure DEST_PATH_IMAGE021
and
Figure 938849DEST_PATH_IMAGE022
are respectively the second order difference at the pixel point, an
Figure DEST_PATH_IMAGE023
And then calculating the principal component direction of the hessian matrix H of the pixel points by adopting a principal component analysis method to serve as the direction of the pixel points, calculating the direction angle, calculating the mean value of the direction angles corresponding to all the pixel points in the earzone region to serve as the average direction angle of the earzone region, and taking the earzone region with the absolute value of the difference value of the average direction angles of the earzone region being smaller than the threshold value of 30 degrees as the adjacent earzone region on the same side.
Dividing the ear zone area into a left ear zone and a right ear zone based on the mean value of the column coordinates of the ear zone area containing pixel points, and calculating the maximum and minimum row coordinates of the left ear zone containing all the pixel pointsThe values are used as the anchor points for the left ear strap weld. If the minimum row coordinate deviates
Figure 296012DEST_PATH_IMAGE024
Or maximum row coordinate deviation
Figure DEST_PATH_IMAGE025
(manufacturers can set corresponding values according to the mask structure designed by manufacturers), the defect that the left ear band has welding spot deviation is shown.
Meanwhile, calculating the mean value of the column coordinates of the left ear band pixel points with the maximum and minimum row coordinates corresponding to the left ear band pixels respectively to judge whether the ear band welding points are broken or not. So long as there is a column coordinate mean value in
Figure 975255DEST_PATH_IMAGE026
,
Figure DEST_PATH_IMAGE027
]And the ear belt of the mask is proved to be broken. The same defect judgment method is adopted for the right ear belt.
The above-mentioned embodiments are only used for illustrating the technical solutions of the present application, and not for limiting the same; although the present application has been described in detail with reference to the foregoing embodiments, it should be understood by those of ordinary skill in the art that: the technical solutions described in the foregoing embodiments may still be modified, or some technical features may be equivalently replaced; such modifications and substitutions do not depart from the spirit and scope of the embodiments of the present application, and they should be construed as being included in the present application.

Claims (8)

1. A sanitary mask defect identification method is characterized by comprising the following steps:
acquiring a mask gray image, and extracting a straight line on the mask gray image to be recorded as a straight line to be analyzed; calculating the gray value average value of pixel points on each straight line to be analyzed to obtain a first gray value average value; respectively marking lines which pass through each pixel point on the straight line to be analyzed and are vertical to the straight line to be analyzed as limb lines corresponding to each pixel point; respectively calculating the mean value of the gray values of the pixel points intersected with the corresponding limb line on the two sides of each pixel point on the straight line to be analyzed to obtain a second gray mean value and a third gray mean value; calculating the wrinkle value of the straight line to be analyzed according to the first, second and third gray level mean values;
setting a fold threshold, and recording a straight line to be analyzed with the fold value larger than the fold threshold as a fold line segment; acquiring a linear equation of a straight line where each wrinkle line segment is located, and calculating a parameter offset value between the two wrinkle line segments according to a slope and an intercept corresponding to the linear equation of each wrinkle line segment; marking the fold line segment with the parameter offset value smaller than the parameter offset threshold value as a collinear fold line segment; if no or only two fold line segments are collinear fold line segments of the same straight line, the mask has the defect of ear band loss;
if more than two fold line segments are collinear fold line segments of the same straight line, acquiring two collinear fold line segment end points which are closest to the same straight line; determining an initial growing point according to the end point, and obtaining a wrinkle region by using a region growing algorithm; calculating the mean value of the gray values of the pixel points on all collinear fold line segments, and performing threshold segmentation to obtain a nose bridge region after re-assigning the pixel values of the pixel points in the fold region by using the mean value of the gray values;
and extracting a straight line segment in the nose bridge strip area, wherein if the length of the straight line segment is smaller than a first line segment threshold value, the mask has the defect that the nose bridge strip is missing, and if the length of the straight line segment is smaller than a second line segment threshold value, the mask has the defect that the nose bridge strip is short.
2. The sanitary mask defect identification method according to claim 1, wherein the straight line to be analyzed and the straight line segment in the nose bridge strip region are extracted by Hough transform straight line detection.
3. The method for recognizing the defect of the sanitary mask according to claim 1, wherein the method for obtaining the wrinkle value comprises the following specific steps:
Figure 954384DEST_PATH_IMAGE002
wherein the content of the first and second substances,
Figure DEST_PATH_IMAGE003
representing the wrinkle value of the line to be analyzed,
Figure 69233DEST_PATH_IMAGE004
the mean value of the gray values of the pixel points on the straight line to be analyzed is represented, p represents the median value of the gray values of the pixel points on the mask gray image,
Figure DEST_PATH_IMAGE005
and
Figure 665299DEST_PATH_IMAGE006
respectively representing the mean value of the gray values of the pixel points intersected with the corresponding limb lines on the two sides of each pixel point on the straight line to be analyzed.
4. The method for identifying the defect of the sanitary mask according to claim 1, wherein the method for obtaining the parameter offset value comprises the following steps:
Figure 611521DEST_PATH_IMAGE008
wherein, the first and the second end of the pipe are connected with each other,
Figure DEST_PATH_IMAGE009
representing the parameter offset value between the wrinkle line segment i and the wrinkle line segment j,
Figure 431578DEST_PATH_IMAGE010
and
Figure DEST_PATH_IMAGE011
the slopes corresponding to the linear equation of the straight line on which the wrinkle line segment i is locatedAnd the intercept of the light beam, and,
Figure 502564DEST_PATH_IMAGE012
and
Figure DEST_PATH_IMAGE013
respectively representing the slope and intercept corresponding to the straight line equation of the straight line on which the wrinkle line segment j is positioned.
5. The method for recognizing the defect of the sanitary mask according to claim 1, wherein the step of determining an initial growing point according to the end point and obtaining a wrinkle region by using a region growing algorithm specifically comprises the steps of:
connecting the end points of the two collinear fold line segments to obtain an ear belt line segment, and calculating the gray average value of pixel points on the ear belt line segment to obtain a fold threshold; respectively obtaining pixel points with preset lengths vertically above and below the end points of the two collinear fold line segments, and marking the pixel points as initial growth points; the growth rule is set as follows: the gray value of the pixel points is greater than the wrinkle threshold, and the difference value of the gray values between the pixel points is smaller than a preset threshold; and obtaining a wrinkle region by using a region growing algorithm according to the initial growing point and the growing rule.
6. The sanitary mask defect identification method according to claim 5, wherein the preset length is obtained by:
and acquiring intercept parameters corresponding to a linear equation of a straight line where the collinear fold line segments are located, calling the same straight line where the collinear fold line segments belong as a fold straight line, calculating the mean value of the intercept parameters corresponding to all the collinear fold line segments on the fold straight line, and obtaining the preset length according to the difference value of the mean values of the intercept parameters corresponding to the preset number of fold straight lines.
7. The sanitary mask defect identification method according to claim 1, wherein the reassigning the pixel values of the pixel points in the wrinkle region by using the gray value mean value further comprises: and performing threshold segmentation to obtain an ear zone region.
8. The method for recognizing the defect of the hygienic mask as claimed in claim 7, further comprising:
classifying the ear zone regions by using a clustering algorithm to obtain a left ear zone class and a right ear zone class; combining the ear zone areas in the same category, and respectively obtaining a left ear zone line and a right ear zone line by utilizing image thinning; neighborhood pixel points in eight neighborhoods of all pixel points on the left ear zone line and the right ear zone line are respectively obtained, and if the neighborhood pixel points corresponding to all the pixel points with the number larger than the preset number belong to the left ear zone line and the right ear zone line, the mask has the defect of ear zone knots.
CN202211138972.8A 2022-09-19 2022-09-19 Sanitary mask defect identification method Withdrawn CN115272299A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202211138972.8A CN115272299A (en) 2022-09-19 2022-09-19 Sanitary mask defect identification method

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202211138972.8A CN115272299A (en) 2022-09-19 2022-09-19 Sanitary mask defect identification method

Publications (1)

Publication Number Publication Date
CN115272299A true CN115272299A (en) 2022-11-01

Family

ID=83756710

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202211138972.8A Withdrawn CN115272299A (en) 2022-09-19 2022-09-19 Sanitary mask defect identification method

Country Status (1)

Country Link
CN (1) CN115272299A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116660269A (en) * 2023-05-24 2023-08-29 昆山祺力达电子材料有限公司 PE film fold detection system

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116660269A (en) * 2023-05-24 2023-08-29 昆山祺力达电子材料有限公司 PE film fold detection system
CN116660269B (en) * 2023-05-24 2023-12-26 昆山祺力达电子材料有限公司 PE film fold detection system

Similar Documents

Publication Publication Date Title
WO2020133046A1 (en) Defect detection method and device
CN109993099A (en) A kind of lane line drawing recognition methods based on machine vision
CN104537651B (en) Proportion detecting method and system for cracks in road surface image
CN103674965A (en) Classification and detection method of wafer appearance defects
CN112507865B (en) Smoke identification method and device
CN112149543B (en) Building dust recognition system and method based on computer vision
DE112018004661T5 (en) Shadow detection method for a surveillance video image, system thereof, and shadow removal method
CN115330795B (en) Cloth burr defect detection method
CN115311310B (en) Method for extracting printed patterns of textiles through graph cutting
CN115272299A (en) Sanitary mask defect identification method
CN117253024B (en) Industrial salt quality inspection control method and system based on machine vision
CN115115642A (en) Strip steel scab defect detection method based on image processing
CN114331986A (en) Dam crack identification and measurement method based on unmanned aerial vehicle vision
CN115797361B (en) Aluminum template surface defect detection method
CN115266732B (en) Carbon fiber tow defect detection method based on machine vision
CN108171693B (en) Method for automatically detecting inferior mushrooms
CN117635609B (en) Visual inspection method for production quality of plastic products
CN115049667B (en) Gear defect detection method
CN114972575A (en) Linear fitting algorithm based on contour edge
CN111753794A (en) Fruit quality classification method and device, electronic equipment and readable storage medium
CN109544513A (en) A kind of steel pipe end surface defect extraction knowledge method for distinguishing
CN104168462B (en) Camera scene change detection method based on image angle point set feature
CN106650735B (en) A kind of LED character automatic positioning recognition methods
CN113689431B (en) Industrial product appearance defect detection method and device
CN113808084A (en) Model-fused online tobacco bale surface mildew detection method and 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
WW01 Invention patent application withdrawn after publication

Application publication date: 20221101