CN103745471B - A kind of vision-based detection for the automatic mounted box of Notebook Battery and control method - Google Patents

A kind of vision-based detection for the automatic mounted box of Notebook Battery and control method Download PDF

Info

Publication number
CN103745471B
CN103745471B CN201410010979.0A CN201410010979A CN103745471B CN 103745471 B CN103745471 B CN 103745471B CN 201410010979 A CN201410010979 A CN 201410010979A CN 103745471 B CN103745471 B CN 103745471B
Authority
CN
China
Prior art keywords
battery
prime
draw
groove
image
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.)
Active
Application number
CN201410010979.0A
Other languages
Chinese (zh)
Other versions
CN103745471A (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.)
Write Easy Network Technology Shanghai Co ltd
Original Assignee
Nanjing University of Information Science and Technology
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 Nanjing University of Information Science and Technology filed Critical Nanjing University of Information Science and Technology
Priority to CN201410010979.0A priority Critical patent/CN103745471B/en
Publication of CN103745471A publication Critical patent/CN103745471A/en
Application granted granted Critical
Publication of CN103745471B publication Critical patent/CN103745471B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02PCLIMATE CHANGE MITIGATION TECHNOLOGIES IN THE PRODUCTION OR PROCESSING OF GOODS
    • Y02P90/00Enabling technologies with a potential contribution to greenhouse gas [GHG] emissions mitigation
    • Y02P90/02Total factory control, e.g. smart factories, flexible manufacturing systems [FMS] or integrated manufacturing systems [IMS]

Landscapes

  • Image Analysis (AREA)
  • Image Processing (AREA)

Abstract

The invention discloses a kind of vision-based detection for the automatic mounted box of Notebook Battery and control method, it is characterized in that utilizing the CCD camera that is arranged on transport tape top to take Notebook Battery image, use visual detection algorithm, determine particular location and the direction of Notebook Battery on transport tape, and then control robot movement captures Notebook Battery, then, utilize the CCD camera that reverses platform top to take the visible images sending from Battery Card groove center rectangle hole, utilize image processing algorithm, determine the position of groove and the placement direction of both positive and negative polarity that current battery will be put, pass through twist mechanism, Notebook Battery both positive and negative polarity is docked to arrangement successively, finally by manipulator, the Notebook Battery arranging is packed in battery case automatically. the present invention utilizes vision-based detection principle, has method simple, and accuracy of detection is high, the advantage that controlling unit automaticity is high.

Description

