CN110823134A - Target line calculation and industrial sensor installation detection method - Google Patents

Target line calculation and industrial sensor installation detection method Download PDF

Info

Publication number
CN110823134A
CN110823134A CN201810813917.1A CN201810813917A CN110823134A CN 110823134 A CN110823134 A CN 110823134A CN 201810813917 A CN201810813917 A CN 201810813917A CN 110823134 A CN110823134 A CN 110823134A
Authority
CN
China
Prior art keywords
target
line
target line
image
length
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
CN201810813917.1A
Other languages
Chinese (zh)
Other versions
CN110823134B (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.)
China Daheng (group) Co Ltd Beijing Image Visual Technology Branch
BEIJING DAHENG IMAGE VISION Co Ltd
Original Assignee
China Daheng (group) Co Ltd Beijing Image Visual Technology Branch
BEIJING DAHENG IMAGE VISION Co Ltd
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 China Daheng (group) Co Ltd Beijing Image Visual Technology Branch, BEIJING DAHENG IMAGE VISION Co Ltd filed Critical China Daheng (group) Co Ltd Beijing Image Visual Technology Branch
Priority to CN201810813917.1A priority Critical patent/CN110823134B/en
Publication of CN110823134A publication Critical patent/CN110823134A/en
Application granted granted Critical
Publication of CN110823134B publication Critical patent/CN110823134B/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/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/60Analysis of geometric attributes

Abstract

The invention discloses a target line calculation and industrial sensor installation detection method. The method comprises the following steps: shooting a target image by using an industrial camera to be detected, acquiring a plurality of interested areas in the target image according to set parameters of the target image, and marking the interested areas as the image to be detected; calculating the length of a target line, the line width of the target line and the definition of the target line of the edge cross target according to the image to be detected and a weighting method; determining a cross target to be detected according to the maximum value of the target line definition and a preset definition threshold value; and generating and sending an adjusting instruction of the industrial camera sensor according to the length and the line width of the target line in the cross target. According to the technical scheme, the detection automation degree of the industrial camera sensor is improved, the human interference in the detection process is reduced, the reliability of the detection effect is improved, and the consistency and the product quality of mass production industrial cameras are improved.

Description

