Summary of the invention
The objective of the invention is for overcoming above-mentioned the deficiencies in the prior art, a kind of easy realization robotization is provided, discerns accurately, satisfy empty bottle wall defect detection method and device that high-speed production lines requires.
For achieving the above object, the present invention adopts following technical proposals:
A kind of empty bottle wall defect detection method may further comprise the steps:
A. the marginal point that scans on the bottleneck is right, utilizes the method for the definite bottle of symmetry analysis binding site relation wall each several part central axis to carry out a bottle wall location, obtains the position of body processing region, bottle wall surveyed area is divided carried out subarea processing;
B. to the positioned area by adopting grey stretching method to pre-processing image data, increase the contrast and the brightness of image;
C. adopt maximum variance between clusters that image is cut apart, obtain target information;
D. the bottle wall image after over-segmentation is carried out connectivity analysis, extract the characteristic of each defective, judge according to centroid position, figure's ratio and the area features of connected domain whether each detected connected domain is real defective.
Bottle wall basis on location bottleneck edge in the described steps A positions tracking, and concrete tracking step is as follows:
1) because in side wall image, only produce fluctuation in the horizontal direction, thus when the location horizontal ordinate of a computing center, at first determine one group of n bar (n=5 altogether, 6,, 20) and the position of scanning straight line, guarantees that every scans the both sides of the edge that straight line can both pass bottleneck;
2) set up some array P0, P1 and P2;
3) carry out bilateral scanning along every scanning straight line, suddenly change the from low to high point of intensity maximum of gray-scale value on the search straight line, with on every straight line from left to right scanning and from right to left the point that obtains of scanning be designated as respectively
,
, i=1 is to the integer of n, with point
Order leaves among the array P1 point in
Order leaves among the array P2;
4) utilize formula (1) promptly to a pair of marginal point on every scanning straight line
,
Horizontal ordinate
With
Average, utilize formula (2) to ask distance between every pair of marginal point, be designated as
, calculate a group switching centre point horizontal ordinate reference value by these paired marginal points that scan
(1)
5) combination
The distribution situation of analytic centre's point horizontal ordinate reference value: each position
All should with the corresponding scope of detection bottle in fluctuate, if exceeded this scope, illustrate that this is the pseudo-edge point to having a point in the marginal point at least, this moment can remove this horizontal ordinate reference value to the central point of a correspondence;
6) in the reference center point set of finally choosing, obtain the final calculated value of central point by the method for averaging, determine the position of body processing region then.
Grey stretching method among the described step B may further comprise the steps pre-processing image data: parameter is seen Fig. 7, and the x axle is the gray-scale value before the conversion, and the y axle is the gray-scale value after the conversion.
1) determine the greyscale transformation function, establish (
,
), (
,
) be the point of determining on the transforming function transformation function, certain gray values of pixel points is respectively Gray1 and Gray2 in the image of conversion front and back;
2) when Gray1 0~
Between the time, the order
3) exist as Gray1
~
Between the time, the order
4) exist as Gray1
In the time of between~255, order
It is 0 rank and the 1 rank square that utilizes grey level histogram that maximum variance between clusters among the described step C is cut apart image, dynamically determines the image segmentation threshold value according to the maximum variance between target and the background,
If the pixel number of piece image is N, it has L(L is natural number) individual gray level (0,1 ..., L-1), gray level is that the pixel number of i is
, so
, to image histogram normalization, probability density distribution is arranged:
Wherein
, if entire image is with gray level t(0<t<L-1) as threshold value, establish threshold value t image is divided into
With
Two classes,
With
Represent object and background respectively, and
With
Difference corresponding
grey scale level 0,1 ... t } and t+1, t+2 ... L-1 } pixel,
With
The probability that class takes place is respectively:
(5)
Wherein
,
With
Average be respectively:
(6)
Wherein
,
, can verify the following formula establishment,
(8)
Can define the class internal variance at this:
(9)
Inter-class variance:
(10)
According to the maximum between-cluster variance criterion, obtain optimum threshold value gray level
Need satisfy following formula:
It is optimal threshold
Make the inter-class variance maximum.
Whether each the detected connected domain of judging among the described step D is that real defective is:
At first extract the parameter that the connected domain algorithm returns, set up a template pixel, promptly the pel array that breach returned of empty bottle wall 1mm * 1mm is H * W, and this array is a normal value in fixing camera system;
The breach corresponding parameters template of corresponding empty bottle wall Amm * Bmm size is (A * H) * (B * W);
The pixels tall coefficient that returns then, return the pixel wide coefficient, return the elemental area coefficient, return the pixel-intensive degree and compare with the examination criteria of setting, if the parameter of extracting is not in critical field, then think the defective image of bottle wall, decision signal is passed to controller, is rejected by device for eliminating.
A kind of empty bottle wall defect pick-up unit, comprise inlet bottle wall detecting unit, outlet bottle wall detecting unit and speed difference connecting gear, described inlet bottle wall detecting unit and outlet bottle wall detecting unit lay respectively at the two ends of speed difference connecting gear, described inlet bottle wall detecting unit and outlet bottle wall detecting unit comprise photoelectric sensor respectively, camera, backlight and tertiary reflex mirror, photoelectric sensor links to each other with controller, controller is connected with the rejecting mechanism of outlet behind the detecting unit, backlight is arranged at detected bottle wall one side, tertiary reflex mirror and camera are arranged at the opposite side of detected bottle wall, the tertiary reflex mirror is corresponding with detected bottle wall and camera respectively, camera and image processing system are electrically connected, and image processing system is electrically connected with controller.
Described speed difference connecting gear comprises two parallel travelling belts up and down, the equal diameters of the distance between two travelling belts and detected bottle, and two travelling belts are arranged at respectively on the different belt wheels, and belt wheel is connected with motor by transmission shaft.
Described controller is industrial computer CPU.
Described backlight is the led light source that is connected to the stroboscopic controller, the led light source color tunable: select white light during white bottle for use, green bottle is with green, palm fibre bottle red light source.
Described image processing system is the industrial computer that has image pick-up card.
This detection system adopts the flat LED light source to carry out back lighting in bottle one side in the bottle wall detects, image carries out realizing that the multi-angle of bottle wall is Polaroid after the tertiary reflex through the tertiary reflex mirror: by each mirror angle in the first order reflector group, collect the image of the bottle of many group different angles, image enters camera through second level reflector group, the reflection of third level catoptron two-stage successively then, and system has realized the clear and near undistorted image by a camera collecting bottle wall circumference 240 degree thus.The design of tertiary reflex mirror has reduced the acquisition system occupation space, makes the total system structure compact more, has strengthened the integration of system.
Tertiary reflex mirror structure comprises first order reflection mirror, secondary reflex mirror, tertiary reflex mirror, empty bottle is positioned on the incident direction of first order reflection mirror, the first order reflection mirror is positioned on the incident direction of secondary reflex mirror, the secondary reflex mirror is positioned on the incident direction of tertiary reflex mirror, camera is positioned on the reflection direction of tertiary reflex mirror, the tertiary reflex mirror is positioned on the reflection direction of secondary reflex mirror, and the secondary reflex mirror is positioned on the reflection direction of first order reflection mirror.The empty bottle wall reflected light enters the first order reflection mirror, enters the secondary reflex mirror by the first order reflection mirror reflection, enters the tertiary reflex mirror by the secondary reflex mirror reflection again, enters camera by the tertiary reflex mirror reflection then, catches the empty bottle wall image by camera.The first order reflection mirror comprises two groups, and every group has two parallel staggered catoptrons, and two groups of both sides that are positioned at the secondary reflex mirror respectively become with the empty bottle direction of transfer

