CN115063400A - Musical instrument production defect detection method using visual means - Google Patents

Musical instrument production defect detection method using visual means Download PDF

Info

Publication number
CN115063400A
CN115063400A CN202210859624.3A CN202210859624A CN115063400A CN 115063400 A CN115063400 A CN 115063400A CN 202210859624 A CN202210859624 A CN 202210859624A CN 115063400 A CN115063400 A CN 115063400A
Authority
CN
China
Prior art keywords
gray
image
pixel points
value
defect
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
CN202210859624.3A
Other languages
Chinese (zh)
Other versions
CN115063400B (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.)
Shandong Zhongyi Yinmei Equipment Co ltd
Original Assignee
Shandong Zhongyi Yinmei Equipment 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 Shandong Zhongyi Yinmei Equipment Co ltd filed Critical Shandong Zhongyi Yinmei Equipment Co ltd
Priority to CN202210859624.3A priority Critical patent/CN115063400B/en
Publication of CN115063400A publication Critical patent/CN115063400A/en
Application granted granted Critical
Publication of CN115063400B publication Critical patent/CN115063400B/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
    • G06T7/0008Industrial image inspection checking presence/absence
    • 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
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T7/00Image analysis
    • G06T7/10Segmentation; Edge detection
    • G06T7/194Segmentation; Edge detection involving foreground-background segmentation
    • 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

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Vision & Pattern Recognition (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Theoretical Computer Science (AREA)
  • Quality & Reliability (AREA)
  • Image Analysis (AREA)

Abstract

The invention relates to the field of image processing, in particular to a musical instrument production defect detection method by using a visual means, which comprises the following steps: acquiring a panel gray scale image of the guitar to be detected; equally dividing the panel gray level image according to different block sizes, and acquiring an optimal block image by using the block size when the block effect value is maximum; screening the optimal block image to obtain a first block image suspected of having defects; setting different segmentation thresholds to segment the pixels in the first block image, and obtaining defect segmentation effect values under different segmentation thresholds by utilizing the possibility that suspected defect pixels in the first block image are misjudged under different segmentation thresholds and the number of suspected defect pixels in all the first block images; and determining defect pixel points in the first block image by using the segmentation threshold value when the defect segmentation effect value is maximum, and further obtaining a defect area in the guitar panel to be detected. The method is used for detecting the defects of the musical instruments, and can improve the detection accuracy.

Description

Musical instrument production defect detection method using visual means
Technical Field
The invention relates to the field of image processing, in particular to a musical instrument production defect detection method by using a visual means.
Background
Along with the continuous improvement of living standard, people's amusement life is more and more abundant. Guitars are also enjoyed by more and more people as a common instrument in recreational life. The quality of the guitar's various components directly affects the quality of the guitar. In particular, since the guitar panel has a large material area and a high possibility of defects, it is important to detect defects in the guitar panel.
The existing guitar panel defect detection method mainly comprises a pixel-based target segmentation algorithm: and setting segmentation parameters based on the characteristics of the pixels, and segmenting the guitar panel to obtain a defect area.
However, the existing target segmentation algorithm has fixed segmentation parameters, poor segmentation effect and easy target misjudgment. There is therefore a need for a method for improving the accuracy of guitar panel defect detection.
Disclosure of Invention
The invention provides a musical instrument production defect detection method by using a visual means, which aims to solve the problem of low accuracy of the existing musical instrument production defect detection method.
In order to achieve the above object, the present invention adopts the following technical solution, a method for detecting musical instrument production defects by using a visual means, comprising:
acquiring a panel gray scale image of the guitar to be detected;
equally dividing the panel gray-scale image according to different block sizes, and calculating to obtain a block effect value of the panel gray-scale image under each block size by using the gray value mean value of all pixel points in the panel gray-scale image, the number of block images under each block size, the gray value mean value of all pixel points in each block image and the variance of the gray values of all pixel points in the block image;
taking the corresponding block size when the block effect value is maximum as the optimal block size, and equally dividing the panel gray-scale image by using the optimal block size to obtain the optimal block image of the panel gray-scale image;
screening the optimal block images with larger variance of gray values of all pixel points from all the optimal block images to obtain a first block image suspected of having defects;
setting different segmentation thresholds to segment pixel points in the first block image to obtain suspected defect pixel points in the first block image under different segmentation thresholds;
calculating to obtain defect segmentation effect values under different segmentation thresholds by using the possibility that suspected defect pixel points in the first segmented images under different segmentation thresholds are misjudged and the number of suspected defect pixel points in all the first segmented images;
taking a corresponding segmentation threshold value when the defect segmentation effect value is maximum as an optimal segmentation threshold value, segmenting pixel points in the first block images by using the optimal segmentation threshold value, and determining defect pixel points in each first block image;
and obtaining a defect area in the guitar panel to be detected according to the defect pixel points in the first block image.
According to the method for detecting the musical instrument production defects by using the visual means, the optimal block image of the panel gray-scale image is obtained as follows:
setting an initial block size, and performing first-time equal division on the panel gray-scale image according to the initial block size to obtain all initial block images;
calculating the mean value of gray values of all pixel points in the panel gray image;
calculating the mean value of the gray values of all pixel points in each initial block image and the variance of the gray values of all pixel points in the initial block image;
calculating to obtain a blocking effect value of the panel gray-scale image under the initial blocking size by using the number of the initial blocking images, the gray value mean value of all pixel points in the panel gray-scale image, the gray value mean value of all pixel points in each initial blocking image and the variance of the gray values of all pixel points in the initial blocking image;
obtaining the blocking effect value of the panel gray level image under each blocking size according to the mode, obtaining the corresponding blocking size when the blocking effect value is maximum, and taking the blocking size as the optimal blocking size;
and equally dividing the panel gray-scale image according to the optimal block size to obtain the optimal block image of the panel gray-scale image.
According to the method for detecting the musical instrument production defects by using the visual means, suspected defect pixel points in the first block images under different segmentation thresholds are obtained according to the following mode:
calculating the variance of the gray values of all pixel points in each optimal block image;
sorting the variances of the gray values of all the pixel points in each optimal block image from small to large to obtain a variance sequence;
setting a variance threshold, screening out the variance which is greater than the variance threshold in the variance sequence, and taking the optimal block image corresponding to the variance as a first block image suspected of having defects;
judging the gray value of each pixel point in the first block image: when the gray value of a pixel point is greater than the mean value of the gray values of all the pixel points in the panel gray image, the pixel point is a first background pixel point; when the gray value of a pixel point is less than or equal to the mean value of the gray values of all the pixel points in the panel gray image, the pixel point is a first defective pixel point;
and setting different segmentation thresholds, and segmenting the pixel points in the first block image according to the different segmentation thresholds to obtain suspected defect pixel points and suspected background pixel points in the first block image under different segmentation thresholds.
According to the method for detecting the musical instrument production defects by using the visual means, the process of segmenting the pixel points in the first segmented image according to different segmentation thresholds is as follows:
selecting any pixel point in the first block image, and calculating the gray value difference value of the pixel point and each pixel point in the neighborhood of the pixel point;
judging the gray value difference between the pixel point and each pixel point in the neighborhood: when the absolute value of the gray value difference value between a pixel point and a pixel point in the neighborhood of the pixel point is smaller than a segmentation threshold, dividing the type of the pixel point in the neighborhood of the pixel point into the type of the pixel point, otherwise, dividing the type into other types, and sequentially judging the type of the pixel point in the neighborhood of the pixel point to obtain the pixel point of which the type is judged and the rest of pixel points in the first block image;
and judging the types of the pixel points in the neighborhoods of the rest pixel points according to the mode until the types of all the pixel points in the first block image are judged, and finishing the segmentation of the pixel points in the first block image.
According to the method for detecting the musical instrument production defects by using the visual means, the defect segmentation effect values under different segmentation threshold values are obtained as follows:
calculating the mean value of gray values of all suspected background pixel points in the first block image;
counting the number of suspected defective pixel points in the neighborhood of the suspected defective pixel points in the first block image;
calculating the possibility that the suspected defect pixel points are misjudged by utilizing the gray value variance of all the pixel points in the first block image where the suspected defect pixel points are located, the gray value mean value of all the suspected background pixel points, the gray value of the suspected defect pixel points and the number of the suspected defect pixel points in the neighborhood of the suspected defect pixel points;
and calculating to obtain defect segmentation effect values under different segmentation thresholds by using the possibility of misjudging the suspected defect pixel points and the number of the suspected defect pixel points in all the first block images.
According to the method for detecting the musical instrument production defects by using the visual means, the defect area in the guitar panel to be detected is obtained as follows:
taking a corresponding segmentation threshold value when the defect segmentation effect value is maximum as an optimal segmentation threshold value, and segmenting pixel points in the first block images by using the optimal segmentation threshold value to obtain defect pixel points in each first block image;
acquiring all defect connected domains according to defect pixel points in each first block image;
setting a size threshold of a connected domain, and judging each defect connected domain: and when the size of the defect connected domain is larger than the threshold value, the defect connected domain is a defect area in the guitar panel to be detected.
According to the method for detecting the musical instrument production defects by using the visual means, the panel gray-scale image of the guitar to be detected is acquired according to the following method:
acquiring a guitar panel gray scale image;
calculating to obtain the suspected defect degree of the guitar panel gray scale image by using the variance of the gray scale values of all pixel points in the guitar panel gray scale image and the difference value between the maximum value and the minimum value in the neighborhood gray scale value mean value of each pixel point;
judging whether the guitar panel has defects or not by using the suspected defect degree of the guitar panel gray scale image, and acquiring the panel gray scale image of the guitar to be detected.
According to the method for detecting the musical instrument production defects by using the visual means, the guitar panel gray-scale map is acquired as follows:
collecting guitar panel images;
performing semantic segmentation on the guitar panel image to obtain a guitar panel area image;
and carrying out graying processing on the image of the guitar panel area to obtain a guitar panel gray scale image.
According to the method for detecting the musical instrument production defects by using the visual means, the suspected defect degree of the guitar panel gray scale map is obtained as follows:
setting neighborhood size, and calculating the gray value mean value of all pixel points in the neighborhood size range of each pixel point in the guitar panel gray level image to obtain the neighborhood gray value mean value corresponding to each pixel point;
acquiring the maximum value and the minimum value in the neighborhood gray value mean values corresponding to all the pixel points;
calculating the variance of gray values of all pixel points in the guitar panel gray image;
and calculating to obtain the suspected defect degree of the guitar panel gray-scale image by using the variance of the gray values of all pixel points in the guitar panel gray-scale image and the difference value of the maximum value and the minimum value in the neighborhood gray-scale value mean value of each pixel point.
The method for detecting musical instrument production defects by using a visual means comprises the following steps of judging whether a guitar panel has defects or not by using suspected defect degrees of a guitar panel gray scale map:
setting a suspected defect degree threshold value, and judging the suspected defect degree of the guitar panel gray scale image: when the suspected defect degree of the guitar panel gray scale image is less than or equal to a suspected defect degree threshold value, judging that the gray scale image has no defects; and when the suspected defect degree of the guitar panel gray scale image is larger than the threshold value of the suspected defect degree, taking the gray scale image as the panel gray scale image of the guitar to be detected.
The invention has the beneficial effects that: the method firstly utilizes the characteristics of the defects to preliminarily screen out the panels suspected of having the defects, thereby reducing unnecessary calculation analysis and improving the detection rate. Then, according to the image blocking effect, the optimal blocking size is determined, so that the segmentation effect is better; and finally, constructing a segmentation effect expression by utilizing the characteristic that misjudgment is easy to occur in target segmentation, and obtaining the optimal segmentation effect by changing segmentation parameters, so that more accurate segmentation of pixel points in the defect region is realized, and more accurate defect regions are obtained.
Drawings
In order to more clearly illustrate the embodiments of the present invention or the technical solutions in 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 for those skilled in the art, other drawings can be obtained according to the drawings without creative efforts.
Fig. 1 is a schematic flow chart of a method for detecting defects in production of musical instruments by using a visual means according to an embodiment of the present invention.
Detailed Description
The technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are only a part of the embodiments of the present invention, and not all of the embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
Examples
In the production process of the guitar, the quality of the panel directly affects the quality of the guitar, so that defect detection needs to be carried out on the panel. In the embodiment, the defective pixel points are segmented by searching the pixel points, and meanwhile, the optimal segmentation effect is obtained by changing the segmentation parameters, so that accurate defective pixel points are obtained, and more accurate guitar panel defect detection is realized.
An embodiment of the method for detecting musical instrument production defects by using visual means of the present invention, as shown in fig. 1, comprises:
s101, acquiring a panel gray scale image of the guitar to be detected.
A camera is arranged above a detection platform of the guitar panel, the camera is started when the detection is started, images of the guitar panel are shot, and the images need to be preprocessed for facilitating subsequent processing.
Firstly, obtaining a panel area image according to semantic segmentation, then carrying out graying on the panel area image, and carrying out subsequent calculation on the basis of the obtained panel area gray image.
It should be noted that: for identifying a defect area in a gray scale map of a panel area, firstly, a defect pixel point needs to be identified, in the embodiment, the defect pixel point is segmented by searching the pixel point, and meanwhile, a segmentation effect expression is constructed aiming at the condition of segmentation misjudgment; because the pixel segmentation parameters directly influence the segmentation effect, the optimal segmentation effect is obtained under the condition of changing the parameters, and the most accurate defective pixel point is obtained.
It should be noted that: for a large amount of guitar panel detection, firstly, preliminary judgment is carried out in a large amount of acquired guitar panel gray level maps to obtain guitar panel gray level maps possibly with defects, and the guitar panel gray level maps possibly with defects are further analyzed, so that unnecessary calculation analysis is reduced, and the detection rate is improved.
The defects in the guitar panel are mainly expressed as cracks and holes on the surface, so that the gray value of pixel points of the defects is low, and meanwhile, the characteristics in the guitar panel gray image are expressed as the difference of the gray value of the pixel points and the aggregation of difference pixel points, so that according to the characteristics of the pixel points, the characteristic quantity is firstly constructed to express the suspected defect degree of the guitar panel gray image.
The suspected defect degree construction process of the guitar panel gray scale map is as follows:
1. setting neighborhood size, calculating the gray value mean value of all pixel points in the neighborhood size range of each pixel point in the guitar panel gray level image, and obtaining the neighborhood gray value mean value corresponding to each pixel point.
2. And acquiring the maximum value and the minimum value in the neighborhood gray value mean values corresponding to all the pixel points.
3. And calculating the variance of the gray values of all pixel points in the guitar panel gray image.
4. Calculating to obtain the suspected defect degree of the guitar panel gray level image:
Figure 648411DEST_PATH_IMAGE002
wherein the content of the first and second substances,
Figure DEST_PATH_IMAGE003
in the gray scale diagram representing the guitar panel
Figure 371779DEST_PATH_IMAGE004
Each pixel point
Figure DEST_PATH_IMAGE005
In the neighborhood of
Figure 814393DEST_PATH_IMAGE006
The gray value of each pixel point is calculated,
Figure DEST_PATH_IMAGE007
to represent
Figure 627497DEST_PATH_IMAGE005
The number of pixel points in the neighborhood is,
Figure 483457DEST_PATH_IMAGE007
given according to the practical experience that,
Figure 273165DEST_PATH_IMAGE008
denotes the first
Figure 632603DEST_PATH_IMAGE004
Of a pixel
Figure 898499DEST_PATH_IMAGE005
Mean of grey values of pixels in the neighborhood, i.e. mean of grey values of a region, in guitar panel grey maps
Figure 694285DEST_PATH_IMAGE008
The greater the difference between, the more likely there is a defect in the guitar panel gray scale map,
Figure DEST_PATH_IMAGE009
the larger the value of the maximum difference of the mean values of the gray values of the areas in the guitar panel gray map, the more likely defects exist in the guitar panel gray map.
Figure 71040DEST_PATH_IMAGE010
The variance of the gray values of all the pixel points in the guitar panel gray image is represented, the difference of the gray values of the pixel points in the guitar panel gray image is reflected,
Figure 550563DEST_PATH_IMAGE010
the larger the difference of the gray values of the pixel points is, the more possible defects exist in the guitar panel gray image.
Figure DEST_PATH_IMAGE011
Indicating the suspected defect level of the guitar panel gray scale map,
Figure 206935DEST_PATH_IMAGE011
the larger the size, the greater the degree of doubtful.
Setting a threshold value according to actual experience for suspected defect degree of guitar panel gray scale map
Figure 975170DEST_PATH_IMAGE012
When it comes to
Figure DEST_PATH_IMAGE013
Indicating that the guitar panel gray scale map may be defective, further analysis is required to determine the presence of defects. Thus, a gray-scale image of the panel of the guitar to be detected is obtained.
S102, the panel gray-scale image is equally divided according to different block sizes, and the block effect value of the panel gray-scale image under each block size is calculated by utilizing the gray value mean value of all pixel points in the panel gray-scale image, the number of block images under each block size, the gray value mean value of all pixel points in each block image and the variance of the gray values of all pixel points in the block image.
It should be noted that: according to the target segmentation method for pixel point searching, it is required to ensure that all block images with defects do not exist in all block images, because pixel point searching is mainly based on differences among pixel points, if all block images with defects exist, the differences among the pixel points are small, and target defect pixel points cannot be obtained through searching. The size of the image patch needs to be determined for different segmented objects.
Firstly, equally dividing a panel gray image of a guitar to be detected to obtain all block images, which specifically comprises the following steps:
1. and setting an initial block size according to actual experience, and performing primary equal division on the panel gray-scale image according to the initial block size to obtain all initial block images.
2. And calculating the mean value of the gray values of all the pixel points in the panel gray image.
3. And calculating the mean value of the gray values of all the pixel points in each initial block image and the variance of the gray values of all the pixel points in the initial block image.
4. Constructing a blocking effect expression:
Figure DEST_PATH_IMAGE015
wherein, the first and the second end of the pipe are connected with each other,
Figure 342567DEST_PATH_IMAGE016
is shown as
Figure DEST_PATH_IMAGE017
The blocking effect value at the time of changing the blocking size the second time.
Figure 899100DEST_PATH_IMAGE018
Is shown as
Figure 506799DEST_PATH_IMAGE017
The number of block images at the time of changing the block size,
Figure DEST_PATH_IMAGE019
representing the mean of the gray values of all the pixel points in the panel gray map,
Figure 27910DEST_PATH_IMAGE020
is shown as
Figure 995735DEST_PATH_IMAGE017
When the block size is changed a second time, the
Figure DEST_PATH_IMAGE021
The mean value of the gray values of all the pixel points in each block image,
Figure 184271DEST_PATH_IMAGE022
reflect the first
Figure 962871DEST_PATH_IMAGE021
The difference between the mean value of the gray values of all the pixel points in the block image and the mean value of the gray values of all the pixel points in the panel gray map,
Figure 253169DEST_PATH_IMAGE022
the larger, the
Figure 775417DEST_PATH_IMAGE021
The greater the likelihood of a defect within an individual tile image. In order to ensure that all the block images are not defective, the gray value difference of pixel points in the defective block images needs to be large, that is, the variance of the block images is large, and
Figure DEST_PATH_IMAGE023
is shown as
Figure 552880DEST_PATH_IMAGE021
The variance of the gray values of all the pixels in each block image is calculated by
Figure 954912DEST_PATH_IMAGE024
And calculating the difference sum of each block image as a weight value, and further calculating a block effect value. By changing the size of the block size, the block effect values under different block sizes are obtained
Figure 716194DEST_PATH_IMAGE016
Figure 42133DEST_PATH_IMAGE016
The larger the value, the better the blocking effect.
5. And obtaining the blocking effect values under different blocking sizes according to the mode.
S103, taking the corresponding block size when the block effect value is maximum as the optimal block size, and equally dividing the panel gray-scale image by using the optimal block size to obtain the optimal block image of the panel gray-scale image.
And acquiring the corresponding block size when the block effect value is maximum, and taking the block size as the optimal block size.
To obtain
Figure 953064DEST_PATH_IMAGE016
The corresponding block size is optimal at this time, namely, the optimal block image of the panel gray scale image of the guitar to be detected is obtained.
S104, screening the optimal block images with larger variance of gray values of all pixel points from all the optimal block images to obtain a first block image suspected of having defects.
Calculating the variance of all pixel point gray values in each optimal block image according to the obtained optimal block images, and respectively expressing the variance as
Figure DEST_PATH_IMAGE025
The variance reflects the difference of the gray values of all the pixel points in the optimal block imageIn other words, the larger the variance of the best block image, the larger the difference of the gray values thereof, i.e., the more likely there is a defect in the best block image. Since the defects on the surface of the guitar panel are generally small, the proportion of the defective area in the image is also small, and it can be determined that most of the best block images do not contain defects.
Arranging the variances of the gray values of all the pixel points in each optimal block image according to the sequence from small to large to obtain a variance sequence
Figure 807888DEST_PATH_IMAGE026
Wherein
Figure DEST_PATH_IMAGE027
Representing the sequence number of the variance, then setting a threshold value, and sequencing the variances
Figure 40155DEST_PATH_IMAGE026
And removing the optimal block image corresponding to the variance smaller than or equal to the threshold value, and obtaining the rest of the first block image suspected to have the defect.
S105, setting different segmentation thresholds to segment the pixel points in the first block image, and obtaining suspected defect pixel points in the first block image under different segmentation thresholds.
It should be noted that: after removing the best block image with smaller variance, the variance sequence of the first block image is expressed as
Figure 904206DEST_PATH_IMAGE028
At this time
Figure 921840DEST_PATH_IMAGE028
In the corresponding first block image, a part of the image contains defects, and a part of the image is a background area. Therefore, is in
Figure 478723DEST_PATH_IMAGE028
And analyzing the corresponding first block image to further determine the defect area.
Respectively judging the gray value and the gray value of each pixel point in all the first block images
Figure DEST_PATH_IMAGE029
Because the defects are mainly cracks and holes and the gray value of the defective pixel point is lower, the relationship (2) is judged
Figure 434172DEST_PATH_IMAGE030
In the first block image
Figure DEST_PATH_IMAGE031
Gray value of each pixel point
Figure 23285DEST_PATH_IMAGE032
And recording the pixel point as a first background pixel point, otherwise recording the pixel point as a first defect pixel point, namely a first target pixel point.
According to the difference of the gray values of the defective pixel point and the background pixel point, namely when the difference of the gray values of the two pixel points is within a certain range, the pixel points belong to the same type, and when the difference of the gray values of the two pixel points exceeds the certain range, the pixel points are represented as different types. At this time, whether the pixels belong to the same type is judged according to the difference of the gray values of the two pixels, and the judgment relation is as follows:
Figure 895426DEST_PATH_IMAGE034
wherein
Figure DEST_PATH_IMAGE035
Is shown as
Figure 92053DEST_PATH_IMAGE030
In the first block image
Figure 57167DEST_PATH_IMAGE031
The gray value of each pixel point is calculated,
Figure 528600DEST_PATH_IMAGE036
denotes the first
Figure 520826DEST_PATH_IMAGE030
In the first block image
Figure DEST_PATH_IMAGE037
The gray value of each pixel point is calculated,
Figure 137621DEST_PATH_IMAGE038
a parameter for controlling a difference value of gray values of two pixel points is represented,
Figure 582509DEST_PATH_IMAGE038
the larger the judgment scale is, the larger the judgment scales of different types of pixel points are, the less obvious judgment condition is, and the misjudgment of some pixel points is caused;
Figure 592053DEST_PATH_IMAGE038
the smaller the judgment scale of different types of pixel points is, the more some pixel points can not be classified, and meanwhile, the calculation amount can be increased. So for the parameter
Figure 704366DEST_PATH_IMAGE038
The selection of (2) directly influences the classification accuracy of the pixel points and the size of the calculated amount. Based on the results of the prior studies, in general
Figure 462369DEST_PATH_IMAGE038
Is taken from the value of
Figure DEST_PATH_IMAGE039
The segmentation effect is optimal, but for different segmentation targets, further parameters need to be determined
Figure 128973DEST_PATH_IMAGE038
I.e. determine different segmentation thresholds.
The process of segmenting the pixel points in the first block image by using the judgment relationship is as follows:
selecting any pixel point in the first block image, and calculating the gray value difference value of the pixel point and each pixel point in the 8-neighborhood of the pixel point;
judging the gray value difference between the pixel point and each pixel point in the 8 neighborhoods of the pixel point: when the absolute value of the gray value difference between a pixel point and a pixel point in the 8 neighborhoods of the pixel point is smaller than the threshold of the gray value difference between two pixel points, the type of the pixel point in the 8 neighborhoods of the pixel point is divided into the type of the pixel point, otherwise, the type of the pixel point in the 8 neighborhoods of the pixel point is divided into other types, and the type of the pixel point in the 8 neighborhoods of the pixel point is sequentially judged to obtain the pixel point with the judged type and the other pixel points in the first block image;
and judging the types of the pixel points in the 8 neighborhoods of the rest pixel points according to the mode until the types of all the pixel points in the first block image are judged, and finishing the segmentation of the pixel points in the first block image.
Therefore, suspected defect pixel points and suspected background pixel points in the first block image under different segmentation thresholds are obtained.
S106, calculating to obtain defect segmentation effect values under different segmentation thresholds according to the possibility that suspected defect pixel points in the first segmented images under different segmentation thresholds are misjudged and the number of suspected defect pixel points in all the first segmented images.
It should be noted that: the pixel points in each first block image are divided into suspected defect pixel points and suspected background pixel points, but in the actual process, some pixel points are judged by mistake, namely the suspected background pixel points are judged as the suspected defect pixel points by mistake. At the moment, the number of the misjudged pixel points reflects the segmentation effect of the suspected defective pixel points, so different parameters can be selected
Figure 191476DEST_PATH_IMAGE038
Different segmentation thresholds reflect different target segmentation effects, and at the moment, pixel points which are possibly judged by mistake are judged according to the characteristics of the segmented pixel points.
The process of acquiring the possibility of misjudging the pixel point is as follows:
1. and calculating the mean value of the gray values of all suspected background pixel points in the first block image.
2. And counting the number of suspected defective pixel points in 8 neighborhoods of the suspected defective pixel points in the first block image.
3. For suspected defect pixel points, the suspected defect pixel points are generally gathered and appear as a connected domain in the image, namely a suspected defect connected domain; meanwhile, the larger the difference between the suspected defect pixel point and the suspected background pixel point is, the smaller the possibility of misjudgment is, so that the misjudgment possibility of all the suspected defect pixel points is calculated, and the gray value of the known suspected defect pixel point is represented as
Figure 158295DEST_PATH_IMAGE040
Then, the probability of misjudgment thereof is expressed as:
Figure 133204DEST_PATH_IMAGE042
wherein
Figure DEST_PATH_IMAGE043
The second to indicate the suspected defective pixel
Figure 34908DEST_PATH_IMAGE044
The variance of the gray values of all the pixel points in the first block image,
Figure 386255DEST_PATH_IMAGE043
the larger the image is, the higher the probability that the pixel point in the first block image belongs to the defective pixel point is, so that the probability of misjudgment on the pixel point is lower, namely
Figure DEST_PATH_IMAGE045
The larger the suspected defect pixel point is, the higher the possibility of being misjudged is;
Figure 128952DEST_PATH_IMAGE046
the second one indicating the suspected defective pixel
Figure 540341DEST_PATH_IMAGE044
The mean value of the gray values of all the suspected background pixel points in the first block image,
Figure DEST_PATH_IMAGE047
and expressing the difference between the suspected defect pixel point and the suspected background pixel point in the first block image where the suspected defect pixel point is located, wherein the larger the difference is, the smaller the possibility of misjudgment is.
Figure 915959DEST_PATH_IMAGE048
The number of suspected defect pixel points in the 8 neighborhoods of the suspected defect pixel points is represented,
Figure 821729DEST_PATH_IMAGE048
the larger the suspected defect pixel point is, the smaller the possibility that the suspected defect pixel point is an isolated pixel point is, and the smaller the possibility that the suspected defect pixel point is misjudged is.
Figure DEST_PATH_IMAGE049
The probability that the suspected defect pixel points are judged by mistake is represented, and the lower the probability that the suspected defect pixel points are judged by mistake is, the better the segmentation effect is reflected.
4. And calculating to obtain defect segmentation effect values under different segmentation threshold values by using the possibility of misjudging the suspected defect pixel points and the number of the suspected defect pixel points in all the first block images.
Calculating the possibility that all suspected defect pixel points under different segmentation thresholds are judged by mistake so as to reflect segmentation effect values under different segmentation thresholds, wherein the expression of the defect segmentation effect values under different segmentation thresholds is as follows:
Figure 231982DEST_PATH_IMAGE050
wherein
Figure 548694DEST_PATH_IMAGE049
Denotes the first
Figure DEST_PATH_IMAGE051
In the first block image
Figure 660875DEST_PATH_IMAGE052
The probability of misjudging the suspected defective pixel,
Figure DEST_PATH_IMAGE053
denotes the first
Figure 822866DEST_PATH_IMAGE051
The number of suspected defective pixel points in the first block image,
Figure 575709DEST_PATH_IMAGE054
indicating the number of first block images with suspected defective pixels,
Figure DEST_PATH_IMAGE055
representing the total number of segmented suspected-defect pixels,
Figure 797742DEST_PATH_IMAGE056
the segmentation effect values of the defects under different segmentation thresholds are represented, the lower the misjudgment probability of the suspected defect pixel points segmented in the image is, the better the segmentation effect corresponding to the current segmentation threshold is represented, namely
Figure 928378DEST_PATH_IMAGE056
The larger the value of (c).
And S107, taking the segmentation threshold corresponding to the maximum defect segmentation effect value as an optimal segmentation threshold, and segmenting the pixel points in the first block images by using the optimal segmentation threshold to determine the defective pixel points in each first block image.
For the segmentation of the defective pixel points, different segmentation thresholds reflect different segmentation effects, and the segmentation effect values corresponding to the different segmentation thresholds are obtained by the steps
Figure 159640DEST_PATH_IMAGE056
Figure 75643DEST_PATH_IMAGE056
The maximum corresponds to the best segmentation effect value.
So as to obtain the best segmentation effect value, the parameters need to be changed
Figure 999737DEST_PATH_IMAGE038
Is obtained by obtaining
Figure 119134DEST_PATH_IMAGE056
The division of the corresponding defective pixel point is most accurate at the moment. Therefore, under the optimal segmentation effect value, the defect pixel point in each first block image is obtained, namely the defect pixel point in the whole image is obtained, and then the defect area in the image is judged according to the obtained defect pixel point and the characteristics of the defect.
And S108, obtaining a defect area in the guitar panel to be detected according to the defect pixel points in the first block image.
And according to the steps, dividing the defective pixel points. At this time, a defect area in the image is further determined according to the distribution characteristics of the divided defect pixel points.
For defects of the guitar panel, mainly crack defects and hole defects are adopted, so that the defect regions have sizes, the connected domain belonging to the defects is judged according to the sizes of the connected domains of the segmented defect pixel points, and all the connected domains in the whole image are respectively expressed as
Figure DEST_PATH_IMAGE057
Respectively, the sizes thereof are expressed as
Figure 826190DEST_PATH_IMAGE058
Then the threshold is set according to practical experience
Figure DEST_PATH_IMAGE059
Figure 49229DEST_PATH_IMAGE060
Indicating that the corresponding connected component is a defective area. Up to this point, all defective areas in the image are obtained.
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 musical instrument production defect detection method using a visual means, comprising:
acquiring a panel gray scale image of the guitar to be detected;
equally dividing the panel gray-scale image according to different block sizes, and calculating to obtain a block effect value of the panel gray-scale image under each block size by using the gray value mean value of all pixel points in the panel gray-scale image, the number of block images under each block size, the gray value mean value of all pixel points in each block image and the variance of the gray values of all pixel points in the block image;
taking the corresponding block size when the block effect value is maximum as the optimal block size, and equally dividing the panel gray-scale image by using the optimal block size to obtain the optimal block image of the panel gray-scale image;
screening the optimal block images with larger variance of gray values of all pixel points from all the optimal block images to obtain a first block image suspected of having defects;
setting different segmentation thresholds to segment pixel points in the first block image to obtain suspected defect pixel points in the first block image under different segmentation thresholds;
calculating to obtain defect segmentation effect values under different segmentation thresholds by using the possibility that suspected defect pixel points in the first segmented images under different segmentation thresholds are misjudged and the number of suspected defect pixel points in all the first segmented images;
taking a corresponding segmentation threshold value when the defect segmentation effect value is maximum as an optimal segmentation threshold value, segmenting pixel points in the first block images by using the optimal segmentation threshold value, and determining defect pixel points in each first block image;
and obtaining a defect area in the guitar panel to be detected according to the defect pixel points in the first block image.
2. The method of detecting defects in the production of musical instruments by visual means as set forth in claim 1, wherein the best block image of the gray-scale image of the panel is obtained as follows:
setting an initial block size, and performing first-time equal division on the panel gray-scale image according to the initial block size to obtain all initial block images;
calculating the mean value of gray values of all pixel points in the panel gray image;
calculating the mean value of the gray values of all pixel points in each initial block image and the variance of the gray values of all pixel points in the initial block image;
calculating to obtain a blocking effect value of the panel gray image under the initial blocking size by using the number of the initial blocking images, the gray value mean value of all pixel points in the panel gray image, the gray value mean value of all pixel points in each initial blocking image and the variance of the gray values of all pixel points in the initial blocking image;
obtaining the blocking effect value of the panel gray level image under each blocking size according to the mode, obtaining the corresponding blocking size when the blocking effect value is maximum, and taking the blocking size as the optimal blocking size;
and equally dividing the panel gray-scale image according to the optimal block size to obtain the optimal block image of the panel gray-scale image.
3. The method as claimed in claim 1, wherein the suspected defective pixels in the first segmented image under different segmentation thresholds are obtained as follows:
calculating the variance of the gray values of all pixel points in each optimal block image;
sorting the variances of the gray values of all the pixel points in each optimal block image from small to large to obtain a variance sequence;
setting a variance threshold, screening out the variance which is greater than the variance threshold in the variance sequence, and taking the optimal block image corresponding to the variance as a first block image suspected of having defects;
judging the gray value of each pixel point in the first block image: when the gray value of a pixel point is larger than the mean value of the gray values of all the pixel points in the panel gray image, the pixel point is a first background pixel point; when the gray value of a pixel point is less than or equal to the mean value of the gray values of all the pixel points in the panel gray image, the pixel point is a first defective pixel point;
and setting different segmentation thresholds, and segmenting pixel points in the first block image according to the different segmentation thresholds to obtain suspected defect pixel points and suspected background pixel points in the first block image under the different segmentation thresholds.
4. A visual instrument production defect detection method according to claim 3, wherein the segmentation of the pixel points in the first segmented image according to the different segmentation thresholds is as follows:
selecting any pixel point in the first block image, and calculating the gray value difference value of the pixel point and each pixel point in the neighborhood of the pixel point;
judging the gray value difference between the pixel point and each pixel point in the neighborhood: when the absolute value of the gray value difference value between a pixel point and a pixel point in the neighborhood of the pixel point is smaller than a segmentation threshold, dividing the type of the pixel point in the neighborhood of the pixel point into the type of the pixel point, otherwise, dividing the type into other types, and sequentially judging the type of the pixel point in the neighborhood of the pixel point to obtain the pixel point of which the type is judged and the rest of pixel points in the first block image;
and judging the types of the pixel points in the neighborhoods of the rest pixel points according to the mode until the types of all the pixel points in the first block image are judged, and finishing the segmentation of the pixel points in the first block image.
5. The method of claim 1, wherein the defect segmentation effect values under different segmentation thresholds are obtained as follows:
calculating the mean value of gray values of all suspected background pixel points in the first block image;
counting the number of suspected defective pixel points in the neighborhood of the suspected defective pixel points in the first block image;
calculating the possibility that the suspected defect pixel points are misjudged by utilizing the gray value variance of all the pixel points in the first block image where the suspected defect pixel points are located, the gray value mean value of all the suspected background pixel points, the gray value of the suspected defect pixel points and the number of the suspected defect pixel points in the neighborhood of the suspected defect pixel points;
and calculating to obtain defect segmentation effect values under different segmentation thresholds by using the possibility of misjudging the suspected defect pixel points and the number of the suspected defect pixel points in all the first block images.
6. A visual instrument production defect detection method as claimed in claim 1, wherein the defect area in the guitar panel to be detected is obtained as follows:
taking a segmentation threshold corresponding to the maximum defect segmentation effect value as an optimal segmentation threshold, and segmenting pixel points in the first block images by using the optimal segmentation threshold to obtain defect pixel points in each first block image;
acquiring all defect connected domains according to defect pixel points in each first block image;
setting a size threshold of a connected domain, and judging each defect connected domain: and when the size of the defect connected domain is larger than the threshold value, the defect connected domain is a defect area in the guitar panel to be detected.
7. A visual instrument production defect detection method for musical instruments according to claim 1, characterized in that the panel gray-scale map of the guitar to be detected is obtained as follows:
acquiring a guitar panel gray scale image;
calculating to obtain the suspected defect degree of the guitar panel gray scale image by using the variance of the gray scale values of all pixel points in the guitar panel gray scale image and the difference value between the maximum value and the minimum value in the neighborhood gray scale value mean value of each pixel point;
judging whether the guitar panel has defects or not by using the suspected defect degree of the guitar panel gray scale image, and acquiring the panel gray scale image of the guitar to be detected.
8. A visual instrument production defect detection method as claimed in claim 7, wherein said guitar panel gray scale map is obtained as follows:
collecting a guitar panel image;
performing semantic segmentation on the guitar panel image to obtain a guitar panel area image;
and carrying out graying processing on the image of the guitar panel area to obtain a guitar panel gray scale image.
9. The method of claim 7, wherein the suspected defect level of the guitar panel gray scale is obtained as follows:
setting neighborhood size, and calculating the gray value mean value of all pixel points in the neighborhood size range of each pixel point in the guitar panel gray level image to obtain the neighborhood gray value mean value corresponding to each pixel point;
acquiring the maximum value and the minimum value in the neighborhood gray value mean values corresponding to all the pixel points;
calculating the variance of gray values of all pixel points in the guitar panel gray image;
and calculating to obtain the suspected defect degree of the guitar panel gray-scale image by using the variance of the gray values of all pixel points in the guitar panel gray-scale image and the difference value of the maximum value and the minimum value in the neighborhood gray-scale value mean value of each pixel point.
10. The method as claimed in claim 7, wherein the process of determining whether the guitar panel is defective or not by using the suspected defect level of the gray scale map of the guitar panel is as follows:
setting a suspected defect degree threshold value, and judging the suspected defect degree of the guitar panel gray scale image: when the suspected defect degree of the guitar panel gray scale image is less than or equal to a suspected defect degree threshold value, judging that the gray scale image has no defects; and when the suspected defect degree of the guitar panel gray scale image is larger than the threshold value of the suspected defect degree, taking the gray scale image as the panel gray scale image of the guitar to be detected.
CN202210859624.3A 2022-07-22 2022-07-22 Musical instrument production defect detection method using visual means Active CN115063400B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202210859624.3A CN115063400B (en) 2022-07-22 2022-07-22 Musical instrument production defect detection method using visual means

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202210859624.3A CN115063400B (en) 2022-07-22 2022-07-22 Musical instrument production defect detection method using visual means

Publications (2)

Publication Number Publication Date
CN115063400A true CN115063400A (en) 2022-09-16
CN115063400B CN115063400B (en) 2022-11-01

Family

ID=83206743

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202210859624.3A Active CN115063400B (en) 2022-07-22 2022-07-22 Musical instrument production defect detection method using visual means

Country Status (1)

Country Link
CN (1) CN115063400B (en)

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115272346A (en) * 2022-09-30 2022-11-01 江苏炜盛光电科技有限公司 PCB production process online detection method based on edge detection
CN115457035A (en) * 2022-11-10 2022-12-09 山东鲁旺机械设备有限公司 Machine vision-based construction hanging basket welding quality detection method
CN116309671A (en) * 2023-05-23 2023-06-23 浩珂科技有限公司 Geosynthetic fabric quality detection system
CN116645364A (en) * 2023-07-18 2023-08-25 金乡县金沪合金钢有限公司 Alloy steel casting air hole defect detection method based on image data

Citations (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2009097959A (en) * 2007-10-16 2009-05-07 Tokyo Seimitsu Co Ltd Defect detecting device and defect detection method
CN104990925A (en) * 2015-06-23 2015-10-21 泉州装备制造研究所 Defect detecting method based on gradient multiple threshold value optimization
US20150332451A1 (en) * 2014-05-15 2015-11-19 Applied Materials Israel Ltd. System, a method and a computer program product for fitting based defect detection
CN105354831A (en) * 2015-09-30 2016-02-24 广东工业大学 Multi-defect detection method based on image block variance-weighting eigenvalues
CN106093066A (en) * 2016-06-24 2016-11-09 安徽工业大学 A kind of magnetic tile surface defect detection method based on the machine vision attention mechanism improved
CN106780486A (en) * 2017-01-16 2017-05-31 大连海事大学 A kind of Surface Defects in Steel Plate image extraction method
CN110009638A (en) * 2019-04-12 2019-07-12 重庆交通大学 Bridge cable picture appearance defect inspection method based on partial statistics characteristic
CN112862773A (en) * 2021-01-29 2021-05-28 山东建筑大学 Shaving board image defect classification detection method and device
US11216932B1 (en) * 2021-03-26 2022-01-04 Minds AI Technologies Ltd Electronic substrate defect detection

Patent Citations (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2009097959A (en) * 2007-10-16 2009-05-07 Tokyo Seimitsu Co Ltd Defect detecting device and defect detection method
US20150332451A1 (en) * 2014-05-15 2015-11-19 Applied Materials Israel Ltd. System, a method and a computer program product for fitting based defect detection
CN104990925A (en) * 2015-06-23 2015-10-21 泉州装备制造研究所 Defect detecting method based on gradient multiple threshold value optimization
CN105354831A (en) * 2015-09-30 2016-02-24 广东工业大学 Multi-defect detection method based on image block variance-weighting eigenvalues
CN106093066A (en) * 2016-06-24 2016-11-09 安徽工业大学 A kind of magnetic tile surface defect detection method based on the machine vision attention mechanism improved
CN106780486A (en) * 2017-01-16 2017-05-31 大连海事大学 A kind of Surface Defects in Steel Plate image extraction method
CN110009638A (en) * 2019-04-12 2019-07-12 重庆交通大学 Bridge cable picture appearance defect inspection method based on partial statistics characteristic
CN112862773A (en) * 2021-01-29 2021-05-28 山东建筑大学 Shaving board image defect classification detection method and device
US11216932B1 (en) * 2021-03-26 2022-01-04 Minds AI Technologies Ltd Electronic substrate defect detection

Non-Patent Citations (2)

* Cited by examiner, † Cited by third party
Title
TAO S.等: "A quick Otsu-Kmeans algorithm for the internal pipeline detection", 《2017 IEEE INTERNATIONAL CONFERENCE ON MECHATRONICS AND AUTOMATION (ICMA)》 *
宋辉 等: "一种基于SVM的中密度纤维板表面粗糙缺陷检测方法", 《电脑知识与技术》 *

Cited By (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115272346A (en) * 2022-09-30 2022-11-01 江苏炜盛光电科技有限公司 PCB production process online detection method based on edge detection
CN115457035A (en) * 2022-11-10 2022-12-09 山东鲁旺机械设备有限公司 Machine vision-based construction hanging basket welding quality detection method
CN116309671A (en) * 2023-05-23 2023-06-23 浩珂科技有限公司 Geosynthetic fabric quality detection system
CN116309671B (en) * 2023-05-23 2023-08-11 浩珂科技有限公司 Geosynthetic fabric quality detection system
CN116645364A (en) * 2023-07-18 2023-08-25 金乡县金沪合金钢有限公司 Alloy steel casting air hole defect detection method based on image data
CN116645364B (en) * 2023-07-18 2023-10-27 金乡县金沪合金钢有限公司 Alloy steel casting air hole defect detection method based on image data

Also Published As

Publication number Publication date
CN115063400B (en) 2022-11-01

Similar Documents

Publication Publication Date Title
CN115063400B (en) Musical instrument production defect detection method using visual means
CN115457041B (en) Road quality identification and detection method
CN106251361B (en) A kind of rail surface defects image self-adapting division method
CN117173184B (en) Road construction quality detection method and system based on artificial intelligence
CN115908411B (en) Concrete curing quality analysis method based on visual detection
CN114419025A (en) Fiberboard quality evaluation method based on image processing
CN115294139B (en) Image-based slope crack monitoring method
CN113409314B (en) Unmanned aerial vehicle visual detection and evaluation method and system for corrosion of high-altitude steel structure
CN106778734A (en) A kind of insulator based on rarefaction representation falls to go here and there defect inspection method
CN115861290B (en) Skin-feel wood door surface defect detection method
CN114820625B (en) Automobile top block defect detection method
CN107798293A (en) A kind of crack on road detection means
CN115294159A (en) Method for dividing corroded area of metal fastener
CN116580021B (en) Environment-friendly concrete carbon reduction product production and quality detection method
CN112964712A (en) Method for rapidly detecting state of asphalt pavement
CN116309599B (en) Water quality visual monitoring method based on sewage pretreatment
CN115272321A (en) Textile defect detection method based on machine vision
CN113643276A (en) Textile texture defect automatic detection method based on statistical analysis
CN115953409A (en) Injection molding surface defect detection method based on image processing
CN115272349A (en) Method for detecting welding defects of computer PCB main board
CN117635604B (en) Method for detecting welding quality of constructional engineering steel structure
CN115311284A (en) Production quality detection method for glass fiber mat
CN114972353B (en) Quality evaluation method and system for metal high-pressure special pipe fitting
CN115311278A (en) Yarn cutting method for yarn detection
CN115965796A (en) Metal corrosion detection method and system based on image recognition

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