Target line calculation and industrial sensor installation detection method
Technical Field
The invention relates to the technical field of industrial camera detection, in particular to a target line length and line width weighting calculation method based on a histogram and a detection method for an industrial camera sensor.
Background
The existing method for detecting whether the installation angle of the industrial camera sensor meets the requirement is to shoot an ISO12233 image definition test card, then detect the resolution of the shot image to obtain the definition of the camera to be detected, compare the obtained definition with a set standard, judge that the installation angle of the industrial camera sensor meets the requirement if the definition meets the set standard, and if not, reinstall the industrial camera sensor.
However, in the prior art, a method for inspecting a shot image is usually based on detection of a standard image definition test card ISO12233, and this method can only indicate that an industrial camera is not assembled properly, and cannot determine that an industrial camera sensor is abnormal in installation angle or an industrial camera is abnormal in rear intercept adjustment, so that installation accuracy of the industrial camera sensor and consistency of products cannot be guaranteed.
Disclosure of Invention
The invention aims to: the method for calculating the target line and detecting the installation of the industrial camera sensor is provided, and by calculating and detecting the line length and the line width of the target line, the consistency of judging whether the installation angle of the industrial camera sensor to be detected meets the required standard is improved, and the reliability of detecting the industrial camera sensor in batches is improved.
The technical scheme of the first aspect of the invention is as follows: a histogram-based target line length and line width weighting calculation method is provided, which comprises the following steps: step 10A, shooting a target image by using an industrial camera to be detected, acquiring a plurality of interested areas in the target image according to set parameters of the target image, and marking the interested areas as the image to be detected; step 20A, carrying out binarization processing on an image to be detected, and calculating the effective line length and the effective line width of any detection line segment on a target in the image to be detected by adopting a weighting algorithm; and step 30A, calculating the target line length and the target line width of the cross target line in any image to be detected according to the effective line length and the effective line width of the detection line segment, wherein the cross target line comprises a vertical target line and a horizontal target line.
In any one of the above technical solutions, further, the step 20A specifically includes: step 21A, performing binarization processing on an image to be detected to obtain a calculated image; step 22A, acquiring a detection line segment image according to the calculated image by a connected domain analysis method; step 23A, determining the scanning direction of the detection line segment image according to the frame of the minimum circumscribed rectangle of the detection line segment; and step 24A, calculating the effective line length and the effective line width of the detection line segment by using a histogram weighting method according to the scanning direction and the preset gray threshold value.
In any one of the above technical solutions, further, the step 20A specifically further includes: step 25A, changing the statistical state of the detection line segment with the effective line length and the line width calculated from "not calculated" to "calculated"; step 26A, judging whether the statistical state of the detection line segment in the image to be detected contains 'not calculated'; step 27A, when it is judged that the statistical state contains "not calculated", step 23A is executed; in step 28A, when it is determined that the statistical state does not contain "not calculated", step 30A is performed.
The technical scheme of the second aspect of the invention is as follows: a detection method for an industrial camera sensor is proposed, comprising: step 10C, shooting a target image by using an industrial camera to be detected, acquiring a plurality of interested areas in the target image according to set parameters of the target image, and marking the interested areas as the image to be detected; step 20C, calculating the length of a target line, the line width of the target line and the definition of the target line of the cross target line in the image to be detected according to the image to be detected and a weighting method; step 30C, determining the numbers of the cross-shaped target to be detected and the corresponding sensors according to the maximum value of the target line definition and a preset definition threshold value; and step 40C, generating and sending an adjusting instruction of the industrial camera sensor according to the length and the line width of the target line in the cross target.
In any one of the above technical solutions, further, the step 40C includes: step 41C, judging and checking the size relation between the target line lengths of the horizontal target line and the vertical target line in the cross target; step 42C, when the length of the target line of the horizontal target line is judged to be larger than or equal to that of the vertical target line, generating and sending a vertical direction adjusting instruction; and 43C, when the target line length of the horizontal target line is smaller than that of the vertical target line, generating and sending a horizontal direction adjusting instruction.
In any one of the above technical solutions, further, step 42C specifically includes: when the length of the target line of the horizontal target line is larger than or equal to that of the vertical target line, judging whether the width of the target line of the vertical target line above the intersection point of the target lines is larger than that of the vertical target line below the intersection point of the target lines; when the judgment result is yes, determining that the vertical adjustment instruction is a downward adjustment instruction which is adjusted downwards according to the reference plane; and when the judgment result is no, determining that the vertical adjustment instruction is an upward adjustment instruction which is adjusted upwards according to the reference surface, wherein the vertical adjustment instruction comprises a downward adjustment instruction and an upward adjustment instruction, the intersection point of the target lines is the intersection point of the horizontal target line and the vertical target line, and the reference surface is a plane which faces the target direction and is parallel to the target.
In any one of the above technical solutions, further, step 43C specifically includes: when the length of the target line of the horizontal target line is smaller than that of the vertical target line, judging whether the target line width of the vertical target line on the right side of the target line intersection point is larger than that of the vertical target line on the left side of the target line intersection point; when the judgment result is yes, determining the horizontal adjustment instruction as a right adjustment instruction adjusted to the right according to the reference surface; and when the judgment result is no, determining that the horizontal adjustment instruction is a leftward adjustment instruction which is adjusted leftward according to the reference surface, wherein the horizontal adjustment instruction comprises a rightward adjustment instruction and a leftward adjustment instruction, the intersection point of the target lines is the intersection point of the horizontal target line and the vertical target line, and the reference surface is a plane which faces the target direction and is parallel to the target.
The invention has the beneficial effects that: by introducing a histogram weighting algorithm, the accuracy and reliability of target line calculation are improved, the influence of human factors on a calculation result is reduced, the target line is calculated according to the physical coordinates of an image by scanning the image, the calculation amount of the length, the line width and the definition of the target line is favorably reduced, the hardware requirement of an operation server is reduced, and the anti-interference capability and the fault tolerance rate of the calculation result are improved by setting a corresponding threshold value.
According to the invention, the cross target is determined to be detected according to the definition of the target line; according to the method, the adjustment instruction of the industrial camera sensor is generated and sent according to the length and the line width of the target line in the cross target, so that the automation degree of detection of the industrial camera sensor is improved, the human error in the detection process is reduced, the reliability and the consistency of batch detection of the industrial camera sensor are improved, and the product yield of the industrial camera is improved.
Drawings
The above and/or additional aspects and advantages of the present invention will become apparent and readily appreciated from the following description of the embodiments, taken in conjunction with the accompanying drawings of which:
FIG. 1 is a schematic illustration of a target for industrial camera detection according to one embodiment of the present invention;
FIG. 2 is a schematic view of a first edge cross target according to one embodiment of the present invention;
FIG. 3 is a schematic flow chart diagram of a histogram-based target line length and line width weighting calculation method according to an embodiment of the present invention;
FIG. 4 is a schematic diagram of a minimum bounding rectangle according to one embodiment of the present invention;
FIG. 5 is a schematic flow chart diagram of a histogram-based sharpness weighting calculation method in accordance with one embodiment of the present invention;
FIG. 6 is a schematic diagram of a binarization process according to one embodiment of the invention;
FIG. 7 is a schematic view of a connected component image of a first edge cross target according to one embodiment of the present invention;
FIG. 8 is a schematic flow diagram of a detection method for an industrial camera sensor according to one embodiment of the invention;
FIG. 9 is a schematic flow diagram of a detection method for industrial camera back intercept in accordance with one embodiment of the present invention;
FIG. 10 is an industrial camera sharpness curve simulation diagram in accordance with one embodiment of the present invention.
Detailed Description
In order that the above objects, features and advantages of the present invention can be more clearly understood, a more particular description of the invention will be rendered by reference to the appended drawings. It should be noted that the embodiments and features of the embodiments of the present application may be combined with each other without conflict.
In the following description, numerous specific details are set forth in order to provide a thorough understanding of the present invention, however, the present invention may be practiced in other ways than those specifically described herein, and therefore the scope of the present invention is not limited by the specific embodiments disclosed below.
Example (b):
embodiments of the present invention will be described in detail with reference to fig. 1 to 10.
As shown in fig. 1, the target for industrial camera detection in this embodiment includes: a central cross target 10 and four edge cross targets, each cross target comprising two intersecting target lines; the central cross target 10 is arranged at the central position of the target; four marginal cross targets set up respectively in the four corners of target, to arbitrary marginal cross target, the crossing point of target line sets up outside the central point of corresponding marginal cross target, and marginal cross target divide into first marginal cross target 21, second marginal cross target 22, third marginal cross target 23 and fourth marginal cross target 24, and the target line includes first horizontal target line 35, first vertical target line 36, second horizontal target line 31 and the vertical target line 30 of second.
Further, the cross target also comprises a frame;
further, the central cross target 10 is provided with a first horizontal target line 35 and a first vertical target line 36, the first horizontal target line 35 being located on the horizontal center line 51 and the first vertical target line 36 being located on the vertical center line 52.
Specifically, according to the specification of the target, a horizontal center line 51 and a vertical center line 52 of the target are determined, and the intersection 34 of the two is the center position of the target where the center cross target 10 is disposed. The first horizontal target line 35 of the central cross target 10 coincides with the horizontal center line 51, the first vertical target line 36 of the central cross target 10 coincides with the vertical center line 52, and the first horizontal target line 35 and the first vertical target line 36 serve as detection lines of the central cross target 10 and symmetrically divide the central cross target 10 into four detection areas, namely the central cross target 10 is set to be a symmetrical structure.
The left-right rotation angle of the industrial camera is adjusted by judging the length relation of the target lines of the first horizontal target line 35 on the left part and the right part of the intersection point 34, and the pitch angle of the industrial camera is adjusted by judging the length relation of the target lines of the first vertical target line 36 on the upper part and the lower part of the intersection point 34.
Further, the first edge cross target 21, the fourth edge cross target 24, the second edge cross target 22, and the third edge cross target 23 are symmetrically disposed along the horizontal center line 51, and the first edge cross target 21, the second edge cross target 22, the third edge cross target 23, and the fourth edge cross target 24 are symmetrically disposed along the vertical center line 52.
Specifically, four edge cross targets are arranged at four vertexes of the target, the four edge cross targets are equidistant from the horizontal borderline 42 and the vertical borderline 41 of the target borderline, and the four edge cross targets are symmetrically distributed along the horizontal center line 51 and the vertical center line 52.
Further, the edge cross target is provided with a second horizontal target line 31 and a second vertical target line 30, the second horizontal target line 31 is arranged close to the horizontal edge line 42 of the target, and the second vertical target line 30 is arranged close to the vertical edge line 41 of the target.
Specifically, the second horizontal target line 31 and the second vertical target line 32 are provided on the side of the edge cross target close to the horizontal borderline 42 and the vertical borderline 41 as the detection lines of the edge cross target. Taking the first edge cross target 21 at the upper left corner of the target as an example, the intersection point of the second horizontal target line 31 and the second vertical target line 32 is the reference point B, and the reference point B is arranged near the vertex V of the target, that is, the length of the target line (the second horizontal target line 31 and the second vertical target line 32) at the side near the vertex V is shorter than that at the side far from the vertex V. Therefore, when the target is detected, the position of the cross target to which the target line belongs can be judged by analyzing the length relation of the line segments of the target line, and then the line length and the line width of the target line (the second horizontal target line 31 and the second vertical target line 32) in the cross target (such as the first cross target 21) are calculated, so that whether the installation angle of the industrial camera sensor corresponding to the first edge cross target 21 meets the requirements or not is judged.
Further, the first horizontal target line 35, the first vertical target line 36, the second horizontal target line 31 and the second vertical target line 30 are composed of at least one detecting point 32 and at least two detecting line segments 33, and the detecting point 32 is arranged between the two detecting line segments 33.
Further, the detecting points 32 are disposed between the two detecting line segments 33 at equal intervals.
Specifically, set up by detection point 32 and detection line segment 33 equidistance and constitute the detection line, the detection line includes: the detection line comprises a first horizontal target line 35, a first vertical target line 36, a second horizontal target line 31 and a second vertical target line 30, wherein the starting position and the ending position of the detection line are detection line segments 33, the detection points 33 are arranged between the two detection line segments 33 at equal intervals, and the detection points 33 are used for separating the detection line segments 33 so as to judge the positions of the affiliated cross targets.
Further, the lengths of any two detection line segments 33 are equal.
Further, the distance between the second horizontal target line 31 and the second vertical target line 30 and the horizontal side line 42 and the vertical side line 41 is greater than or equal to the length of the detection line segment 33.
Specifically, at least one detection line segment 33 is arranged between the second horizontal target line 31 and the horizontal side line 42, and at least one detection line segment 33 is arranged between the second vertical target line 30 and the vertical side line 41.
Further, the position of intersection of the first horizontal target line 35 and the first vertical target line 36, and the second horizontal target line 31 and the second vertical target line 30 is any one of the detection points 32.
Further, the detection point 32 of the intersection position of the first horizontal target line 35 and the first vertical target line 36 coincides with the position of the intersection point 34 of the horizontal center line 51 and the vertical center line 52.
Specifically, as shown in fig. 2, in the first edge cross target 21, the detection lines of the second horizontal target line 31 and the second vertical target line 30 are composed of five detection line segments 33 and four detection points 32, and taking the second edge cross target 22 as an example, the second horizontal target line 31 sequentially comprises, from left to right: the detection Line segment Line _ UL _ H _1, the detection Line segment Line _ UL _ H _2, the detection Line segment Line _ UL _ H _3, the detection Line segment Line _ UL _ H _4, and the detection Line segment Line _ UL _ H _5, and the second vertical target Line 30 sequentially includes, from top to bottom: the detection Line segment Line _ UL _ V _1, the detection Line segment Line _ UL _ V _2, the detection Line segment Line _ UL _ V _3, the detection Line segment Line _ UL _ V _4, and the detection Line segment Line _ UL _ V _1, the detection points 32 are disposed between the detection Line segments 33 at equal intervals, and the detection point P is an intersection (reference point) of the second horizontal target Line 31 and the second vertical target Line 31. Two detection Line segments 33 are arranged between the second horizontal target Line 31 and the horizontal side Line 42, namely a detection Line segment Line _ UL _ H _1 and a detection Line segment Line _ UL _ H _2, and two detection Line segments 33 (a detection Line segment Line _ UL _ V _1 and a detection Line segment Line _ UL _ V _2) are also arranged between the second vertical target Line 30 and the vertical side Line 41.
Further, in the central cross target 10, the first horizontal target line 35 and the first vertical target line 34 are composed of four detection line segments 33 and three detection points 32, the first horizontal target line 35 is symmetrically arranged along the vertical center line 52, two detection line segments 33 and one detection point 32 are respectively arranged at two ends, similarly, the first vertical target line 34 is symmetrically arranged along the horizontal center line 51, wherein the position of the detection point 32 where the first horizontal target line 35 and the first vertical target line 34 intersect is arranged at the position of the intersection point 34.
In this embodiment, the target size is 356mm × 200mm, the physical length of the corresponding detection line segment is 10mm, the physical width is 3mm, and when shooting is performed by using an industrial camera to be inspected with a resolution of 1280 × 960, the length of the detection line segment in the obtained image is 36 pixels, and the width of the detection line segment is 11 pixels.
As shown in fig. 3, the method for calculating the weighted target line length and line width based on the histogram in this embodiment includes:
step 10A, shooting a target image by using an industrial camera to be detected, acquiring a plurality of interested areas in the target image according to set parameters of the target image, and marking the interested areas as the image to be detected;
specifically, the target in the embodiment is shot by using an industrial camera to be detected, a target image is obtained, and when the target image is obtained, the target is subjected to rotation transformation, so that the target line in the target is parallel to the image edge. According to the setting parameters of the target image, acquiring an image in a Region of Interest (ROI) and recording the image as an image to be detected, wherein the setting parameters to be set are the parameter size of the rectangular frame 211 of the cross target (first edge cross target 21), and the method comprises the following steps: the abscissa x of the upper left corner of the ROI, the ordinate y of the upper left corner of the ROI, the width w of the ROI and the height h of the ROI. The method comprises the steps of dividing a target image acquired by an industrial camera by setting the size of ROI (region of interest), enabling each divided ROI image (to-be-detected image) to correspond to one industrial camera sensor, and detecting the installation angle of the industrial camera sensor by detecting the length, the line width and the definition of a target line in the ROI image.
In this embodiment, the ROI of the first edge cross target 21 is set to be (0, 0, [ W/3], [ H/3]), the ROI of the second edge cross target 22 is set to be (0, [2 XH/3 ], [ W/3], [ H/3]), the ROI of the third edge cross target 23 is set to be ([2 XH/3 ], [ W/3], [ H/3]), the ROI of the fourth edge cross target 24 is set to be ([2 XH/3 ], [ W/3], [ H/3]), and the ROI of the center cross target 10 is set to be ([ W/3], [ H/3], [ W/3], [ H/3 ]).
Where W is 1280, H is 960, and the function [ θ ] is an upward rounding function.
Step 20A, carrying out binarization processing on an image to be detected, and calculating the effective line length and the effective line width of any detection line segment on a target in the image to be detected by adopting a weighting algorithm;
in step 20A, the method specifically includes:
step 21A, performing binarization processing on an image to be detected to obtain a calculated image;
specifically, an image to be detected is scanned, binarization processing is performed on the image to be detected, gray values of pixel points in the image to be detected are adjusted, the gray value of the pixel point with the gray value smaller than a preset pixel threshold is set to be 0, the gray value of the pixel point with the gray value larger than or equal to the preset pixel threshold is set to be 255, and therefore calculation accuracy of line length and line width of a detected line segment is improved, wherein the value of the preset pixel threshold is 125.
Step 22A, acquiring a detection line segment image according to the calculated image by a connected domain analysis method;
specifically, the connected domain analysis method can identify an image area composed of pixel points with the same gray value in the image, and for the computed image subjected to binarization processing, the connected domain analysis method can identify the image of the detection line segment forming the target line in the image, so that the accuracy of computing after scanning the detection line segment image is improved.
Step 23A, determining the scanning direction of the detection line segment image according to the frame of the minimum circumscribed rectangle of the detection line segment;
specifically, as shown in fig. 4, in order to prevent the acquired detection line segment image from being irregular, a method of extracting a minimum circumscribed rectangle is adopted, and the trend of the detection line segment 33 is determined according to the length direction and the width direction of the minimum circumscribed rectangle 401 of the detection line segment, that is, the length direction of the minimum circumscribed rectangle 401 is the line length direction of the detection line segment 33, and the width direction of the minimum circumscribed rectangle 401 is the line width direction of the detection line segment 33, so as to determine the scanning direction of the detection line segment image.
And step 24A, calculating the effective line length and the effective line width of the detection line segment by using a histogram weighting method according to the scanning direction and the preset gray threshold value.
Specifically, taking the calculation of the Line width of the detection Line segment Line _ UL _ H _1 in the second horizontal target Line 31 as an example, the trend of the detection Line segment Line _ UL _ H _1 is determined by extracting the minimum circumscribed rectangle of the detection Line segment Line _ UL _ H _1, that is, the corresponding Line width is calculated by adopting a column scanning manner, and the corresponding Line length is calculated by adopting a Line scanning manner. The method comprises the steps of performing column scanning on a detection line segment image, determining a pixel point of which the first gray value is greater than a preset gray threshold value in column pixels of the detection line segment image as a column starting point, and marking the pixel point as a column ending point, wherein the corresponding line width ld of the column scanning is equal to c _ end-c _ star, and the size of the preset gray threshold value is 125.
Obtaining the line width number array ld of each column by scanning column by columniI is 1, 2, …, and n is the number of rows corresponding to the pixel points in the longitudinal direction of the detection Line segment Line _ UL _ H _1, where n is 36.
Line width series ld calculated for each columniPerforming histogram statistical analysis to calculate each line width series ldiNumerical value corresponding width probability piThe width probability piAs the weight of the corresponding Line width, the Line widths are weighted and summed, and the weighted sum is recorded as the effective Line width Ld of the detection Line segment Line _ UL _ H _1UL_H_1
A typical line width histogram sequence is shown in table 1.
TABLE 1
Line width array ld i 0 1 2 3 4 5
Probability p i 0 0.3 0.6 0.05 0.05 0
The calculation formula of the effective line width Ld is:
Ld=sum(ldi×pi)。
the effective line length calculation mode is the same as the effective line width calculation mode in principle, and is not described herein again.
Step 25A, changing the statistical state of the detection line segment with the effective line length and the line width calculated from "not calculated" to "calculated";
after binarization processing, the statistical state of the detection line segments is automatically marked as 'not calculated'.
Step 26A, judging whether the statistical state of the detection line segment in the image to be detected contains 'not calculated';
step 27A, when it is judged that the statistical state contains "not calculated", step 23A is executed;
in step 28A, when it is determined that the statistical state does not contain "not calculated", step 30A is performed.
And step 30A, calculating the target line length and the target line width of the cross target line in any image to be detected according to the effective line length and the effective line width of the detection line segment, wherein the cross target line comprises a vertical target line and a horizontal target line.
Specifically, any edge cross target or center cross target is used as a calculation unit, the sum of the effective line lengths of all the detection line segments 33 corresponding to the first horizontal target line 35 and the second horizontal target line 31 is calculated respectively and recorded as the horizontal target line length, and then the sum of the effective line lengths of all the detection line segments 33 corresponding to the first vertical target line 36 and the second vertical target line 30 is calculated respectively and recorded as the vertical target line length. And calculating the arithmetic mean value of the effective line width of the corresponding detection line segment by taking any edge cross target or center cross target as a calculating unit, and recording the arithmetic mean value as the line width of the target line of the corresponding region.
As shown in fig. 5, the histogram-based target line sharpness weighting calculation method in this embodiment is as follows:
step 10B, shooting a target image by using an industrial camera to be detected, acquiring a plurality of interested areas in the target image according to set parameters of the target image, and marking the interested areas as the image to be detected;
specifically, the target in the embodiment is shot by using an industrial camera to be detected, a target image is obtained, and when the target image is obtained, the target is subjected to rotation transformation, so that the target line in the target is parallel to the image edge. According to the setting parameters of the target image, acquiring an image in a Region of Interest (ROI), and recording the image as an image to be detected, wherein the setting parameters to be set are the parameter size (x, y, w, h) of the rectangular frame 211 of the cross target (first edge cross target 21), and the setting parameters include: the abscissa x of the upper left corner of the ROI, the ordinate y of the upper left corner of the ROI, the width W of the ROI, and the height H of the ROI, taking the first edge cross target 21 as an example, correspond to (0, 0, [ W/3], [ H/3]), where W is 1280 and H is 960. The method comprises the steps of dividing a target image acquired by an industrial camera by setting the size of ROI (region of interest), enabling each divided ROI image (to-be-detected image) to correspond to one industrial camera sensor, and detecting the installation angle of the industrial camera sensor by detecting the length, the width and the definition of a target line in the ROI image.
Step 20B, according to the sobel operator, performing edge extraction on the image to be detected, and recording the edge image;
specifically, the sobel operator is two groups of matrices 3x3, a plane convolution between the two groups of matrices and the image to be detected is calculated, and a transverse luminance difference approximation Gx and a longitudinal luminance difference approximation Gy are obtained, and the corresponding calculation formula is as follows:
Figure BDA0001739878110000111
wherein A is a corresponding matrix of the image to be detected.
As shown in fig. 6, fig. 6(a) is an image to be detected corresponding to one detection line segment 33 of the first edge cross target 21 in the image to be detected, and fig. 6(B) is an edge image corresponding to the detection line segment 33 after edge extraction processing.
Step 30B, obtaining a corresponding connected domain image according to the edge image by using a connected domain analysis algorithm;
in step 30B, the method specifically includes:
step 31B, performing binarization processing on the edge image to obtain a binarized image;
specifically, the edge image is scanned, binarization processing is performed on the edge image, the gray values of the pixels in the edge image are adjusted, the gray value of the pixel with the gray value smaller than the preset pixel threshold is set to be 0, and the gray value of the pixel with the gray value larger than or equal to the preset pixel threshold is set to be 255, so that the calculation accuracy of the image definition is improved.
And step 32B, acquiring a connected domain image according to the binary image through a connected domain analysis algorithm.
And step 40B, calculating the definition of the target line by using a weighted average method according to the connected domain image.
In step 40B, the method specifically includes:
step 41B, scanning the connected domain image, and calculating the scanning width of the connected domain corresponding to the detection line segment 33 in the cross target line in the connected domain image;
specifically, for the four connected component images obtained by the connected component analysis algorithm corresponding to the target, taking the first edge cross target 21 as an example, as shown in fig. 7, in this case, for any detected line segment 33 in the first edge cross target 21, the connected component of the detected line segment 33 is composed of four edge lines 71, and the edge lines 71 are formed by connecting at least two edge points 72 with the same gray scale value in the scanning direction.
By scanning the edge region in a line, the position of the edge point 72 where the gray value of the pixel point on the left side is less than the preset gray threshold is recorded as the first limit point pLCorrespondingly, the position of the edge point 72 where the gray value of the right pixel point is less than the preset gray threshold is recorded as the second limit point pRThen, the scanning width d of the edge line 71 is equal to pR-pL
Step 42B, carrying out histogram statistical analysis according to the scanning width to obtain a line width weight;
step 43B, calculating the weighted line width corresponding to the connected domain image according to the scanning width and the line width weight, recording as the definition of the cross target,
the calculation formula of the weighted line width D is as follows:
D=sum(dx×px),
in the formula (d)xIs the width of the edge line, x is the index of the edge line, pxIs the corresponding line width weight.
And step 44B, calculating the arithmetic mean value of the definition of the cross target, and recording the arithmetic mean value as the definition of the target line.
Step 45B, changing the scanning state of the edge area corresponding to the connected domain image with the calculated cross target definition from 'non-scanning' to 'scanned';
after the connected domain image is acquired, the scanning state of the edge region is automatically marked as 'unscanned'.
Step 46B, judging whether the scanning state of the edge region in the connected domain image contains 'non-scanning';
step 47B, when it is determined that the scanning state of the edge region in the connected component image contains "not scanned", executing step 41B;
and step 48B, finishing when the scanning state of the edge region in the connected domain image does not contain 'unscanned'.
As shown in fig. 8, the detection method for an industrial camera sensor in this embodiment includes:
step 10C, shooting a target image by using an industrial camera to be detected, acquiring a plurality of interested areas in the target image according to set parameters of the target image, and marking the interested areas as the image to be detected;
step 20C, calculating the length of a target line, the line width of the target line and the definition of the target line of the cross target line in the image to be detected according to the image to be detected and a weighting method;
wherein the cross target lines comprise a first horizontal target line 35, a first vertical target line 36, a second horizontal target line 31 and a second vertical target line 30.
Step 30C, determining the numbers of the cross-shaped target to be detected and the corresponding sensors according to the maximum value of the target line definition and a preset definition threshold value;
specifically, the target line definition is sorted according to the numerical value, the maximum value of the target line definition is compared with a preset definition threshold value, and when the maximum target line definition is judged to be smaller than or equal to the preset definition threshold value, the industrial camera sensor is determined to be installed according with the requirements.
And when the maximum target line definition is judged to be greater than a preset definition threshold value, marking the cross target corresponding to the maximum target line definition as a test cross target.
Wherein, the value of the preset definition threshold is generally 2.
Further, step 30C specifically includes:
step 31C, respectively calculating the line segment lengths of the horizontal target line and the vertical target line in the cross target at two sides of the intersection point, wherein the line segment length of the horizontal target line at the left side of the intersection point is taken as a first length, the line segment length of the horizontal target line at the right side of the intersection point is taken as a second length, the line segment length of the vertical target line above the intersection point is taken as a third length, and the line segment length of the vertical target line below the intersection point is taken as a fourth length;
and step 32C, determining the serial number of the industrial camera sensor according to the size relation of the length of the line segment.
Specifically, when the first length is determined to be smaller than the second length and the third length is smaller than the fourth length, the cross target is determined as the first edge cross target 21, when the first length is determined to be smaller than the second length and the third length is greater than the fourth length, the cross target is determined as the second edge cross target 22, when the first length is determined to be greater than the second length and the third length is greater than the fourth length, the cross target is determined as the third edge cross target 23, when the first length is determined to be greater than the second length and the third length is less than the fourth length, the cross target is determined as the fourth edge cross target 24, when the first length is determined to be equal to the second length and the third length is equal to the fourth length, the cross target is determined as the center cross target 10, otherwise, the cross target is determined to be abnormal, and the step 10C is executed again. And then determining the serial number of the industrial camera sensor according to the determined inspection cross target.
And step 40C, generating and sending an adjusting instruction of the industrial camera sensor according to the length and the line width of the target line in the cross target.
In step 40C, the method specifically includes:
step 41C, judging and checking the size relation between the target line lengths of the horizontal target line and the vertical target line in the cross target;
step 42C, when the length of the target line of the horizontal target line is judged to be larger than or equal to that of the vertical target line, generating and sending a vertical direction adjusting instruction;
this step 42C specifically includes:
when the length of the target line of the horizontal target line is larger than or equal to that of the vertical target line, judging whether the width of the target line of the vertical target line above the intersection point of the target lines is larger than that of the vertical target line below the intersection point of the target lines;
when the judgment result is yes, determining that the vertical adjustment instruction is a downward adjustment instruction which is adjusted downwards according to the reference plane;
when the judgment is no, determining the vertical adjustment instruction as an upward adjustment instruction which is adjusted upward according to the reference surface,
the vertical direction adjusting instruction comprises a downward adjusting instruction and an upward adjusting instruction, the intersection point of the target line is the intersection point of the horizontal target line and the vertical target line, and the reference surface is a plane which faces the target direction and is parallel to the target.
And 43C, when the target line length of the horizontal target line is smaller than that of the vertical target line, generating and sending a horizontal direction adjusting instruction.
This step 43C specifically includes:
when the length of the target line of the horizontal target line is smaller than that of the vertical target line, judging whether the target line width of the vertical target line on the right side of the target line intersection point is larger than that of the vertical target line on the left side of the target line intersection point;
when the judgment result is yes, determining the horizontal adjustment instruction as a right adjustment instruction adjusted to the right according to the reference surface;
when the judgment is no, determining the horizontal adjusting instruction as a left adjusting instruction which is adjusted to the left according to the reference surface,
the horizontal direction adjusting instruction comprises a right adjusting instruction and a left adjusting instruction, the intersection point of the target line is the intersection point of the horizontal target line and the vertical target line, and the reference surface is a plane which faces the target direction and is parallel to the target.
As shown in fig. 9, the method for detecting the rear intercept of the industrial camera in this embodiment includes:
step 10D, calculating the target line definition of the central cross target corresponding to any focus ring adjustment angle according to the set parameters of the camera, and generating a definition sequence;
specifically, at first, the focus ring adjustment angle is set to be zero, the image to be detected corresponding to the target at the moment is acquired, the target line definition of the central cross target 10 with the focus ring adjustment angle being zero is calculated, the focus ring adjustment angle is increased by one step length, whether the focus ring adjustment angle reaches the maximum value or not is judged, if the focus ring adjustment angle does not reach the maximum value, the image to be detected corresponding to the focus ring adjustment angle at the moment is acquired, and the corresponding target line definition is calculated. And if the focal ring adjusting angle reaches the maximum value, the image to be detected is not acquired, wherein the maximum rotation angle of the focal ring is set to be 60 degrees, the focal plane adjusting distance is 4mm, the focal ring rotation angle is divided into 40 equal parts, a step length is 1.5 degrees, and correspondingly, the focal plane adjusting distance is 0.1 mm.
Step 20D, when an extreme value exists in the definition sequence, sending prompting information of the rear intercept of the industrial camera according to the difference value between the first focal ring position corresponding to the minimum definition of the target line and the second focal ring position corresponding to the minimum definition standard value;
the step 20D specifically includes:
step 21D, when the absolute value of the difference between the first focal ring position corresponding to the minimum definition value and the second focal ring position corresponding to the minimum definition standard value is judged to be smaller than or equal to a first preset difference, sending back intercept normal information;
specifically, as shown in fig. 10, when it is determined that the absolute value of the difference between the first focal ring position corresponding to the minimum definition value and the second focal ring position corresponding to the minimum definition standard value is less than or equal to the first preset difference, a back intercept normal instruction is generated and sent, and it is determined that the back intercept of the industrial camera does not need to be adjusted;
step 22D, when it is determined that the difference between the first focal ring position corresponding to the minimum definition value and the second focal ring position corresponding to the minimum definition standard value is greater than the first preset difference, sending information that the back intercept is small;
and when the difference between the first focal ring position corresponding to the minimum definition value and the second focal ring position corresponding to the minimum definition standard value is judged to be larger than a first preset difference, namely the definition sequence is a first curve 91, generating and sending a rear intercept smaller instruction.
And step 23D, when it is determined that the difference between the first focal ring position corresponding to the minimum definition value and the second focal ring position corresponding to the minimum definition standard value is smaller than a second preset difference, sending the information that the back intercept is larger.
And when the difference value between the first focal ring position corresponding to the minimum definition value and the second focal ring position corresponding to the minimum definition standard value is smaller than a second preset difference value, namely the definition sequence is a second curve 92, generating and sending a rear intercept enlarging instruction.
Wherein the first predetermined difference is set to 0.1mm, the second predetermined difference is set to-0.1 mm, and the third curve 90 is a definition standard curve.
And step 30D, when the extreme value does not exist in the definition sequence, sending installation error prompt information.
Specifically, the zero position of the focal ring of the industrial camera lens is set to the side close to the industrial camera sensor. And when the extremum does not exist in the definition sequence, judging whether an interval with monotonous and increasing target line definition exists in the definition sequence, if so, judging that the back intercept is too short, otherwise, judging that the back intercept is too long, and generating and sending corresponding installation error prompt information according to the judgment result of the back intercept being too long or the back intercept being too short.
The steps in the invention can be sequentially adjusted, combined and deleted according to actual requirements.
The units in the device of the invention can be merged, divided and deleted according to actual requirements.
Although the present invention has been disclosed in detail with reference to the accompanying drawings, it is to be understood that such description is merely illustrative of and not restrictive on the application of the present invention. The scope of the invention is defined by the appended claims and may include various modifications, adaptations and equivalents of the invention without departing from its scope and spirit.

