A lifting type steel material weighing platform levelness detection device and method
By installing feature marks and reflectors on the side of the steel scale platform, using linear structured light projectors and image processing technology, the level of the scale platform is detected in real time, and the problem of lack of real-time detection in the existing technology is solved, improving the accuracy of weighing and production efficiency.
Patent Information
- Application Number
- CN202111650306.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-12-30
- Publication Date
- 2025-05-06
- Estimated Expiration
- 2041-12-30
AI Technical Summary
The prior art lacks real-time detection of the scale level of lifting steel scales, resulting in increased weighing errors and lag in fault discovery.
Using computer vision principle, by installing feature marks and reflectors on the side of the steel scale platform, using a linear structured light projector to project horizontal light strips, combining image processing technology to extract the center point coordinates of the feature marks and the linear equations of the light strips, calculate the angle between the bottom surface of the scale platform and the horizontal surface, and realize real-time horizontal detection.
Real-time detection of the level of steel scale platform is realized, fault detection is timely detected, weighing errors and fault detection time is reduced, and production efficiency is improved.
Smart Images

Figure CN115249265B_ABST
Abstract
Description
Technical Field
[0001] The invention belongs to the technical field of measurement, and in particular relates to a device and method for detecting the horizontality of a lifting type steel material weighing platform. Background Art
[0002] Steel scale is a weighing device widely used in steel mills and other metallurgical industries. For products such as wires that have been packaged into coils, a lifting steel scale is generally used to weigh the weight before entering and leaving the warehouse. The principle is that when a coil of wire is detected on the assembly line passing over the steel scale, the assembly line movement is stopped, the hydraulic device of the steel scale is started, the steel scale is raised, and the coiled wire is lifted up. After it is raised to a certain height to ensure that the weight of the wire is fully applied to the steel scale, the lifting action is stopped and the weight of the wire is weighed. During the weighing process, the horizontality of the steel scale platform will have a greater impact on the error of the weighing result. If the levelness of the scale platform is not enough, the weighing sensor of the steel scale will be unevenly stressed, resulting in an increase in the weighing error. There are generally two reasons that affect the levelness of the platform of a lifting steel scale. One is that the position of the object to be weighed on the platform deviates from the center area of the platform, causing uneven force on the platform. The other is that when the hydraulic lifting device lifts the steel scale, it is affected by the mechanical deviation of the hydraulic connecting rod, causing the steel scale to deflect as a whole. Since lifting steel scales are mostly online scales, if there are problems such as poor levelness of the platform, it will directly affect the production process. Therefore, it is particularly important to perform real-time detection of the levelness of the platform of the lifting steel scale.
[0003] At present, there is no device and method for real-time detection of the horizontality of the lifting steel scale platform. In the actual production process, the weighing deviation of the steel scale is generally discovered by regular calibration of the steel scale. After the steel scale is reported to have a fault, it is repaired manually to determine whether the equipment failure is caused by the horizontality of the scale platform. However, this method will inevitably lead to a delay in fault discovery and the need to re-weigh some products. It also cannot detect the problem that the weighing error of individual products to be weighed becomes larger due to deviation from the center of the scale platform. Therefore, there is an urgent need for a device and method for real-time detection of the horizontality of the lifting steel scale platform. Summary of the invention
[0004] In view of the deficiencies in the prior art, the present invention provides a device and method for detecting the horizontality of a lifting steel scale platform. The basic principles of computer vision are applied to install characteristic marks on the two sides of the steel scale platform, and reflectors are installed on the sides of the scale platform base. A line structured light projector is used to project a horizontal light strip on the reflector, and the light strip is used as a height reference for measurement. Image processing technology is used to extract the center point coordinates of a light-transmitting cover of the characteristic mark in the image and the straight line equation of the light strip. The perspective projection constraint relationship between the characteristic mark, the light strip and their images is used to calculate the vertical drop from the center point of the light-transmitting cover of the characteristic mark to the light strip, and then the angle between the bottom surface of the scale platform and the horizontal plane is obtained, thereby realizing the horizontality detection of the scale platform, and giving an early warning for weighing actions with poor horizontality of the scale platform, so as to promptly discover the failure of the steel scale.
[0005] A lifting type steel material weighing platform levelness detection device comprises an industrial computer, a power module and two sets of measuring devices, the industrial computer is equipped with a control system, the two sets of measuring devices are respectively arranged at the front and rear sides of the weighing platform, and the measuring devices are connected to the power module;
[0006] The measuring device comprises a camera, a line structured light projector, two characteristic marks, an L-shaped reflector, two positioning scales and a bracket; the characteristic marks in the two groups of measuring devices are respectively installed on the side facades on the front and rear sides of the weighing platform, and the two characteristic marks in each group are respectively located close to the left and right sides of the side facades, and the four characteristic marks are at equal distances from the vertical boundaries of the corresponding side facades and the distances to the bottom surface of the weighing platform. The center points of the light-transmitting covers of the four characteristic marks form a rectangle, and the plane where the rectangle is located is called the measuring plane, and the measuring plane is parallel to the bottom surface of the weighing platform; the reflector is installed on the base of the weighing platform at the same level as the characteristic marks. On the side facade, the lower plane of the reflector is horizontal; two positioning rulers are installed on each reflector facade, and the distances between the two positioning rulers and the lower plane of the reflector are equal; the line structured light projector is installed on the bracket, and the installation position and angle of the line structured light projector must ensure that the projected light plane intersects with the reflector facade when the scale platform is raised, and can project horizontal light strips on the reflector, and ensure that the light strips projected by the two sets of measuring devices are on the same horizontal plane; the camera is installed on the bracket and connected to the industrial computer through a network cable; the field of view of the camera covers the two characteristic mark areas before and after the scale platform is raised and the light strip area after the scale platform is raised.
[0007] The control system carried by the industrial computer includes a camera control module, a calibration module, an image processing module, a feature extraction module and a visual solution module:
[0008] The camera control module controls the camera to take pictures, issues a picture-taking command to the camera, receives the distorted original image captured by the camera and transmits it to the calibration module and the image processing module;
[0009] The calibration module calibrates the camera parameters and transmits the calibration results to the visual solution module;
[0010] The image processing module processes the scene image collected from the camera and transmits it to the feature extraction module;
[0011] The feature extraction module extracts the coordinates of the center point of the light-transmitting cover and the equation of the light bar line of the feature mark and transmits the extraction result to the visual solution module;
[0012] The visual solution module calculates the angle between the normal vector of the fitted measurement plane and the normal vector of the horizontal plane based on the results of calibration and feature extraction.
[0013] The camera is a black-and-white industrial camera equipped with a fixed-focus lens and has an Ethernet interface.
[0014] The laser color of the line structured light projector is different from the color of the side facade of the scale platform. The projection angle is selected according to actual conditions to ensure that the horizontal light bar projected on the reflective plate on the side facade of the scale platform base can cover the two scales on the corresponding side, which is convenient for the horizontal adjustment of the light bar and the subsequent straight line feature extraction.
[0015] The characteristic mark is a mark that can actively emit light. The light-transmitting cover is circular in shape and uses LED as a light source inside. The color of the light is the same as the color of the laser projected by the line structured light projector.
[0016] The reflector is a right-angle L-shaped reflector.
[0017] The power module adopts a direct current power supply to provide power for the feature mark, the camera and the line structured light projector.
[0018] The above-mentioned levelness detection method of the lifting type steel material scale platform levelness detection device has the following specific steps:
[0019] Step 1: Camera calibration and parameter measurement, which is completed before the scale levelness detection process;
[0020] Step 1.1: The calibration module calibrates the camera's intrinsic parameters, extrinsic parameters, and distortion parameters;
[0021] The camera parameters are calibrated using a camera calibration method based on a plane target. A checkerboard calibration plate with uniform thickness is selected as the calibration target. When placing the calibration plate, a position parallel to the side elevation of the scale platform where the characteristic mark is installed is specially selected to place the calibration plate once. The plane world coordinate system O is established according to the position of the characteristic points on the calibration plate at this position. W -x W y W , so that x W The coordinate axis points to the right along the distribution direction of the feature points on the calibration plate, y WThe coordinate axis points downward, and the three-dimensional world coordinate system O is established according to the right-hand rule. W -x W y W z W ; Determine the camera's intrinsic parameters, extrinsic parameters relative to the defined world coordinate system, and lens distortion parameters using a camera calibration method based on a planar target;
[0022] Step 1.2: Calculate virtual image generation parameters and construct a lookup table;
[0023] Assume the camera coordinate system Ox C y C z C With the world coordinate system O defined W -x W y W z W There is the following transformation relationship between them:
[0024]
[0025] Where R is the rotation matrix of the coordinate transformation, and T is the translation vector. The values of R and T can be obtained by using the camera extrinsic calibration results in step 1.1.
[0026] Place the calibration target at a special position on the calibration plate plane, i.e. W -x W y W The plane is regarded as a virtual image plane, and it is considered that there is also a projection image of the photographed target area on the virtual image plane, which is called a virtual image. The image and the photographed target area satisfy the perspective projection relationship with the optical center of the camera as the projection center; the virtual image is generated from the distorted original image taken by the camera using the calibrated camera parameters;
[0027] Note O W -x W y W The undistorted image point corresponding to the world coordinate point (x, y) on the plane is (u, v), and the following relationship exists between them:
[0028]
[0029] Where K is the camera intrinsic parameter matrix, r1 and r2 are the left two columns of R, H = K (r1, r2, T) is the homography between the image plane and the virtual image plane, and t is the scale factor. Using the camera calibration result obtained in step 1.1, these parameters are all known;
[0030] remember is the coordinate of the distorted image point corresponding to the undistorted image point (u, v). Using formula (2), we can get the calculation formula of the undistorted image point (u, v) corresponding to the world coordinate point (x, y) on the virtual image plane. Then, using the lens distortion model, we can get the corresponding distorted image point The calculation formula is simplified as follows:
[0031]
[0032] Using the bilinear interpolation method, we can get the calculation formula of the gray value V(x,y) of the point (x,y) in the virtual image:
[0033]
[0034] in i=1,2,3,4 is enclosed The pixel coordinates of the four original distorted images, and are all integers, In the original image Gray value of the point, ω i is the weight corresponding to the bilinear interpolation calculation; as long as the relative position between the camera and the virtual image plane remains unchanged, for any world coordinate point (x, y) on each virtual image plane, the corresponding four groups in formula (4) and ω i The values are fixed, that is, there are 12 tuples corresponding to them
[0035] Select the world coordinate point (x LT ,y LT ) as the upper left corner of the virtual image, the pixel arrangement directions of the virtual image are respectively W Axis and y W The axis direction is parallel, Δx and Δy are the pixel distances in the two directions of the virtual image, respectively. LT ,y LT ), Δx, Δy values are selected according to the actual situation; then the world coordinates corresponding to the pixel point (i, j) on the virtual image are (x LT +Δx·i,y LT +Δy·j), and use the above method to obtain the corresponding 12-tuple, which can also be considered as the 12-tuple corresponding to the pixel point (i, j) on the virtual image; let the width of the virtual image be w and the height be h, calculate all the 12-tuples corresponding to the total w·h virtual image pixels and form a lookup table;
[0036] Step 1.3: Parameter measurement;
[0037] Measure the distance d from the reflector surface to the virtual image plane C ; Measure the distance d from the center point of the light-transmitting cover of the i-th characteristic mark to the vertical surface of the reflector i (i=1,2,3,4); measure the length d of the rectangle formed by the center points of the light-transmitting mask with the four characteristic marks W and width d H ;
[0038] Step 2: Check the levelness of the scale platform. This step is performed every time the test is performed.
[0039] Step 2.1: The camera control module of the industrial computer sends a photo command to the two cameras at the same time, and the two cameras take photos at the same time, and each camera takes an image of the target area on the corresponding side, that is, two characteristic marks and a horizontal light strip;
[0040] Step 2.2: The image processing module processes the image. The processing process for the two images is the same:
[0041] Step 2.2.1: The image processing module generates a virtual image using the lookup table obtained in step 1.2; binarizes the generated virtual image to obtain a binary image that satisfies
[0042]
[0043] Where B(i,j) is the gray value of the virtual image coordinate point (i,j) after binarization, V(i,j) is the gray value of the pixel point (i,j) in the virtual image, and T B is a threshold artificially set in advance; since the characteristic mark emits light actively, the laser light strip on the reflector is also brighter than the background, so their pixel values are larger in the binary image, appearing white, while the background appears black;
[0044] Step 2.2.2: The image processing module performs median filtering on the binary image generated in step 2.2.1; and then performs a dilation operation on the filtered image, the purpose of which is to make the light spots on the light strip connected to each other;
[0045] Step 2.3: Feature extraction module performs feature extraction:
[0046] Step 2.3.1: The feature extraction module extracts the connected areas of white points from the binary image processed in step 2.2.2, and determines the area of each connected area and the height H of the circumscribed rectangle. k and width W k , filter out the area smaller than T D The connected area of the body is used to eliminate interference, where T D is a manually set parameter; calculate the shape description parameters of each remaining connected area:
[0047]
[0048] Obviously there is r k ≥1; select the connected area with the smallest shape description parameter and mark it as the No. 1 feature mark area, denoted by R1; select the connected area with the second smallest shape description parameter and mark it as the No. 2 feature mark area, denoted by R2; select the area with the largest shape description parameter and mark it as the light strip area, denoted by R L ;
[0049] Step 2.3.2: The feature extraction module calculates the virtual image coordinates of the center of gravity of the two feature mark areas R1 and R2 marked in step 2.3.1, respectively, and records them as g1(u1,v1) and g2(u2,v2), thereby determining the center point coordinates of the light-transmitting cover of the left and right feature marks respectively:
[0050]
[0051]
[0052] Step 2.3.3: The feature extraction module determines whether the scale moves upward;
[0053] Step 2.3.3.1: Set counter c:=0;
[0054] Step 2.3.3.2: Extract the coordinates of the center point of the light-transmitting mask of the left characteristic mark of the current frame image according to step 2.3.2 as g L (u L ,v L ), the coordinate of the center point of the light-transmitting cover of the characteristic mark detected from the previous frame image is recorded as g' L (u' L ,v' L ), if v' L -v L >T R , then c:=c+1, otherwise c:=0, here T R It is a parameter set in advance;
[0055] Step 2.3.3.3: If c>T C , then the scale is considered to be moving upward, otherwise go to step 2.3.3.2 to process the next frame, where T C It is a parameter set in advance;
[0056] Step 2.3.4: The feature extraction module determines whether the scale stops moving upward;
[0057] Step 2.3.4.1: Set counter s:=0;
[0058] Step 2.3.4.2: Extract the center coordinate of the light-transmitting mask of the left characteristic mark of the current frame image according to step 2.3.2 as g L (u L ,v L ), the coordinate of the center point of the light-transmitting cover of the characteristic mark detected from the previous frame image is recorded as g' L (u' L ,v' L ), if |v L -v' L |≤T R , then s:=s+1, otherwise s:=0, here the parameter T R with the parameter T in step 2.3.3.2 R same;
[0059] Step 2.3.4.3: If s>T S , it is considered that the scale stops moving upward, otherwise go to step 2.3.4.2 to process the next frame, where T S It is a parameter set in advance;
[0060] Step 2.3.5: The feature extraction module extracts the light bar straight line equation;
[0061] Assume that the linear equation of the light strip in the virtual image is
[0062] v=ku+b (9)
[0063] Remember R L Select R as the light stripe area extracted in step 2.3.1. L All the pixels in are taken as sample points of the straight line equation of formula (9), and the parameters k and b in the straight line equation (9) are fitted by the least square method to obtain the straight line equation of the light strip;
[0064] Step 2.4: The visual solution module calculates the vertical drop of the center point of the light-transmitting cover of the characteristic mark relative to the light bar;
[0065] According to step 1.3, the distance between the virtual image plane and the reflector facade has been measured to be d C According to step 1.3, the center point P of the light-transmitting mask of the i-th characteristic mark has been measured i Distance d to the reflector surface i , then the distance from the characteristic mark plane to the reflector facade is d i , the distance from the feature plane to the virtual image plane is d C +d i ;
[0066] Assume the world coordinates of the camera optical center is O(x O ,y O ,zO ), according to formula (1) and the camera calibration result, we have
[0067]
[0068] Let the vertical projection point of the camera optical center on the virtual image plane be S, then its world coordinate S(x S ,y S ,z S )for
[0069]
[0070] The center point P of the light-transmitting cover of the characteristic mark i The image on the virtual image plane is Q i , extracted according to step 2.3.2 i The image coordinates are According to the virtual image generation process described in step 1.2, Q i The world coordinates of the point for
[0071] Let the vertical projection point of the camera optical center on the characteristic plane be G, then its world coordinate G(x G ,y G ,z G )for
[0072]
[0073] Note: i The world coordinates of Since the triangle OSQ i With triangle OGP i Similar, yes
[0074]
[0075] So we calculate P i The world coordinates of the point
[0076]
[0077] The image of the light strip L on the reflector facade on the virtual image plane is denoted as l. In step 2.3.5, the image line equation (9) of l has been obtained. Therefore, k and b are known. The world coordinates of l are described as
[0078] y=k l x+b l (16)
[0079] According to the method of generating the virtual image described in step 1.2,
[0080]
[0081] Substituting into formula (9) we can get
[0082]
[0083] Since the straight line L is parallel to l, the equation of the straight line L on the vertical surface of the reflector is
[0084] y=k L x+b L (19)
[0085] According to the perspective projection relationship between L and l, we can get
[0086]
[0087] Let the horizontal projection line of the straight line L on the characteristic mark plane be L', then the straight line equation of L' on the characteristic mark plane is the same as the equation of L on the vertical surface of the reflector, which is (19). Therefore, the center point P of the light-transmitting cover of the characteristic mark can be obtained. i Distance to L'
[0088]
[0089] Also P i Distance to the reference plane;
[0090] Step 2.5: Calculate the levelness of the bottom surface of the scale platform;
[0091] Repeat step 2.4 to obtain the center point P of the light-transmitting mask with four characteristic marks. i Distance to base plane i=1,2,3,4;
[0092] The length d of the rectangle formed by the center points of the light-transmitting mask of the four characteristic marks measured in step 1.3 W and width d H , set the coordinate system O according to the rectangle and the reference plane E -x E y E z E , so that the coordinates of the four measurement points in this coordinate system are Assume the equation of the measurement plane is
[0093] Ax+By+Cz=1 (22)
[0094] A, B, and C are the parameters of the equation. The above four points are regarded as sample points of the measurement plane. The plane is fitted using the least squares method to obtain the estimated values of the three parameters. The unit normal vector of the fitting plane is
[0095]
[0096] Its normal direction to the horizontal plane The angle is:
[0097]
[0098] Since the measuring plane is parallel to the bottom of the weighing platform, this angle is used as an indicator to measure the horizontality of the bottom of the weighing platform. The smaller the angle, the better the horizontality of the weighing platform.
[0099] The beneficial effects of the present invention are:
[0100] 1. The present invention uses the light bar projected by the linear structured light projector on the side of the scale base as the measurement reference, and does not need to install additional fixed reference marks on the steel scale;
[0101] 2. The present invention uses a characteristic mark that can actively emit light, which is conducive to feature extraction from the image;
[0102] 3. The process of measuring the horizontality of the weighing platform of the present invention is a non-contact measurement process, which will not affect the weighing process of the steel scale and is objective and real-time. BRIEF DESCRIPTION OF THE DRAWINGS
[0103] Figure 1 is the overall structural diagram of the present invention (in order to clearly show the structural connection, only one set of measuring devices is shown in the figure);
[0104] Figure 2 A schematic diagram of the position of placing a calibration target at a special position during the calibration process in the present invention;
[0105] Figure 3 A flow chart of the detection method provided by the present invention;
[0106] Figure 4 The schematic diagram of the vertical drop from the center point of the light-transmitting cover to the straight light strip for calculating the characteristic mark in the present invention;
[0107] Figure 5 It is a principle diagram for calculating the horizontality of the bottom surface of the weighing platform in the present invention;
[0108] in,
[0109] 1-weighing platform, 2-characteristic mark, 3-weighing platform base, 4-reflector, 5-positioning scale, 6-bracket, 7-camera, 8-line structured light projector, 9-light plane, 10-light strip, 11-industrial computer, 12-power module, 13-calibration board. DETAILED DESCRIPTION
[0110] In order to better explain the present invention and facilitate understanding, the technical solutions and effects of the present invention are described in detail below through specific implementation modes in conjunction with the accompanying drawings.
[0111] A device for detecting the horizontality of a lifting steel material weighing platform comprises an industrial computer 11, a power module 12 and two sets of measuring devices. The industrial computer 11 is equipped with a control system. The two sets of measuring devices are respectively arranged on the front and rear sides of the weighing platform 1. The measuring devices are connected to the power module 12, and the industrial computer is externally connected to a power supply. The measuring devices comprise a camera 7, a linear structured light projector 8, two characteristic marks 2, an L-shaped reflector 4, two positioning scales 5 and a bracket 6.
[0112] The characteristic marks 2 in the two groups of measuring devices are respectively installed on the side facades on the front and rear sides of the weighing platform 1. The two characteristic marks 2 in each group are respectively located close to the left and right sides of the side facades. The four characteristic marks 2 are equidistant from the vertical boundaries of the corresponding side facades and from the bottom surface of the weighing platform 1. In this way, the center points of the light-transmitting covers of the four characteristic marks 2 form a rectangle. The plane where the rectangle is located is called the measuring plane, and the measuring plane is parallel to the bottom surface of the weighing platform 1.
[0113] The reflector 4 is installed on the side elevation on the same side of the scale base 3 and the characteristic mark 2, and the lower plane of the reflector 4 is horizontal; two positioning rulers 5 are installed on the elevation of each reflector 4, and the distances between the two positioning rulers 5 and the lower plane of the reflector 4 are equal.
[0114] The line structured light projector 8 is installed on the bracket 6. The installation position and angle of the line structured light projector 8 must ensure that the projected light plane 9 intersects with the vertical surface of the reflector 4 when the scale platform 1 is raised, and can project horizontal light strips 10 on the reflector 4. It is also ensured that the light strips 10 projected by the two sets of measuring devices are on the same horizontal plane, and the plane where the two light strips 10 are located is used as the reference plane for measurement.
[0115] The camera 7 is a black-and-white industrial camera with a fixed-focus lens and an Ethernet interface.
[0116] The camera 7 is installed on the bracket 6 and connected to the industrial computer 11 through a network cable; the field of view of the camera 7 covers the two characteristic mark 2 areas before and after the scale platform 1 is raised and the light bar 10 area after the scale platform 1 is raised, and can clearly image the characteristic mark 2 and the light bar 10. The camera 7 receives the command from the industrial computer 11 to take a picture and transmits the taken image to the industrial computer 11.
[0117] The laser color of the line structured light projector 8 is different from the color of the side facade of the weighing platform 1. The projection angle is selected according to actual conditions to ensure that the horizontal light strip 10 projected on the reflector 4 on the side facade of the weighing platform base 3 can cover the two corresponding measured scales, thereby facilitating the horizontal adjustment of the light strip 10 and the subsequent straight line feature extraction.
[0118] The characteristic mark 2 is a mark that can actively emit light, and the color of the light emitted is the same as the color of the laser projected by the line structured light projector 8.
[0119] like Figure 1 As shown, two characteristic marks 2 in one set of measuring devices are installed on the side in front of the weighing platform 1, and the installation position is symmetrical with respect to the side of the weighing platform 1. The characteristic mark 2 described in this embodiment adopts an LED active light-emitting mark, and a blue LED is used as the light source inside. The transparent cover is circular in shape, and the plane where the transparent cover is located is called the characteristic mark plane, which is parallel to the side of the weighing platform 1 where the characteristic mark 2 is located; when imaging, a nearly circular light spot can be formed on the image; the center point of the transparent cover of the characteristic mark 2 is used as the measuring point. The reflector 4 described in this embodiment adopts a right-angle L-shaped reflector, which is installed on the side elevation on the same side of the weighing platform base 3 and the characteristic mark 2. The horizontal plane below the reflector 4 acts as a bracket, which is used to place the calibration target when the camera 7 is calibrated, and the plane below the reflector 4 is ensured to be horizontal during installation. A positioning ruler 5 is installed on each of the left and right sides of the facade of the reflector 4, with a total of two positioning rulers 5; the positioning ruler 5 has scale lines with equal spacing, and the two positioning rulers 5 have the same specifications. The two positioning scales 5 are installed vertically, with horizontal scale lines and the distance between each positioning scale 5 and the lower plane of the reflector 4 is equal. The line structured light projector 8 uses a blue laser and is installed on the bracket 6. Its installation position and angle ensure that the projected light plane 9 intersects with the vertical surface of the reflector 4. When the scale platform 1 rises with the scale platform base 3, it can project a light strip 10 on the vertical surface of the reflector 4. According to the position of the light strip 10 on the two positioning scales 5, the angle of the line structured light projector 8 is adjusted so that the light strip 10 has the same scale value on the two positioning scales 5, thereby ensuring that the light strip 10 is horizontal. When the other set of measuring devices is installed, it is ensured that the light strips 10 projected by the line structured light projectors 8 of the two sets of measuring devices are on the same horizontal plane, and the horizontal plane where the two light strips 10 are located is used as the reference plane for the vertical height of the measuring point. The camera 7 is a black and white industrial camera with a fixed-focus lens and a blue light filter, which is installed on the bracket 6; the field of view of the camera 7 covers the areas of the two characteristic marks 2 corresponding to the front and back of the scale platform 1 and the area of the straight light bar 10 after the scale platform 1 is raised. This area is the target area and can clearly image the characteristic mark 2 and the straight light bar 10; the camera 7 is connected to the industrial computer 11 via a network cable, receives instructions from the industrial computer 11 to take pictures, and transmits the image to the industrial computer 11.
[0120] The power module 12 uses a direct current power supply to provide power for the feature mark 2 , the camera 7 and the line structured light projector 8 .
[0121] The industrial computer 11 has at least two Ethernet interfaces for connecting two cameras 7 respectively. In this embodiment, the industrial computer 11 is equipped with a Core i7 CPU. The control system carried by the industrial computer 11 includes a camera control module, a calibration module, an image processing module, a feature extraction module and a visual solution module:
[0122] The camera control module controls the camera 7 to take pictures, issues a picture taking command to the camera 7, receives the distorted original image captured by the camera 7 and transmits it to the calibration module and the image processing module;
[0123] The calibration module calibrates the parameters of the camera 7 and transmits the calibration results to the visual solution module;
[0124] The image processing module processes the scene image collected from the camera 7, performs image distortion correction, binarization, filtering, and expansion in sequence, and transmits the processed binarized image to the feature extraction module;
[0125] The feature extraction module uses the method of extracting connected areas to extract the coordinates of the center point of the light-transmitting cover of the feature mark 2 in the image, and uses the method of straight line fitting to obtain the straight line equation of the light strip 10, thereby realizing the feature extraction of the light strip 10, and transmitting the extraction result to the visual solution module;
[0126] Based on the results of calibration and feature extraction, the visual solution module uses the perspective projection relationship to calculate the vertical distances of the four measuring points relative to the reference plane, that is, the vertical distances from the center points of the light-transmitting covers of the four characteristic marks 2 to the plane formed by the two straight light strips 10; then the plane fitting method is used to fit the equation of the measuring plane, and the angle between the normal vector of the fitted measuring plane and the normal vector of the horizontal plane is calculated to describe the horizontality of the scale platform 1.
[0127] The calibration method adopted in the calibration process of the detection device is specifically as follows: the camera calibration method based on plane targets proposed by Zhang Zhengyou is used to calibrate the intrinsic parameters, extrinsic parameters and lens distortion parameters of the camera 7. When placing the calibration target, a position parallel to the side elevation of the scale platform 1 on which the characteristic mark 2 is installed is specially selected to place the calibration target once, and the target plane at the special position is defined as the virtual image plane, and a world coordinate system is established on the virtual image plane; the coordinates of the optical center of the camera 7 in the world coordinate system are calculated from the calibration results, and the homography matrix between the image plane and the virtual image plane is obtained; further, a formula for calculating the coordinates of the projection point of any world coordinate point on the virtual image plane in the distorted original image from any world coordinate point on the virtual image plane is obtained, and a formula for generating the distortion-free projection image on the corresponding virtual image plane from the original image of the target area is obtained by using the bilinear interpolation method, and the distortion-free projection image on the virtual image plane is called a virtual image. The calibration process also includes measuring the position parameters of the device, including measuring the distance from the center point of the light-transmitting cover of the characteristic mark 2 to the vertical surface of the reflector 4 with a right-angle measuring ruler, measuring the distance from the vertical surface of the reflector 4 to the virtual image plane, and measuring the side length of the rectangle formed by the center points of the light-transmitting covers of the four characteristic marks 2, and then inputting the measurement results into the industrial computer 11 through the human-machine interface of the industrial computer 11.
[0128] The vertical distance from the center point of the light-transmitting cover of the characteristic mark 2 to the plane formed by the two straight light strips 10; the measurement method is obtained through the control system, specifically: the camera control module of the industrial computer 11 sends a shooting instruction to the two cameras 7 at the same time, and the two cameras 7 simultaneously shoot images of their respective target areas. The camera 7 transmits the captured pictures to the control system, and the image processing module generates a corresponding virtual image through the above-mentioned calibration method; the feature extraction module uses the center point of the light-transmitting cover of the characteristic mark 2 as the measurement point, and uses the virtual image to extract the image coordinates of the measurement point; according to the changes in the image coordinates of the measurement point obtained by each shooting, the movement of the weighing platform 1 is determined; if it is determined that the weighing platform 1 stops after moving upward, it means that the steel scale is performing an effective weighing action, and only in this case is the horizontality of the weighing platform 1 detected; during the detection, the feature extraction module extracts the linear equation of the light strip 10 from the virtual image; the visual solution module uses the perspective projection constraint relationship between the center point of the light-transmitting cover of the characteristic mark 2, the light strip 10 and their images to calculate the vertical drop from the center point of the light-transmitting cover of the characteristic mark 2 to the light strip 10.
[0129] The method for calculating the horizontality of the bottom surface of the weighing platform 1 is as follows: construct sample points using the vertical drop from the above four measuring points to the light bar 10 and the length and width of the rectangle formed by the four measuring points, and fit the measurement plane equation using the least squares method; calculate the angle between the normal direction of the fitted measurement plane and the normal direction of the horizontal plane to describe the horizontality of the bottom surface of the weighing platform 1.
[0130] The above-mentioned levelness detection method of the lifting type steel material scale platform levelness detection device is generally divided into two processes: calibration and visual measurement. The specific steps are as follows:
[0131] Step 1: Camera calibration and parameter measurement, which is completed before the scale levelness detection process.
[0132] Step 1.1: The calibration module calibrates the camera's intrinsic parameters, extrinsic parameters, and distortion parameters.
[0133] The camera parameters are calibrated by using a camera calibration method based on a plane target. The calibration target is a checkerboard calibration plate 13 with uniform thickness. The method places the calibration plate 13 multiple times at different positions and angles in the clear imaging area in front of the camera 7 and takes pictures of the calibration plate 13. The collected images are used for camera parameter calibration. When placing the calibration plate 13, a special position needs to be selected to place the calibration plate 13. In this embodiment, the position parallel to the side elevation of the scale platform 1 where the characteristic mark 2 is installed is used as the special position to place the calibration plate 13. Figure 2 As shown, the calibration plate 13 is placed on the horizontal bracket of the reflector 4, and the back side of the calibration plate 13 is close to the vertical surface of the reflector 4. The plane world coordinate system O is established according to the position of the characteristic points on the calibration plate 13. W -x W y W , so that x W The coordinate axis points to the right along the distribution direction of the feature points on the calibration plate, y W The coordinate axis points downward, and the three-dimensional world coordinate system O is established according to the right-hand rule. W -x W y W z W The camera calibration method based on a planar target is used to determine the intrinsic parameters of the camera 7, the extrinsic parameters relative to the defined world coordinate system, and the lens distortion parameters.
[0134] Step 1.2: Calculate virtual image generation parameters and construct a lookup table.
[0135] Assume the camera 7 coordinate system Ox C y C z C With the world coordinate system O defined W -x W y W z W There is the following transformation relationship between them:
[0136]
[0137] Where R is the rotation matrix of the coordinate transformation, and T is the translation vector. The values of R and T can be obtained by using the camera 7 external parameter calibration results in step 1.1.
[0138] The image captured by the camera 7 is actually the image of the photographed object on the real image plane. In this embodiment, the calibration plate plane on which the calibration target is placed at a special position, that is, W -x W y W The plane is regarded as a virtual image plane, and it is considered that there is also a projected image of the photographed target area on the virtual image plane, which is called a virtual image. The image and the photographed target area satisfy the perspective projection relationship with the optical center of the camera 7 as the projection center. The virtual image is generated from the distorted original image taken by the camera 7 using the calibrated camera parameters.
[0139] Note O W -x W y W The undistorted image point corresponding to the world coordinate point (x, y) on the plane is (u, v), and the following relationship exists between them:
[0140]
[0141] Where K is the camera intrinsic parameter matrix, r1 and r2 are the left two columns of R, H = K (r1, r2, T) is the homography between the image plane and the virtual image plane, and t is the scale factor. Using the camera calibration results obtained in step 1.1, these parameters are considered known.
[0142] remember is the coordinate of the distorted image point corresponding to the undistorted image point (u, v). Using formula (2), we can get the calculation formula of the undistorted image point (u, v) corresponding to the world coordinate point (x, y) on the virtual image plane. Then, using the lens distortion model, we can get the corresponding distorted image point The calculation formula is simplified as follows:
[0143]
[0144] Using the bilinear interpolation method, we can get the calculation formula of the gray value V(x,y) of the point (x,y) in the virtual image:
[0145]
[0146] in i=1,2,3,4 is enclosed The pixel coordinates of the four original distorted images, and are all integers, In the original image Gray value of the point, ω iis the weight corresponding to the bilinear interpolation calculation. Note that as long as the relative position between the camera 7 and the virtual image plane remains unchanged, for any world coordinate point (x, y) on each virtual image plane, the corresponding four groups in formula (4) are and ω i The values are fixed, that is, there are 12 tuples corresponding to them
[0147] Select the world coordinate point (x LT ,y LT ) as the upper left corner of the virtual image, the pixel arrangement directions of the virtual image are respectively W Axis and y W The axis direction is parallel, Δx and Δy are the pixel distances in the two directions of the virtual image, respectively. LT ,y LT ), Δx, Δy values are selected according to the actual situation. Then the world coordinates corresponding to the pixel point (i, j) on the virtual image are (x LT +Δx·i,y LT +Δy·j), and use the above method to obtain the corresponding 12-tuple, which can also be considered as the 12-tuple corresponding to the pixel point (i, j) on the virtual image. Let the width of the virtual image be w and the height be h, and calculate all the 12-tuples corresponding to the total w·h virtual image pixels to form a lookup table.
[0148] By using the lookup table, the gray value of each pixel in the virtual image can be quickly calculated from the original image, thereby generating a virtual image and achieving distortion correction of the original distorted image. The process also provides a method for constructing a virtual image.
[0149] Step 1.3: Parameter measurement.
[0150] Measure the distance from the vertical surface of the reflector 4 to the virtual image plane. In this embodiment, the thickness d of the calibration plate 13 is measured. C In the method, when the calibration plate 13 is placed at the special position described in step 1.1, the calibration plate 13 is placed close to the vertical surface of the reflector 4, and the distance from the vertical surface of the reflector 4 to the virtual image plane is d C Measure the distance d from the center point of the light-transmitting cover of the i-th characteristic mark 2 to the vertical surface of the reflector 4 i (i=1,2,3,4); measure the length d of the rectangle formed by the center points of the light-transmitting masks of the four characteristic marks 2 W and width d H .
[0151] Step 2: Check the levelness of the weighing platform 1. This step is performed during each inspection.
[0152] The process of levelness detection of weighing platform 1 is as follows Figure 3 As shown. The camera control module of the industrial computer 11 sends a photo command to the two cameras 7 at the same time, and the two cameras 7 take photos at the same time. Each camera 7 captures the target area on the corresponding side, namely, the image of two characteristic marks 2 and a horizontal light strip 10. The processing process for the two images is the same. Generate a virtual image using the lookup table obtained in step 1.2, and then extract the image coordinates of the center point of the light-transmitting cover of the characteristic mark 2 through the image processing module and the feature extraction module to detect the movement of the weighing platform 1. When it is detected that the weighing platform 1 moves upward, it means that the steel scale is being lifted up. When it is detected that its movement stops, it means that the steel scale has been lifted into place and the weighing action has begun. At this time, the horizontality of the weighing platform 1 is detected. Using the center point coordinates of the light-transmitting cover of the characteristic mark 2 extracted from the virtual image and the straight line equation of the light strip 10, the visual solution module performs visual solution to obtain the vertical distance from the center point of the light-transmitting cover of the characteristic mark 2 to the reference plane, and then calculates the horizontality. Specifically, it includes the following steps:
[0153] Step 2.1: The industrial computer 11 sends a photo command to the two cameras 7 at the same time, and the two cameras 7 take photos at the same time. Each camera 7 takes an image of the target area on the corresponding side, namely, the two characteristic marks 2 and a horizontal light strip 10.
[0154] Step 2.2: The image processing module processes the image. The processing process for the two images is the same:
[0155] Step 2.2.1: The image processing module generates a virtual image using the lookup table obtained in step 1.2; binarizes the generated virtual image to obtain a binary image that satisfies
[0156]
[0157] Where B(i,j) is the gray value of the virtual image coordinate point (i,j) after binarization, V(i,j) is the gray value of the pixel point (i,j) in the virtual image, and T B is a threshold value set in advance. Since the characteristic mark 2 actively emits light, the laser light strip 10 on the reflector 4 is also brighter than the background, so their pixel values are relatively large in the binary image, appearing as white, while the background appears as black;
[0158] Step 2.2.2: The image processing module performs median filtering on the binary image generated in step 2.2.1; and then performs a dilation operation on the filtered image, the purpose of which is to make the light spots on the light strip 10 interconnected;
[0159] Step 2.3: Feature extraction module performs feature extraction:
[0160] Step 2.3.1: The feature extraction module extracts the connected areas of white points from the binary image processed in step 2.2.2, and determines the area of each connected area and the height H of the circumscribed rectangle. k and width W k , filter out the area smaller than T D The connected area of the connected area to eliminate interference, here T D is a manually set parameter; calculate the shape description parameters of each remaining connected area:
[0161]
[0162] Obviously there is r k ≥1. Select the connected area with the smallest shape description parameter and mark it as the No. 1 feature mark area, denoted as R1; select the connected area with the second smallest shape description parameter and mark it as the No. 2 feature mark area, denoted as R2; select the area with the largest shape description parameter and mark it as the light strip area, denoted as R L ;
[0163] Step 2.3.2: The feature extraction module calculates the virtual image coordinates of the center of gravity of the two feature mark areas R1 and R2 marked in step 2.3.1, respectively, and records them as g1(u1,v1) and g2(u2,v2), thereby determining the center point coordinates of the light-transmitting covers of the left and right feature marks 2 respectively:
[0164]
[0165]
[0166] Step 2.3.3: The feature extraction module determines whether the scale 1 moves upward.
[0167] Step 2.3.3.1: Set counter c:=0;
[0168] Step 2.3.3.2: Extract the coordinates of the center point of the light-transmitting cover of the left feature mark 2 of the current frame image according to step 2.3.2 as g L (u L ,v L ), the coordinate of the center point of the light-transmitting cover of the characteristic mark 2 detected from the previous frame image is recorded as g' L (u' L ,v' L ), if v' L -v L >T R , then c:=c+1, otherwise c:=0, here T R It is a parameter set in advance;
[0169] Step 2.3.3.3: If c>T C, then it is considered that the scale 1 moves upward, otherwise go to step 2.3.3.2 to process the next frame, where T C It is a parameter set in advance;
[0170] Step 2.3.4: The feature extraction module determines whether the scale 1 stops moving upward.
[0171] Step 2.3.4.1: Set counter s:=0;
[0172] Step 2.3.4.2: Extract the coordinates of the center point of the light-transmitting cover of the left feature mark 2 of the current frame image according to step 2.3.2 as g L (u L ,v L ), the coordinate of the center point of the light-transmitting cover of the characteristic mark 2 detected from the previous frame image is recorded as g' L (u' L ,v' L ), if |v L -v' L |≤T R , then s:=s+1, otherwise s:=0, here the parameter T R with the parameter T in step 2.3.3.2 R same;
[0173] Step 2.3.4.3: If s>T S , it is considered that the scale 1 stops moving upward, otherwise go to step 2.3.4.2 to process the next frame, where T S It is a parameter set in advance;
[0174] Step 2.3.5: The feature extraction module extracts the straight line equation of the light bar 10.
[0175] Assume that the linear equation of the light bar 10 in the virtual image is
[0176] v=ku+b (9)
[0177] Remember R L For the light bar 10 region extracted in step 2.3.1, select R L All the pixel points in are used as sample points of the straight line equation of formula (9), and the parameters k and b in the straight line equation (9) are fitted by the least square method to obtain the straight line equation of the light strip 10.
[0178] Step 2.4: The visual solution module calculates the vertical drop from the center point of the light-transmitting cover of the characteristic mark 2 to the light bar 10 .
[0179] The principle of calculating the vertical drop from the center point of the light-transmitting cover of the characteristic mark 2 to the light strip 10 is as follows Figure 4As shown, according to the installation requirements of the aforementioned device, it can be considered that the virtual image plane, the vertical surface of the reflector 4, and the characteristic mark plane are approximately parallel to each other, and they are treated as parallel to each other during the solution process. Without loss of generality, as Figure 4 As shown, the vertical surface of the reflector 4 is located between the virtual image plane and the characteristic mark plane. According to step 1.3, the distance between the virtual image plane and the vertical surface of the reflector 4 has been measured to be d C According to step 1.3, the center point P of the light-transmitting cover of the i-th characteristic mark 2 has been measured i Distance d to the vertical surface of reflector 4 i , then the distance from the characteristic mark plane to the vertical surface of the reflector 4 is d i , the distance from the feature plane to the virtual image plane is d C +d i .
[0180] Assume that the world coordinates of the optical center of camera 7 are O(x O ,y O ,z O ), according to formula (1) and the camera calibration result, we have
[0181]
[0182] Let the vertical projection point of the optical center of camera 7 on the virtual image plane be S, then its world coordinate S(x S ,y S ,z S )for
[0183]
[0184] Figure 4 The center point P of the light-transmitting cover of the characteristic mark 2 i The image on the virtual image plane is Q i , extracted according to step 2.3.2 i The image coordinates are According to the virtual image generation process described in step 1.2, Q i The world coordinates of the point for
[0185]
[0186] Let the vertical projection point of the optical center of camera 7 on the characteristic plane be G, then its world coordinate G(x G ,y G ,z G )for
[0187]
[0188] Note: i The world coordinates of Since the triangle OSQ i With triangle OGP i Similar, yes
[0189]
[0190] So we calculate P i The world coordinates of the point
[0191]
[0192] The light strip 10 on the vertical surface of the reflector 4 is L, and the image of L on the virtual image plane is l. In step 2.3.5, the image line equation (9) of l has been obtained. Therefore, k and b are known. The world coordinates of l are described as
[0193] y=k l x+b l (16)
[0194] According to the method of generating the virtual image described in step 1.2,
[0195]
[0196] Substituting into formula (9) we can get
[0197]
[0198] Since the straight line L is parallel to l, the equation of the straight line L on the vertical surface of the reflector 4 is
[0199] y=k L x+b L (19)
[0200] According to the perspective projection relationship between L and l, we can get
[0201]
[0202] Let the horizontal projection of the straight line L on the characteristic mark plane be L', then the straight line equation of L' on the characteristic mark plane is the same as the equation of L on the vertical surface of the reflector 4, which is (19). Therefore, the center point P of the light-transmitting cover of the characteristic mark 2 can be obtained. i Distance to L'
[0203]
[0204] Also P i The vertical drop to L is also called P i Distance to the reference plane;
[0205] Step 2.5: Calculate the horizontality of the bottom surface of weighing platform 1.
[0206] The calculation principle of the bottom level of the weighing platform 1 is as follows Figure 5 Repeat step 2.4 to obtain the center point P of the light-transmitting mask of the four characteristic marks 2. i Distance to base plane i=1,2,3,4.
[0207] The length d of the rectangle formed by the center points of the light-transmitting cover of the four characteristic marks 2 measured in step 1.3 W and width d H , set the coordinate system O according to the rectangle and the reference plane E -x E y E z E , so that the coordinates of the four measurement points in this coordinate system are Assume that the measurement plane Π E The equation is
[0208] Ax+By+Cz=1 (22)
[0209] A, B, and C are the parameters of the equation. The above four points are regarded as sample points of the measurement plane. The plane is fitted using the least squares method to obtain the estimated values of the three parameters. The unit normal vector of the fitting plane is
[0210]
[0211] Its normal direction to the horizontal plane The angle is:
[0212]
[0213] Since the measuring plane is parallel to the bottom surface of the weighing platform 1 , this angle is used as an indicator to measure the horizontality of the bottom surface of the weighing platform 1 . The smaller the angle is, the better the horizontality of the weighing platform 1 is.
Claims
1. A lifting type steel material weighing platform levelness detection device, characterized in that: It includes an industrial computer, a power module and two sets of measuring devices. The industrial computer is equipped with a control system. The two sets of measuring devices are respectively arranged on the front and rear sides of the weighing platform. The measuring devices are connected to the power module. The measuring device comprises a camera, a line structured light projector, two characteristic marks, an L-shaped reflector, two positioning scales and a bracket; the characteristic marks in the two groups of measuring devices are respectively installed on the side facades on the front and rear sides of the weighing platform, and the two characteristic marks in each group are respectively located close to the left and right sides of the side facades, and the four characteristic marks are at equal distances from the vertical boundaries of the corresponding side facades and the distances to the bottom surface of the weighing platform. The center points of the light-transmitting covers of the four characteristic marks form a rectangle, and the plane where the rectangle is located is called the measuring plane, and the measuring plane is parallel to the bottom surface of the weighing platform; the reflector is installed on the base of the weighing platform at the same level as the characteristic marks. On the side elevation of the side, the lower plane of the reflector is horizontal; two positioning rulers are installed on each reflector elevation, and the distance between the two positioning rulers and the lower plane of the reflector is equal; the line structured light projector is installed on the bracket, and the installation position and angle of the line structured light projector must ensure that the projected light plane intersects with the reflector elevation when the scale platform is raised, and can project horizontal light strips on the reflector, and ensure that the light strips projected by the two sets of measuring devices are on the same horizontal plane; the camera is installed on the bracket and connected to the industrial computer through a network cable; the field of view of the camera covers the two characteristic mark areas before and after the scale platform is raised and the light strip area after the scale platform is raised; The control system carried by the industrial computer includes a camera control module, a calibration module, an image processing module, a feature extraction module and a visual solution module: The camera control module controls the camera to take pictures, issues a picture-taking command to the camera, receives the distorted original image captured by the camera and transmits it to the calibration module and the image processing module; The calibration module calibrates the camera parameters and transmits the calibration results to the visual solution module; The image processing module processes the scene image collected from the camera and transmits it to the feature extraction module; The feature extraction module extracts the coordinates of the center point of the light-transmitting cover and the equation of the light bar line of the feature mark and transmits the extraction result to the visual solution module; The visual solution module calculates the angle between the normal vector of the fitted measurement plane and the normal vector of the horizontal plane based on the results of calibration and feature extraction.
2. The device for detecting the horizontality of a lifting steel material weighing platform according to claim 1 is characterized in that: The camera is a black-and-white industrial camera equipped with a fixed-focus lens and has an Ethernet interface.
3. The device for detecting the horizontality of a lifting steel material weighing platform according to claim 1 is characterized in that: The laser color of the line structured light projector is different from the color of the side facade of the scale platform. The projection angle is selected according to actual conditions to ensure that the horizontal light bar projected on the reflective plate on the side facade of the scale platform base can cover the two scales on the corresponding side, which is convenient for the horizontal adjustment of the light bar and the subsequent straight line feature extraction.
4. The device for detecting the horizontality of a lifting steel material weighing platform according to claim 3 is characterized in that: The characteristic mark is a mark that can actively emit light. The light-transmitting cover is circular in shape and uses LED as a light source inside. The color of the light is the same as the color of the laser projected by the line structured light projector.
5. The device for detecting the horizontality of a lifting steel material weighing platform according to claim 1 is characterized in that: The reflector is a right-angle L-shaped reflector.
6. The device for detecting the horizontality of a lifting steel material weighing platform according to claim 1, characterized in that: The power module adopts a direct current power supply to provide power for the feature mark, the camera and the line structured light projector.
7. A levelness detection method for a lifting type steel material weighing platform levelness detection device according to any one of claims 1 to 6, characterized in that: The specific steps are as follows: Step 1: Camera calibration and parameter measurement, this step is completed before the scale levelness detection process; Step 1.1: The calibration module calibrates the camera's intrinsic parameters, extrinsic parameters, and distortion parameters; The camera parameters are calibrated using a camera calibration method based on a plane target. A checkerboard calibration plate with uniform thickness is selected as the calibration target. When placing the calibration plate, a position parallel to the side elevation of the scale platform where the characteristic mark is installed is selected to place the calibration plate once. The plane world coordinate system O is established according to the position of the characteristic points on the calibration plate at this position. W -x W y W , so that x W The coordinate axis points to the right along the distribution direction of the feature points on the calibration plate, y W The coordinate axis points downward, and the three-dimensional world coordinate system O is established according to the right-hand rule. W -x W y W z W ; Determine the camera's intrinsic parameters, extrinsic parameters relative to the defined world coordinate system, and lens distortion parameters using a camera calibration method based on a planar target; Step 1.2: Calculate virtual image generation parameters and construct a lookup table; Assume the camera coordinate system Ox C y C z C With the world coordinate system O defined W -x W y W z W There is the following transformation relationship between them: Where R is the rotation matrix of the coordinate transformation, and T is the translation vector. The values of R and T can be obtained by using the camera extrinsic calibration results in step 1.
1. Place the calibration target on the calibration plate plane, i.e. W -x W y W The plane is regarded as a virtual image plane, and it is considered that there is also a projection image of the photographed target area on the virtual image plane, which is called a virtual image. The image and the photographed target area satisfy the perspective projection relationship with the optical center of the camera as the projection center; the virtual image is generated from the distorted original image taken by the camera using the calibrated camera parameters; Note O W -x W y W The undistorted image point corresponding to the world coordinate point (x, y) on the plane is (u, v), and the following relationship exists between them: Where K is the camera intrinsic parameter matrix, r1 and r2 are the left two columns of R, H = K (r1, r2, T) is the homography between the image plane and the virtual image plane, and t is the scale factor. Using the camera calibration result obtained in step 1.1, these parameters are all known; remember is the coordinate of the distorted image point corresponding to the undistorted image point (u, v). Using formula (2), we can get the calculation formula of the undistorted image point (u, v) corresponding to the world coordinate point (x, y) on the virtual image plane. Then, using the lens distortion model, we can get the corresponding distorted image point The calculation formula is simplified as follows: Using the bilinear interpolation method, we can get the calculation formula of the gray value V(x,y) of the point (x,y) in the virtual image: in To surround The pixel coordinates of the four original distorted images, and are all integers, In the original image Gray value of the point, ω i is the weight corresponding to the bilinear interpolation calculation; as long as the relative position between the camera and the virtual image plane remains unchanged, for any world coordinate point (x, y) on each virtual image plane, the corresponding four groups in formula (4) and ω i The values are fixed, that is, there are 12 tuples corresponding to them Select the world coordinate point (x LT ,y LT ) as the upper left corner of the virtual image, the pixel arrangement directions of the virtual image are respectively W Axis and y W The axis direction is parallel, △x and △y are the pixel distances in the two directions of the virtual image, respectively. LT ,y LT ), △x, △y values are selected according to the actual situation; then the world coordinates corresponding to the pixel point (i, j) on the virtual image are (x LT +△x·i,y LT +△y·j), use the above method to obtain the corresponding 12-tuple, which can also be considered as the 12-tuple corresponding to the pixel point (i, j) on the virtual image; let the width of the virtual image be w and the height be h, calculate all the 12-tuples corresponding to the total w·h virtual image pixels and form a lookup table; Step 1.3: Parameter measurement; Measure the distance d from the reflector surface to the virtual image plane C ; Measure the distance d from the center point of the light-transmitting cover of the i-th characteristic mark to the vertical surface of the reflector i (i=1,2,3,4); measure the length d of the rectangle formed by the center points of the light-transmitting mask with the four characteristic marks W and width d H ; Step 2: Check the levelness of the scale platform. This step is performed every time the test is performed. Step 2.1: The camera control module of the industrial computer sends a photo command to the two cameras at the same time, and the two cameras take photos at the same time, and each camera takes an image of the target area on the corresponding side, that is, two characteristic marks and a horizontal light strip; Step 2.2: The image processing module processes the image. The processing process for the two images is the same: Step 2.2.1: The image processing module generates a virtual image using the lookup table obtained in step 1.2; binarizes the generated virtual image to obtain a binary image that satisfies Where B(i,j) is the gray value of the virtual image coordinate point (i,j) after binarization, V(i,j) is the gray value of the pixel point (i,j) in the virtual image, and T B is a threshold artificially set in advance; since the characteristic marks emit light actively, the laser light strips on the reflective plate are also brighter than the background, so their pixel values are large in the binary image and appear white, while the background appears black; Step 2.2.2: The image processing module performs median filtering on the binary image generated in step 2.2.1; and then performs a dilation operation on the filtered image, the purpose of which is to make the light spots on the light strip connected to each other; Step 2.3: Feature extraction module performs feature extraction: Step 2.3.1: The feature extraction module extracts the connected areas of white points from the binary image processed in step 2.2.2, and determines the area of each connected area and the height H of the circumscribed rectangle. k and width W k , filter out the area smaller than T D The connected area of the body is used to eliminate interference, where T D is a manually set parameter; calculate the shape description parameters of each remaining connected area: Obviously there is r k ≥1; select the connected area with the smallest shape description parameter and mark it as the No. 1 feature mark area, denoted by R1; select the connected area with the second smallest shape description parameter and mark it as the No. 2 feature mark area, denoted by R2; select the area with the largest shape description parameter and mark it as the light strip area, denoted by R L ; Step 2.3.2: The feature extraction module calculates the virtual image coordinates of the center of gravity of the two feature mark areas R1 and R2 marked in step 2.3.1, respectively, and records them as g1(u1,v1) and g2(u2,v2), thereby determining the center point coordinates of the light-transmitting cover of the left and right feature marks respectively: Step 2.3.3: The feature extraction module determines whether the scale moves upward; Step 2.3.3.1: Set counter c:=0; Step 2.3.3.2: Extract the coordinates of the center point of the light-transmitting mask of the left characteristic mark of the current frame image according to step 2.3.2 as g L (u L ,v L ), the coordinate of the center point of the light-transmitting cover of the characteristic mark detected from the previous frame image is recorded as g' L (u' L ,v' L ), if v' L -v L >T R , then c:=c+1, otherwise c:=0, here T R It is a parameter set in advance; Step 2.3.3.3: If c>T C , then the scale is considered to be moving upward, otherwise go to step 2.3.3.2 to process the next frame, where T C It is a parameter set in advance; Step 2.3.4: The feature extraction module determines whether the scale stops moving upward; Step 2.3.4.1: Set counter s:=0; Step 2.3.4.2: Extract the center coordinate of the light-transmitting mask of the left characteristic mark of the current frame image according to step 2.3.2 as g L (u L ,v L ), the coordinate of the center point of the light-transmitting cover of the characteristic mark detected from the previous frame image is recorded as g' L (u' L ,v' L ), if |v L -v' L |≤T R , then s:=s+1, otherwise s:=0, here the parameter T R with the parameter T in step 2.3.3.2 R same; Step 2.3.4.3: If s>T S , it is considered that the scale stops moving upward, otherwise go to step 2.3.4.2 to process the next frame, where T S It is a parameter set in advance; Step 2.3.5: The feature extraction module extracts the light bar straight line equation; Assume that the linear equation of the light strip in the virtual image is v=ku+b (9) Remember R L Select R as the light stripe area extracted in step 2.3.
1. L All the pixels in are taken as sample points of the straight line equation of formula (9), and the parameters k and b in the straight line equation (9) are fitted by the least square method to obtain the straight line equation of the light strip; Step 2.4: The visual solution module calculates the vertical drop of the center point of the light-transmitting cover of the characteristic mark relative to the light bar; According to step 1.3, the distance between the virtual image plane and the reflector facade has been measured to be d C According to step 1.3, the center point P of the light-transmitting mask of the i-th characteristic mark has been measured i Distance d to the reflector surface i , then the distance from the characteristic mark plane to the reflector facade is d i , the distance from the feature plane to the virtual image plane is d C +d i ; Assume the world coordinates of the camera optical center is O(x O ,y O ,z O ), according to formula (1) and the camera calibration result, we have Let the vertical projection point of the camera optical center on the virtual image plane be S, then its world coordinate S(x S ,y S ,z S )for The center point P of the light-transmitting cover of the characteristic mark i The image on the virtual image plane is Q i , extracted according to step 2.3.2 i The image coordinates are According to the virtual image generation process described in step 1.2, Q i The world coordinates of the point for Let the vertical projection point of the camera optical center on the characteristic plane be G, then its world coordinate G(x G ,y G ,z G )for Note: i The world coordinates of Since the triangle OSQ i With triangle OGP i Similar, yes So we calculate P i The world coordinates of the point The image of the light strip L on the reflector facade on the virtual image plane is denoted as l. In step 2.3.5, the image line equation (9) of l has been obtained. Therefore, k and b are known. The world coordinates of l are described as y=k l x+b l (16) According to the method of generating the virtual image described in step 1.2, we have Substituting into formula (9) we can get Since the straight line L is parallel to l, the equation of the straight line L on the vertical surface of the reflector is y=k L x+b L (19) According to the perspective projection relationship between L and l, we can get Let the horizontal projection line of the straight line L on the characteristic mark plane be L', then the straight line equation of L' on the characteristic mark plane is the same as the equation of L on the vertical surface of the reflector, which is (19). Therefore, the center point P of the light-transmitting cover of the characteristic mark can be obtained. i Distance to L' Also P i Distance to the reference plane; Step 2.5: Calculate the levelness of the bottom surface of the scale platform; Repeat step 2.4 to obtain the center point P of the light-transmitting mask with four characteristic marks. i Distance to base plane The length d of the rectangle formed by the center points of the light-transmitting mask of the four characteristic marks measured in step 1.3 W and width d H , set the coordinate system O according to the rectangle and the reference plane E -x E y E z E , so that the coordinates of the four measurement points in this coordinate system are Assume the equation of the measurement plane is Ax+By+Cz=1 (22) A, B, and C are the parameters of the equation. The above four points are regarded as sample points of the measurement plane. The plane is fitted using the least squares method to obtain the estimated values of the three parameters. The unit normal vector of the fitting plane is Its normal direction to the horizontal plane The angle is: Since the measuring plane is parallel to the bottom of the weighing platform, this angle is used as an indicator to measure the horizontality of the bottom of the weighing platform. The smaller the angle, the better the horizontality of the weighing platform.
Citation Information
Patent Citations
Optical vision measuring system with wide-field structure and measuring method thereof
CN102788559A
Structural Light Parameter Calibration Device and Method Based on Front-Coating Plane Mirror
US20200132451A1