CN111879241A - Mobile phone battery size measuring method based on machine vision - Google Patents

Mobile phone battery size measuring method based on machine vision Download PDF

Info

Publication number
CN111879241A
CN111879241A CN202010586510.7A CN202010586510A CN111879241A CN 111879241 A CN111879241 A CN 111879241A CN 202010586510 A CN202010586510 A CN 202010586510A CN 111879241 A CN111879241 A CN 111879241A
Authority
CN
China
Prior art keywords
edge
roi
size
battery
pixel
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.)
Granted
Application number
CN202010586510.7A
Other languages
Chinese (zh)
Other versions
CN111879241B (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.)
Xian Jiaotong University
Original Assignee
Xian Jiaotong University
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 Xian Jiaotong University filed Critical Xian Jiaotong University
Priority to CN202010586510.7A priority Critical patent/CN111879241B/en
Publication of CN111879241A publication Critical patent/CN111879241A/en
Application granted granted Critical
Publication of CN111879241B publication Critical patent/CN111879241B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G01MEASURING; TESTING
    • G01BMEASURING LENGTH, THICKNESS OR SIMILAR LINEAR DIMENSIONS; MEASURING ANGLES; MEASURING AREAS; MEASURING IRREGULARITIES OF SURFACES OR CONTOURS
    • G01B11/00Measuring arrangements characterised by the use of optical techniques
    • G01B11/02Measuring arrangements characterised by the use of optical techniques for measuring length, width or thickness
    • GPHYSICS
    • G01MEASURING; TESTING
    • G01BMEASURING LENGTH, THICKNESS OR SIMILAR LINEAR DIMENSIONS; MEASURING ANGLES; MEASURING AREAS; MEASURING IRREGULARITIES OF SURFACES OR CONTOURS
    • G01B11/00Measuring arrangements characterised by the use of optical techniques
    • G01B11/14Measuring arrangements characterised by the use of optical techniques for measuring distance or clearance between spaced objects or spaced apertures
    • GPHYSICS
    • G01MEASURING; TESTING
    • G01BMEASURING LENGTH, THICKNESS OR SIMILAR LINEAR DIMENSIONS; MEASURING ANGLES; MEASURING AREAS; MEASURING IRREGULARITIES OF SURFACES OR CONTOURS
    • G01B11/00Measuring arrangements characterised by the use of optical techniques
    • G01B11/26Measuring arrangements characterised by the use of optical techniques for measuring angles or tapers; for testing the alignment of axes
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T7/00Image analysis
    • G06T7/0002Inspection of images, e.g. flaw detection
    • G06T7/0004Industrial image inspection
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T7/00Image analysis
    • G06T7/10Segmentation; Edge detection
    • G06T7/12Edge-based segmentation
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T7/00Image analysis
    • G06T7/60Analysis of geometric attributes
    • G06T7/62Analysis of geometric attributes of area, perimeter, diameter or volume
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T7/00Image analysis
    • G06T7/70Determining position or orientation of objects or cameras

Abstract

The mobile phone battery size measuring method based on machine vision collects calibration plate images and determines a region of interest (ROI) where an edge to be detected is located; calculating the actual distance of a unit pixel in the calibration plate image; creating a region of interest ROI in a battery image to be detected; calculating the deviation between the edge point in each ROI and the edge point in the ROI corresponding to the calibration plate image, calculating the deviation between the pixel size of the battery to be detected and the standard pixel size in the calibration plate, multiplying the deviation by the actual distance corresponding to a single pixel in the calibration plate image to obtain the actual size deviation, and then adding the actual size deviation to the standard size in the calibration plate to obtain the actual size of the battery to be detected. The method uses morphological coarse edge extraction before sub-pixel edge extraction, can quickly locate the area where the edge is located, reduces the detection range of a sub-pixel edge extraction algorithm, improves the detection speed and has strong adaptability.

Description