A kind of vision-based detection for the automatic mounted box of Notebook Battery and control method
Technical field
What the present invention relates to is a kind of automatic production line, and particularly a kind of automation of scattered synthetic rapid-assembling is rawProduce line, belong to Electromechanical Control field.
Background technology
Along with the development of world's industry and commerce process, the same society's life falling behind of material and cultural needs that the mankind are growingContradiction between product increases day by day, the scientific and technological progress of entering to determine society. The gusher formula of the notebook of various brands goes outExisting, the competition of aggravation Liao Ge businessman. Improve the quality of products, speed production efficiency and will determine that businessman obtains initiatively in competition.
Find through retrieval, the assembling of current domestic Notebook Battery is handwork substantially, and the master that handwork existsWant problem to have: production efficiency is low and quality is unstable, in addition owing to a large amount of repeating, dull operation can make people feel uninteresting,, very easily there is loading error in fatigue. Not only can affect the quality of battery if made a mistake, also can produce after after sale unnecessaryReally. And the expensive of nowadays manpower work is also the unmodifiable fact.
Summary of the invention
The object of the invention is to overcome the domestic deficiency taking handwork as main Notebook Battery assemble method, provide oneKind utilize vision-based detection principle, method simple, detect accurate high, controlling unit automaticity high for Notebook Battery fromVision-based detection and the control method of moving mounted box.
Concrete technical scheme of the present invention is as follows:
For vision-based detection and the control method of Notebook Battery automatic Composition, the method concrete steps are as follows:
Respectively directly over production line station A and battery draw-in groove K3And K4CCD camera C is installed directly over centre1And CCDCamera C2, on the torsion platform B of parallel and production line, six battery draw-in groove K are set1,K2,K3,K4,K5,K6, and manipulator J1With manipulator J2, the centre bottom of six battery draw-in grooves is offered rectangle hole, below each battery draw-in groove, places upward respectivelyThe white visible light source irradiating, battery draw-in groove K1And K2Connect as one battery draw-in groove K3And K4Connect as one battery draw-in groove K5And K6Connect as one, at draw-in groove K3The lower left corner arranges a rotating shaft Z perpendicular to reversing platform B1, at K4The upper right corner is perpendicular to torsionPlatform B arranges a rotating shaft Z2,K2And K3Through rotating shaft Z1Be connected, make K1,K2Can be around Z1Be rotated counterclockwise 180 degree, K4And K5Through revolvingRotating shaft Z2Be connected, K5,K6Can be around Z2Be rotated counterclockwise 180 degree, concrete steps are as follows:
Step 1: utilize CCD camera C1Take pictures extract the Notebook Battery at station A place on production line centre coordinate andDirectional information, and control manipulator J1Capture battery
(1) adopt a kind of improved Roberts edge algorithms to detect the edge of notebook cell image;
(2) the polar angle θ of the column axis by the above-mentioned station A of Hough transformation calculations place Notebook Battery;
(3) Coordinate Conversion
By original coordinate system iO1Any point coordinate [i, j] in j is transformed into i ' O in new coordinate system1J ', and calculate that it is newCoordinate figure [i ', j '], specific formula for calculation is as follows:
First, whenTime, by original coordinate system iO1J is around an O1Be rotated counterclockwiseAngle set up new withO1For the rectangular coordinate system i ' O of initial point1j′,
, i ′ = i 2 + j 2 cos ( β - θ - π 2 ) j ′ = i 2 + j 2 sin ( β - θ - π 2 ) ,
Wherein, i ', j ' is respectively coordinate system i ' O1The horizontal stroke of j ' mid point, ordinate value, and i ', j ' is natural number, i '=-399 ,-398, L0,1,2, L, 398, or 399, j '=-299 ,-298, L, 0,1,2, L, 298, or 299, and the abscissa i of pointEqual at 0 o'clock,In the time that the abscissa i of point is not equal to 0, β = arctan - 1 j i ,
WhenTime, by original coordinate system iO1J is around an O1Be rotated counterclockwiseAngle is set up new for O1ForRectangular coordinate system i ' the O of initial point1j′,
, i ′ = i 2 + j 2 cos ( β - θ + π 2 ) j ′ = i 2 + j 2 sin ( β - θ + π 2 ) ,
(4) calculate above-mentioned station A place Notebook Battery center point coordinate
First, at original coordinate system iO1In j, the image gathering is carried out to Threshold segmentation binary conversion treatment, obtain two-valueChange the gray value B of image1[i,j],I1[i, j] is the gray scale of the original image of collectionValue, T is the binarization segmentation threshold value of barrier and background, T=210, I1In the original image that [i, j] representative gathers i capable, theThe gray value of j row pixel, i=0,1,2, L, 398, or 399, j=0,1,2, L, 298, or 299, and by binaryzation in coordinate systemThe point of not processing is all set to 0,
Then, by the gray value B of image after binaryzation1[i, j], at coordinate system i ' O1In j ' respectively on i ' axle and j ' axleProjection, determines the coordinate J ' of battery central point on i ' axle and j ' axlexAnd J 'y, concrete steps are as follows:
1) by the gray value B of image after binaryzation1[i, j], to projection on i ' axle, calculates each parallel with j ' axle and lists allThe gray value sum of pixel, is stored in respectively array F by result of calculation1In [f], whenTime, F 1 &lsqb; f &rsqb; = &Sigma; i &prime; = - r 1 0 B 1 &lsqb; f , i &prime; &rsqb; , Wherein r 1 = 400 &times; c o s ( &pi; 2 - &theta; ) , m1=300×cosθ,n1=300 × cos θ, and r1、m1、n1Adopt respectively rounding-off method to getInteger value, f is from-m1Value is to n successively1; When &pi; 2 &le; &theta; < &pi; Time, F 1 &lsqb; f &rsqb; = &Sigma; i &prime; = - m n B 1 &lsqb; f , i &prime; &rsqb; , Wherein r 1 = 500 &times; c o s ( &beta; - &theta; + &pi; 2 ) , m1=400×cos(π-θ),And r1、m1、n1Adopt respectively rounding-off method to round numerical value, f is from 0Value is to r successively1
2) by the gray value B of image after binaryzation1[i, j], to projection on j ' axle, calculates in every a line parallel with i ' axle allThe gray value sum of pixel, is stored in respectively array H by result of calculation1In [h], whenTime, H 1 &lsqb; h &rsqb; = &Sigma; i &prime; = - m 2 n 2 B 1 ( i &prime; , h ) , Wherein r 2 = 500 &times; c o s ( &beta; - &theta; - &pi; 2 ) , m 2 = 400 &times; c o s ( &pi; 2 - &theta; ) , n2=300 × cos θ, and r2, m, n adopt respectively fourHouse five enters method and rounds numerical value, h from 0 successively value to r2; When &pi; 2 &le; &theta; < &pi; Time, H 1 &lsqb; k &rsqb; = &Sigma; i &prime; = 0 r 2 B 1 ( i &prime; , k ) , Wherein r 2 = 500 &times; c o s ( &beta; - &theta; - &pi; 2 ) , m2=400×cos(π-θ),And r2、m2、n2Adopt respectivelyRounding-off method rounds numerical value, and h is from-m2Value is to n successively2
3) at coordinate system i ' O1In j ', adopt two ends detection methods, determine left and right on i ' direction of principal axis of Notebook BatteryThe abscissa value on border, and by result store at variable J 'L、J′RIn, simultaneously by the upper and lower border of determining on j ' direction of principal axisOrdinate value is stored in variable K 'UAnd K 'DIn, concrete steps are as follows:
A) f is according to f=-400 ,-399, L, and 0,1,2,399,400 values successively, in the time that f meets following condition: F1[f+2]-F1[f]≥15&&F1[f+2]≥25&&F1[f]≤5, show to have detected the left margin of Notebook Battery, use variableJ′LNote down current abscissa f, and make J 'L=f, continues to f assignment, when f meets following condition: F1[f]-F1[f+2]≥15&&F1[f]≥25&&F1[f+2]≤5, show to have detected the right margin of Notebook Battery, with variable J 'RNote down currentAbscissa f, and make J 'R=f,
B) h is according to h=-300 ,-299, L0, and 1,2, L299,300 values successively, when h meets following condition: H1[h+2]-H1[h]≥15&&H1[h+2]≥25&&H1[h]≤5, show to have detected the lower boundary of Notebook Battery, use variableK′DNote down current abscissa h, and make K 'D=h, continues to h assignment, when h meets following condition: H1[h]-H1[h+2]≥15&&H1[h]≥25&&H1[h+2]≤5, show to have detected the coboundary of Notebook Battery, with variable K 'UNote down currentAbscissa h, and make K 'U=h,
C) the abscissa C ' of calculating Notebook Battery central pointi′With ordinate C 'j′,C′i′=(J′L+J′R)/2,C′j′=(K′U+K′D)/2,
(5) determine the position of the anodal and negative pole of Notebook Battery
If F[J 'L]>F[J′R], Notebook Battery negative pole is at coordinate system i ' O1The middle abscissa value of j ' is J 'L, anodal horizontal seatScale value is J 'R; If F[J 'L]<F[J′R], Notebook Battery positive pole is at coordinate system i ' O1The middle abscissa value of j ' is J 'L, negative pole horizontal strokeCoordinate figure is J 'R
(6) according to Notebook Battery central point at coordinate system i ' O1Horizontal stroke under j ', ordinate value, calculate at iO1J coordinate systemUnder horizontal stroke, ordinate value, computing formula is as follows:
When 0 &le; &theta; < &pi; 2 Time, C i = C i &prime; 2 + C j &prime; 2 cos ( &beta; &prime; + &theta; + &pi; 2 ) C j = C i &prime; 2 + C j &prime; 2 sin ( &beta; &prime; + &theta; + &pi; 2 )
When &pi; 2 &le; &theta; < &pi; Time, C i = C i &prime; 2 + C j &prime; 2 cos ( &beta; &prime; + &theta; - &pi; 2 ) C j = C i &prime; 2 + C j &prime; 2 sin ( &beta; &prime; + &theta; - &pi; 2 )
Wherein, Ci′And Cj′Be respectively at new rectangular coordinate system i ' O1The horizontal stroke of definite Notebook Battery central point, vertical in j 'Coordinate figure, as abscissa Ci′Equal at 0 o'clock,As abscissa Ci′Be not equal at 0 o'clock, &beta; &prime; = arctan - 1 C j &prime; C i &prime; ,
(7) control manipulator J1Capture Notebook Battery
First, PLC controls manipulator J1To specified coordinate position, i.e. Notebook Battery center C (Ci,Cj), and controlMagnetic chuck X1The long the longest limit MN of rib vertical with torsion platform B horizontal center line ST, MN and L1L2Parallel, whenTime, PLC controls manipulator and is rotated counterclockwise θ angle and declines 10 centimetres, then the magnetic chuck crawl battery that powers onAnd rise 10 centimetres, and now, if F[J 'L]>F[J′R], control turn clockwise θ angle decline 10 centimetres of manipulator, thenMagnetic chuck power-off is put into Notebook Battery to reverse on platform, if F[J 'L]<F[J′R], control manipulator and be rotated counterclockwise π-θAngle also declines 10 centimetres, and then magnetic chuck power-off is put into Notebook Battery to reverse on platform; WhenTime, controllerTurn clockwise π-θ angle decline 10 centimetres of tool hand, then magnetic chuck powers on and captures battery and rise 10 centimetres, now,If F[J 'L]>F[J′R], control manipulator and be rotated counterclockwise π-θ angle and decline 10 centimetres, then magnetic chuck power-off is by penRemember that this battery is put on torsion platform, if F[J 'L]<F[J′R], control turn clockwise θ angle decline 10 centimetres of manipulator,Then magnetic chuck power-off is put into Notebook Battery to reverse on platform;
Step 2: utilize CCD camera C2Take and reverse six draw-in groove centre bottom rectangle hole images on platform, by figureDetermine as Processing Algorithm position and the positive and negative electrode direction that Notebook Battery should be placed
(1) image is carried out to binary conversion treatment
With CCD camera C2Take the image that reverses upper six draw-in grooves of platform B, with CCD camera C2The center of the image of takingPoint O2For initial point is set up rectangular coordinate system, the image of taking is carried out to Threshold segmentation binary conversion treatment, obtain binary imageGray value B2[i,j],I2[i, j] is CCD camera C2The i that gathers image is capable,The gray value of j row pixel, T2For the white visible ray that sends from draw-in groove central rectangular aperture hole and the binarization segmentation threshold of backgroundValue, T2=200, i, j is natural number, and i=-199 ,-198, L, 0,1,2, L, 198, or 199, j=-149 ,-148, L, 0,1,2, L, 148, or 149,
(2) image is carried out to noise remove and connective processing
First, the gray value of pixel on image edge is set to 0, then adopts 3 × 3 detection window traversal view pictureImage, the gray value that makes detection window central point is B2[i, j], central point around the gray value of 8 neighborhood points from the upper left corner withBe respectively clockwise B2[i-1,j+1]、B2[i,j+1]、B2[i+1,j+1]、B2[i+1,j]、B2[i+1,j-1]、B2[i,j-1]、B2[i-1,j-1]、B2[i-1,j],
Allow 3 × 3 detection window travel through successively entire image, the gray value of the pixel under calculation window covers, if B2[i,j]+B2[i-1,j+1]+B2[i,j+1]+B2[i+1,j+1]+B2[i+1,j]+B2[i+1,j-1]+B2[i,j-1]+B2[i-1,j-1]+B2[i-1, j]≤3, make B2[i, j]=1, otherwise, B made2[i,j]=0,
Secondly, the image of removing after noise is carried out to floor projection
The gray value of removing each pixel listing of image after noise is added, result of calculation is stored in respectivelyArray F2In [f],Wherein f is integer, f=-199, and-198, L, 0,1,2, L, 198, or 199,
(3) Notebook Battery central point abscissa in computed image;
(4) determine by template matching method the position that Notebook Battery should be laid
At manipulator J1Before laying battery, the CCD camera that reverses platform top all can be to reversing platform photographic images, to figurePicture is processed, and result of calculation is still stored in respectively to array F2In [f],Wherein f is integer,F=-199 ,-198, L0,1,2, L, 198, or 199 values successively, when f meets following condition: F2[f+2]-F2[f]≥15&&F2[f+2]≥25&&F2[f]≤5, show that first rising edge that image detected, along coordinate, stops the assignment to f, with becomingAmount E notes down current abscissa f, and makes E=f, states condition: F when f gets all over being discontented with foot after all values2[f+2]-F2[f]≥15&&F2[f+2]≥25&&F2[f]≤5 o'clock, store in variable E 0, i.e. E=0, by E respectively with x1、x2、x3、x4、x5、x6Compare, ifWherein ε is error threshold, and ε=3, shows draw-in groove K1Not placing battery, nowPLC controls manipulator J1The battery of absorption is put into draw-in groove K1; IfShow draw-in groove K2Not placing battery,Now PLC controls manipulator J1The battery of absorption is put into draw-in groove K2; IfShow draw-in groove K3Do not placeBattery, now PLC controls manipulator J1By first the battery of drawing Rotate 180 degree, then put into draw-in groove K3; IfShow draw-in groove K4Not placing battery, now PLC controls manipulator J1The battery of absorption is first rotated180 degree, then put into draw-in groove K4; IfShow draw-in groove K5Not placing battery, now PLC controls manipulatorThe battery of absorption is put into draw-in groove K5; IfShow draw-in groove K6Not placing battery, now PLC controllerTool hand J1The battery of absorption is put into draw-in groove K6; If E=0, shows that six draw-in grooves have all put battery, execution step three;
Step 3: by twist mechanism, Notebook Battery both positive and negative polarity is docked to arrangement successively
When six draw-in grooves are all after placing battery, PLC controls the twist mechanism reversing on platform, makes K1、K2Around Z1Axle is counterclockwiseRotate 180 degree makes K simultaneously5、K6Around Z2Axle is rotated counterclockwise 180 degree, now, and manipulator J2By six joint notebook electricity after reversingPond is placed in the note book battery box on tooling platform V and assembles after capturing simultaneously.
Further design of the present invention is:
CCD camera C1Be responsible for the collection of Notebook Battery image on production line, CCD camera C2Be responsible for reversing platform B upper sixThe collection of individual draw-in groove and center white visible images thereof, manipulator J1With manipulator J2End is respectively with cuboid grooveShape magnetic chuck X1And X2, manipulator J1Be responsible for a batteries capture rear and be put in the draw-in groove reversing on platform from production line,Manipulator J2After being responsible for six batteries on torsion retrotorsion platform B to capture together, be placed in the battery case of notebook batteryBox is placed on and reverses on the other tooling platform V of platform B.
Described in (1) of step 1, adopt the edge of improved Roberts edge algorithms detection notebook cell image, toolBody step is as follows:
First, with CCD camera C1The image of taking production line station A place Notebook Battery, at the lower-left point of image isInitial point O1Set up rectangular coordinate system iO1J, adopts 3 × 3 whole image of detection window traversal, in 8 connected pixel neighborhoods, respectivelyCalculated level direction, vertical direction, the Grad in 135 degree directions and 45 degree directions, wherein, the Grad in horizontal directionFor: P0[i,j]=|I1[i-1,j]-I1[i+1, j] |, the Grad in vertical direction is: P90[i,j]=|I1[i,j-1]-I1[i, j+1] |, the Grad in 135 degree directions is: P135[i,j]=|2×(I1[i-1,j-1]-I1[i+1, j+1]) |, 45 degree sidesGrad is upwards: P45[i,j]=|2×(I1[i+1,j-1]-I1[i-1, j+1]) |, I in formula1It is former that [i, j] representative gathersThe gray value of capable, the j row pixel of i in beginning image, i=0,1,2, L, 398, or 399, j=0,1,2, L, 298, or 299,
Secondly, calculate total Grad M[i in 8 connected pixel neighborhoods, j], M[i, j]=P0[i,j]+P90[i,j]+P135[i,j]+P45[i, j], and itself and the threshold tau of setting are compared, obtain the gray value C[i of binaryzation back edge image, j], C &lsqb; i , j &rsqb; = 1 , M &lsqb; i , j &rsqb; > &tau; 0 , M &lsqb; i , j &rsqb; &le; &tau; , Wherein, the selected threshold that τ is marginal point, and τ=6.
Described in (2) of step 1, pass through the utmost point of the column axis of the above-mentioned station A of Hough transformation calculations place Notebook BatteryAngle θ, concrete steps are as follows:
First, will be with O1For the rectangular coordinate system of initial point changes into O1For the polar coordinate system of initial point, establishing ρ is utmost point footpath, and α isPolar angle, ρ and α are natural number, and ρ equals 0,1 ..., 498, or 499, α equals 0,1 ..., 178, or 179, respectively in its maximumBetween value and minimum of a value, set up a discrete parameter space;
Secondly, set up the accumulator N[ρ of a two-dimensional array] [α], in juxtaposition array, each element is 0;
Then, each marginal point in edge image C [i, j], the pixel that edge image gray value is 1, doesHough conversion, calculates this corresponding curve in polar coordinate system, and adds 1, i.e. N[ρ on corresponding accumulator] [α]=N[ρ][α]+1,
Finally, find out the local maximum of the accumulator of collinear points on correspondence (x, y) coordinate system, this value provide (x,Y) parameter (ρ of collinear points straight line on coordinate plane00),α0Be the polar angle of the straight line that collinear points are maximum, because two, batteryThe length of crest line HR and GP is the longest, and therefore, the line segment that collinear points are maximum must be in HR or GP, again because HR and GP are flatOK, again with battery post body axis L1L2Parallel, therefore, battery post body axis L1L2Polar angle θ=α0
Notebook Battery central point abscissa in computed image described in (3) of step 2, concrete steps are as follows:
F is according to f=-199 ,-198, L0, and 1,2, L, 198, or 199 values successively, when f meets following condition: F2[f+2]-F2[f]≥15&&F2[f+2]≥25&&F2[f]≤5, show that the rising edge for the first time that image detected is along coordinate,Note down current abscissa f with variable G, and make G=f, continue to f assignment, when f meets following condition: F2[f]-F2[f+2]≥15&&F2[f]≥25&&F2[f+2]≤5, show that the trailing edge for the first time that image detected, along coordinate, stops composing to fValue, notes down current abscissa f with variable G ', and makes G '=f, Notebook Battery rectangle draw-in groove K4Intermediate rectangular hole is at figureWidth value d ' in picture0=G '-G, unit is pixel, utilizes ruler directly to measure Notebook Battery rectangle draw-in groove intermediate rectangular holeWidth is d0, draw-in groove K1And K2Distance between intermediate rectangular hole center is l1, draw-in groove K2And K3Intermediate rectangular hole center itBetween distance be l2, draw-in groove K3And K4Distance between intermediate rectangular hole center is l3, draw-in groove K4And K5In intermediate rectangular holeDistance between the heart is l4, draw-in groove K5And K6Distance between intermediate rectangular hole center is l5,d0、l1、l2、l3、l4And l5ListPosition is millimeter; Known as calculated, draw-in groove K in image1And K2Distance between intermediate rectangular hole centerDraw-in grooveK2And K3Distance between intermediate rectangular hole centerDraw-in groove K3And K4Distance between intermediate rectangular hole centerDraw-in groove K4And K5Distance between intermediate rectangular hole centerDraw-in groove K5And K6Intermediate rectangular holeDistance between centerl′1、l′2、l′3、l′4、l′5Unit be pixel, and round off method is to l '1、l′2、l′3、l′4、l′5Round, establish draw-in groove K in image1、K2、K3、K4、K5、K6The abscissa of intermediate rectangular hole central point is from left to right respectively x1、x2、x3、x4、x5、x6, unit is pixel, x 1 = - l 3 &prime; 2 - l 2 &prime; - l 1 &prime; , x 2 = - l 3 &prime; 2 - l 2 &prime; , x 3 = - l 3 &prime; 2 , x 4 = l 3 &prime; 2 , x 5 = l 3 &prime; 2 + l 4 &prime; , x 6 = l 3 &prime; 2 + l 4 &prime; + l 5 &prime; .
Compared with prior art, tool of the present invention has the following advantages:
(1) the present invention adopts machine vision technique, propose a kind of vision-based detection for the automatic mounted box of Notebook Battery andControl method, has overcome that production efficiency hand-manipulated is low, quality is unstable, the drawback of loading error, has improved Notebook BatteryThe gentle efficiency of Automated water of installing.
(2) utilize two CCD cameras, be respectively used to calculate the centre coordinate of Notebook Battery on production line and determine penRemember the position that this battery should be placed, and then realized the automatic mounted box of Notebook Battery, improved Notebook Battery automatic mountingThe precision of box and reliability.
Brief description of the drawings
Fig. 1 is workbench schematic diagram;
Fig. 2 reverses platform initial position floor map;
Fig. 3 is the position view after Notebook Battery rotation;
Fig. 4 comprises that Fig. 4 (a) and 4 (b) are the coordinate transform schematic diagrames that solves polar angle;
Fig. 5 is overall workflow figure.
In figure: 1-transfer station; 2-Notebook Battery; 4-CCD camera C1; 5-station A; 6-magnetic chuck X1; 8 batteriesBox; 9-manipulator J2; 10-reverses platform B; 11-magnetic chuck X2; A 12-CCD report picture C2; 13-draw-in groove K1; 14 draw-in groove K2; 15-Draw-in groove K3; 16-draw-in groove K4; 17-draw-in groove K5; 18-draw-in groove K6; 19-rotating shaft Z1; 20-rotating shaft Z2; Hole in the middle of 21-draw-in groove.
Detailed description of the invention:
As shown in Figure 5, the present invention comprises following step for vision-based detection and the control method of Notebook Battery automatic CompositionRapid:
Respectively directly over production line station A and battery draw-in groove K3And K4CCD camera C is installed directly over centre1And CCDCamera C2, on the torsion platform B of parallel and production line, six battery draw-in groove K are set1,K2,K3,K4,K5,K6, six Battery CardsThe centre bottom of groove is offered rectangle hole, places respectively the white visible light source irradiating, electricity below each battery draw-in groove upwardPond draw-in groove K1And K2Connect as one battery draw-in groove K3And K4Connect as one battery draw-in groove K5And K6Connect as one, at draw-in grooveK3The lower left corner arranges a rotating shaft Z perpendicular to reversing platform B1, at K4The upper right corner arranges a rotating shaft Z perpendicular to reversing platform B2,K2WithK3Through rotating shaft Z1Be connected, make K1,K2Can be around Z1Be rotated counterclockwise 180 degree, K4And K5Through rotating shaft Z2Be connected, K5,K6Can be around Z2Be rotated counterclockwise 180 degree. Concrete layout as shown in Figure 1-Figure 3.
CCD camera C1Be responsible for the collection of Notebook Battery image on production line, CCD camera C2Be responsible for reversing platform B upper 6The collection of individual draw-in groove and center white visible images thereof, manipulator J1With manipulator J2End is respectively with cuboid grooveShape magnetic chuck X1And X2, manipulator J1Be responsible for a batteries capture rear and be put in the draw-in groove reversing on platform from production line,Manipulator J2After being responsible for six batteries on torsion retrotorsion platform B to capture together, be placed in the battery case of notebook batteryBox is placed on and reverses the other tooling platform V of platform B above, and later step is as follows:
Step 1: utilize CCD camera C1Take pictures extract the Notebook Battery at station A place on production line centre coordinate andDirectional information, and control manipulator J1Capture battery
(1) adopt a kind of improved Roberts edge algorithms to detect the edge of notebook cell image
First, with CCD camera C1The image of taking production line station A place Notebook Battery, at the lower-left point of image isInitial point O1Set up rectangular coordinate system iO1J, adopts 3 × 3 whole image of detection window traversal, in 8 connected pixel neighborhoods, respectivelyCalculated level direction, vertical direction, the Grad in 135 degree directions and 45 degree directions, wherein, the Grad in horizontal directionFor: P0[i,j]=|I1[i-1,j]-I1[i+1, j] |, the Grad in vertical direction is: P90[i,j]=|I1[i,j-1]-I1[i, j+1] |, the Grad in 135 degree directions is: P135[i,j]=|2×(I1[i-1,j-1]-I1[i+1, j+1]) |, 45 degree sidesGrad is upwards: P45[i,j]=|2×(I1[i+1,j-1]-I1[i-1, j+1]) |, I in formula1It is former that [i, j] representative gathersThe gray value of capable, the j row pixel of i in beginning image, i=0,1,2, L, 398, or 399, j=0,1,2, L, 298, or 299,
Secondly, calculate total Grad M[i in 8 connected pixel neighborhoods, j], M[i, j]=P0[i,j]+P90[i,j]+P135[i,j]+P45[i, j], and itself and the threshold tau of setting are compared, obtain the gray value C[i of binaryzation back edge image, j], C &lsqb; i , j &rsqb; = 1 , M &lsqb; i , j &rsqb; > &tau; 0 , M &lsqb; i , j &rsqb; &le; &tau; , Wherein, the selected threshold that τ is marginal point, and τ=6,
(2) the polar angle θ of the column axis by the above-mentioned station A of Hough transformation calculations place Notebook Battery
As shown in Figure 4, Figure 5, first, will be with O1For the rectangular coordinate system of initial point changes into O1For the polar coordinate system of initial point,If ρ is utmost point footpath, α is polar angle, and ρ and α are natural number, and ρ equals 0,1 ..., 498, or 499, α equals 0,1 ..., 178, or 179,Between its maximum and minimum of a value, set up respectively a discrete parameter space;
Secondly, set up the accumulator N[ρ of a two-dimensional array] [α], in juxtaposition array, each element is 0;
Then, each marginal point in edge image C [i, j], the pixel that edge image gray value is 1, doesHough conversion, calculates this corresponding curve in polar coordinate system, and adds 1, i.e. N[ρ on corresponding accumulator] [α]=N[ρ][α]+1,
Finally, find out the local maximum of the accumulator of collinear points on correspondence (x, y) coordinate system, this value provide (x,Y) parameter (ρ of collinear points straight line on coordinate plane00),α0Be the polar angle of the straight line that collinear points are maximum, because two, batteryThe length of crest line HR and GP is the longest, and therefore, the line segment that collinear points are maximum must be in HR or GP, again because HR and GP are flatOK, again with battery post body axis L1L2Parallel, therefore, battery post body axis L1L2Polar angle θ=α0
(3) Coordinate Conversion
By original coordinate system iO1Any point coordinate [i, j] in j is transformed into i ' O in new coordinate system1J ', and calculate that it is newCoordinate figure [i ', j '], specific formula for calculation is as follows:
First, whenTime, by original coordinate system iO1J is around an O1Be rotated counterclockwiseAngle set up new withO1For the rectangular coordinate system i ' O of initial point1j′,
, i &prime; = i 2 + j 2 cos ( &beta; - &theta; - &pi; 2 ) j &prime; = i 2 + j 2 sin ( &beta; - &theta; - &pi; 2 ) ,
Wherein, i ', j ' is respectively coordinate system i ' O1The horizontal stroke of j ' mid point, ordinate value, and i ', j ' is natural number, i '=-399 ,-398, L0,1,2, L, 398, or 399, j '=-299 ,-298, L, 0,1,2, L, 298, or 299, and the abscissa i of pointEqual at 0 o'clock,In the time that the abscissa i of point is not equal to 0, &beta; = arctan - 1 j i ,
WhenTime, by original coordinate system iO1J is around an O1Be rotated counterclockwiseAngle is set up new for O1For formerRectangular coordinate system i ' the O of point1j′,
, i &prime; = i 2 + j 2 cos ( &beta; - &theta; + &pi; 2 ) j &prime; = i 2 + j 2 sin ( &beta; - &theta; + &pi; 2 ) ,
(4) calculate above-mentioned station A place Notebook Battery center point coordinate
First, at original coordinate system iO1In j, the image gathering is carried out to Threshold segmentation binary conversion treatment, obtain two-valueChange the gray value B of image1[i,j],I1[i, j] is the gray value of the original image of collection,T is the binarization segmentation threshold value of barrier and background, T=210, I1Capable, the j of i row in the original image that [i, j] representative gathersThe gray value of pixel, i=0,1,2, L, 398, or 399, j=0,1,2, L, 298, or 299, and by no place of binaryzation in coordinate systemThe point of managing is all set to 0,
Then, by the gray value B of image after binaryzation1[i, j], at coordinate system i ' O1In j ' respectively on i ' axle and j ' axleProjection, determines the coordinate J ' of battery central point on i ' axle and j ' axlexAnd J 'y, concrete steps are as follows:
1) by the gray value B of image after binaryzation1[i, j], to projection on i ' axle, calculates each parallel with j ' axle and lists allThe gray value sum of pixel, is stored in respectively array F by result of calculation1In [f], whenTime, F 1 &lsqb; f &rsqb; = &Sigma; i &prime; = - r 1 0 B 1 &lsqb; f , i &prime; &rsqb; , Wherein r 1 = 400 &times; c o s ( &pi; 2 - &theta; ) , m1=300×cosθ,n1=300 × cos θ, and r1、m1、n1Adopt and round up respectivelyMethod rounds numerical value, and f is from-m1Value is to n successively1; When &pi; 2 &le; &theta; < &pi; Time, F 1 &lsqb; f &rsqb; = &Sigma; i &prime; = - m n B 1 &lsqb; f , i &prime; &rsqb; , Wherein r 1 = 500 &times; c o s ( &beta; - &theta; + &pi; 2 ) , m1=400×cos(π-θ), n 1 = 300 &times; c o s ( &theta; - &pi; 2 ) , And r1、m1、n1Adopt respectivelyRounding-off method rounds numerical value, f from 0 successively value to r1
2) by the gray value B of image after binaryzation1[i, j], to projection on j ' axle, calculates in every a line parallel with i ' axleThe gray value sum of all pixels, is stored in respectively array H by result of calculation1In [h], whenTime, H 1 &lsqb; k &rsqb; = &Sigma; i &prime; = - m 2 n 2 B 1 ( i &prime; , k ) , Wherein r 2 = 500 &times; c o s ( &beta; - &theta; - &pi; 2 ) , m 2 = 400 &times; c o s ( &pi; 2 - &theta; ) , n2=300×cosθ, and r2, m, n adopt respectively rounding-off method to round numerical value, h from 0 successively value to r2; When &pi; 2 &le; &theta; < &pi; Time, H 1 &lsqb; k &rsqb; = &Sigma; i &prime; = 0 r 2 B 1 ( j &prime; , k ) , Wherein r 2 = 500 &times; c o s ( &beta; - &theta; - &pi; 2 ) , m2=400×cos(π-θ),And r2、m2、n2Adopt respectively rounding-off method to round numerical value, h is from-m2Value is to n successively2
3) at coordinate system i ' O1In j ', adopt two ends detection methods, determine left and right on i ' direction of principal axis of Notebook BatteryThe abscissa value on border, and by result store at variable J 'L、J′RIn, simultaneously by the upper and lower border of determining on j ' direction of principal axisOrdinate value is stored in variable K 'UAnd K 'DIn, concrete steps are as follows:
A) f is according to f=-400 ,-399, L, and 0,1,2,399,400 values successively, in the time that f meets following condition: F1[f+2]-F1[f]≥15&&F1[f+2]≥25&&F1[f]≤5, show to have detected the left margin of Notebook Battery, use variableJ′LNote down current abscissa f, and make J 'L=f, continues to f assignment, when f meets following condition: F1[f]-F1[f+2]≥15&&F1[f]≥25&&F1[f+2]≤5, show to have detected the right margin of Notebook Battery, with variable J 'RNote down currentAbscissa f, and make J 'R=f,
B) h is according to h=-300 ,-299, L0, and 1,2, L299,300 values successively, when h meets following condition: H1[h+2]-H1[h]≥15&&H1[h+2]≥25&&H1[h]≤5, show to have detected the lower boundary of Notebook Battery, use variableK′DNote down current abscissa h, and make K 'D=h, continues to h assignment, when h meets following condition: H1[h]-H1[h+2]≥15&&H1[h]≥25&&H1[h+2]≤5, show to have detected the coboundary of Notebook Battery, with variable K 'UNote down currentAbscissa h, and make K 'U=h,
C) the abscissa C ' of calculating Notebook Battery central pointi′With ordinate C 'j′,C′i′=(J′L+J′R)/2,C′j′=(K′U+K′D)/2,
(5) determine the position of the anodal and negative pole of Notebook Battery
If F[J 'L]>F[J′R], Notebook Battery negative pole is at coordinate system i ' O1The middle abscissa value of j ' is J 'L, anodal horizontal seatScale value is J 'R; If F[J 'L]<F[J′R], Notebook Battery positive pole is at coordinate system i ' O1The middle abscissa value of j ' is J 'L, negative pole horizontal strokeCoordinate figure is J 'R
(6) according to Notebook Battery central point at coordinate system i ' O1Horizontal stroke under j ', ordinate value, calculate at iO1J coordinate systemUnder horizontal stroke, ordinate value, computing formula is as follows:
When 0 &le; &theta; < &pi; 2 Time, C i = C i &prime; 2 + C j &prime; 2 cos ( &beta; &prime; + &theta; + &pi; 2 ) C j = C i &prime; 2 + C j &prime; 2 sin ( &beta; &prime; + &theta; + &pi; 2 )
When &pi; 2 &le; &theta; < &pi; Time, C i = C i &prime; 2 + C j &prime; 2 cos ( &beta; &prime; + &theta; - &pi; 2 ) C j = C i &prime; 2 + C j &prime; 2 sin ( &beta; &prime; + &theta; - &pi; 2 )
Wherein, Ci′And Cj′Be respectively at new rectangular coordinate system i ' O1The horizontal stroke of definite Notebook Battery central point, vertical in j 'Coordinate figure, as abscissa Ci′Equal at 0 o'clock,As abscissa Ci′Be not equal at 0 o'clock, &beta; &prime; = arctan - 1 C j &prime; C i &prime; ,
(7) control manipulator J1Capture Notebook Battery
First, PLC controls manipulator J1To specified coordinate position, i.e. Notebook Battery center C (Ci,Cj), and controlMagnetic chuck X1The long the longest limit MN of rib vertical with torsion platform B horizontal center line ST, MN and L1L2Parallel, whenTime, PLC controls manipulator and is rotated counterclockwise θ angle and declines 10 centimetres, then the magnetic chuck crawl battery that powers onAnd rise 10 centimetres, and now, if F[J 'L]>F[J′R], control turn clockwise θ angle decline 10 centimetres of manipulator, thenMagnetic chuck power-off is put into Notebook Battery to reverse on platform, if F[J 'L]<F[J′R], control manipulator and be rotated counterclockwise π-θAngle also declines 10 centimetres, and then magnetic chuck power-off is put into Notebook Battery to reverse on platform; WhenTime, controllerTurn clockwise π-θ angle decline 10 centimetres of tool hand, then magnetic chuck powers on and captures battery and rise 10 centimetres, now,If F[J 'L]>F[J′R], control manipulator and be rotated counterclockwise π-θ angle and decline 10 centimetres, then magnetic chuck power-off is by penRemember that this battery is put on torsion platform, if F[J 'L]<F[J′R], control turn clockwise θ angle decline 10 centimetres of manipulator,Then magnetic chuck power-off is put into Notebook Battery to reverse on platform;
Step 2: utilize CCD camera C2Take and reverse six draw-in groove centre bottom rectangle hole images on platform, by figureDetermine as Processing Algorithm position and the positive and negative electrode direction that Notebook Battery should be placed
(1) image is carried out to binary conversion treatment
With CCD camera C2Take the image that reverses upper six draw-in grooves of platform B, with CCD camera C2The center of the image of takingPoint O2For initial point is set up rectangular coordinate system, the image of taking is carried out to Threshold segmentation binary conversion treatment, obtain binary imageGray value B2[i,j],I2[i, j] is CCD camera C2The i that gathers image is capable,The gray value of j row pixel, T2For the white visible ray that sends from draw-in groove central rectangular aperture hole and the binarization segmentation threshold of backgroundValue, T2=200, i, j is natural number, and i=-199 ,-198, L, 0,1,2, L, 198, or 199, j=-149 ,-148, L, 0,1,2, L, 148, or 149,
(2) image is carried out to noise remove and connective processing
First, the gray value of pixel on image edge is set to 0, then adopts 3 × 3 detection window traversal view pictureImage, the gray value that makes detection window central point is B2[i, j], central point around the gray value of 8 neighborhood points from the upper left corner withBe respectively clockwise B2[i-1,j+1]、B2[i,j+1]、B2[i+1,j+1]、B2[i+1,j]、B2[i+1,j-1]、B2[i,j-1]、B2[i-1,j-1]、B2[i-1,j],
Allow 3 × 3 detection window travel through successively entire image, the gray value of the pixel under calculation window covers, if B2[i,j]+B2[i-1,j+1]+B2[i,j+1]+B2[i+1,j+1]+B2[i+1,j]+B2[i+1,j-1]+B2[i,j-1]+B2[i-1,j-1]+B2[i-1, j]≤3, make B2[i, j]=1, otherwise, B made2[i,j]=0,
Secondly, the image of removing after noise is carried out to floor projection
The gray value of removing each pixel listing of image after noise is added, result of calculation is stored in respectivelyArray F2In [f],Wherein f is integer, f=-199, and-198, L, 0,1,2, L, 198, or 199,
(3) Notebook Battery central point abscissa in computed image
F is according to f=-199 ,-198, L0, and 1,2, L, 198, or 199 values successively, when f meets following condition: F2[f+2]-F2[f]≥15&&F2[f+2]≥25&&F2[f]≤5, show that the rising edge for the first time that image detected is along coordinate,Note down current abscissa f with variable G, and make G=f, continue to f assignment, when f meets following condition: F2[f]-F2[f+2]≥15&&F2[f]≥25&&F2[f+2]≤5, show that the trailing edge for the first time that image detected, along coordinate, stops composing to fValue, notes down current abscissa f with variable G ', and makes G '=f, Notebook Battery rectangle draw-in groove K4Intermediate rectangular hole is at figureWidth value d ' in picture0=G '-G, unit is pixel, utilizes ruler directly to measure Notebook Battery rectangle draw-in groove intermediate rectangular holeWidth is d0, draw-in groove K1And K2Distance between intermediate rectangular hole center is l1, draw-in groove K2And K3Intermediate rectangular hole center itBetween distance be l2, draw-in groove K3And K4Distance between intermediate rectangular hole center is l3, draw-in groove K4And K5In intermediate rectangular holeDistance between the heart is l4, draw-in groove K5And K6Distance between intermediate rectangular hole center is l5,d0、l1、l2、l3、l4And l5ListPosition is millimeter; Known as calculated, draw-in groove K in image1And K2Distance between intermediate rectangular hole centerDraw-in grooveK2And K3Distance between intermediate rectangular hole centerDraw-in groove K3And K4Distance between intermediate rectangular hole centerDraw-in groove K4And K5Distance between intermediate rectangular hole centerDraw-in groove K5And K6Intermediate rectangular hole centerBetween distancel′1、l′2、l′3、l′4、l′5Unit be pixel, and round off method is to l '1、l′2、l′3、l′4、l′5Round, establish draw-in groove K in image1、K2、K3、K4、K5、K6The abscissa of intermediate rectangular hole central point is from left to right respectively x1、x2、x3、x4、x5、x6, unit is pixel, x 1 = - l 3 &prime; 2 - l 2 &prime; - l 1 &prime; , x 2 = - l 3 &prime; 2 - l 2 &prime; , x 3 = - l 3 &prime; 2 , x 4 = l 3 &prime; 2 , x 5 = l 3 &prime; 2 + l 4 &prime; , x 6 = l 3 &prime; 2 + l 4 &prime; + l 5 &prime; ;
(4) determine by template matching method the position that Notebook Battery should be laid
At manipulator J1Before laying battery, the CCD camera that reverses platform top all can be to reversing platform photographic images, to figurePicture is processed, and result of calculation is still stored in respectively to array F2In [f],Wherein f is integer,F=-199 ,-198, L0,1,2, L, 198, or 199 values successively, when f meets following condition: F2[f+2]-F2[f]≥15&&F2[f+2]≥25&&F2[f]≤5, show that first rising edge that image detected, along coordinate, stops the assignment to f, with becomingAmount E notes down current abscissa f, and makes E=f, states condition: F when f gets all over being discontented with foot after all values2[f+2]-F2[f]≥15&&F2[f+2]≥25&&F2[f]≤5 o'clock, store in variable E 0, i.e. E=0, by E respectively with x1、x2、x3、x4、x5、x6Compare, ifWherein ε is error threshold, and ε=3, shows draw-in groove K1Not placing battery, nowPLC controls manipulator J1The battery of absorption is put into draw-in groove K1; IfShow draw-in groove K2Do not place electricityPond, now PLC controls manipulator J1The battery of absorption is put into draw-in groove K2; IfShow draw-in groove K3NotPlacing battery, now PLC controls manipulator J1By first the battery of drawing Rotate 180 degree, then put into draw-in groove K3; IfShow draw-in groove K4Not placing battery, now PLC controls manipulator J1The battery of absorption is first rotated180 degree, then put into draw-in groove K4; IfShow draw-in groove K5Not placing battery, now PLC controls manipulatorThe battery of absorption is put into draw-in groove K5; IfShow draw-in groove K6Not placing battery, now PLC controllerTool hand J1The battery of absorption is put into draw-in groove K6; If E=0, shows that 6 draw-in grooves have all put battery, execution step three;
Step 3: by twist mechanism, Notebook Battery both positive and negative polarity is docked to arrangement successively
When 6 draw-in grooves are all after placing battery, PLC controls the twist mechanism reversing on platform, makes K1、K2Around Z1Axle is counterclockwiseRotate 180 degree makes K simultaneously5、K6Around Z2Axle is rotated counterclockwise 180 degree, now, and manipulator J2By six joint notebook electricity after reversingPond is placed in the note book battery box on tooling platform V and assembles after capturing simultaneously.