Claims (7)

1. A target line length and line width weighting calculation method based on a histogram is characterized by comprising the following steps:
step 10A, shooting a target image by using an industrial camera to be detected, acquiring a plurality of interested areas in the target image according to set parameters of the target image, and marking the interested areas as images to be detected;
step 20A, carrying out binarization processing on the image to be detected, and calculating the effective line length and the effective line width of any detection line segment on the target in the image to be detected by adopting a weighting algorithm;
step 30A, calculating the target line length and the target line width of the cross target line in any image to be detected according to the effective line length and the effective line width of the detection line segment,
wherein the cross target line comprises a vertical target line and a horizontal target line.
2. The histogram-based target line length and line width weighting calculation method according to claim 1, wherein the step 20A specifically includes:
step 21A, carrying out binarization processing on the image to be detected to obtain a calculated image;
step 22A, acquiring a detection line segment image according to the calculated image by a connected domain analysis method;
step 23A, determining a scanning direction of the detection line segment image according to a frame of a minimum circumscribed rectangle of the detection line segment;
and 24A, calculating the effective line length and the effective line width of the detection line segment by using a histogram weighting method according to the scanning direction and a preset gray threshold value.
3. The histogram-based target line length and line width weighting calculation method according to claim 2, wherein the step 20A further includes:
step 25A, changing the statistical state of the detection line segment with the effective line length and the line width calculated from "not calculated" to "calculated";
step 26A, judging whether the statistical state of the detection line segment in the image to be detected contains the 'not-calculated';
step 27A, when it is determined that the statistical state contains the "not calculated", executing the step 23A;
step 28A, when it is determined that the statistical state does not contain the "not calculated", the step 30A is performed.
4. A detection method for an industrial camera sensor, comprising:
step 10C, shooting a target image by using an industrial camera to be detected, acquiring a plurality of interested areas in the target image according to set parameters of the target image, and marking the interested areas as the image to be detected;
step 20C, calculating the length of a target line, the line width of the target line and the definition of the target line of the cross target line in the image to be detected according to the image to be detected and a weighting method;
step 30C, determining a cross target to be detected and the number of a corresponding sensor according to the maximum value of the target line definition and a preset definition threshold value;
and step 40C, generating and sending an adjusting instruction of the industrial camera sensor according to the length of the target line and the line width of the target line in the cross target.
5. The detection method for industrial camera sensors according to claim 4, characterized in that said step 40C comprises:
step 41C, judging the size relationship between the target line lengths of the horizontal target line and the vertical target line in the cross-shaped target;
step 42C, when it is determined that the target line length of the horizontal target line is greater than or equal to the target line length of the vertical target line, generating and sending a vertical direction adjustment instruction;
and 43C, when the length of the target line of the horizontal target line is smaller than that of the vertical target line, generating and sending a horizontal direction adjusting instruction.
6. The detection method for industrial camera sensors according to claim 5, characterized in that said step 42C comprises in particular:
when the length of the target line of the horizontal target line is judged to be larger than or equal to the length of the target line of the vertical target line, judging whether the target line width of the vertical target line above the target line intersection point is larger than the target line width of the vertical target line below the target line intersection point;
when the judgment result is yes, determining that the vertical adjusting instruction is a downward adjusting instruction which is adjusted downwards according to the reference plane;
when the judgment is negative, determining that the vertical adjustment instruction is an upward adjustment instruction which is adjusted upward according to the reference surface,
the vertical direction adjusting instruction comprises the downward adjusting instruction and the upward adjusting instruction, the target line intersection point is the intersection point of the horizontal target line and the vertical target line, and the reference surface is a plane parallel to the target in the direction facing the target.
7. The detection method for industrial camera sensors according to claim 5, characterized in that said step 43C comprises in particular:
when the length of the target line of the horizontal target line is smaller than that of the vertical target line, judging whether the width of the target line of the vertical target line on the right side of the target line intersection point is larger than that of the vertical target line on the left side of the target line intersection point;
when the judgment result is yes, determining the horizontal adjusting instruction as a right adjusting instruction which is adjusted to the right according to the reference surface;
when the judgment is negative, determining the horizontal adjusting instruction as a left adjusting instruction for left adjustment according to the reference plane,
the horizontal direction adjusting instruction comprises a rightward adjusting instruction and a leftward adjusting instruction, the target line intersection point is the intersection point of the horizontal target line and the vertical target line, and the reference surface is a plane parallel to the target in the direction facing the target.
CN201810813917.1A 2018-07-23 2018-07-23 Target line calculation and industrial sensor installation detection method Active CN110823134B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201810813917.1A CN110823134B (en) 2018-07-23 2018-07-23 Target line calculation and industrial sensor installation detection method

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201810813917.1A CN110823134B (en) 2018-07-23 2018-07-23 Target line calculation and industrial sensor installation detection method