Mobile phone battery size measuring method based on machine vision
Technical Field
The invention relates to a battery size measuring method, in particular to a mobile phone battery size measuring method based on machine vision.
Background
The mobile phone battery is one of the key components in the mobile phone, and the current development trend requires that the mobile phone battery has smaller and smaller volume and is strictly matched with a mobile phone battery bin, so that the measurement of the size of the mobile phone battery is an important step in the production process. In addition, the manufacturing of the lithium battery of the mobile phone has complex process and more working procedures, the defects of burrs, size change and the like can be generated due to the limitation of the manufacturing process, the production environment and the like in the production process, the appearance size defects are mainly the setting size and the positioning size, the positioning size is used for marking the relative position of each part, and the setting size is the specific size of a certain part. These defective products, which fail, affect the performance and safety of the mobile phone battery and need to be removed in a timely manner.
Traditional mobile phone lithium battery size detection uses tool and slide caliper rule to accomplish through the workman, has many problems:
(1) the manual measurement speed is slow, and is inefficient, and the shipment time is long, and the labour cost is big.
(2) The subjectivity awareness of manual measurement is large, the measurement results of different people may be different, or the measurement results of the same person in different states may also be different, which results in very low measurement result precision, and the measurement data is not favorable for storage and recording and also is not favorable for information management.
(3) Manual measurement has a great disadvantage in ensuring the quality of the product. Human eyes are fatigued and misjudged if they work for a long time.
(4) The soft package lithium battery has low mechanical strength, and the contact type manual measurement can cause damage in the measurement process.
The existing detection methods have many defects, and a more advanced method for measuring the size of the mobile phone battery is urgently needed.
Disclosure of Invention
The invention aims to provide a mobile phone battery size measuring method based on machine vision, which can replace manual detection and automatically measure the length, width, edge straightness, verticality and parallelism of a battery at high speed and high precision by using a 2D industrial camera.
In order to achieve the purpose, the invention adopts the following technical scheme:
the mobile phone battery size measuring method based on machine vision comprises the following steps:
(1) collecting a calibration plate image, and preprocessing the calibration plate image;
(2) determining a region of interest ROI where the edge to be detected is located on the preprocessed calibration plate image;
(3) for each ROI in the calibration plate image, firstly carrying out rough edge positioning, then extracting edge points in the ROI at a sub-pixel level to obtain a group of edge points representing a standard size, and calculating the actual distance of unit pixels in the calibration plate image according to the edge points;
(4) collecting a battery image to be detected, and preprocessing the battery image to be detected;
(5) creating a region of interest ROI in the battery image to be detected preprocessed in the step (4) according to the coordinates of the upper left corner of the ROI and the width and height of the ROI recorded in the step (2); for each ROI, firstly, roughly positioning the edge, then extracting edge points in the ROI at a sub-pixel level, and calculating the deviation between the edge points in the ROI and the edge points in the ROI at the corresponding position of the calibration plate image;
(6) and calculating the deviation between the pixel size of the battery to be detected and the standard pixel size in the calibration plate according to the deviation, multiplying the deviation between the pixel size of the battery to be detected and the standard pixel size in the calibration plate by the actual distance corresponding to a single pixel in the image of the calibration plate to obtain the actual size deviation, and adding the actual size deviation to the standard size in the calibration plate to obtain the actual size of the battery to be detected.
The further improvement of the invention is that in the step (1), the specific process for manufacturing the calibration plate is as follows: the calibration plate comprises a plurality of edges, the edge of each edge is in a sawtooth shape, the sawtooth-shaped edge comprises a plurality of connected sawtooth structures, and each sawtooth structure bagIncluding parallel arrangement and first line segment, second line segment, third line segment and fourth line segment from a left side to a right side in proper order, second line segment and fourth line segment are located same straight line, and first line segment is located second line segment and fourth line segment place straight line lstdAbove, the third line segment is located on the straight line l of the second line segment and the fourth line segmentstdBelow, the first line segment has a line segment connected with the left end of the second line segment, the right end of the second line segment is connected with the left end of the third line segment, the right end of the third line segment is connected with the left end of the fourth line segment, and the right end of the fourth line segment is connected with another sawtooth structure;
the straight line of the first line section is a straight line lmaxThe straight line of the fourth line segment is a straight line lminStraight line lstdLine l representing the edge position of a standard size batterymaxAnd a straight line lminIs a straight line lstdBoth sides and a straight line lstdA straight line at a distance z.
The invention has the further improvement that in the step (1), the calibration board image preprocessing process comprises the following steps: and carrying out multiple average filtering on more than 5 calibration plate images shot at the same position.
The invention has the further improvement that the specific process of the step (2) is as follows: and establishing a plurality of rectangular frames on the preprocessed calibration plate image by using a human-computer interaction interface, wherein each rectangular frame comprises the edge of the calibration plate to be detected, the area in each rectangular frame is used as the ROI, and the upper left corner coordinate of each ROI and the width and height of the ROI are recorded.
The further improvement of the invention is that in the step (3), the edge is roughly positioned by using a morphological edge extraction algorithm, then the edge points in the ROI are extracted at a sub-pixel level by using a sub-pixel edge extraction algorithm to obtain a group of edge points representing a standard size, and the actual distance corresponding to a unit pixel in the calibration plate image is calculated by using a calibration algorithm by using the distance z.
The further improvement of the invention is that, in the step (3), the specific process of calculating the actual distance corresponding to a single pixel in the calibration plate image by using the calibration algorithm by using the distance z comprises the following steps: classifying each into a predetermined size by least square approximationRespectively fitting straight lines to sub-pixel edge points in the sub-ROI, and calculating all adjacent two categories to be respectively the calibration sizemaxCalibrating sizeminDistance of pixels between straight lines in the sub-ROI of (1)pixelThen, then
Figure BDA0002554860290000031
The actual distance corresponding to the unit pixel between the two calibration edges.
The further improvement of the invention is that in the step (5), the edge is roughly positioned by using a morphological edge extraction algorithm, then the edge points in the ROI are extracted at a sub-pixel level by using a sub-pixel edge extraction algorithm, and the deviation between the edge points in the ROI and the edge points in the ROI at the corresponding position of the calibration plate image is calculated.
The invention has the further improvement that in the step (6), the real size of the battery to be detected comprises straightness, verticality, distance and parallelism, and the specific process is as follows:
and (3) calculating the straightness: if the edge in the ROI is a horizontal line, the deviation point P of the battery edge to be detected in the ROI is detectedierr(xi,yerr) I is 0,1, fitting a straight line l, ax + by + c is 0 by a least square method, and calculating Pierr(xi,yerr) I is 0,1
Figure RE-GDA0002636210360000041
Will dis _ rightiAnd (4) multiplying the actual distance corresponding to the single pixel in the calibration board image obtained by calculation in the step (3) to obtain the actual distance dis _ rightinewTaking the maximum n actual distances to calculate the average maxstraightThe minimum n actual distances calculate the average minstraightThe linearity of the edge of the battery to be detected is Stright maxstraight-minstraight;n≥5;
If the edge in the ROI is a vertical line, the deviation point P in the ROI where the edge of the battery to be tested is located is determinedierr(xerr,yi) I is 0,1, fitting a straight line l, ax + by + c is 0 by a least square method, and calculatingPierr(xerr,yi) I is 0,1
Figure BDA0002554860290000042
Will disiMultiplying the actual distance corresponding to a single pixel in the calibration board image to obtain the actual distance dis _ rightinewTaking the maximum n actual distances to calculate the average maxstraightAverage min is calculated for the minimum n actual distancesstraightThe straightness of the edge of the battery to be detected is Stright maxstraight-minstraight;n≥5。
The invention is further improved in that the parallelism calculation: for two edges A, B of the battery to be measured, which need to calculate the parallelism, taking the edge A as a reference, and translating the edge B to ensure that the standard size edge of the edge B is superposed with the standard size edge of the edge A; fitting a straight line l of deviation points in the ROI of the edge A using a least squares methodAAx + by + c is 0, and the deviation point P of the edge B after translation is calculatedBierrI is 0,1AIs a distance of
Figure BDA0002554860290000043
Will dis _ parallelismiMultiplying the actual distance corresponding to a single pixel in the calibration board image to obtain the actual distance dis _ parallelismsinewTaking the maximum n actual distances to calculate the average maxparallelismThe minimum n actual distances are calculated as the average minparallelismThe parallelism of the edge A and the edge B in the battery to be detected is parallelisms ═ maxparallelism-minparallelism|;n≥5。
The invention is further improved in that in the step (3), the verticality is calculated as follows: for two edges A, B of the cell to be detected, which need to calculate the verticality, taking the edge A as a reference, and fitting a straight line l of deviation points in the ROI of the edge A by using a least square methodAAx + by + c is 0; all deviation points P of the edge BBierrI is 0,1ATo obtain a new point set PBierr' 0,1, in the direction of the edge a, n highest points are selected asCalculating the average value of n points as extreme value sampling points to obtain a high point virtual extreme value reference point r1(ii) a Selecting n lowest points as extreme value sampling points, calculating the average value of the n points to obtain a low point virtual extreme value reference point r2;r1And r2Distance dis _ permanent betweenr=|r1-r2Multiplying the absolute value by the actual distance corresponding to a single pixel in the calibration plate image obtained by calculation in the step (3), wherein the product is the Perpendicularity Perpendicularity of the edge A and the edge B in the battery to be measured; n is more than or equal to 5;
the straightness, the perpendicularity and the parallelism are all 0 in standard size;
and (3) distance calculation: for two parallel edges A, B of the battery to be measured, which need to calculate the distance, taking the edge A as a reference, translating the edge B to ensure that the standard size edge of the edge B is superposed with the standard size edge of the edge A, and fitting a straight line l of a deviation point in the ROI of the edge A by using a least square methodAAx + by + c is 0, and the deviation point P of the edge B after translation is calculatedBierrI is 0,1AIs a distance of
Figure BDA0002554860290000051
Averaging all distances disavrAverage distance disiMultiplying the actual distance corresponding to a single pixel in the calibration plate image to obtain an actual distance disavrnew
Will disavrnewThe sum of the standard size and the standard size is the real size of the battery to be tested.
Compared with the prior art, the invention has the following beneficial effects:
(1) according to the invention, the local image containing the edge is taken as the ROI, and only the ROI is subjected to image processing, so that the calculation amount of an algorithm is greatly reduced, and the detection speed is improved.
(2) The invention uses the sub-pixel edge extraction algorithm, can keep the high precision of the measurement under the condition of low CCD resolution, and reduces the cost.
(3) The invention obtains the actual size of the battery to be measured by calculating the deviation between the battery to be measured and the standard plate and then adding the deviation to the size of the standard plate, thereby reducing the error caused by the distortion of the camera lens.
(4) The method uses morphological coarse edge extraction before sub-pixel edge extraction, can quickly locate the area where the edge is located, reduces the detection range of the sub-pixel edge extraction algorithm, and further improves the detection speed.
(5) The invention manually selects the area to be detected and the detection content through the human-computer interaction interface, can flexibly adjust according to different battery types and has strong adaptability.
Drawings
FIG. 1 is a flow chart of the present invention.
Fig. 2 is a schematic diagram of the edge structure of the calibration plate.
FIG. 3 is a schematic view of the zigzag structure of the edge of the calibration plate.
Fig. 4 is an image including horizontal and vertical directions in step 3.
Fig. 5 is an image including horizontal and vertical directions in step 5.
Fig. 6 is a schematic view of a calibration plate.
Fig. 7 is a schematic diagram of a rectangular frame.
FIG. 8 is a diagram of standard sized edge points.
In the figure, 1 is a first segment, 2 is a second segment, 3 is a third segment, and 4 is a fourth segment.
Detailed Description
The present invention will be described in detail with reference to the accompanying drawings.
The invention provides a mobile phone battery size measuring method based on machine vision, which can replace manual detection and automatically measure the length, width, edge straightness, perpendicularity and parallelism of a battery at high speed and high precision by using a 2D industrial camera.
Referring to fig. 1, the method for measuring the size of the mobile phone battery based on machine vision comprises the following steps:
(1) manufacturing a calibration plate according to the standard size of a battery to be detected, placing the calibration plate in the central position of an image acquisition platform, acquiring an image of the calibration plate by using an industrial camera, and preprocessing the image of the calibration plate;
in the step (1), the process of manufacturing the calibration plate comprises the following steps: the calibration board includes a plurality of limits, the edge on every limit is the cockscomb structure, refer to fig. 3, the cockscomb structure edge includes the sawtooth structure that a plurality of links to each other, refer to fig. 3, every sawtooth structure includes parallel arrangement and first line segment 1 from a left side to a right side in proper order, second line segment 2, third line segment 3 and fourth line segment 4, second line segment 2 is located same straight line with fourth line segment 4, first line segment 1 is located second line segment 2 and fourth line segment 4 place straight line top, third line segment 3 is located second line segment 2 and fourth line segment 4 place straight line below, the line segment that has of first line segment 1 links to each other with the left end of second line segment 2, the right-hand member of second line segment 2 links to each other with the left end of third line segment 3, the right-hand member of third line segment 3 links to each other with the left end of fourth line segment 4, the right-hand member of fourth line segment 4 links to each other.
The shape of each side is shown in FIG. 2, wherein the straight line lstdLine l representing the edge position of a standard size batterymaxAnd a straight line lminIs a straight line lstdBoth sides and a straight line lstdThe distance is zmm, which is the known dimension for calculating the actual distance for a unit pixel in the image. z is determined from the actual situation as a known dimension of the actual distance corresponding to the unit pixel in the computed image. z may be 2.
The calibration plate image preprocessing process comprises the following steps: more than 5 calibration plate images are shot at the same position, and more than 5 calibration plate images are subjected to multi-amplitude average filtering.
(2) And determining the ROI where the edge to be detected is located.
Creating a plurality of rectangular frames on the preprocessed calibration plate image by using a human-computer interaction interface, wherein each rectangular frame comprises and only comprises one edge of the calibration plate to be detected, taking the area in each rectangular frame as an ROI, and recording the upper left corner coordinate of each ROI and the width and height of the ROI;
(3) for each ROI in the calibration plate image, roughly positioning edges by using a morphological edge extraction algorithm, extracting edge points in the ROI at a subpixel level by using a subpixel edge extraction algorithm to obtain a group of edge points representing a standard size, and calculating an actual distance corresponding to a unit pixel in the calibration plate image by using a calibration algorithm by using a distance z;
in the step (3), the specific process of roughly positioning the edge by using the morphological edge extraction algorithm comprises the following steps: assuming f (x, y) as the image in the region of interest and g (x, y) as the structural element, the morphological operator is:
Figure BDA0002554860290000071
in the formula: is an on operation, is an off operation,
Figure BDA0002554860290000072
an expand operation, an erosion operation.
Using cross-shaped structural elements, respectively
Figure BDA0002554860290000081
And x-shaped structural elements
Figure BDA0002554860290000082
Calculating the morphological gradient image IGrad (f) obtained from the cruciform structuring element1And morphological gradient images IGrad (f) obtained from x-shaped structuring elements2Mixing IGrad (f)1And IGrad (f)2The two images are linearly mixed according to the weight of 0.5 of each image to obtain an average morphological gradient image IGrad (f)mixFor IGrad (f)mixFor each pixel in (a) to image igrad (f)mixPerforming enhancement to obtain an enhanced image IGrad (f)strong
dsti=saturate(|α·srci+β|)
In the formula, srciIs an average morphological gradient image IGrad (f)mixThe ith pixel in (1), dstiFor enhanced image IGrad (f)strongAnd in the corresponding pixel, alpha is a multiplier factor, beta is an offset, saturate is a normalization operation, and the normalization operation enables the calculated pixel value to be still 8 bits.
To IGrad(f)strongPerforming thresholding, setting the gray value of the pixel with the gray value being more than or equal to the threshold value T as 255 and the gray value of the pixel with the gray value being less than the threshold value T as 0, and obtaining a thresholded image IGrad (f)T. The threshold value T is set according to actual needs.
For thresholded image IGrad (f)TUsing a rectangular template of 12 pixels × 1 pixel for etching, and then using a rectangular template of 9 pixels × 1 pixel for expansion, to obtain an image igrad (f) retaining only horizontal straight linesx(ii) a For thresholded image IGrad (f)TEtching with a rectangular template of 1 pixel × 12 pixels and expanding with a rectangular template of 1 pixel × 9 pixels to obtain an image igrad (f) retaining only a straight line in the vertical directiony
Will only keep the image IGrad (f) of the horizontal direction straight linexAnd the image IGrad (f) only keeping the straight line in the vertical directionyLinear blending with a weight of 0.5 per image to obtain an image IGrad (f) containing horizontal and vertical directionsxyAs shown in fig. 4.
For an image IGrad (f) containing horizontal and vertical directionsxyExtracting a circumscribed rectangle Rect of each line segmentiI is 0,1, and will circumscribe a rectangle RectiI-0, 1.. the middle region serves as a sub-ROI.
Judging whether the edge in the ROI is horizontal or vertical, and determining an edge classification standard: detection of images IGrad (f) Using Hough transformxyTo obtain a set of straight lines Lii=xcos(θi)+ysin(θi),i=0,1,...,ρiIs the distance from the straight line to the origin, x is the abscissa of the point on the straight line, y is the ordinate of the point on the straight line, θiThe included angle between the straight line and the x axis is kept, only the first three straight lines with the maximum number of votes are reserved, and the straight lines are ranked as a straight line L from small to large according to the distance from the straight line to the origin1Line L2Line L3. According to a straight line L2And judging whether the edge in the ROI is horizontal or vertical according to the included angle between the ROI and the x axis: if the straight line L2Angle to the x-axis
Figure BDA0002554860290000091
Is smaller than the straight line L2If the difference value between the included angle of the ROI and the x axis is 0, the middle edge of the ROI is a horizontal line; if the straight line L2Angle to the x-axis
Figure BDA0002554860290000092
Is greater than the straight line L2And if the included angle between the ROI and the x axis is different from 0, the edge in the ROI is a vertical line. Determining edge classification criteria: the line segments in the jagged edge are classified into 3 types: a standard size, a minimum nominal size, and a maximum nominal size. Will straight line L2Distance to origin as standard size Classification criterion ClassifystdWill be a straight line L1Classification criterion Classify with distance to origin as minimum scaling sizeminWill be a straight line L3Classification criterion Classify with distance to origin as maximum scaling sizemax
sub-ROIs were classified: for the ith sub-ROI, if the edge in the ROI is a horizontal line, respectively calculating the ordinate of the upper left corner of the sub-ROI and the Classify standardstd、Classifymin、ClassifymaxThe absolute value of the difference value is calculated, if the edge in the ROI is a vertical line, the abscissa of the upper left corner of the sub ROI and the classification standard Classify are calculatedstd、Classifymin、ClassifymaxThe absolute value of the difference, and the class with the smallest absolute value of the difference is the class to which the sub-ROI belongs.
The specific process of extracting the edge points in the ROI at the sub-pixel level by using the sub-pixel edge extraction algorithm comprises the following steps: for each sub-ROI, the size is resized to increase 3 pixel widths to both sides in a direction perpendicular to the middle edge of the sub-ROI to become new sub-ROIs. For each new sub-ROI, convolving the new sub-ROI with 7 Zernike moment templates of 7 pixels multiplied by 7 pixels to obtain 7 Zernike moments of each pixel: 0 th order 0 Zernike moment Z 001 st order 1 Zernike moment real part Z 11R1 st order 1 Zernike moment imaginary part Z 11I2 order 0 Zernike moments Z 203 order 1 Zernike moment real part Z 31R3 order 1 Zernike moment imaginary part Z31I4 th order 0 Zernike moment Z407 Zernike moment templates of 7 pixels multiplied by 7 pixels are respectively:
Figure BDA0002554860290000101
Figure BDA0002554860290000102
Figure BDA0002554860290000103
Figure BDA0002554860290000104
Figure BDA0002554860290000105
Figure BDA0002554860290000111
Figure BDA0002554860290000112
For each pixel point, the calculated Zernike moment Z11R、Z11I、Z31R、Z31IMultiplying by the angle correction factor, the rotation angle
Figure BDA0002554860290000113
The moment after rotation is:
Z'11=sin(φ)·Z11I+cos(φ)·Z11R
Z'31=sin(φ)·Z31I+cos(φ)·Z31R
calculating a distance parameter L, a background gray level H and a gray level difference parameter K by adopting the following formula, and judging whether each point is an edge point or not according to the distance parameter L, the background gray level H and the gray level difference parameter K;
Figure BDA0002554860290000114
Figure BDA0002554860290000115
Figure BDA0002554860290000116
l1、l2is an intermediate variable.
Figure BDA0002554860290000117
Figure BDA0002554860290000118
If L, H, K satisfies | l1-l2|≤T1,|L|≤T2,K>T3,H<T4Wherein T is1,T2,T3,T4And determining the threshold value according to the actual situation, and then recovering the edge scale according to the following formula:
Figure BDA0002554860290000121
wherein x issIs the abscissa, y, of the sub-pixel edge pointsIs the ordinate of the sub-pixel edge point, x is the abscissa of the pixel point, y is the ordinate of the pixel point, and phi is the rotation angle.
Acquiring standard size edge points: the sub-pixel edge points in the sub-ROI classified as the standard size are taken as the standard size edge points.
The specific process of calculating the actual distance corresponding to a single pixel in the calibration plate image by using the calibration algorithm by using the distance z comprises the following steps: respectively fitting sub-pixel edge points in each sub-ROI classified into the specified size into straight lines by a least square approximation method, and calculating all adjacent two categories into the specified size respectivelymaxCalibrating sizeminIn the sub-ROI between the straight linesDistancepixelThen, then
Figure BDA0002554860290000122
Is a calibration value, i.e. the actual distance corresponding to a unit pixel between two calibration edges.
(4) Placing a battery to be detected in the center of an image acquisition platform, acquiring an image of the battery to be detected by using an industrial camera, and preprocessing the image of the battery to be detected;
(5) and (3) creating a region of interest ROI in the detection battery image preprocessed in the step (4) according to the coordinate of the upper left corner of the ROI recorded in the step (2) and the width and the height of the ROI. For each ROI, firstly, roughly positioning edges by using a morphological edge extraction algorithm, then extracting edge points in the ROI at a subpixel level by using a subpixel edge extraction algorithm, and calculating the deviation of the edge points in the ROI and the edge points in the ROI at the corresponding position of a calibration plate image;
(6) and (3) calculating the deviation between the pixel size of the battery to be detected and the standard pixel size in the calibration plate according to the deviation obtained in the step (5), multiplying the deviation between the pixel size of the battery to be detected and the standard pixel size in the calibration plate by a calibration value delta (namely the actual distance corresponding to a unit pixel in the image of the calibration plate obtained by calculation in the step (3)) to obtain the actual size deviation, and adding the actual size deviation to the standard size in the calibration plate to obtain the actual size of the battery to be detected.
In the step (5), extracting the morphological rough edge outline: if f (x, y) is the image of the battery to be detected, and g (x, y) is the structural element, the morphological operator is
Figure BDA0002554860290000131
In the formula: is an on operation, is an off operation,
Figure BDA0002554860290000132
an expand operation, an erosion operation. Using cross-structure operators respectively
Figure BDA0002554860290000133
And x-shape structure operator
Figure BDA0002554860290000134
Computing morphological gradient operator IGrad (f)1And IGrad (f)2Mixing IGrad (f)1And IGrad (f)2Taking the average to obtain a linear mixed IGrad (f) of morphological calculatorsmixFor IGrad (f)mixTo obtain an enhanced image igrad (f)strong
dsti=saturate(|α·srci+β|)
In the formula, srciFor the ith pixel in the input image, dstiFor the corresponding output pixel, α is the multiplier factor, β is the offset, saturate is the normalization operation, so that the calculated pixel value is still 8 bits. To IGrad (f)strongPerforming thresholding, setting the gray value of the pixel with the gray value being more than or equal to the threshold value T as 255 and the gray value of the pixel with the gray value being less than the threshold value T as 0 to obtain a thresholded image IGrad (f)T. To IGrad (f)TUsing a rectangular template of 12 pixels × 1 pixel for etching, and then using a rectangular template of 9 pixels × 1 pixel for expansion to obtain an image IGrad (f) retaining only horizontal straight linesx(ii) a To IGrad (f)TUsing a rectangular template erosion of 1 pixel by 12 pixels and a rectangular template dilation of 1 pixel by 9 pixels results in an image IGrad (f) that retains only vertical linesy(ii) a Mixing IGrad (f)xAnd IGrad (f)yLinear blending with a weight of 0.5 per image to obtain an image IGrad (f) comprising horizontal and vertical directionsxyAs shown in fig. 5.
Finally, extract IGrad (f)xyThe circumscribed rectangle Rect of the middle edge point is determined, and the Rect is determinediThe middle region serves as a sub-ROI.
In the step (5), extracting the sub-pixel edge: the method is the same as the method for extracting the sub-pixel edge in the step (3).
The purpose of calculating the deviation between the edge point in the ROI and the edge point in the ROI corresponding to the calibration plate image is to convert the edge point coordinate into the difference value with the standard size edge point in the calibration plate and calculate the feelingThe specific process of deviation of the edge point in the interesting region ROI from the edge point in the position ROI corresponding to the calibration plate image comprises the following steps: for detecting each sub-pixel edge point P in ROI in the battery imagei(xi,yi) If the edge in the ROI is a horizontal line, finding an abscissa and a P at a standard-size edge point in the ROI corresponding to the calibration plate imageiNearest edge point Pistd1And Pistd2Calculating P by linear interpolationistd1And Pistd2The horizontal cross coordinate of the connecting line is xiOrdinate y of the point(s)istdCalculating the difference y between the edge point coordinates of the battery to be measured and the edge points of the standard size in the calibration plateerr=yi-yistdObtaining a set of deviation points Pierr(xi,yerr) (ii) a If the edge in the ROI is a vertical line, finding a vertical coordinate and a P at the edge point with the standard size in the ROI corresponding to the calibration plate imageiNearest edge point Pistd1And Pistd2Calculating P by linear interpolationistd1And Pistd2The ordinate on the connecting line is yiThe abscissa x of the point(s) ofistdThe difference value between the edge point coordinate of the battery to be measured and the edge point with the standard size in the calibration board is xerr=xi-xistdObtaining a set of deviation points Pierr(xerr,yi),i=0,1,...;
In the step (6), the real size of the battery to be detected comprises straightness, perpendicularity, distance and parallelism, and the specific process is as follows:
and (3) calculating the straightness: if the edge in the ROI is a horizontal line, the deviation point P of the battery edge to be detected in the ROI is detectedierr(xi,yerr) I is 0,1, fitting a straight line l, ax + by + c is 0 by a least square method, and calculating Pierr(xi,yerr) Distance to line i (positive and negative inclusive)
Figure RE-GDA0002636210360000141
Will dis _ rightiMultiplying the obtained result by a calibration value of the corresponding position (the calibration value is the actual distance corresponding to a unit pixel in the calibration plate image obtained by calculation in the step (3)) to obtain the calibration valueTo the actual distance dis _ rightinewAnd taking the maximum n (n is more than or equal to 5) actual distances to calculate an average value a, taking the minimum n (n is more than or equal to 5) actual distances to calculate an average value b, and setting the straightness of the edge of the battery to be detected as Straight a-b.
If the edge in the ROI is a vertical line, the deviation point P in the ROI where the edge of the battery to be tested is located is determinedierr(xerr,yi) I is 0,1, fitting a straight line l, ax + by + c is 0 by a least square method, and calculating Pierr(xerr,yi) Distance to line i (positive and negative inclusive)
Figure BDA0002554860290000142
Will disiMultiplying the actual distance dis by a calibration value delta (the calibration value is the actual distance corresponding to a unit pixel in the calibration plate image obtained by calculation in the step (3)) of the corresponding position to obtain an actual distance disinewTaking the maximum n (n is more than or equal to 5) actual distances to calculate an average value a, taking the minimum n (n is more than or equal to 5) actual distances to calculate an average value b, and setting the straightness of the edge of the battery to be detected as Straight as a-b;
and (3) calculating the parallelism: for the two edges A, B of the cell to be tested, which need to be parallel, one of the straight lines (e.g., edge a) is taken as a reference. Translating edge B so that the standard size edge of edge B coincides with the standard size edge of edge a. Fitting a straight line l of deviation points in the ROI of the edge A using a least squares methodAAx + by + c is 0, and the deviation point P of the edge B after translation is calculatedBierrI is 0,1AIs a distance of
Figure BDA0002554860290000151
Will dis _ parallelismiMultiplying the actual distance dis by a calibration value delta (the calibration value is the actual distance corresponding to the unit pixel in the calibration plate image calculated in the step (3)) of the corresponding position to obtain an actual distance disinewTaking the largest n (n is more than or equal to 5) actual distances to calculate an average value m, taking the smallest n (n is more than or equal to 5) actual distances to calculate an average value n, and setting the Parallelism of an edge A and an edge B in the battery to be detected as | m-n |;
and (3) calculating the verticality: for calculating verticality in battery to be inspectedTwo edges A, B are referenced to one of the straight lines (e.g., edge a). Fitting a straight line l of deviation points in the ROI of the edge A using a least squares methodAAx + by + c is 0. All deviation points P of the edge BBierrI is 0,1ATo obtain a new point set PBierr' 0,1, in the direction of the edge A, selecting n (n is more than or equal to 5) highest points as extreme value sampling points, calculating the average value of n points, and obtaining a high point virtual extreme value reference point r1(ii) a Selecting n (n is more than or equal to 5) minimum points as extreme value sampling points, calculating the average value of the n points to obtain a low point virtual extreme value reference point r2;r1And r2Dis of each otherr=|r1-r2And (3) multiplying the | by a calibration value delta (the calibration value is the actual distance corresponding to a unit pixel in the calibration plate image obtained by calculation in the step (3)), wherein the product is the Perpendicularity of the edge A and the edge B in the battery to be tested.
The straightness, perpendicularity and parallelism are all 0 in the standard size.
And (3) distance calculation: for the two parallel edges A, B of the cell to be measured, which need to be calculated, one of the straight lines (e.g., edge a) is taken as a reference. Translating edge B so that the standard size edge of edge B coincides with the standard size edge of edge a. Fitting a straight line l of deviation points in the ROI of the edge A using a least-two multiplicationAAx + by + c is 0, and the deviation point P of the edge B after translation is calculatedBierrI is 0,1AIs a distance of
Figure BDA0002554860290000161
Averaging dis of all distancesavrWill disiMultiplying the actual distance dis by a calibration value delta (the calibration value is an actual distance corresponding to a unit pixel in the calibration plate image obtained by calculation in the step (3)) of the corresponding position to obtain an actual distance disavrnew
Will disavrnewAdding the standard size and the actual distance between the two parallel lines, wherein the distance is the actual size of the battery to be detected.
The following is a specific example.
As an embodiment, the battery under test is shown in fig. 6:
step 1, referring to fig. 6, manufacturing a calibration plate as shown in fig. 7 according to the standard size of a battery to be detected, placing the calibration plate at the center of an image acquisition platform, acquiring an image of the calibration plate by using an industrial camera, and preprocessing the image of the calibration plate;
and 2, referring to fig. 8, creating rectangular frames as shown in fig. 8 on the preprocessed calibration plate image by using a human-computer interaction interface, wherein each rectangular frame only comprises one edge of the calibration plate to be detected, and the area in each rectangular frame is used as an ROI.
Step 3, referring to fig. 8, for each ROI in the calibration plate image, first, using a morphological edge extraction algorithm to coarsely locate the edge, then using a sub-pixel edge extraction algorithm to extract the edge points in the ROI at a sub-pixel level to obtain a group of edge points representing a standard size, and using a calibration algorithm to calculate the actual distance corresponding to a unit pixel in the calibration plate image by using the known size z of 2mm in the calibration plate;
the specific process of roughly positioning the edge by utilizing the morphological edge extraction algorithm in the step 3 is as follows: obtaining average morphological gradient image IGrad (f) by structural elementmixFor IGrad (f)mixFor each pixel in (a) to image igrad (f)mixPerforming enhancement to obtain an enhanced image IGrad (f)strong
dsti=saturate(|α·srci+β|)
In the formula, srciIs an average morphological gradient image IGrad (f)mixThe ith pixel in (1), dstiFor enhanced image IGrad (f)strongThe corresponding pixel in (1) is a multiplier factor with a value of 3.0, beta is an offset with a value of 10.0, saturate is a normalization operation, and the normalization operation makes the calculated pixel value still 8 bits.
To IGrad (f)strongPerforming thresholding, wherein the gray value of the pixel with the gray value being more than or equal to the threshold value T being 100 is 255, the gray value of the pixel with the gray value being less than the threshold value T is 0, and obtaining a thresholded image IGrad (f)T
To IGrad (f)TUsing a rectangular template of 12 pixels × 1 pixel for etching, and then using a rectangular template of 9 pixels × 1 pixel for expansion, to obtain an image igrad (f) retaining only horizontal straight linesx(ii) a To IGrad (f)TEtching with a rectangular template of 1 pixel × 12 pixels and expanding with a rectangular template of 1 pixel × 9 pixels to obtain an image igrad (f) with only straight lines in the vertical directiony(ii) a Mixing IGrad (f)xAnd IGrad (f)yLinear blending with a weight of 0.5 per image to obtain an image IGrad (f) containing horizontal and vertical directionsxy
To IGrad (f)xyExtracting a circumscribed rectangle Rect of each line segmentiI is 0,1, and Rect, and will RectiA region in 0, 1.. is taken as a sub-ROI.
And judging whether the edge in the ROI is horizontal or vertical, determining edge classification criteria, and classifying the sub-ROI according to the edge classification criteria.
The specific process of extracting the edge points in the ROI at the sub-pixel level by using the sub-pixel edge extraction algorithm in the step 3 is as follows: for each sub-ROI, the size is resized to increase 3 pixel widths to both sides in a direction perpendicular to the middle edge of the sub-ROI, thereby forming new sub-ROIs. For each new sub ROI, convolution is carried out on the new sub ROI and 7 Zernike moment templates with 7 pixels multiplied by 7 pixels to obtain 7 Zernike moments Z of each pixel point00、Z11R、Z11I、Z20、Z31R、Z31I、Z40. For each pixel point, the Zernike moment Z is calculated11R、Z11I、Z31R、Z31IMultiplying the angle correction coefficient to obtain the rotated moment Z1'1And Z3'1. Calculating a distance parameter L, a background gray H and a gray difference parameter K, and judging whether each point is an edge point according to the distance parameter L, the background gray H and the gray difference parameter K: if L, H, K satisfies | l1-l2|≤T1,|L|≤T2,K>T3,H<T4Wherein T is1,T2,T3,T4Is a threshold value, threshold value T1,T2,T3,T4Are respectively as
Figure BDA0002554860290000171
120. 255, then can be regarded as the edge point, and then according to the restored edge scale.
In step 3, the specific process of calculating the actual distance corresponding to a unit pixel in the calibration plate image by using the calibration algorithm by using the known dimension, namely the distance z, in the calibration plate is as follows: respectively fitting the sub-pixel edge points in each sub-ROI classified into the specified size into straight lines by a least square approximation method, and calculating all adjacent two classes to be respectively the specified sizemaxCalibrating sizeminDistance of pixels between straight lines in the sub-ROI of (1)pixelThen, then
Figure BDA0002554860290000181
Is a calibration value, i.e. the actual distance corresponding to a unit pixel between two calibration edges.
Step 4, placing the battery to be detected in the center of the image acquisition platform, acquiring an image of the battery to be detected by using an industrial camera, and preprocessing the image of the battery to be detected;
and 5, creating a region of interest ROI in the battery image to be detected according to the recorded coordinates (x, y) at the upper left corner of the ROI, the width and the height of the ROI. For each ROI, firstly, roughly positioning edges by using a morphological edge extraction algorithm, then extracting edge points in the ROI at a sub-pixel level by using a sub-pixel edge extraction algorithm, and calculating the deviation of the edge points in the ROI and the edge points in the ROI at the corresponding position of a calibration plate image;
and 6, calculating the deviation between the pixel size of the battery to be detected and the standard pixel size in the calibration plate according to the deviation obtained in the step 5, multiplying the deviation between the pixel size of the battery to be detected and the standard pixel size in the calibration plate by a calibration value delta (namely the actual distance corresponding to a single pixel in the image of the calibration plate obtained by calculation in the step 3) to obtain the actual size deviation, and adding the actual size deviation to the standard size in the calibration plate to obtain the actual size of the battery to be detected.