(
) angle, the secondary reflex mirror comprises two catoptrons, becomes between two catoptrons
(
) angle, each becomes two secondary reflex mirrors with the first order reflection mirror of this side
(
) angle, the tertiary reflex mirror plane is parallel with the empty bottle direction of transfer, becomes with ground
(
) angle, camera is positioned at the top of tertiary reflex mirror, becomes with the tertiary reflex mirror
(
) angle.
When arriving speed difference translator unit, empty bottle is clamped by belt, unsettled transmission.Because two belts have certain velocity contrast, empty bottle can rotate in this part transmission course, the belt speed difference that is provided with just makes empty bottle revolve after by this part and turn 90 degrees, and the detection blind area of inlet bottle wall test section is presented in the surveyed area of outlet bottle wall fully.
Empty bottle is realized 90 degree rotations in speed difference conveyer principle as shown in Figure 3, the length velocity relation of belt conveyor is V among the figure1V2, and become fixed proportion.Turn 90 degrees thereby realized empty bottle accurately revolved.
Detection method provided by the invention can be applied in the checkout equipment of industrial flow-line easily, thereby realizes the automatic high-speed of empty bottle wall defect is accurately detected.Pick-up unit provided by the invention is simple in structure, can realize accurately the empty bottle that has bottle wall defect is rejected automatically at a high speed.Judge that with graphical analysis bottle wall defect makes equipment simple and reliable.The higher order reflection structure can make camera once obtain the image information of empty bottle 240 degree, behind connecting gear, empty bottle revolves and turn 90 degrees, and inlet bottle wall detects and outlet bottle wall detects with regard to passable to complete image information like this, and this method can be finished and handle fast and judge bottle wall defect information.This device highest detection speed is 72000 bottles/hour, can detect in the surveyed area minimum dimension and be long 4mm, and the dirt of wide 4mm, the rejecting rate of defective empty bottle is more than 99.95%, the mistake rejecting rate of qualified empty bottle is controlled at below 0.3%.
Embodiment
The present invention is further described below in conjunction with drawings and Examples.
Shown in Fig. 1-8, the hardware construction of system is made up of travelling belt 2, photoelectric sensor,CCD camera 12, image processing system, industrial computer,backlight 16 and supporting stroboscopic controller thereof.
The principle of work of this device is:
Large-area flat-plate LED-backlit source 16 is adopted in the illumination of bottle wall, places bottle wall one side, and adjustable color light passes a bottle wall at a certain angle, andCCD camera 12 is on the light source opposite, and the opposite side of bottle is by multistage facetted mirrors collecting bottle wall image.The detection of bottle wall is made up of an inlet bottlewall detecting unit 3 and an outlet bottlewall detecting unit 4, is responsible for entrance and exit bottle wall image acquisition and processing respectively, eliminates the bottle wall and detects the comprehensive detection of blind area realization to empty bottle.View data is delivered to industrial computer and is carried out analysis and judgement, obtains being used to distinguish qualified empty bottle signal with defective and passes through control panel card control device for eliminating.Simultaneously, the software of man-machine interface is integrated data, realizes various functions such as data presentation, setting, filing.
The empty bottle wall defect pick-up unit, comprise inlet bottlewall detecting unit 3, outlet bottlewall detecting unit 4 and speed difference connecting gear 5, described inlet bottlewall detecting unit 3 and outlet bottlewall detecting unit 4 lay respectively at the two ends of speed difference connecting gear 5, described inlet bottlewall detecting unit 3 and outlet bottlewall detecting unit 4 comprise photoelectric sensor respectively,camera 12,backlight 16 and tertiary reflex mirror, photoelectric sensor links to each other with controller, controller is connected with the rejecting mechanism of outlet behind the detectingunit 4,backlight 16 is arranged at detected bottle wall one side, tertiary reflex mirror andcamera 12 are arranged at the opposite side of detected bottle wall, the tertiary reflex mirror is corresponding with detected bottle wall andcamera 12 respectively,camera 12 and image processing system are electrically connected, and image processing system is electrically connected with controller.
Described speed difference connecting gear 5 comprises up and down the equal diameters of distance and detected bottle between two parallel travelling belt 2, two travelling belts 2, and two travelling belts 2 are arranged at respectively on the different drive pulleys 1, and drivepulley 1 is connected with motor by transmission shaft.
Described controller is industrial computer CPU.
Describedbacklight 16 is the led light sources that are connected to the stroboscopic controller, the led light source color tunable: select white light during white bottle for use, green bottle is with green, palm fibre bottle red light source.
Described image processing system is the industrial computer that has image pick-up card.
This detection system adopts the flat LED light source to carry out back lighting in bottle one side in the bottle wall detects, image carries out realizing that the multi-angle of bottle wall is Polaroid after the tertiary reflex through the tertiary reflex mirror, each mirror angle in thefirst order catoptron 14, collect the image (image that comprisesbottleneck 9,shoulder 10 and body 11) of the bottle of many group different angles, this image is delivered to camera lens throughsecond level catoptron 15 andthird level catoptron 13 again, and system has realized the clear and near undistorted image by a camera collecting bottle wall circumference 240 degree thus.The design of tertiary reflex mirror has reduced the acquisition system occupation space, makes the total system structure compact more, has strengthened the integration of system.
Tertiary reflex mirror structure comprises first order reflection mirror 14, secondary reflex mirror 15, tertiary reflex mirror 13, empty bottle is positioned on the incident direction of first order reflection mirror 14, first order reflection mirror 14 is positioned on the incident direction of secondary reflex mirror 15, secondary reflex mirror 15 is positioned on the incident direction of tertiary reflex mirror 13, camera 12 is positioned on the reflection direction of tertiary reflex mirror 13, tertiary reflex mirror 13 is positioned on the reflection direction of secondary reflex mirror 15, and secondary reflex mirror 15 is positioned on the reflection direction of first order reflection mirror 14.The empty bottle wall reflected light enters first order reflection mirror 14, enter secondary reflex mirror 15 by 14 reflections of first order reflection mirror, enter tertiary reflex mirror 13 by 15 reflections of secondary reflex mirror again, enter camera 12 by 13 reflections of tertiary reflex mirror then, catch the empty bottle wall image by camera 12.First order reflection mirror 14 comprises two groups, and every group has two parallel staggered catoptrons, and two groups of both sides that are positioned at secondary reflex mirror 14 respectively become with the empty bottle direction of transfer

