Background
The toughened glass belongs to safety glass for buildings, and the glass strength is improved by forming prestress on the surface of the glass by a chemical or physical method. During its production, it is necessary to perform a chip condition test to ensure its quality.
According to GB 15763.2-2005 "safety glass for buildings part 2: the procedure for the glass fragment test is described below, as specified in tempered glass ": impacting by a small hammer or a punch with the curvature radius of the tip of 0.2mm +/-0.05 mm at the position which is about 20mm away from the periphery on the central line of the longest side of the sample; collection of the glass fragment pattern was started 10s after impact and within 3mm after impact; during fragment counting, the part within the range of 80mm from the radius of an impact point and 25mm from the edge of the glass or the edge of a drilled hole is removed, the part with the largest fragments is selected from the pattern, the counting frame of 50mmx50mm is adopted to count the number of the fragments in the frame, no through crack can exist in each fragment, and the fragments crossing the edge of the counting frame are counted according to 1/2 fragments; in any 50mmx50mm area, the minimum number of fragments is 30, 40 and 30 at thicknesses of 3mm, 4-12 mm and above 15mm according to the thickness of the plate glass.
The existing tempered glass fragment state measuring method mostly adopts manual counting, a counting frame of 50mmx50mm is framed on a fragment test by using a color pen, the number of fragments is identified by eyes, and errors often occur; the measurement method mentioned in the prior patent adopts indirect measurement such as CN106680075A, and needs to place flat glass on a photosensitive paper, perform a fragmentation test on the photosensitive paper and expose the photosensitive paper, and then collect patterns on the photosensitive paper by a CCD sensor or a CMOS sensor to perform fragment counting. The method needs to replace the sensitive paper when the test is carried out each time, and does not have the function of automatically identifying the counting frame; for example, patents CN207488070U and CN207488095U, etc., have been used for device design for glass detection, and also CCD and CMOS sensors are used for collecting glass plate fragments, and a conveyor belt is designed for conveying, but the image collection mode for glass fragments is in a common indoor illumination environment, and no other processing is performed, which may cause a large error effect, and cannot be used in some special environments;
CN105403455A shows a glass fragment state detection device, which limits a rectangular frame for image acquisition of glass by a fixed stop strip and a movable stop strip, but is also used in a common indoor lighting environment, and the accuracy is not easy to control.
The specific patent references and related documents mentioned above are:
1) and a toughened glass fragment detection system and a detection method thereof, and has a patent number CN 106680075A. The invention discloses a system and a method for detecting glass fragments of toughened glass. The method does not have the function of automatically identifying the counting frame, belongs to indirect measurement of the glass fragment image, and needs to replace the sensitive paper in each measurement.
2) And a tempered glass fragment detection system, patent No. CN 207488070U. The utility model discloses a toughened glass fragment detection system, which comprises a shell, a support rod, a conveying device, a vision detector, a backlight plate, a controller and a fragment collector, wherein the conveying device comprises a first transmission roller, a second transmission roller and a conveying belt; the vision detector is installed at the top of the shell, the vision detector is located above the conveying belt, the backlight plate is located under the vision detector and located below the conveying belt, the controller is connected with the vision detector and the backlight plate respectively, and the fragment collector is installed on the shell and is adjacent to one end of the conveying device. The method is used for carrying out image acquisition on glass fragments in a common indoor illumination environment, and other image processing is not carried out, so that larger error influence can be caused.
3) And "glass cullet condition detection device", patent No. CN 105403455A. The invention discloses a glass fragment state detection device, which comprises a fixed barrier strip and a movable barrier strip for fixing a glass sample and a support bottom plate for placing and supporting glass, wherein the fixed barrier strip consists of a transverse branch strip and a longitudinal branch strip and is in a 7 shape; the movable barrier strip is L-shaped and is arranged on the fixed barrier strip, two ends of the movable barrier strip are correspondingly clamped on any section of the transverse branch strip and the longitudinal branch strip of the fixed barrier strip respectively, and a closed rectangular frame matched with the glass sample to be detected is formed by the movable barrier strip and the fixed barrier strip; an image acquisition device and an image processing device electrically connected with the image acquisition device are arranged above the rectangular frame for fixing the glass sample; the supporting bottom plate is arranged on the inner side of the fixed barrier strip, and the upper end of the supporting bottom plate is in contact with the lower end of the movable barrier strip. However, the invention only provides a detailed design for the glass fixing and clamping device, and the fragment counting method is not considered further.
4) The article provides an image segmentation method based on edge detection, and firstly carries out glass fragment gap line detection, supplements and de-noizes unconnected gap lines obtained by traditional edge detection to obtain thicker gap lines basically matched with an original image, and then realizes concave position containing treatment of fragments by solving a distance function, reconstructing and inverting gray level, further carries out image segmentation, completes identification of glass fragments and obtains the gap lines with the number of the fragments and the pixel width of 1. However, the gap line growth algorithm of the algorithm adopts the watershed algorithm to judge the gray threshold of each pixel point, so that a large amount of calculation is generated, the efficiency in actual engineering application is low, the requirements on illumination conditions and imaging effects are high, and the influences of factors such as illumination and dirt cannot be well compatible.
Disclosure of Invention
In order to solve the above technical problems, the present invention aims to provide an intelligent counting method and device for a flat glass fragment state test, so as to meet the requirements of a glass fragment state detection test on accurate measurement and reduction of manual use. The measurement efficiency and the applicability of the measurement method are improved.
The purpose of the invention is realized by the following technical scheme:
an intelligent counting method for a flat glass fragment state test comprises the following steps:
a, calibrating the length of a camera counting frame and acquiring a glass fragment sample image in a shielding darkroom;
b, obtaining a glass fragment counting frame through the length calibration of the counting frame, creating a mask according to the position of the counting frame, and extracting a local image of the glass fragment sample;
c, performing color gamut conversion on the local image of the glass fragment sample, extracting L-channel brightness information, performing PCA principal component analysis to obtain a glass fragment gray image, calculating a gray segmentation threshold of a glass background and a fragment edge, and performing threshold segmentation on the gray image;
d, performing closed operation and inverse color processing on the converted gray level image;
e, performing two-dimensional wavelet decomposition on the gray level image subjected to the inverse color processing to obtain a plurality of image components, and performing adaptive threshold processing on the image components to obtain a new threshold;
f, carrying out black-and-white segmentation on the gray-scale image by using a new threshold, carrying out two times of edge detection, and taking intersection of two binary images of the two times of edge detection to obtain a glass fragment edge segmentation binary image;
and G, segmenting the binary image according to the glass fragment edge, calculating the number of connected domains, calculating the number of glass fragments according to the number of the connected domains, and obtaining a qualified detection result of the glass fragments by judging and calculating the glass fragment edge.
An intelligent counting device for a flat glass fragment state test comprises: the device comprises a shielding darkroom, a toughened flat glass carrying platform, an LED flat light source, an image acquisition module and a calibration color block; the above-mentioned
The shielding darkroom is a shielding darkroom without the influence of stray light and consists of a black panel;
the toughened flat glass carrying platform is used for providing a horizontal plane for placing a flat toughened fragment sample and providing a dark background for image acquisition;
the LED flat light source is used for emitting a parallel light source with adjustable brightness to be projected onto a glass fragment sample to be detected from the side so as to avoid background color noise interference and enhance the gap line contrast;
the image acquisition module consists of an industrial CMOS camera and a corresponding camera bracket, is arranged above the toughened flat glass carrying platform, and has a view field positioned in the center of the carrying platform;
and calibrating the color blocks, namely marking the color blocks in red, wherein the length of each marking block is 50mm, and the width of each marking block is 10 mm.
One or more embodiments of the present invention may have the following advantages over the prior art:
the method realizes intelligent fragment counting for testing the state of the plate glass fragments, has good applicability, and improves the measurement precision and the detection efficiency on the premise of ensuring the timeliness.
Detailed Description
In order to make the objects, technical solutions and advantages of the present invention more apparent, the present invention will be described in further detail with reference to the following embodiments and accompanying drawings.
As shown in fig. 1, the intelligent counting method for the flat glass fragment state test comprises the following steps:
step 10, calibrating the length of a camera counting frame and acquiring a glass fragment sample image in a shielding darkroom;
under a CMOS camera, firstly calibrating the length of a camera counting frame, and measuring the long-edge length pixels of the calibrated color blocks to obtain the pixel size corresponding to the length of 50 mm;
and under the condition that the LED flat light sources on the left side and the right side provide illumination environments, the flat glass fragment samples are subjected to image acquisition.
Step 20, obtaining a glass fragment counting frame through the length calibration of the counting frame, creating a mask according to the position of the counting frame, and extracting a local image of the glass fragment sample;
after the image is acquired, the length of the counting frame is calibrated in the step 10, an ROI (region of interest) frame corresponding to the pixel size of 50mmx50mm is created in the acquired image and is used as the counting frame for counting the glass fragments, the ROI frame is generated at the center of an image acquisition area under the default condition, and a user can drag the counting frame according to the own requirement;
after the position of the counting frame is determined, a Mask is created, and the local image in the counting frame is extracted for further processing.
Step 30, performing color gamut conversion on the local image of the glass fragment sample, extracting L-channel brightness information, performing PCA principal component analysis to obtain a glass fragment gray image, calculating a gray segmentation threshold of a glass background and a fragment edge, and performing threshold segmentation on the gray image;
converting the glass fragment sample picture from an RGB color gamut to a CIE L A B color space, and extracting an L brightness value;
PCA principal component analysis was performed on the L value: normalizing the L brightness value to obtain L' (x, y); let the image pixel length and width be X, Y, respectively, and calculate its covariance matrix C:
calculating eigenvectors corresponding to the covariance
Wherein A is a matrix of its eigenvalues, calculated as
And (3) calculating a principal component S of the L brightness value component after PCA, wherein the principal component S is marked as V:
S=L×V
obtaining the maximum value S of the principal component S matrixmaxAnd minimum value SminAnd calculating a gray level picture of the glass fragment sample image about lightness, and recording the gray level picture as G (x, y):
calculating threshold value T for segmenting glass background and fragment edge
gShould make sure that
The calculation method is as follows:
according to the threshold value TgPerforming threshold segmentation on the gray level image K to obtain a binary image for judging the glass background and the fragment edge based on the gray level, and recording the binary image as BW1The method comprises the following steps:
step 40, performing closed operation and inverse color processing of morphological processing on the converted gray level image; the processing method of the morphological processing comprises the following steps:
creating a structural element
Using se to carry out closed operation on the image G, and recording the operation result as K, wherein the processing method comprises the following steps
In order to carry out the expansion treatment,
for the shrink treatment:
and (3) as a result after processing, the background of the glass fragments is black, the edges of the glass fragments are white, and the gray image K is subjected to reverse color processing, namely:
K(x,y)=255-K(x,y)。
step 50, performing two-dimensional wavelet decomposition on the gray level image subjected to the inverse color processing to obtain a plurality of image components, and performing adaptive threshold processing on the image components to obtain a new threshold; wherein:
the two-dimensional wavelet decomposition method comprises the following steps:
processing the image K (x, y) by wavelet decomposition; the approximation image of the two-dimensional wavelet decomposition of K (x, y) is:
wherein A is
j+1K is the low frequency approximate component of the image after wavelet decomposition j +1,
representing the high frequency horizontal components of the image,
representing the high-frequency vertical component of the image,
representing high frequency diagonal components of the image. According to the orthogonality of the wavelet function and the scale function, h is set to represent a low-pass filter coefficient, g is set to represent a high-pass filter coefficient, and the method comprises the following steps:
A method of adaptive thresholding, comprising:
adopting a maximum inter-class variance method to perform self-adaptive threshold processing on the four components cA, cH, cV and cD to obtain four corresponding thresholds which are marked as g1、g2、g3、g4And calculating a new threshold g by using the four thresholdsqThe method comprises the following steps:
step 60, carrying out black-and-white segmentation on the gray-scale image by using a new threshold, carrying out two times of edge detection, and obtaining an intersection of two binary images of the two times of edge detection to obtain a glass fragment edge segmentation binary image;
at a threshold value gqPerforming threshold segmentation on the gray level image K to obtainCoarse contour binary image to fragment edge, denoted as BW2The method comprises the following steps:
for BW2And (5) detecting the edge contour twice by using a canny operator to achieve suppression of contour noise and smoothing of the image. BW extraction1And BW2Obtaining a final glass gap line segmentation binary image, and recording the final glass gap line segmentation binary image as BW:
BW=BW1∩BW2。
and 70, dividing the binary image according to the glass fragment edge, calculating the number of connected domains, calculating the number of glass fragments according to the number of the connected domains, and obtaining a qualified detection result of the glass fragments by judging and calculating the glass fragment edge. Wherein:
after the binary image of the glass fragment edge segmentation of the image in the counting frame is obtained according to the step 60, the number of the connected domains is calculated and is used as the number of the glass fragment counting;
specifically, if the connected component intersects with the counting frame edge, it is counted as 0.5 fragments;
and after the specific number of the fragments is obtained through the processing, comparing the specific number with the qualified fragment standard in the standard GB 15763.2-2005, and judging and outputting a result.
The mode avoids manual counting, improves the applicability of the measuring process, and simultaneously, combines the methods of edge detection and threshold judgment to ensure that the counting of the glass fragments is more accurate, direct and reliable.
As shown in fig. 2, fig. 3 and fig. 4, the present embodiment further provides an intelligent counting device for a flat glass fragment state test, which includes a shielding darkroom 1 without stray light influence, a tempered flat glass carrying platform 3, a left LED flat light source 5, a right LED flat light source 4, an image acquisition module 6, a camera support 2, and a calibration color block 7.
The interior of the darkroom 1 is formed by a black panel, so that the interference of external stray light is avoided, and the influence of reflection on the shooting effect caused by the interior is avoided;
the toughened flat glass carrying platform 3 is used for providing a horizontal plane for placing flat toughened fragment samples and providing a dark background for image acquisition;
LED flat light source 4, 5, its width is higher than the glass plane, and length width is in above-mentioned toughened flat glass cargo platform, and the parallel light source that sends adjustable luminance projects on the glass piece sample that awaits measuring from the side, and its effect lies in: A. background mottle caused by the projection of an image acquisition module above the glass fragment sample on the plane of the glass fragment sample is avoided; B. the contrast of the gap line of the glass fragment sample is increased, and the subsequent image processing process is facilitated.
The image acquisition module 6 consists of an industrial CMOS camera and a corresponding camera bracket, the installation position of the image acquisition module is positioned above the toughened flat glass carrying platform, and the view field of the image acquisition module is positioned in the center of the carrying platform;
the calibration color block 7 is a red mark with the length of 50mm and the width of 10mm, and is used for providing a standard length mark for automatically generating a corresponding glass fragment counting frame in a subsequent process.
Although the embodiments of the present invention have been described above, the above descriptions are only for the convenience of understanding the present invention, and are not intended to limit the present invention. It will be understood by those skilled in the art that various changes in form and details may be made therein without departing from the spirit and scope of the invention as defined by the appended claims.