Claims (10)

1. The mobile phone battery size measuring method based on machine vision is characterized by comprising the following steps:
(1) collecting a calibration plate image, and preprocessing the calibration plate image;
(2) determining a region of interest ROI where the edge to be detected is located on the preprocessed calibration plate image;
(3) for each ROI in the calibration plate image, firstly carrying out rough edge positioning, then extracting edge points in the ROI at a sub-pixel level to obtain a group of edge points representing a standard size, and calculating the actual distance of unit pixels in the calibration plate image according to the edge points;
(4) collecting a battery image to be detected, and preprocessing the battery image to be detected;
(5) creating a region of interest ROI in the battery image to be detected preprocessed in the step (4) according to the coordinates of the upper left corner of the ROI and the width and height of the ROI recorded in the step (2); for each ROI, firstly, roughly positioning the edge, then extracting edge points in the ROI at a sub-pixel level, and calculating the deviation between the edge points in the ROI and the edge points in the ROI at the corresponding position of the calibration plate image;
(6) and calculating the deviation between the pixel size of the battery to be detected and the standard pixel size in the calibration plate according to the deviation, multiplying the deviation between the pixel size of the battery to be detected and the standard pixel size in the calibration plate by the actual distance corresponding to a single pixel in the image of the calibration plate to obtain the actual size deviation, and adding the actual size deviation to the standard size in the calibration plate to obtain the actual size of the battery to be detected.
2. The method for measuring the size of the mobile phone battery based on the machine vision according to the claim 1, wherein in the step (1), the specific process for manufacturing the calibration plate is as follows: the calibration plate comprises a plurality of edges, the edge of each edge is in a sawtooth shape, the sawtooth-shaped edge comprises a plurality of sawtooth structures connected with each other, and each sawtooth structure comprises a first line segment (1), a second line segment (2), a first line segment (2), a second line segment and a third line segment which are arranged in parallel and are arranged from left to right in sequence,A third line segment (3) and a fourth line segment (4), wherein the second line segment (2) and the fourth line segment (4) are positioned on the same straight line, and the first line segment (1) is positioned on the straight line l where the second line segment (2) and the fourth line segment (4) are positionedstdThe third line segment (3) is positioned on the straight line l where the second line segment (2) and the fourth line segment (4) are positionedstdBelow, the wired section of the first line section (1) is connected with the left end of the second line section (2), the right end of the second line section (2) is connected with the left end of the third line section (3), the right end of the third line section (3) is connected with the left end of the fourth line section (4), and the right end of the fourth line section (4) is connected with the other sawtooth structure;
the straight line where the first line segment (1) is positioned is a straight line lmaxThe straight line where the fourth line segment (1) is located is a straight line lminStraight line lstdLine l representing the edge position of a standard size batterymaxAnd a straight line lminIs a straight line lstdBoth sides and a straight line lstdA straight line at a distance z.
3. The mobile phone battery size measurement method based on machine vision according to claim 1, wherein in step (1), the calibration board image preprocessing process is as follows: and carrying out multiple average filtering on more than 5 calibration plate images shot at the same position.
4. The mobile phone battery size measurement method based on machine vision according to claim 1, characterized in that, the specific process of step (2) is: and establishing a plurality of rectangular frames on the preprocessed calibration plate image by using a human-computer interaction interface, wherein each rectangular frame comprises the edge of the calibration plate to be detected, the area in each rectangular frame is used as the ROI, and the upper left corner coordinate of each ROI and the width and height of the ROI are recorded.
5. The mobile phone battery size measurement method based on machine vision according to claim 2, characterized in that in step (3), the morphological edge extraction algorithm is used to perform rough edge positioning, the sub-pixel edge extraction algorithm is used to extract the edge points in the ROI at the sub-pixel level to obtain a group of edge points representing the standard size, and the distance z is used to calculate the actual distance corresponding to a unit pixel in the calibration plate image by using the calibration algorithm.
6. The method for measuring the size of the mobile phone battery based on the machine vision as claimed in claim 2, wherein in the step (3), the specific process of calculating the actual distance corresponding to a unit pixel in the calibration board image by using the calibration algorithm using the distance z comprises: respectively fitting the sub-pixel edge points in each sub-ROI classified into the specified size into straight lines by a least square approximation method, and calculating all adjacent two classes to be respectively the specified sizemaxCalibrating sizeminThe pixel distance Distan ce between straight lines in the sub ROIpixelThen, then
Figure FDA0002554860280000021
Is the actual distance corresponding to the unit pixel between the two calibration edges.
7. The mobile phone battery size measurement method based on machine vision according to claim 1, wherein in step (3), in step (5), the morphological edge extraction algorithm is used to perform rough edge positioning, then the sub-pixel edge extraction algorithm is used to extract the edge points in the ROI at the sub-pixel level, and the deviation between the edge points in the ROI and the edge points in the ROI at the corresponding position of the calibration plate image is calculated.
8. The mobile phone battery dimension measurement method based on machine vision according to claim 1, characterized in that in step (3), in step (6), the real dimensions of the battery to be detected include straightness, perpendicularity, distance and parallelism, and the specific process is as follows:
and (3) calculating the straightness: if the edge in the ROI is a horizontal line, the deviation point P of the battery edge to be detected in the ROI is detectedierr(xi,yerr) I is 0,1, fitting a straight line l, ax + by + c is 0 by a least square method, and calculating Pierr(xi,yerr) I is 0,1
Figure RE-FDA0002636210350000031
Will dis _ rightiMultiplying the actual distance corresponding to a single pixel in the calibration board image to obtain the actual distance dis _ rightinewTaking the maximum n actual distances to calculate the average maxstraightThe minimum n actual distances calculate the average minstraightThe straightness of the edge of the battery to be detected is Stright maxstraight-minstraight;n≥5;
If the edge in the ROI is a vertical line, the deviation point P in the ROI where the edge of the battery to be tested is located is determinedierr(xerr,yi) I is 0,1, fitting a straight line l, ax + by + c is 0 by a least square method, and calculating Pierr(xerr,yi) I is 0,1
Figure RE-FDA0002636210350000032
Will disiMultiplying the actual distance corresponding to a single pixel in the calibration board image to obtain the actual distance dis _ rightinewTaking the maximum n actual distances to calculate the average maxstraightThe minimum n actual distances calculate the average minstraightThe straightness of the edge of the battery to be detected is Stright maxstraight-minstraight,n≥5。
9. The method for measuring the size of the mobile phone battery based on the machine vision according to the claim 1, wherein in the step (3), the parallelism calculation is as follows: for two edges A, B of the battery to be measured, which need to calculate the parallelism, taking the edge A as a reference, and translating the edge B to ensure that the standard size edge of the edge B is superposed with the standard size edge of the edge A; fitting a straight line l of deviation points in the ROI of the edge A using a least squares methodAAx + by + c is 0, and the deviation point P of the edge B after translation is calculatedBierrI is 0,1AIs a distance of
Figure FDA0002554860280000033
Will dis _ parallelismiAnd step (3)Multiplying the actual distances corresponding to the single pixels in the calibration board image obtained by calculation to obtain the actual distance dis _ parallelisminewTaking the maximum n actual distances to calculate the average maxparallelismThe minimum n actual distances calculate the average minparallelismThe parallelism of the edge A and the edge B in the battery to be detected is ═ maxparallelism-minparallelism|;n≥5。
10. The mobile phone battery size measuring method based on machine vision according to claim 1, characterized in that in step (3), perpendicularity calculation: for two edges A, B of the cell to be detected, which need to calculate the verticality, taking the edge A as a reference, and fitting a straight line l of deviation points in the ROI of the edge A by using a least square methodAAx + by + c is 0; all deviation points P of the edge BBierrI is 0,1ATo obtain a new point set PBierr' 0,1, in the direction of the edge A, selecting n highest points as extreme value sampling points, calculating the average value of the n points, and obtaining a high point virtual extreme value reference point r1(ii) a Selecting n lowest points as extreme value sampling points, calculating the average value of the n points to obtain a low point virtual extreme value reference point r2;r1And r2Distance dis _ permanent betweenr=|r1-r2Multiplying the l by the actual distance corresponding to a single pixel in the calibration board image, wherein the product is the Perpendicularity Perpendicularity of the edge A and the edge B in the battery to be tested; n is more than or equal to 5;
the straightness, the perpendicularity and the parallelism are all 0 in standard size;
and (3) distance calculation: for two parallel edges A, B of the battery to be measured, which need to calculate the distance, taking the edge A as a reference, translating the edge B to ensure that the standard size edge of the edge B is superposed with the standard size edge of the edge A, and fitting a straight line l of a deviation point in the ROI of the edge A by using a least square methodAAx + by + c is 0, and the deviation point P of the edge B after translation is calculatedBierrI is 0,1AIs a distance of
Figure FDA0002554860280000041
Averaging all distances disavrAverage distance disiMultiplying the actual distance corresponding to a single pixel in the calibration plate image to obtain an actual distance disavrnew(ii) a Will disavrnewThe sum of the standard size and the actual distance between the two parallel lines is the real size of the battery to be detected.
CN202010586510.7A 2020-06-24 2020-06-24 Mobile phone battery size measuring method based on machine vision Active CN111879241B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202010586510.7A CN111879241B (en) 2020-06-24 2020-06-24 Mobile phone battery size measuring method based on machine vision

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202010586510.7A CN111879241B (en) 2020-06-24 2020-06-24 Mobile phone battery size measuring method based on machine vision

