Disclosure of Invention
In order to solve the problem that the uniform MSR scale number can influence the enhancement effect of the image on the surface of the fiber cloth cover gypsum board so as to influence the accuracy and the efficiency of surface quality detection, the invention provides a method for detecting the surface quality of the fiber cloth cover gypsum board, which comprises the following steps:
Acquiring a gray image of the surface of the fiber cloth cover gypsum board; determining the uniformity of the local range of each pixel point, wherein the uniformity is positively correlated with the gray value variety number of the pixel point in the local range of the pixel point, and is negatively correlated with the gray value range of the pixel point in the local range of the pixel point, and the gray value range is the difference between the maximum value and the minimum value in the gray values of the pixel point in the local range of the pixel point; dividing the pixel points in the local range of each pixel point into two categories with the largest inter-category variance, determining the granularity of the local range of each pixel point, positively correlating the granularity with the shortest path length of all the pixel points in the two categories, which contain the category, negatively correlating the number of the pixel points in the two categories, determining the detail richness of each pixel point, negatively correlating the detail richness with the uniformity and granularity of the local range of the pixel point, determining the distance between each pixel point and the rest of the pixel points, positively correlating the difference of the detail richness between the pixel point and the rest of the pixel points, a preset detail richness compensation factor and the Euclidean distance between the target pixel point and the rest of the pixel points, clustering the pixel points of a gray image according to the distance to obtain a plurality of clusters, taking the minimum circumscribed rectangles of each cluster as sub-areas of the clusters, determining the number of scales of MSR algorithm of each sub-area, positively correlating the number of scales with the initial scale number of scales and the richness of each pixel point in the sub-area, and carrying out the MSR algorithm on the number of scales of the initial scale to finish the surface quality detection of the fiber gypsum board by the gray level algorithm.
The method has the advantages that the change condition of local gray values is reflected through uniformity in the local range of the pixel points, the distribution compactness degree of different types of pixel points is reflected through granularity in the local range of the pixel points, the detail richness is obtained through uniformity and granularity, the quality characteristics of gray images on the surface of the gypsum board are comprehensively analyzed from different angles, the pixel points are clustered through distance measurement, the surface image is divided into a plurality of clusters, the minimum circumscribed rectangle is used as a subarea, the different areas can be analyzed and processed more pertinently, the scale number of the MSR algorithm can be adaptively adjusted according to the characteristics of each subarea, the problem of excessive enhancement or insufficient enhancement can be avoided while the gray images are enhanced, the detail characteristics of the surface of the gypsum board are better highlighted, the definition and the contrast of the images are improved, and the effect and the efficiency of image enhancement are improved.
Further, the uniformity satisfies the following relationship:
In the formula (I), in the formula (II), Is the firstUniformity of local area of individual pixels,、Respectively the firstMaximum and minimum values among gray values of pixel points within a local range of the individual pixel points,Is the firstThe number of gray value categories of the pixel points in the local range of the pixel points,Is a preset super parameter.
The method has the advantages that uniformity is calculated by combining the number of gray value types in the local range of the pixel point with the difference between the maximum gray value and the minimum gray value, uniformity characteristics of the local range of the pixel point are reflected more accurately, self-adaptive adjustment can be carried out on different image areas according to specific gray value distribution conditions, uniformity can be correspondingly reduced in areas with larger gray value changes, uniformity can be higher in areas with closer gray values, and the method is beneficial to analyzing quality differences of the surface of the fiber cloth gypsum board more finely and accurately and detecting potential quality problems.
Further, the particle size satisfies the following relation:
In the formula (I), in the formula (II), Is the firstGranularity in a local range of individual pixels,、Respectively the firstThe shortest path length of all pixels of the first class and the second class within the local range of the pixels of the class,、Respectively the firstThe number of pixels in the first category and the second category within the local range of the individual pixels.
The method has the advantages that the granularity distribution condition of the whole gray level image can be obtained by calculating the granularity value of each pixel point, specific data support is provided for subsequent quality analysis and processing, the quality standard and the control range can be determined by carrying out statistical analysis on the granularity value, abnormal conditions in the production process can be found in time, corresponding improvement measures are adopted, and the stability and consistency of the product quality are improved.
Further, the shortest path length including all pixel points of the category is obtained through a Di Jie Style algorithm.
Further, the detail richness satisfies the following relation:
In the formula (I), in the formula (II), Is the firstThe degree of detail richness of the individual pixel points,Is the firstUniformity of local area of individual pixels,Is the firstGranularity in a local range of individual pixels,As a natural exponential function.
The method has the beneficial effects that the method utilizes the form of a natural exponential function to process by combining the uniformity and granularity of the pixel points, comprehensively considers the change condition of gray values and the particle distribution characteristics in the local range, and more comprehensively reflects the detail information of the pixel points.
Further, the distance satisfies the following relation:
In the formula (I), in the formula (II), Is the firstPixel dot and the firstThe distance between the individual pixel points is such that,、Respectively the firstPixel dot and the firstThe degree of detail richness of the individual pixel points,Is thatPixel dot and the firstThe euclidean distance between the individual pixel points,And (5) compensating factors for the preset detail richness.
The method has the advantages that the actual difference between two pixel points can be reflected more comprehensively by combining the detail richness difference and the Euclidean distance of the pixel points, the detail richness reflects the complexity of the local image characteristics of the pixel points, the Euclidean distance reflects the distance on the spatial position, the relationship between the pixel points is measured from the two aspects of image content and the spatial position by combining the detail richness difference and the Euclidean distance, and the subsequent image enhancement effect is improved.
Further, the clustering adopts a DBSCAN clustering algorithm.
Further, the number of scales satisfies the following relation:
In the formula (I), in the formula (II), Is the firstThe number of scales of the sub-region MSR algorithm,For the number of initial dimensions,Represent the firstThe mean value of the detail richness of each pixel point in each sub-area,To round the symbol.
The method has the advantages that the number of scales of the MSR algorithm of the subareas is determined by combining the number of initial scales and the detailed characteristics of the subareas, so that the image enhancement can be carried out on different subareas more pertinently, the details and the structures of the image are better reserved while the image is enhanced, the quality and the definition of the image are improved, different subareas possibly have different quality characteristics and requirements, and the number of scales can be optimized according to specific conditions through self-adaption, so that the enhanced image meets the requirements of actual detection and analysis.
Further, the method for detecting the surface quality of the fiber cloth cover gypsum board comprises the steps of carrying out threshold segmentation on the enhanced gray level image to obtain a defect area, taking the ratio of the area of the defect area to the total area of the gray level image as the tolerance of the defect area, and responding to the tolerance being larger than a preset threshold value to judge that the surface quality of the fiber cloth cover gypsum board is unqualified and finish the surface quality detection of the fiber cloth cover gypsum board.
The invention has the following beneficial effects:
the method comprehensively analyzes quality characteristics of the gypsum board surface from different angles by considering a plurality of indexes such as uniformity, granularity, detail richness and the like in a local range of pixel points, clusters the pixel points by utilizing distance measurement, divides the gray image into a plurality of clusters, takes the minimum circumscribed rectangle as a subarea, can analyze and process different areas more pertinently, and then adapts to the MSR scale number in different subareas in a self-adaptive manner, thereby better adapting to the local characteristics of the image, improving the enhancement effect and enhancement efficiency and further improving the accuracy of the quality detection of the fiber-covered gypsum board surface.
Detailed Description
The following description of the embodiments of the present invention will be made clearly and fully with reference to the accompanying drawings, in which it is evident that the embodiments described are some, but not all embodiments of the invention. All other embodiments, which can be made by those skilled in the art based on the embodiments of the invention without making any inventive effort, are intended to be within the scope of the invention.
When the gray level image on the surface of the fiber cloth cover gypsum board is enhanced by utilizing the MSR algorithm, different areas of the gray level image possibly have different characteristics and detail richness (namely defect expression degree), the number of scales in the MSR algorithm determines the enhancement effect, and the larger the number of scales can lead to larger calculation complexity, if the uniform number of MSR scales is used on the whole image, the problems of resource waste in areas with low detail richness and underenhancement or over-enhancement in positions with high detail richness can be caused, so that the image enhancement effect is affected. Therefore, the detail richness of the pixel points is obtained by combining the uniformity and granularity of the local range of the pixel points, then the image is divided into a plurality of subareas according to the detail richness, and the number of different MSR scales is used in different subareas, so that the enhancement effect and efficiency of the gray level image on the surface of the fiber cloth cover gypsum board are improved.
Specific embodiments of the present invention are described in detail below with reference to the accompanying drawings.
Referring to fig. 1, a flowchart of the steps of a method for detecting the surface quality of a gypsum board with a fiber cloth cover according to an embodiment of the invention is shown, the method comprises the following steps:
s1, acquiring a gray image of the surface of the fiber cloth cover gypsum board.
As shown in fig. 2, an image of the surface of the fiber cloth cover gypsum board is acquired by a high-resolution camera, and is subjected to graying treatment, so that a gray image is obtained.
And S2, determining the uniformity of the local range of each pixel point.
The uniformity of the local area of the pixel point can be represented by the number of types of gray values of the pixel point in the local area and the extremely bad gray value (difference between the maximum and minimum gray values).
Specifically, the uniformity satisfies the following relationship:
;
in the formula, Is the firstUniformity of local area of individual pixels,、Respectively the firstMaximum and minimum values among gray values of pixel points within a local range of the individual pixel points,Is the firstThe number of gray value categories of the pixel points in the local range of the pixel points,Is a preset super parameter.
The practitioner can set the size and super parameters of the local range according to the specific implementation, e.g. the local range is centered on the current pixel pointIs 0.01.
Wherein, The larger the ratio of (c) is, the better the uniformity is, because at a certain gray value width, the more gray value types indicate that the gray value changes more gradually, but not the gray value has obvious dipolar differentiation, the more uniform the gray value is in the local range of the pixel point, and when the gray value types are determined, the smaller the gray value width is, the more similar the gray value is, and the more uniform the gray value is.
S3, dividing the pixel points in the local range of each pixel point into two categories with the maximum inter-category variance, and determining the granularity of the local range of each pixel point.
It should be noted that, the granularity of the pixel points in the local range may be divided into two types by using the mode of maximizing the inter-class variance, and then the dispersion of the two types of pixel points is calculated respectively, where the dispersion may be represented by the average path distance of the pixel points in the two types when the inter-class variance is maximum, and the larger the average distance, the better the dispersion, and the average value of the dispersion of the two types may represent the granularity.
Specifically, the particle size satisfies the following relation:
;
in the formula, Is the firstGranularity in a local range of individual pixels,、Respectively the firstThe shortest path length of all pixels of the first class and the second class within the local range of the pixels of the class,、Respectively the firstThe number of pixels in the first category and the second category within the local range of the individual pixels.
Wherein, 、Respectively represent the firstThe higher the dispersion, the stronger the granularity of the first class and the second class within the local range of the individual pixel points.
Specifically, the shortest path containing all pixel points of the category is obtained through a Di Jie St algorithm.
And S4, determining the detail richness of each pixel point.
It should be noted that, the present invention aims to detect the quality of the surface of the fiber cloth cover gypsum board, namely, detect the defect, so that the detail needs to be determined to be rich, where the detail is the detail of the defect (which can be understood as the defect surface degree), because the gray level image of the surface of the fiber cloth cover gypsum board has uniform gray level values in the local range of the pixel points in the defect-free area, but some tiny particles (i.e. uniform gray level values but small-amplitude gray level change) exist, and the occurrence of the defect (such as cracks, bubbles, etc.) can cause the larger change of the gray level values of the pixel points in the defect area in the local range, and the tiny particles originally cause the particle disappearance due to scratches or shadows (the bubbles). Therefore, the uniformity of the local range of the pixel point and the graininess can be used for calculating the detail richness, wherein the lower the uniformity is, the lower the graininess is, the higher the detail richness is.
Specifically, the detail richness satisfies the following relation:
;
in the formula, Is the firstThe degree of detail richness of the individual pixel points,Is the firstUniformity of local area of individual pixels,Is the firstGranularity in a local range of individual pixels,As a natural exponential function.
Wherein, 、Respectively represent the firstThe uniformity and granularity of the local range of each pixel point are inversely related to the detail richness, so that the sum of negative exponentials is the detail richness, and finally, the value of the detail richness is limited to 0-1 by taking one half.
And S5, determining the distance between each pixel point and the rest pixel points.
It should be noted that after the detail richness of each pixel point in the gray level image of the surface of the fiber cloth cover gypsum board is obtained, each data point can be clustered by using a clustering algorithm to obtain a plurality of class clusters,
Specifically, the distance satisfies the following relation:
;
in the formula, Is the firstPixel dot and the firstThe distance between the individual pixel points is such that,、Respectively the firstPixel dot and the firstThe degree of detail richness of the individual pixel points,Is thatPixel dot and the firstThe euclidean distance between the individual pixel points,And (5) compensating factors for the preset detail richness.
The implementation personnel can set the detail richness compensation factor according to specific implementation cases, for example, 10, and the detail richness compensation factor is set because the value range of the detail richness is limited to 0-1 and the Euclidean distance is necessarily a numerical value larger than 1.
And S6, acquiring the scale number of each subarea and each subarea MSR algorithm according to the distance.
And clustering the pixel points of the gray level image according to the distance to obtain a plurality of clusters, taking the minimum circumscribed rectangle of each cluster as a sub-region of the cluster, and determining the scale number of each sub-region MSR algorithm.
Specifically, the clustering adopts a DBSCAN clustering algorithm.
The practitioner can set the cluster radius of the DBSCAN clustering algorithm, for example, 2.5, according to the specific implementation.
After the gray level image is divided, the scale number of the self-adaptive MSR algorithm is carried out on each sub-region, and the image can be better enhanced due to the fact that the larger scale number is, but larger calculation amount is brought at the same time.
Specifically, the number of scales satisfies the following relation:
;
in the formula, Is the firstThe number of scales of the sub-region MSR algorithm,For the number of initial dimensions,Represent the firstThe mean value of the detail richness of each pixel point in each sub-area,To round the symbol.
The practitioner may set the initial number of dimensions, e.g., 2, depending on the particular implementation.
And S7, enhancing the gray level image through an MSR algorithm according to the number of the scales so as to finish the surface quality detection of the fiber cloth cover gypsum board.
Specifically, the method for detecting the surface quality of the gypsum board with the fiber cloth cover comprises the following steps:
threshold segmentation is carried out on the enhanced gray level image to obtain a defect area, and the ratio of the area of the defect area to the total area of the gray level image is taken as the tolerance of the defect area;
And in response to the tolerance being greater than a preset threshold, determining that the surface quality of the fiber cloth cover gypsum board is unqualified, and finishing the surface quality detection of the fiber cloth cover gypsum board.
The practitioner may set a threshold value, for example, 3%, depending on the particular implementation.
By the detection method, the surface quality of each fiber cloth cover gypsum board is detected in real time on a production line, and the detection result is combined with a production line control system to timely find and reject unqualified fiber cloth cover gypsum boards.
The above description is only of the preferred embodiments of the present invention and is not intended to limit the invention, but any modifications, equivalent substitutions, improvements, etc. within the principles of the present invention should be included in the scope of the present invention.