Claims (5)

1. for vision-based detection and the control method of Notebook Battery automatic Composition, it is characterized in that, respectively at production lineDirectly over station A and battery draw-in groove K3And K4CCD camera C is installed directly over centre1With CCD camera C2, in parallel and productionSix battery draw-in groove K are set on the torsion platform B of line1,K2,K3,K4,K5,K6, and manipulator J1With manipulator J2, six Battery CardsThe centre bottom of groove is offered rectangle hole, places respectively the white visible light source irradiating, electricity below each battery draw-in groove upwardPond draw-in groove K1And K2Connect as one battery draw-in groove K3And K4Connect as one battery draw-in groove K5And K6Connect as one, at draw-in grooveK3The lower left corner arranges a rotating shaft Z perpendicular to reversing platform B1, at K4The upper right corner arranges a rotating shaft Z perpendicular to reversing platform B2,K2WithK3Through rotating shaft Z1Be connected, make K1,K2Can be around Z1Be rotated counterclockwise 180 degree, K4And K5Through rotating shaft Z2Be connected, K5,K6Can be around Z2Be rotated counterclockwise 180 degree, concrete steps are as follows:
Step 1: utilize CCD camera C1Take pictures and extract centre coordinate and the direction of the Notebook Battery at station A place on production lineInformation, and control manipulator J1Capture battery
(1) adopt a kind of improved Roberts edge algorithms to detect the edge of notebook cell image;
(2) the polar angle θ of the column axis by the above-mentioned station A of Hough transformation calculations place Notebook Battery;
(3) Coordinate Conversion
By original coordinate system iO1Any point coordinate [i, j] in j is transformed into i ' O in new coordinate system1J ', and calculate its new seatScale value [i ', j '], specific formula for calculation is as follows:
First, whenTime, by original coordinate system iO1J is around an O1Be rotated counterclockwiseAngle is set up new for O1ForRectangular coordinate system i ' the O of initial point1j′,
, i &prime; = i 2 + j 2 cos ( &beta; - &theta; - &pi; 2 ) j &prime; = i 2 + j 2 sin ( &beta; - &theta; - &pi; 2 ) ,
Wherein, i ', j ' is respectively coordinate system i ' O1The horizontal stroke of j ' mid point, ordinate value, and i ', j ' is natural number, i '=-399 ,-398, L0,1,2, L, 398, or 399, j '=-299 ,-298, L, 0,1,2, L, 298, or 299, and the abscissa i of point equals 0Time,In the time that the abscissa i of point is not equal to 0, &beta; = arctan - 1 j i ,
WhenTime, by original coordinate system iO1J is around an O1Be rotated counterclockwiseAngle is set up new for O1For initial pointRectangular coordinate system i ' O1j′,
, i &prime; = i 2 + j 2 cos ( &beta; - &theta; + &pi; 2 ) j &prime; = i 2 + j 2 sin ( &beta; - &theta; + &pi; 2 ) ,
(4) calculate above-mentioned station A place Notebook Battery center point coordinate
First, at original coordinate system iO1In j, the image gathering is carried out to Threshold segmentation binary conversion treatment, obtain binary pictureThe gray value B of picture1[i,j],I1[i, j] is the gray value of the original image of collection, and T isThe binarization segmentation threshold value of barrier and background, T=210, I1In the original image that [i, j] representative gathers, capable, the j of i is listed as pictureThe gray value of element, i=0,1,2, L, 398, or 399, j=0,1,2, L, 298, or 299, and binaryzation in coordinate system is not processedTo point be all set to 0,
Then, by the gray value B of image after binaryzation1[i, j], at coordinate system i ' O1In j ' respectively to projection on i ' axle and j ' axle,Determine the coordinate J ' of battery central point on i ' axle and j ' axlexAnd J 'y, concrete steps are as follows:
1) by the gray value B of image after binaryzation1[i, j], to projection on i ' axle, calculates each parallel with j ' axle and lists all picturesThe gray value sum of element, is stored in respectively array F by result of calculation1In [f], whenTime, F 1 &lsqb; f &rsqb; = &Sigma; i &prime; = - r 1 0 B 1 &lsqb; f , i &prime; &rsqb; , Wherein r 1 = 400 &times; c o s ( &pi; 2 - &theta; ) , m1=300×cosθ,n1=300 × cos θ, and r1、m1、n1Adopt and round up respectivelyMethod rounds numerical value, and f is from-m1Value is to n successively1; When &pi; 2 &le; &theta; < &pi; Time, F 1 &lsqb; f &rsqb; = &Sigma; i &prime; = - m n B 1 &lsqb; f , i &prime; &rsqb; , Wherein r 1 = 500 &times; c o s ( &beta; - &theta; + &pi; 2 ) , m1=400×cos(π-θ),And r1、m1、n1Adopt respectivelyRounding-off method rounds numerical value, f from 0 successively value to r1
2) by the gray value B of image after binaryzation1[i, j], to projection on j ' axle, calculates all pictures in every a line parallel with i ' axleThe gray value sum of element, is stored in respectively array H by result of calculation1In [h], whenTime, H 1 &lsqb; k &rsqb; = &Sigma; i &prime; = - m 2 n 2 B 1 ( i &prime; , h ) , Wherein r 2 = 500 &times; c o s ( &beta; - &theta; - &pi; 2 ) , m 2 = 400 &times; c o s ( &pi; 2 - &theta; ) , n2=300 × cos θ, and r2, m, n adopt respectively fourHouse five enters method and rounds numerical value, h from 0 successively value to r2; When &pi; 2 &le; &theta; < &pi; Time, H 1 &lsqb; k &rsqb; = &Sigma; i &prime; = 0 r 2 B 1 ( i &prime; , k ) , Wherein r 2 = 500 &times; c o s ( &beta; - &theta; - &pi; 2 ) , m2=400×cos(π-θ),And r2、m2、n2Adopt respectivelyRounding-off method rounds numerical value, and h is from-m2Value is to n successively2
3) at coordinate system i ' O1In j ', adopt two ends detection method, determine the left and right border of Notebook Battery on i ' direction of principal axisAbscissa value, and by result store at variable J 'L、J′RIn, simultaneously by the vertical seat on the upper and lower border of determining on j ' direction of principal axisScale value is stored in variable K 'UAnd K 'DIn, concrete steps are as follows:
A) f is according to f=-400 ,-399, L, and 0,1,2,399,400 values successively, in the time that f meets following condition: F1[f+2]-F1[f]≥15&&F1[f+2]≥25&&F1[f]≤5, show to have detected the left margin of Notebook Battery, with variable J 'LRecordRecord current abscissa f, and make J 'L=f, continues to f assignment, when f meets following condition: F1[f]-F1[f+2]≥15&&F1[f]≥25&&F1[f+2]≤5, show to have detected the right margin of Notebook Battery, with variable J 'RNote down current horizontal seatMark f, and make J 'R=f,
B) h is according to h=-300 ,-299, L0, and 1,2, L299,300 values successively, when h meets following condition: H1[h+2]-H1[h]≥15&&H1[h+2]≥25&&H1[h]≤5, show to have detected the lower boundary of Notebook Battery, with variable K 'DRecordRecord current abscissa h, and make K 'D=h, continues to h assignment, when h meets following condition: H1[h]-H1[h+2]≥15&&H1[h]≥25&&H1[h+2]≤5, show to have detected the coboundary of Notebook Battery, with variable K 'UNote down current horizontal seatMark h, and make K 'U=h,
C) the abscissa C ' of calculating Notebook Battery central pointi′With ordinate C 'j′,C′i′=(J′L+J′R)/2,C′j′=(K′U+K′D)/2,
(5) determine the position of the anodal and negative pole of Notebook Battery
If F[J 'L]>F[J′R], Notebook Battery negative pole is at coordinate system i ' O1The middle abscissa value of j ' is J 'L, anodal abscissa valueFor J 'R; If F[J 'L]<F[J′R], Notebook Battery positive pole is at coordinate system i ' O1The middle abscissa value of j ' is J 'L, negative pole abscissaValue is J 'R
(6) according to Notebook Battery central point at coordinate system i ' O1Horizontal stroke under j ', ordinate value, calculate at iO1Under j coordinate systemHorizontal, ordinate value, computing formula is as follows:
When 0 &le; &theta; < &pi; 2 Time, C i = C i &prime; 2 + C j &prime; 2 cos ( &beta; &prime; + &theta; + &pi; 2 ) C j = C i &prime; 2 + C j &prime; 2 sin ( &beta; &prime; + &theta; + &pi; 2 )
When &pi; 2 &le; &theta; < &pi; Time, C i = C i &prime; 2 + C j &prime; 2 cos ( &beta; &prime; + &theta; - &pi; 2 ) C j = C i &prime; 2 + C j &prime; 2 sin ( &beta; &prime; + &theta; - &pi; 2 )
Wherein, Ci′And Cj′Be respectively at new rectangular coordinate system i ' O1Horizontal stroke, the ordinate of definite Notebook Battery central point in j 'Value, as abscissa Ci′Equal at 0 o'clock,As abscissa Ci′Be not equal at 0 o'clock, &beta; &prime; = arctan - 1 C j &prime; C i &prime; ,
(7) control manipulator J1Capture Notebook Battery
First, PLC controls manipulator J1To specified coordinate position, i.e. Notebook Battery center C (Ci,Cj), and control magneticSucker X1The long the longest limit MN of rib vertical with torsion platform B horizontal center line ST, MN and L1L2Parallel, whenTime,PLC controls manipulator and is rotated counterclockwise θ angle and declines 10 centimetres, and then magnetic chuck powers on and captures battery and rise 10 lisRice, now, if F[J 'L]>F[J′R], control turn clockwise θ angle decline 10 centimetres of manipulator, then magnetic chuck is disconnectedElectricity is put into Notebook Battery to reverse on platform, if F[J 'L]<F[J′R], control manipulator and be rotated counterclockwise π-θ angle and decline10 centimetres, then magnetic chuck power-off is put into Notebook Battery to reverse on platform; WhenTime, control manipulator clockwiseRotation π-θ angle also declines 10 centimetres, and then magnetic chuck powers on and captures battery and rise 10 centimetres, now, if F[J 'L]>F[J′R], control manipulator and be rotated counterclockwise π-θ angle and decline 10 centimetres, then magnetic chuck power-off is by Notebook BatteryBe put into and reverse on platform, if F[J 'L]<F[J′R], control turn clockwise θ angle decline 10 centimetres, then magnetic of manipulatorSucker power-off is put into Notebook Battery to reverse on platform;
Step 2: utilize CCD camera C2Take and reverse six draw-in groove centre bottom rectangle hole images on platform, by image placeAdjustment method is determined position and the positive and negative electrode direction that Notebook Battery should be placed
(1) image is carried out to binary conversion treatment
With CCD camera C2Take the image that reverses upper six draw-in grooves of platform B, with CCD camera C2The central point O of the image of taking2For initial point is set up rectangular coordinate system, the image of taking is carried out to Threshold segmentation binary conversion treatment, obtain the ash of binary imageDegree value B2[i,j],I2[i, j] is CCD camera C2The i that gathers image is capable, j rowThe gray value of pixel, T2For the white visible ray that sends from draw-in groove central rectangular aperture hole and the binarization segmentation threshold value of background, T2=200, i, j is natural number, and i=-199 ,-198, L, 0,1,2, L, 198, or 199, j=-149 ,-148, L, 0,1,2, L,148, or 149,
(2) image is carried out to noise remove and connective processing
First, the gray value of pixel on image edge is set to 0, then adopts 3 × 3 detection window traversal view picture figurePicture, the gray value that makes detection window central point is B2[i, j], central point around the gray value of 8 neighborhood points from the upper left corner with suitableClockwise is respectively B2[i-1,j+1]、B2[i,j+1]、B2[i+1,j+1]、B2[i+1,j]、B2[i+1,j-1]、B2[i,j-1]、B2[i-1,j-1]、B2[i-1,j],
Allow 3 × 3 detection window travel through successively entire image, the gray value of the pixel under calculation window covers, if
B2[i,j]+B2[i-1,j+1]+B2[i,j+1]+B2[i+1,j+1]+B2[i+1,j]+B2[i+1,j-1]+B2[i,j-1]+B2[i-1,j-1]+B2[i-1, j]≤3, make B2[i, j]=1, otherwise, B made2[i,j]=0,
Secondly, the image of removing after noise is carried out to floor projection
The gray value of removing each pixel listing of image after noise is added, result of calculation is stored in respectively to arrayF2In [f],Wherein f is integer, f=-199, and-198, L, 0,1,2, L, 198, or 199,
(3) Notebook Battery central point abscissa in computed image;
(4) determine by template matching method the position that Notebook Battery should be laid
At manipulator J1Before laying battery, the CCD camera that reverses platform top all can, to reversing platform photographic images, enter imageRow is processed, and result of calculation is still stored in respectively to array F2In [f],Wherein f is integer, f=-199 ,-198, L0,1,2, L, 198, or 199 values successively, when f meets following condition: F2[f+2]-F2[f]≥15&&F2[f+2]≥25&&F2[f]≤5, show that first rising edge that image detected, along coordinate, stops the assignment to f, use variable ENote down current abscissa f, and make E=f, state condition: F when f gets all over being discontented with foot after all values2[f+2]-F2[f]≥15&&F2[f+2]≥25&&F2[f]≤5 o'clock, store in variable E 0, i.e. E=0, by E respectively with x1、x2、x3、x4、x5、x6Carry outCompare, ifWherein ε is error threshold, and ε=3, shows draw-in groove K1Not placing battery, now PLC controlManipulator J processed1The battery of absorption is put into draw-in groove K1; IfShow draw-in groove K2Not placing battery, nowPLC controls manipulator J1The battery of absorption is put into draw-in groove K2; IfShow draw-in groove K3Not placing battery,Now PLC controls manipulator J1By first the battery of drawing Rotate 180 degree, then put into draw-in groove K3; IfTableBright draw-in groove K4Not placing battery, now PLC controls manipulator J1By first the battery of drawing Rotate 180 degree, then put into draw-in groove K4; IfShow draw-in groove K5Not placing battery, now PLC controls manipulator the battery of absorption is put into draw-in grooveK5; IfShow draw-in groove K6Not placing battery, now PLC controls manipulator J1The battery of absorption is putEnter draw-in groove K6; If E=0, shows that six draw-in grooves have all put battery, execution step three;
Step 3: by twist mechanism, Notebook Battery both positive and negative polarity is docked to arrangement successively
When six draw-in grooves are all after placing battery, PLC controls the twist mechanism reversing on platform, makes K1、K2Around Z1Axle is rotated counterclockwise180 degree make K simultaneously5、K6Around Z2Axle is rotated counterclockwise 180 degree, now, and manipulator J2By same six joint Notebook Batterys after reversingIn time, is placed in the note book battery box on tooling platform V and assembles after capturing.
2. the vision-based detection for Notebook Battery automatic Composition as claimed in claim 1 and control method, is characterized in that:CCD camera C1Be responsible for the collection of Notebook Battery image on production line, CCD camera C2Be responsible for reverse upper six draw-in grooves of platform B andThe wherein collection of core white look visible images, manipulator J1With manipulator J2End is inhaled with cuboid groove shape magnetic respectivelyDish X1And X2, manipulator J1Be responsible for a batteries capture rear and be put in the draw-in groove reversing on platform manipulator J from production line2After being responsible for six batteries on torsion retrotorsion platform B to capture together, be placed in the battery case of notebook, battery case is placed onReverse on the other tooling platform V of platform B.
3. the vision-based detection for Notebook Battery automatic Composition as claimed in claim 1 and control method, is characterized in that: stepDescribed in rapid one (1), adopt improved Roberts edge algorithms to detect the edge of notebook cell image, concrete steps asUnder:
First, with CCD camera C1The image of taking production line station A place Notebook Battery is initial point O at the lower-left point of image1Set up rectangular coordinate system iO1J, adopts 3 × 3 whole image of detection window traversal, in 8 connected pixel neighborhoods, calculates respectivelyHorizontal direction, vertical direction, the Grad in 135 degree directions and 45 degree directions, wherein, the Grad in horizontal direction is: P0[i,j]=|I1[i-1,j]-I1[i+1, j] |, the Grad in vertical direction is: P90[i,j]=|I1[i,j-1]-I1[i,j+1] |, the Grad in 135 degree directions is: P135[i,j]=|2×(I1[i-1,j-1]-I1[i+1, j+1]) |, in 45 degree directionsGrad be: P45[i,j]=|2×(I1[i+1,j-1]-I1[i-1, j+1]) |, I in formula1The original graph that [i, j] representative gathersThe gray value of capable, the j row pixel of i in picture, i=0,1,2, L, 398, or 399, j=0,1,2, L, 298, or 299,
Secondly, calculate total Grad M[i in 8 connected pixel neighborhoods, j], M[i, j]=P0[i,j]+P90[i,j]+P135[i,j]+P45[i, j], and itself and the threshold tau of setting are compared, obtain the gray value C[i of binaryzation back edge image, j], C &lsqb; i , j &rsqb; = { 1 , M &lsqb; i , j &rsqb; > &tau; 0 , M &lsqb; i , j &rsqb; &le; &tau; , Wherein, the selected threshold that τ is marginal point, and τ=6.
4. the vision-based detection for Notebook Battery automatic Composition as claimed in claim 1 and control method, is characterized in that: stepDescribed in rapid one (2), pass through the polar angle θ of the column axis of the above-mentioned station A of Hough transformation calculations place Notebook Battery, specifically stepRapid as follows:
First, will be with O1For the rectangular coordinate system of initial point changes into O1For the polar coordinate system of initial point, establishing ρ is utmost point footpath, and α is polar angle,ρ and α are natural number, and ρ equals 0,1 ..., 498, or 499, α equals 0,1 ..., 178, or 179, respectively in its maximum andBetween little value, set up a discrete parameter space;
Secondly, set up the accumulator N[ρ of a two-dimensional array] [α], in juxtaposition array, each element is 0;
Then, each marginal point in edge image C [i, j], the pixel that edge image gray value is 1, makes Hough and becomesChange, calculate this corresponding curve in polar coordinate system, and add 1, i.e. N[ρ on corresponding accumulator] [α]=N[ρ] [α]+1,
Finally, find out the local maximum of the accumulator of collinear points on correspondence (x, y) coordinate system, this value provides (x, y) to sitParameter (the ρ of collinear points straight line in mark plane00),α0Be the polar angle of the straight line that collinear points are maximum, because two crest lines of batteryThe length of HR and GP is the longest, and therefore, the line segment that collinear points are maximum must be in HR or GP, again because HR is parallel with GP,Again with battery post body axis L1L2Parallel, therefore, battery post body axis L1L2Polar angle θ=α0
5. the vision-based detection for Notebook Battery automatic Composition as claimed in claim 1 and control method, is characterized in that: stepNotebook Battery central point abscissa in computed image described in rapid two (3), concrete steps are as follows:
F is according to f=-199 ,-198, L0, and 1,2, L, 198, or 199 values successively, when f meets following condition: F2[f+2]-F2[f]≥15&&F2[f+2]≥25&&F2[f]≤5, show that the rising edge for the first time that image detected, along coordinate, uses variableG notes down current abscissa f, and makes G=f, continues to f assignment, when f meets following condition: F2[f]-F2[f+2]≥15&&F2[f]≥25&&F2[f+2]≤5, show that the trailing edge for the first time that image detected, along coordinate, stops the assignment to f, with becomingAmount G ' notes down current abscissa f, and makes G '=f, Notebook Battery rectangle draw-in groove K4Intermediate rectangular hole is wide in imageDegree value d '0=G '-G, unit is pixel, utilizes ruler directly to measure Notebook Battery rectangle draw-in groove intermediate rectangular hole width to bed0, draw-in groove K1And K2Distance between intermediate rectangular hole center is l1, draw-in groove K2And K3Distance between intermediate rectangular hole centerFrom being l2, draw-in groove K3And K4Distance between intermediate rectangular hole center is l3, draw-in groove K4And K5Between intermediate rectangular hole centerDistance be l4, draw-in groove K5And K6Distance between intermediate rectangular hole center is l5,d0、l1、l2、l3、l4And l5Unit beMillimeter; Known as calculated, draw-in groove K in image1And K2Distance between intermediate rectangular hole centerDraw-in groove K2And K3Distance between intermediate rectangular hole centerDraw-in groove K3And K4Distance between intermediate rectangular hole centerDraw-in groove K4And K5Distance between intermediate rectangular hole centerDraw-in groove K5And K6Intermediate rectangular hole centerBetween distancel′1、l′2、l′3、l′4、l′5Unit be pixel, and round off method is to l '1、l′2、l′3、l′4、l′5Round, establish draw-in groove K in image1、K2、K3、K4、K5、K6The abscissa of intermediate rectangular hole central point is from left to right respectivelyx1、x2、x3、x4、x5、x6, unit is pixel, x 1 = - l 3 &prime; 2 - l 2 &prime; - l 1 &prime; , x 2 = - l 3 &prime; 2 - l 2 &prime; , x 3 = - l 3 &prime; 2 , x 4 = l 3 &prime; 2 , x 5 = l 3 &prime; 2 + l 4 &prime; , x 6 = l 3 &prime; 2 + l 4 &prime; + l 5 &prime; .
CN201410010979.0A 2014-01-09 2014-01-09 A kind of vision-based detection for the automatic mounted box of Notebook Battery and control method Active CN103745471B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201410010979.0A CN103745471B (en) 2014-01-09 2014-01-09 A kind of vision-based detection for the automatic mounted box of Notebook Battery and control method

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201410010979.0A CN103745471B (en) 2014-01-09 2014-01-09 A kind of vision-based detection for the automatic mounted box of Notebook Battery and control method

Publications (2)

Publication Number Publication Date
CN103745471A CN103745471A (en) 2014-04-23
CN103745471B true CN103745471B (en) 2016-05-11

Family

ID=50502486

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201410010979.0A Active CN103745471B (en) 2014-01-09 2014-01-09 A kind of vision-based detection for the automatic mounted box of Notebook Battery and control method

Country Status (1)

Country Link
CN (1) CN103745471B (en)

Families Citing this family (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105817430B (en) * 2016-03-29 2017-12-29 常熟理工学院 Product inspection method based on machine vision
CN107730521B (en) * 2017-04-29 2020-11-03 安徽慧视金瞳科技有限公司 Method for rapidly detecting ridge type edge in image
CN109297409B (en) * 2018-10-23 2020-07-21 深圳市万福达精密设备股份有限公司 Battery displacement identification and positioning device and method
CN112964159B (en) * 2021-03-12 2022-08-23 烟台铁中宝钢铁加工有限公司 Detection sample plate, detection method and evaluation method of rack

Citations (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN202922160U (en) * 2012-10-19 2013-05-08 南京信息工程大学 Battery automatic changing system of small sized multi-rotor unmanned aerial vehicle

Patent Citations (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN202922160U (en) * 2012-10-19 2013-05-08 南京信息工程大学 Battery automatic changing system of small sized multi-rotor unmanned aerial vehicle

Non-Patent Citations (2)

* Cited by examiner, † Cited by third party
Title
Visual novelty detection with automatic scale selection;Hugo Vieira Neto etc;《Robotics and Autonomous Systems》;20070524;第55卷;693-701 *
硅太阳能电池制备过程的全自动视觉检测设备关键技术研究;陈军;《中国优秀硕士学位论文全文数据库 工程科技Ⅱ辑》;20111215;第3章,第4章 *

Also Published As

Publication number Publication date
CN103745471A (en) 2014-04-23

Similar Documents

Publication Publication Date Title
CN103747667B (en) A kind of vision-based detection for the automatic mounted box of Notebook Battery and control system
CN103745471B (en) A kind of vision-based detection for the automatic mounted box of Notebook Battery and control method
Chen et al. Feature detection and description for image matching: from hand-crafted design to deep learning
CN107680135B (en) Localization method, system and the robot being applicable in
CN109074084A (en) Control method, device, system and the robot being applicable in of robot
CN104484648B (en) Robot variable visual angle obstacle detection method based on outline identification
CN104376576A (en) Target tracking method and device
CN107330357A (en) Vision SLAM closed loop detection methods based on deep neural network
Shen et al. Neighbors do help: Deeply exploiting local structures of point clouds
CN102971768A (en) State-of-posture estimation device and state-of-posture estimation method
CN103530590A (en) DPM (direct part mark) two-dimensional code recognition system
CN103198477A (en) Apple fruitlet bagging robot visual positioning method
CN112163588A (en) Intelligent evolution-based heterogeneous image target detection method, storage medium and equipment
CN103020707A (en) Flow type high-precision and high-speed automatic counting device for particle matters based on machine vision
CN109784297A (en) A kind of Three-dimensional target recognition based on deep learning and Optimal Grasp method
Lin et al. Floorplan-jigsaw: Jointly estimating scene layout and aligning partial scans
CN110910349B (en) Wind turbine state acquisition method based on aerial photography vision
Cao et al. Accurate 3-D reconstruction under IoT environments and its applications to augmented reality
Wan et al. A robotic grinding station based on an industrial manipulator and vision system
Feng et al. Lane detection base on deep learning
CN105224941A (en) Process identification and localization method
Puttemans et al. Detecting of photovoltaic installations in RGB aerial imaging: a comparative study
CN103268612A (en) Single image fisheye camera calibration method based on low rank characteristic recovery
CN107748621A (en) A kind of intelligent interaction robot
CN117351078A (en) Target size and 6D gesture estimation method based on shape priori

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
C14 Grant of patent or utility model
GR01 Patent grant
TR01 Transfer of patent right
TR01 Transfer of patent right

Effective date of registration: 20230504

Address after: Room 125, 1st Floor, Building 20, No. 1188, Huyi Road, Jiading District, Shanghai, 201802

Patentee after: Write easy network technology (Shanghai) Co.,Ltd.

Address before: 210044, No. 219, Ning six road, Pukou District, Jiangsu, Nanjing

Patentee before: Nanjing University of Information Science and Technology

EE01 Entry into force of recordation of patent licensing contract
EE01 Entry into force of recordation of patent licensing contract

Application publication date: 20140423

Assignee: Shanghai Suiyu Enterprise Management Consulting Partnership (L.P.)

Assignor: Write easy network technology (Shanghai) Co.,Ltd.

Contract record no.: X2023980042559

Denomination of invention: A Visual Detection and Control Method for Automatic Packaging of Notebook Batteries

Granted publication date: 20160511

License type: Common License

Record date: 20230923