Publications (2)

Publication Number Publication Date
CN111879241A true CN111879241A (en) 2020-11-03
CN111879241B CN111879241B (en) 2021-09-07

Family

ID=73157092

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202010586510.7A Active CN111879241B (en) 2020-06-24 2020-06-24 Mobile phone battery size measuring method based on machine vision

Country Status (1)

Country Link
CN (1) CN111879241B (en)

Cited By (11)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112361977A (en) * 2020-11-10 2021-02-12 成都新西旺自动化科技有限公司 Linear distance measuring method based on weight distribution
CN113176223A (en) * 2021-03-23 2021-07-27 中山大学新华学院 Infrared spectrophotometry detector
CN113513991A (en) * 2021-04-15 2021-10-19 珠海博明视觉科技有限公司 Battery pole piece burr height detection method and device
CN113639678A (en) * 2021-08-20 2021-11-12 徐海 Linear guide rail precision detection method based on intelligent camera
CN114383517A (en) * 2021-12-29 2022-04-22 南京大学 Battery expansion real-time detection method and device based on optical imaging
CN115760782A (en) * 2022-11-16 2023-03-07 华南理工大学 In-mold labeling offset defect identification method based on machine vision
CN116580022A (en) * 2023-07-07 2023-08-11 杭州鄂达精密机电科技有限公司 Workpiece size detection method, device, computer equipment and storage medium
CN117237441A (en) * 2023-11-10 2023-12-15 湖南科天健光电技术有限公司 Sub-pixel positioning method, sub-pixel positioning system, electronic equipment and medium
CN117392127A (en) * 2023-12-11 2024-01-12 深圳精智达技术股份有限公司 Method and device for detecting display panel frame and electronic equipment
CN117723551A (en) * 2024-02-18 2024-03-19 宁德时代新能源科技股份有限公司 Battery detection device, point detection method, battery production device and detection method
CN117782993A (en) * 2024-02-23 2024-03-29 宁德时代新能源科技股份有限公司 Point inspection method of bare cell appearance detection system and bare cell appearance detection system

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2002122964A (en) * 2000-10-12 2002-04-26 Fuji Photo Film Co Ltd Battery jacket of film unit with lens
CN1677788A (en) * 2003-11-14 2005-10-05 索尼株式会社 Battery, battery protection processing device and control method
CN102737377A (en) * 2012-05-14 2012-10-17 上海瑞伯德智能系统科技有限公司 Improved method for extracting sub-pixel edge
CN210676012U (en) * 2019-04-01 2020-06-05 安徽理工大学 Waste battery separation and recovery device based on machine vision

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2002122964A (en) * 2000-10-12 2002-04-26 Fuji Photo Film Co Ltd Battery jacket of film unit with lens
CN1677788A (en) * 2003-11-14 2005-10-05 索尼株式会社 Battery, battery protection processing device and control method
CN102737377A (en) * 2012-05-14 2012-10-17 上海瑞伯德智能系统科技有限公司 Improved method for extracting sub-pixel edge
CN210676012U (en) * 2019-04-01 2020-06-05 安徽理工大学 Waste battery separation and recovery device based on machine vision

