(2) technical background
Existing glass bottle and jar detection method has contact and contactless two kinds.
Detection to glass bottle and jar bottleneck size and unevenness, body verticality etc. adopts the glass bottle and jar of contact to detect automatically more, is generally mechanical sensing mode and measures.But adopt the glass bottle and jar pick-up unit test item of this class detection mode single, as Chinese invention patent application CN2414005 " vial vertical axis deviation test fixture ", CN2276628 " vial vertical axis deviation measuring instrument " etc.And require the machining accuracy of pick-up unit high, and cause the pick-up unit cost to rise, hold at high price, general medium and small glass bottle and jar factory is difficult to make inquiries.
The contactless glass bottle and jar of the many employings of crackle to glass bottle and jar detects, general employing is many to be installed on different angles to infrared emission, receiving tube, when glass bottle and jar process infra-red range, and the glass bottle and jar rotation, when bottleneck had crackle, it was to the reflectance anomaly of infrared-ray.According to each infrared-ray acknowledge(ment) signal situation, judge whether bottleneck has crack defect.The weak point of this kind method is that the every pair of infrared emission in the pick-up unit, receiving tube angle of coverage scope are very little, can enlarge angle of coverage though increase the logarithm of emission, receiving tube, still has the omission zone.These emissions, receiving tube are adjusted inconvenient, all will readjust when change of product, particularly in the testing process, in case the relative angle of power valve and receiving tube changes, then are difficult to be readjusted to optimum condition.
(3) summary of the invention
The objective of the invention is to propose a kind of efficiently, glass bottle and jar detection method accurately, this kind method can detect a plurality of projects such as the bottleneck crackle, bottleneck diameter of bottle, and can get rid of multiple interference.
Glass bottle and jar detection method of the present invention comprises Computer Image Processing and multiple computing method.The light source light projector is at the bottleneck of glass bottle and jar, optical screen is as the background of glass bottle and jar to be checked, glass bottle and jar revolves three-sixth turn, the image of several bottlenecks of picked-up in the rotary course, computing machine carries out Flame Image Process and calculating to the sequence image that same bottle is absorbed by the width of cloth, as long as find the speck of bottleneck crackle direct reflection therein in the width of cloth, can assert that there is crack defect in bottleneck.Image cutting algorithm, zonule partitioning and computer generalization analysis and judgement method have been adopted in the Computer Processing.
Above-mentioned image segmentation algorithm is an image rectangle partitioning algorithm; At first add up the gray-scale value of certain width of cloth gained image pixel, calculate the average of the gray-scale value of the image section of bottle and the image section of background respectively with statistics, intermediate value M with two gray averages is the global threshold of image, pixel grey scale is background area-white area greater than M's, and gray scale smaller or equal to M be the bottle image area-black area, institute's pickup image is divided into two zones of black and white, black and white two is distinguished the outline line that secant is approximately bottle, with the outline line peak P0 of bottle and the line of its right side first flex point P is the diagonal line of rectangle, make rectangle P0, P00, P, P ' is partitioned into this rectangle as the Computer Processing zone.
Comprise glass bottle and jar monitor station, pick-up unit for implementing above-mentioned detection method glass bottle and jar pick-up unit, the glass bottle and jar monitor station is static bar shaped platform, upper product travelling belt is delivered to the monitor station front end with glass bottle and jar to be checked, and the glass bottle and jar after the detection then is pushed on the next product travelling belt.A plurality of card bottle dollies are positioned on the circular orbit, and this circular orbit and monitor station have a parallel section.Card bottle dolly register pin down with stop walking apparatus and link to each other, in one-period, regularly pause and acceleration is walked.On the card bottle dolly 2 location steamboats are arranged, bottle to be checked is stuck between 2 location steamboats, and is pushed to move ahead by card bottle dolly.Detecting station, the opposite side of the monitor station relative with card bottle dolly has the bottle of stranding with the hands belt, and this belt sleeve is on two belt pulleys, and one of them is the driving wheel that links to each other with motor.Driving wheel rotates, and rubs the bottle belt with the hands and walks in two belt pulley cocycles.When bottle to be checked snapped between stranding bottle belt and the card bottle dolly, the belt rubbing made bottle rotation to be checked.In a side that detects station is video camera, and opposite side has light source.Video camera links to each other with computing machine.
The advantage of glass bottle and jar detection method of the present invention is: 1 adopts shooting and Computer Image Processing, and contactless detection has realized online automatic detection; The image of picked-up all angles guaranteed no omission during 2 glass bottle and jars rotated a circle; 3 adopt multiple image processing algorithm, accurately to obtain testing result rapidly; 4 same sequence images can be used for bottleneck crackle and two detections of bottleneck diameter.
(5) embodiment
Glass bottle and jar detection method of the present invention comprises Computer Image Processing and multiple computing method.The light source light projector is at the bottleneck of glass bottle and jar, optical screen is as the background of glass bottle and jar to be checked, glass bottle and jar revolves three-sixth turn, absorb the image of 15~35 width of cloth bottlenecks in the rotary course, computing machine carries out Flame Image Process and calculating to the sequence image that same bottle is absorbed by the width of cloth, as long as find the speck of bottleneck crackle direct reflection therein in the width of cloth, can assert that there is crack defect in bottleneck.
When tested bottle rotates a circle, the image appearance of several series bottles of picked-up whole bottleneck situations.Computing machine adopts image segmentation algorithm during to Flame Image Process, cuts out the parts of images of bottleneck in every width of cloth figure, as the Computer Processing zone, has significantly reduced the treatment capacity of computing machine like this.
Image rectangle partitioning algorithm as shown in Figure 1 and Figure 2.At first add up the gray-scale value of certain width of cloth gained image pixel.Owing to adopt the shooting background of optical screen as bottle, bottle has big contrast with background in the image that is absorbed, and the image section of bottle is dark, and gray scale is lower relatively, and background parts is obviously brighter because of optical screen is arranged, and gray scale is higher relatively.Calculating the average of the gray-scale value of the image section of bottle and the image section of background respectively with statistics, is the global threshold of image with the intermediate value M of two gray averages.Pixel grey scale is background area-white area greater than M's, and gray scale smaller or equal to M be the bottle image area-black area, as shown in Figure 5, institute's pickup image is divided into two zones of black and white.Black and white two is distinguished the outline line that secant is approximately bottle.With the outline line peak P0 of bottle and the line of its right side first flex point P is the diagonal line of rectangle, make rectangle P0, P00, P, P ', this rectangle is partitioned into as the Computer Processing zone, i.e. rectangle region as shown in Figure 5, this district comprises 20%~30% of bottleneck.When tested bottle rotated a circle, the image of several of picked-up bottle had comprised whole bottleneck situations.
Because of in the Computer Processing zone that entire image is partitioned into, illumination patterns is inhomogeneous along the bottleneck contour direction, be difficult to handle calculating with same parameter, so adopt the zonule to divide facture, soon bottleneck portion is divided into some zonules again and handles calculating one by one in the Computer Processing zone.
Facture is divided as shown in Figure 3 in trapezoidal zonule.The outline line of bottleneck is a curve in the Computer Processing zone, is getting n some P1~Pn, 4<n<30 between P0, the P on bottleneck profile camber line.Make vertical line downwards to P11 from P1, according to the corresponding calibration of the distance between the pixel, bottleneck thickness T in the image as can be known with meter.The length of P1-P11 is d1, T<d1<1.5T.Make horizontal line and P0, P00 meet at P01, P0, P01, P11, the trapezoidal R1 of P1 form right angle from P11.Make vertical line downwards to P21 from P2, the length of P2-P21 is d2, T<d2<1.5T.Get 1 P2 ' on the camber line between P0, the P1, the vertical line of doing under horizontal line and the P2 ' from P21 meets at P2 ' 1, P2 ', P2 ' 1, P21, the trapezoidal R2 of P2 form right angle.Trapezoidal R2 and trapezoidal R1 are overlapped.As shown in Figure 6, the rest may be inferred, and the some Pi from the bottleneck profile camber line between P0, the P makes vertical line downwards to Pi1, and the length of Pi-Pi1 is di, T<di<1.5T; But when the end P00-P of this vertical line and the rectangle in the Computer Processing zone that is partitioned into intersects at Pj, during and the length d j of Pi-Pj<T, then getting Pj is Pi1.Getting a Pi ' on the camber line between P (i-1) and the P (i-2), the vertical line of doing under horizontal line and the Pi ' from Pi1 meets at Pi ' 1, Pi ', Pi ' 1, Pi1, the trapezoidal Ri of Pi form right angle.According to said method make a series of and previous trapezoidal equitant little trapezoidal R1~Rn, computing machine carries out comprehensive analysis and judgement to each little trapezoid area one by one to be handled, and has determined whether that crackle exists, and improves processing speed and accuracy.Little trapezoidal neighbor is overlapping, can avoid Lou meter.
Computer generalization analysis and judgement facture is adopted in the judgement of bottle mouth defect, mainly contains following three contents:
1. noise and interference filtering algorithm
Calculate the gray-scale value of each pixel in the Ri of each zonule, get its average and add the value of adjusting as adaptive threshold Li.Judge gray-scale value in the Ri greater than the number of the pixel of Li whether greater than N.Because of reflection, the refraction of light, or the multiple reason such as inhomogeneous of glass material, have the high phenomenon of individual pixel gray-scale value, be not to be crack defect.N is an adjustable parameter, according to adjustment such as to be checked bottle color and luster, material, thickness.
2. speck shape analysis algorithm
Calculate the Grad of each zonule Ri interior pixel gray scale, and get m pixel of gradient maximum, whether the distance variance sum of the pixel of gray scale maximum and this m pixel is less than M in the calculating Ri.M and M are adjustable parameter.Because of the gray scale of cracks pixel is big, and with the shade of gray height of neighbor, the further filtering veiling glare of this gradient analysis algorithm, noise are determined the existence and the shape of speck.
3. edge extracting and gradient analysis algorithm
Calculate the point group coordinate of Ri interior pixel shade of gray maximum, check whether its trend is not consistent with bottleneck contour edge direction.If it conforms to the bottleneck contour edge, then this speck is that the possibility of bottleneck edge light interference is bigger, should get rid of.
According to 1. above~3. the condition of 3 algorithms all satisfies, and can affirm that then crack defect exists.Also can be with above three condition weighted calculation summation, if determine then that greater than certain value crack defect exists.
With the corresponding calibration of the distance between two pixels on the horizontal direction of camera pickuping image with meter, the sequence image of above-mentioned picked-up is carried out image segmentation by the width of cloth, obtain the pixel count of bottleneck diameter correspondence, be converted to meter according to calibration, with the arithmetic mean of the sequence image gained bottleneck diameter of same bottleneck, be the measurement result of this bottle bottleneck diameter.