Publications (2)

Publication Number Publication Date
CN110823134A true CN110823134A (en) 2020-02-21
CN110823134B CN110823134B (en) 2021-07-23

Family

ID=69533652

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201810813917.1A Active CN110823134B (en) 2018-07-23 2018-07-23 Target line calculation and industrial sensor installation detection method

Country Status (1)

Country Link
CN (1) CN110823134B (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112738503A (en) * 2020-12-30 2021-04-30 凌云光技术股份有限公司 Device and method for judging and adjusting levelness of small-depth-of-field lens camera

Citations (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPH10124683A (en) * 1996-09-05 1998-05-15 Daimler Benz Ag Method for detecting stereoscopic image-object
CN1318728A (en) * 2001-05-01 2001-10-24 中国科学院合肥智能机械研究所 Shooting training guidance system
CN201159720Y (en) * 2008-02-21 2008-12-03 宝山钢铁股份有限公司 Image detection device for continuous casting blank
CN101540040A (en) * 2008-03-21 2009-09-23 深圳迈瑞生物医疗电子股份有限公司 Method and device for automatically detecting boundary of beam-limiting device
CN102801929A (en) * 2011-05-26 2012-11-28 佳能株式会社 Image sensor and image capturing apparatus
CN103591852A (en) * 2013-07-03 2014-02-19 深圳弘江军科技有限公司 Target scoring system and automatic correcting method for same
CN105678245A (en) * 2015-12-31 2016-06-15 杭州晨鹰军泰科技有限公司 Target position identification method based on Haar features
CN106485252A (en) * 2016-09-08 2017-03-08 上海卫星工程研究所 Dot matrix target image Feature point recognition method is tested in image registration

Patent Citations (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPH10124683A (en) * 1996-09-05 1998-05-15 Daimler Benz Ag Method for detecting stereoscopic image-object
CN1318728A (en) * 2001-05-01 2001-10-24 中国科学院合肥智能机械研究所 Shooting training guidance system
CN201159720Y (en) * 2008-02-21 2008-12-03 宝山钢铁股份有限公司 Image detection device for continuous casting blank
CN101540040A (en) * 2008-03-21 2009-09-23 深圳迈瑞生物医疗电子股份有限公司 Method and device for automatically detecting boundary of beam-limiting device
CN102801929A (en) * 2011-05-26 2012-11-28 佳能株式会社 Image sensor and image capturing apparatus
CN103591852A (en) * 2013-07-03 2014-02-19 深圳弘江军科技有限公司 Target scoring system and automatic correcting method for same
CN105678245A (en) * 2015-12-31 2016-06-15 杭州晨鹰军泰科技有限公司 Target position identification method based on Haar features
CN106485252A (en) * 2016-09-08 2017-03-08 上海卫星工程研究所 Dot matrix target image Feature point recognition method is tested in image registration

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112738503A (en) * 2020-12-30 2021-04-30 凌云光技术股份有限公司 Device and method for judging and adjusting levelness of small-depth-of-field lens camera

Also Published As

Publication number Publication date
CN110823134B (en) 2021-07-23

Similar Documents

Publication Publication Date Title
US11227405B2 (en) Determining positions and orientations of objects
CN111474184B (en) AOI character defect detection method and device based on industrial machine vision
CN108629775B (en) Thermal state high-speed wire rod surface image processing method
CN113109368B (en) Glass crack detection method, device, equipment and medium
CN110400290B (en) Method and device for detecting chromatic aberration of solar cell and storage medium
CN108562250B (en) Keyboard keycap flatness rapid measurement method and device based on structured light imaging
CN109141829B (en) Target line definition calculation and industrial camera rear intercept detection method
CN111507976B (en) Defect detection method and system based on multi-angle imaging
CN116559183B (en) Method and system for improving defect judging efficiency
CN111308448A (en) Image acquisition equipment and radar external parameter determination method and device
CN105718931B (en) System and method for determining clutter in acquired images
KR20090101356A (en) Defect detecting device, and defect detecting method
CN111222507A (en) Automatic identification method of digital meter reading and computer readable storage medium
CN108022219B (en) Two-dimensional image gray level correction method
CN112560538A (en) Method for quickly positioning damaged QR (quick response) code according to image redundant information
CN110823134B (en) Target line calculation and industrial sensor installation detection method
CN113176270B (en) Dimming method, device and equipment
CN111179184A (en) Fish-eye image effective region extraction method based on random sampling consistency
CN106951902B (en) Image binarization processing method and device
CN116563298B (en) Cross line center sub-pixel detection method based on Gaussian fitting
CN109151453B (en) Target for industrial camera detection
CN113160223A (en) Contour determination method, contour determination device, detection device and storage medium
CN109726722B (en) Character segmentation method and device
CN115187593B (en) Screen defect detection method and device
CN111047614A (en) Feature extraction-based method for extracting target corner of complex scene image

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