Non-Patent Citations (7)

* Cited by examiner, † Cited by third party
Title
《计量测试技术手册》编辑委员会: "《计量测试技术手册 第2卷 几何量》", 31 March 1997 *
侯宏花: "《数字图像处理与分析》", 30 September 2011 *
姜明灿 等: "《公差与测量技术》", 31 December 2006 *
杨广武: "《新编物理实验》", 31 May 2013 *
王盼: "手机电池的尺寸测量和外观缺陷检测", 《中国优秀硕士学位论文全文数据库 信息科技辑 2017年》 *
蔡利梅: "《数字图像处理》", 31 August 2014 *
黄炽豪: "基于机器视觉的晶硅光伏太阳能电池测量系统研究", 《中国优秀硕士学位论文全文数据库 工程科技II辑 2019年》 *

Cited By (16)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112361977A (en) * 2020-11-10 2021-02-12 成都新西旺自动化科技有限公司 Linear distance measuring method based on weight distribution
CN112361977B (en) * 2020-11-10 2021-05-28 成都新西旺自动化科技有限公司 Linear distance measuring method based on weight distribution
CN113176223A (en) * 2021-03-23 2021-07-27 中山大学新华学院 Infrared spectrophotometry detector
CN113513991A (en) * 2021-04-15 2021-10-19 珠海博明视觉科技有限公司 Battery pole piece burr height detection method and device
CN113639678A (en) * 2021-08-20 2021-11-12 徐海 Linear guide rail precision detection method based on intelligent camera
CN114383517A (en) * 2021-12-29 2022-04-22 南京大学 Battery expansion real-time detection method and device based on optical imaging
CN115760782A (en) * 2022-11-16 2023-03-07 华南理工大学 In-mold labeling offset defect identification method based on machine vision
CN115760782B (en) * 2022-11-16 2023-06-16 华南理工大学 Machine vision-based in-mold labeling offset defect identification method
CN116580022A (en) * 2023-07-07 2023-08-11 杭州鄂达精密机电科技有限公司 Workpiece size detection method, device, computer equipment and storage medium
CN116580022B (en) * 2023-07-07 2023-09-29 杭州鄂达精密机电科技有限公司 Workpiece size detection method, device, computer equipment and storage medium
CN117237441A (en) * 2023-11-10 2023-12-15 湖南科天健光电技术有限公司 Sub-pixel positioning method, sub-pixel positioning system, electronic equipment and medium
CN117237441B (en) * 2023-11-10 2024-01-30 湖南科天健光电技术有限公司 Sub-pixel positioning method, sub-pixel positioning system, electronic equipment and medium
CN117392127A (en) * 2023-12-11 2024-01-12 深圳精智达技术股份有限公司 Method and device for detecting display panel frame and electronic equipment
CN117392127B (en) * 2023-12-11 2024-04-12 深圳精智达技术股份有限公司 Method and device for detecting display panel frame and electronic equipment
CN117723551A (en) * 2024-02-18 2024-03-19 宁德时代新能源科技股份有限公司 Battery detection device, point detection method, battery production device and detection method
CN117782993A (en) * 2024-02-23 2024-03-29 宁德时代新能源科技股份有限公司 Point inspection method of bare cell appearance detection system and bare cell appearance detection system