(
) angle, secondary reflex mirror 15 comprises two catoptrons, becomes between two catoptrons
(
) angle, each becomes two secondary reflex mirrors with the first order reflection mirror of this side
(
) angle, the tertiary reflex mirror plane is parallel with the empty bottle direction of transfer, becomes with ground
(
) angle, camera 12 is positioned at the top of tertiary reflex mirror 13, with 13 one-tenth in tertiary reflex mirror
(
) angle.
When arriving speed difference translator unit, empty bottle is transmitted is with 2 to clamp, unsettled transmission.Because two transmission have certain velocity contrast,empty bottle 6 can rotate in this part transmission course, travelling belt 2 velocity contrasts that are provided with just make empty bottle revolve after by this part and turn 90 degrees, and the detection blind area of inlet bottle wall test section is presented in the surveyed area of outlet bottle wall fully.
Empty bottle is realized 90 degree rotations in speed difference conveyer principle as shown in Figure 2, the length velocity relation along emptybottle working direction 17 belt conveyors among the figure is belt speed V17〉belt speed V28, and become fixed proportion.Turn 90 degrees thereby realizedempty bottle 6 accurately revolved.
Empty bottle wall defect detection method may further comprise the steps:
A. the marginal point that scans on thebottleneck 9 is right, utilizes the method for the definite bottle of symmetry analysis binding site relation wall each several part central axis to carry out a bottle wall location, obtains the position ofbody 11 processing regions, bottle wall surveyed area is divided carried out subarea processing;
B. to the positioned area by adopting grey stretching method to pre-processing image data, increase the contrast and the brightness of image;
C. adopt maximum variance between clusters that image is cut apart, obtain target information;
D. the bottle wall image after over-segmentation is carried out connectivity analysis, extract the characteristic of each defective, judge according to centroid position, figure's ratio and the area features of connected domain whether each detected connected domain is real defective.
Bottle wall basis on location bottleneck edge in the described steps A positions tracking, and concrete tracking step is as follows:
1) because in side wall image, only produce fluctuation in the horizontal direction, thus when the location horizontal ordinate of a computing center, at first determine one group of n bar (n=5 altogether, 6,, 20) and the position of scanning straight line, guarantees that every scans the both sides of the edge that straight line can both passbottleneck 9;
2) set up some array P0, P1 and P2;
3) carry out bilateral scanning along every scanning straight line, suddenly change the from low to high point of intensity maximum of gray-scale value on the search straight line, with on every straight line from left to right scanning and from right to left the point that obtains of scanning be designated as respectively
,
, i=1 is to the integer of n, with point
Order leaves among the array P1 point in
Order leaves among the array P2;
4) utilize formula (1) promptly to a pair of marginal point on every scanning straight line
,
Horizontal ordinate
With
Average, utilize formula (2) to ask distance between every pair of marginal point, be designated as
, calculate a group switching centre point horizontal ordinate reference value by these paired marginal points that scan
(2)
5) combination
The distribution situation of analytic centre's point horizontal ordinate reference value: each position
All should with the corresponding scope of detection bottle in fluctuate, if exceeded this scope, illustrate that this is the pseudo-edge point to having a point in the marginal point at least, this moment can remove this horizontal ordinate reference value to the central point of a correspondence;
6) in the reference center point set of finally choosing, obtain the final calculated value of central point by the method for averaging, determine the position of body processing region then.
Grey stretching method among the described step B may further comprise the steps pre-processing image data: parameter is seen Fig. 7, and the x axle is the gray-scale value before the conversion, and the y axle is the gray-scale value after the conversion.
1) determine the greyscale transformation function, establish (
,
), (
,
) be the point of determining on the transforming function transformation function, certain gray values of pixel points is respectively Gray1 and Gray2 in the image of conversion front and back;
2) when Gray1 0~
Between the time, the order
3) exist as Gray1
~
Between the time, the order
4) exist as Gray1
In the time of between~255, order
It is 0 rank and the 1 rank square that utilizes grey level histogram that maximum variance between clusters among the described step C is cut apart image, dynamically determines the image segmentation threshold value according to the maximum variance between target and the background,
If the pixel number of piece image is N, it has L(L is natural number) individual gray level (0,1 ..., L-1), gray level is that the pixel number of i is
, so
, to image histogram normalization, probability density distribution is arranged:
Wherein
, if entire image is with gray level t(0<t<L-1) as threshold value, establish threshold value t image is divided into
With
Two classes,
With
Represent object and background respectively, and
With
Difference corresponding
grey scale level 0,1 ... t } and t+1, t+2 ... L-1 } pixel,
With
The probability that class takes place is respectively:
Wherein
,
With
Average be respectively:
(6)
Wherein
,
, can verify the following formula establishment,
(8)
Can define the class internal variance at this:(9)
Inter-class variance:
(10)
According to the maximum between-cluster variance criterion, obtain optimum threshold value gray level
Need satisfy following formula:
It is optimal threshold
Make the inter-class variance maximum.
Whether each the detected connected domain of judging among the described step D is that real defective is:
At first extract the parameter that the connected domain algorithm returns, set up a template pixel, promptly the pel array that breach returned of empty bottle wall 1mm * 1mm is H * W, and this array is a normal value in fixing camera system;
The breach corresponding parameters template of corresponding empty bottle wall Amm * Bmm size is (A * H) * (B * W);
The pixels tall coefficient that returns then, return the pixel wide coefficient, return the elemental area coefficient, return the pixel-intensive degree and compare with the examination criteria of setting, if the parameter of extracting is not in critical field, then think the defective image of bottle wall, decision signal is passed to controller, is rejected by device for eliminating.