Also Published As

Publication number Publication date
CN111879241B (en) 2021-09-07

Similar Documents

Publication Publication Date Title
CN111879241B (en) Mobile phone battery size measuring method based on machine vision
US11551341B2 (en) Method and device for automatically drawing structural cracks and precisely measuring widths thereof
CN108764229B (en) Water gauge image automatic identification method based on computer vision technology
CN111062915B (en) Real-time steel pipe defect detection method based on improved YOLOv3 model
CN106934800B (en) Metal plate strip surface defect detection method and device based on YOLO9000 network
CN112613097A (en) BIM rapid modeling method based on computer vision
CN113340909B (en) Glue line defect detection method based on machine vision
CN106340010A (en) Corner detection method based on second-order contour difference
CN112489042A (en) Metal product printing defect and surface damage detection method based on super-resolution reconstruction
US7893947B2 (en) Method for extracting edge in photogrammetry with subpixel accuracy
CN113538503A (en) Solar panel defect detection method based on infrared image
CN112465809A (en) Mold defect detection method based on image recognition, computer-readable storage medium and device
CN115100116A (en) Plate defect detection method based on three-dimensional point cloud
CN112906689B (en) Image detection method based on defect detection and segmentation depth convolutional neural network
CN113269234A (en) Connecting piece assembly detection method and system based on target detection
CN111754461A (en) Method and device for positioning image character area of semiconductor chip
CN112132773B (en) Method, device, equipment and storage medium for detecting riveting point defect of aircraft head cover
CN116862881A (en) Multi-target real-time offset detection method based on image processing
CN112146593A (en) Machine vision-based external thread detection method and real-time detection system
CN114549780B (en) Intelligent detection method for large complex component based on point cloud data
CN112837285B (en) Edge detection method and device for panel image
CN115656182A (en) Sheet material point cloud defect detection method based on tensor voting principal component analysis
CN111260625B (en) Automatic extraction method for offset printing large image detection area
CN115222652A (en) Method for identifying, counting and centering end faces of bundled steel bars and memory thereof
CN114998571A (en) Image processing and color detection method based on fixed-size marker

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant