A method for intelligent positioning of container spreader
Through binocular machine vision technology and RFID identification, the automatic positioning of container spreaders and three-dimensional spatial coordinate calculation are realized, which solves the problem of low efficiency in aligning spreaders and containers during container crane operation, improves operating efficiency and reduces safety accidents. risk.
Patent Information
- Application Number
- CN202111572040.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-12-21
- Publication Date
- 2024-10-15
- Estimated Expiration
- 2041-12-21
AI Technical Summary
The alignment efficiency of the spreader and the container during container crane operation is low, which results in high labor demand, high costs, and prone to loading and unloading accidents. Operators are prone to fatigue, especially when their field of vision is limited.
Binocular machine vision technology is used to calculate the translation and rotation matrices of binocular cameras through black and white checkerboard calibration, linear estimation least multiplication and maximum likelihood estimation methods, and combined with RFID recognition to achieve automatic positioning of containers and three-dimensional spatial coordinate calculation, reducing manual intervention. and improve positioning accuracy.
It realizes the automatic alignment of the container spreader and the container, improves the operating efficiency of the crane, reduces the fatigue of the operator, and reduces the risk of safety accidents in loading and unloading operations.
Smart Images

Figure CN115108466B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of intelligent positioning, and specifically to a method for intelligent positioning of a container spreader. Background Art
[0002] Container crane operators rely on experience to complete the alignment of spreaders and containers, and containers and containers. This has high work costs, large labor requirements, high intensity and low efficiency. During the alignment process, operators often have to adjust the crane trolley and car multiple times to make the spreader center the container, and even need to collide with the side wall of the container through the guide plate to complete the alignment. This is not only inefficient, but also easy to cause damage to the container and cargo. In serious cases, it will lead to safety accidents in loading and unloading operations. During the alignment process, the operator's field of vision is limited, the mind is highly concentrated, and fatigue is easy to occur, which is also not conducive to safe production. Therefore, automatic container positioning technology is becoming increasingly critical.
[0003] With the further development of my country's foreign trade, the number of containers continues to increase. Only professionals can position the containers by making multiple adjustments during the alignment process. At the same time, the accompanying visual fatigue also affects work efficiency. Summary of the invention
[0004] The purpose of the present invention is to provide a method for intelligent positioning of container spreaders in view of the above-mentioned deficiencies in the prior art, so as to solve or improve the above-mentioned problems.
[0005] In order to achieve the above object, the technical solution adopted by the present invention is:
[0006] A method for intelligent positioning of a container spreader, comprising the following steps:
[0007] S1. Detect corner points of a black and white chessboard calibration plate to obtain multiple sets of corner feature points of images captured by left and right cameras;
[0008] S2. Based on the acquired multiple groups of image corner feature points, the radial distortion parameters of the binocular camera are obtained by using the linear estimation minimum multiplication method;
[0009] S3, obtaining the translation and rotation matrices of the binocular camera after correction and optimization according to the maximum likelihood estimation method;
[0010] S4, determine whether the binocular camera calibration calculation result is within the normal value range, if so, execute step S5, otherwise, execute step S1;
[0011] S5, start the binocular camera to continuously shoot the target area container and determine the clarity. If the clarity meets the preset requirements, execute step S9, otherwise, execute step S6;
[0012] S6, extracting a dark channel RGB image from the video image;
[0013] S7, estimating the atmospheric light value and transmittance according to the dark channel RGB image data, and performing defogging processing;
[0014] S8, outputting a clear image after defogging;
[0015] S9, manually intercept and determine the target container according to the location of the crane area and perform real-time target matching images;
[0016] S10, performing median fuzzy denoising, Gaussian smoothing and binarization threshold adaptation according to the traversed image pixels to obtain the pixel coordinates of the target container keyhole image after preprocessing;
[0017] S11, calculating the three-dimensional spatial coordinates of the target container according to the internal parameters of the binocular camera, the translation matrix, the rotation matrix and the pixel coordinates of the keyhole image of the target container;
[0018] S12. Use RFID identification method to transmit the position information to the crane motion control system and automatically archive the lifting process data.
[0019] Furthermore, in step S1, the corner point detection of the black and white chessboard calibration plate is used to obtain multiple groups of image corner feature points captured by the left and right cameras, including:
[0020] The Zhang Zhengyou plane camera calibration method is adopted, which is based on the calibration method of the two-dimensional plane template and uses a black and white chessboard; the camera internal parameters are obtained by calculating the correspondence between the points on the corner point detection template and the corresponding points on the image, and the camera external parameters are solved;
[0021] Place the black and white chessboard in the calibration area of the container positioning, and use the function cvFindchessboardCorners() in the OpenCV function library to locate the corner points in the chessboard.
[0022] Furthermore, in step S2, a 7*8 chessboard with 32 images is selected for camera calibration.
[0023] Furthermore, in step S3, the translation and rotation matrices of the binocular camera after correction and optimization are obtained according to the maximum likelihood estimation method, including:
[0024] S3.1, make Zhang's plane calibration plate;
[0025] S3.2, move the calibration plate to different angles and take 32 sets of plane calibration images;
[0026] S3.3, corner point detection, detecting feature points in the calibration image;
[0027] S3.4, solving the internal and external parameters of the camera based on the OpenCV function library;
[0028] S3.5, using the linear estimation minimum multiplication method to solve the radial distortion parameters;
[0029] S3.6. Solve the function correction optimization internal and external parameters and distortion parameters based on the maximum likelihood estimation method.
[0030] Furthermore, in step S6, extracting and obtaining a dark channel RGB image from the video image includes:
[0031] Construct an atmospheric light scattering model:
[0032] I(x)=L ∞ ρ(x)g -βd(x) +L ∞ (1-e -βd(x) )
[0033] Where I(x) is the image function obtained by the imaging device, L ∞ β(x)e -βd(x) is the mathematical model of direct attenuation of incident light, L ∞ is the atmospheric light variable, L ∞ (1-e -βd(x) ) is the atmospheric light imaging model, ρ(x) is the reflectivity of the object surface, β is the atmospheric light attenuation coefficient, and d is the distance between the scene and the observation device;
[0034] Simplified atmospheric light scattering model:
[0035] I(x)=J(x)t(x)+A(1-t(x))
[0036] Where J(x) = L ∞ ρ(x) is the restored haze-free image, t(x) = e -βd(x) is the transmission rate or transmittance, A=L ∞ is the atmospheric light value.
[0037] Furthermore, in step S7, the atmospheric light value and transmittance are estimated according to the dark channel RGB image data, including:
[0038] Dehazing based on images extracted from the dark channel:
[0039]
[0040] Among them, J c is one of the color channels of image J, Ω(x) is a local sub-block centered on x, and the extraction of the dark channel includes the minimum pixel value solution in the three channels of R / G / B and a minimum value filtering process;
[0041] Simplified to:
[0042]
[0043] in, is the estimated value of the transmittance t(x). Since fog cannot be completely removed, a correction factor ω is introduced and its range is between [0,1]. for:
[0044]
[0045] Based on the dark channel image, the global atmospheric light value A is obtained from the foggy image. The top 0.1% of pixels are taken from the dark channel image according to the brightness, and the point value with the highest brightness in the original foggy image is found in the top 0.1% of pixel positions, and it is estimated as the atmospheric light value A; the transmittance cannot be infinitely less than a certain minimum value, t0 is taken as the minimum value, and introduced as an adjustment parameter, and the final expression for fog-free image processing is obtained as follows:
[0046]
[0047] Among them, J(x) is the haze-free image.
[0048] Further, step S9 manually intercepts and determines the target container and matches the image in real time according to the location of the crane area, including: demarcating an M×N matrix area according to the captured image to search for the target container, intercepting the target from the container in the field of view, and performing template matching with the original image to save the target container;
[0049] The pixel coordinates in the entire image are traversed to find the pixel coordinates of the mouse point and a mouse feedback event is formulated. When the left mouse button is clicked, the actual coordinates of the upper left corner pixel of the predetermined image are inspired and displayed on the image. The mouse feedback event is delayed to the lower right corner coordinates of the selected intercepted target image. Finally, the image reflects the intercepted target image and matches the selected template for the next step of the target image.
[0050] Furthermore, in step S10, median fuzzy denoising, Gaussian smoothing and binarization threshold adaptation are performed on the traversed image pixels to obtain pixel coordinates of the target container keyhole image after preprocessing, including:
[0051] The captured image is binarized. The captured color image is a matrix display expressed by an array of grayscale values 0 to 255 composed of pixels on the image. Let the image grayscale be f(x,y), where x = 1, 2, ....., m; y = 1, 2, ....., n, and the thresholding process is:
[0052]
[0053] Wherein, T represents the background threshold;
[0054] The image processing combining dilation and erosion is used to eliminate edge points and redundant isolated points caused by light and projection.
[0055] Get the pixel coordinates of the container lock hole in the captured image, and use the barycentric coordinates of the dark part of the hanging hole position in the image to replace the position of the ellipse center; refer to the barycentric coordinate method in the OpenCV function library, and use the first-order moment of the ellipse image after the image is binarized to calculate the barycentric coordinates of the ellipse. The horizontal and vertical coordinates of the barycentric coordinates are:
[0056]
[0057] Use OpenCV function cvGetSpatialMoment to solve the center of gravity method:
[0058] M pq =sigma(i)sigma(j)i p j q f(i,j)
[0059] Among them, x, y, i, j are the pixel coordinates in the digital image, and the moment set of the bounded function f(x, y) with two variations is defined as:
[0060]
[0061] Among them, j and k take all non-negative integer values, the parameter j+k is called the order of the moment, and there is only one zero-order moment, which is expressed as:
[0062]
[0063] Let X c ,Y c is the coordinate of the center of gravity of the region, then:
[0064]
[0065] In the binary image, M 00 Represents the area of the region, traverses the black point set in the entire image, and statistically accumulates the point set M in the x and y directions corresponding to each connected area 10 and M 01 , calculate the area M of the black area connected in each single area 00 , the centroid coordinates of each connected area are expressed as:
[0066]
[0067] Furthermore, in step S10, the three-dimensional space coordinates of the target container are calculated according to the internal parameters of the binocular camera, the translation matrix, the rotation matrix and the pixel coordinates of the keyhole image of the target container, including:
[0068] The baseline distance refers to the distance between the projection centers of the two cameras, which is set as B. The two cameras view the same feature point P of the spatial object at the same time, and the image coordinates of point P are obtained on the left camera and the right camera respectively as P left =(X left ,Y left ), P right =(X right ,Y right ); According to the principle of two parallel cameras, if the two cameras are on the same plane, the Y coordinate of the feature point P on the image coordinate is the same, that is, Y left =Y right =Y, then according to the triangle similarity principle we can get:
[0069]
[0070] According to disparity Disparity = X left -X right , then the coordinates of the three-dimensional feature points in space are:
[0071]
[0072] The method for intelligent positioning of container spreaders provided by the present invention has the following beneficial effects:
[0073] The present invention is a method for intelligent container positioning based on binocular machine vision, which has completed a comprehensive construction of scene construction, image analysis and processing, etc. of binocular machine vision for container positioning systems, and has proposed solutions in real-time image processing, image preprocessing methods under severe weather conditions, automatic container color recognition, etc., which can realize automatic alignment of container crane spreaders and containers.
[0074] The present invention can realize automatic alignment between the container crane spreader and the container, improve the automation operation level of the container crane, improve the operation efficiency of the container crane, reduce the fatigue intensity of the operator, and reduce the occurrence of safety accidents in loading and unloading operations. It has important application and economic value.
[0075] The present invention can analyze and process in real time the target container image captured by the camera installed on the spreader, and realize the automatic positioning function of the target container, including camera autonomous calibration, container color recognition, container position recognition in severe weather and other functions, so as to meet the automatic feedback of container position information.
[0076] The image recognition method of the present invention is based on machine vision: for container image targets, the collected image information is digitally processed, and image segmentation and feature matching are performed simultaneously to eliminate influencing factors such as weather, brightness and environment, and intelligent recognition of containers is realized through programming.
[0077] The present invention discloses a position calculation method based on machine vision: after digitally identifying the container, the binocular vision principle in machine vision is applied to calculate the three-dimensional spatial relative position value of the spreader and the container, and the position of the container is determined by programming. BRIEF DESCRIPTION OF THE DRAWINGS
[0078] Figure 1 A flow chart of a method for intelligent positioning of container spreaders.
[0079] Figure 2 Diagram for the principle of dual-target targeting process.
[0080] Figure 3 This is the defogging process flow chart.
[0081] Figure 4 This is the center diagram of the container keyhole.
[0082] Figure 5 Schematic diagram of binocular machine vision stereo imaging principle. DETAILED DESCRIPTION
[0083] The specific implementation modes of the present invention are described below so that those skilled in the art can understand the present invention. However, it should be clear that the present invention is not limited to the scope of the specific implementation modes. For those of ordinary skill in the art, as long as various changes are within the spirit and scope of the present invention as defined and determined by the attached claims, these changes are obvious, and all inventions and creations utilizing the concept of the present invention are protected.
[0084] According to Example 1 of the present application, reference Figure 1 The container spreader intelligent positioning method of the present solution comprises the following steps:
[0085] Step S1, obtaining multiple groups of image corner feature points captured by left and right cameras according to corner point detection of a black and white chessboard calibration plate;
[0086] Step S2, based on the acquired multiple groups of image corner feature points, using the linear estimation minimum multiplication method to obtain the binocular camera radial distortion parameters;
[0087] Step S3, obtaining the translation and rotation matrices of the binocular camera after correction and optimization according to the maximum likelihood estimation method;
[0088] Step S4, determining whether the binocular camera calibration calculation result is within the normal value range, if so, executing step S5, otherwise, executing step S1;
[0089] Step S5, start the binocular camera to continuously shoot the target area container and determine the clarity. If the clarity meets the preset requirements, execute step S9, otherwise, execute step S6;
[0090] Step S6, extracting a dark channel RGB image from the video image;
[0091] Step S7, estimating the atmospheric light value and transmittance according to the dark channel RGB image data, and performing defogging processing;
[0092] Step S8, outputting a clear image after defogging;
[0093] Step S9: manually intercept and determine the target container according to the location of the crane area and perform real-time target matching image;
[0094] Step S10, performing median fuzzy denoising, Gaussian smoothing and binarization threshold adaptation according to the traversed image pixels to obtain the pixel coordinates of the target container keyhole image after preprocessing;
[0095] Step S11, calculating the three-dimensional space coordinates of the target container according to the internal parameters of the binocular camera, the translation matrix, the rotation matrix and the pixel coordinates of the keyhole image of the target container;
[0096] Step S12: Use RFID identification method to transmit the position information to the crane motion control system, and automatically archive the lifting process data.
[0097] The present invention can satisfy the needs of container operators to quickly locate target containers, and at the same time introduces two modes, automatic identification and manual intervention, to achieve accurate positioning and safety protection of containers. After each information extraction, the system will automatically generate an operation process information manual to achieve automatic archiving of each step.
[0098] According to Example 2 of the present application, reference Figure 2-Figure 5 This embodiment will describe the embodiment 1 in detail, including:
[0099] Step S1, obtaining multiple groups of image corner feature points captured by left and right cameras according to corner point detection of a black and white chessboard calibration plate;
[0100] This embodiment preferably obtains 32 groups of image corner feature points captured by the left and right cameras;
[0101] The Zhang Zhengyou planar camera calibration method is adopted, which is based on the calibration method of the two-dimensional plane template. A relatively accurate positioning dot matrix plane template is used, and the plane template is preferably a black and white chessboard.
[0102] The camera intrinsic parameters are obtained by calculating the correspondence between the points on the corner detection template and the corresponding points on the image, and the camera extrinsic parameters are solved.
[0103] Given a black and white chessboard placed in the calibration area of the container positioning while ensuring that there is no other background interference in the field of view of the chessboard, use the function cvFindchessboardCorners() in the OpenCV function library to locate the corner points in the chessboard.
[0104] Using OpenCV library to solve Zhang's plane camera calibration has 4 parameters (f x ,f y ,C x ,C y ) and 5 distortion parameters, including three radial parameters (k1, k2, k3) and two tangential parameters (p1, p2). In order to solve the 5 distortion parameters and increase robustness, more parameters are needed. Among them, 6 sets of information generated by the three corner points of the known pattern are needed to solve the 5 distortion parameters.
[0105] A chessboard model is used to adjust different positions of the chessboard to calculate the internal parameters. In each image, the chessboard is moving and changing. Three rotation parameters (R x ,R y ,R z ) and three translation parameters (T x ,T y ,T z ). By using multiple sets of calibration images to identify different corner points, you can compare and understand their differences and determine their calibration stability.
[0106] Step S2, using the acquired 32 sets of corner point features to obtain the radial distortion parameters of the binocular camera according to the linear estimation minimum multiplication method;
[0107] In order to obtain high-quality calibration parameters, considering the influence of image noise and objective changes in numerical stability, it is necessary to collect more chessboard calibration images. The calibration parameter system module design of this embodiment uses a 7×8 chessboard with 32 images for camera calibration.
[0108] Step S3, obtaining the translation and rotation matrices of the binocular camera after correction and optimization according to the maximum likelihood estimation method;
[0109] refer to Figure 2 , including:
[0110] Step S3.1, making Zhang's plane calibration plate;
[0111] Step S3.2, moving the calibration template at different angles and taking 32 sets of plane calibration images;
[0112] Step S3.3, corner point detection, that is, detecting feature points in the calibration image;
[0113] Step S3.4, solving the internal and external parameters of the camera based on the OpenCV function library;
[0114] Step S3.5, solving radial distortion parameters by linear estimation minimum multiplication method;
[0115] Step S3.6, solving the function correction optimization internal and external parameters and distortion parameters based on the maximum likelihood estimation method.
[0116] Step S4, determining whether the binocular camera calibration calculation result is normal, if normal or within a preset range, executing step S5, otherwise, executing step S1;
[0117] Step S5, start the binocular camera to continuously shoot the target area container and determine whether the clarity is within the preset value range, if it is, execute step S9, otherwise, execute S6;
[0118] Step S6: The image is blurred at this time, and a dark channel RGB image is extracted according to the acquired video image;
[0119] The image defogging processing module under foggy weather conditions uses dark channel extraction to complete the defogging process, proposes an objective evaluation standard for the defogging effect, and realizes the extraction of container image feature information from high-altitude images under extreme weather conditions.
[0120] Convert the physical model of atmospheric scattering into a mathematical model:
[0121] I(x)=L ∞ ρ(x)e -βd(x) +L ∞ (1-e -βd(x) )
[0122] Where I(x) is the image function obtained by the imaging device, L ∞ β(x)e -βd(x) is the mathematical definition of the direct attenuation model of incident light, L ∞ To represent the atmospheric light variable, L ∞ (1-e -βd(x) ) is the mathematical model of atmospheric light imaging, which is assumed to be constant. ρ(x) is the reflectivity of the object surface. In the processing, it is generally assumed that the atmospheric attenuation coefficient of visible light in different bands remains unchanged. β is the atmospheric light attenuation coefficient, and d is the distance between the scene and the observation device.
[0123] The atmospheric light scattering model and the incident light attenuation together lead to the degradation of the visualization effect of foggy images. The above formula can be simplified as:
[0124] I(x)=J(x)t(x)+A(1-t(x))
[0125] Where J(x) = L ∞ ρ(x) is the restored haze-free image, t(x) = e -βd(x) is the transmission rate or transmittance, A=L ∞ is the atmospheric light value, which can be called the atmospheric optical component. The ultimate goal of image defogging is to restore the original fog-free image J(x), image transmission rate t(x) and atmospheric light value A from the existing foggy image I(x). Given I(x), J(x) is calculated.
[0126] Step S7, estimating the atmospheric light value and transmittance according to the dark channel RGB image data, which specifically includes:
[0127] Step S7.1: Image defogging method based on dark channel extraction:
[0128]
[0129] Among them, J c is one of the color channels of image J, Ω(x) is a local sub-block centered on x;
[0130] Step S7.2, extraction of the dark channel includes the process of solving the minimum pixel value in the three channels of R / G / B and a minimum value filtering, so the above formula can be converted into:
[0131]
[0132] in, is the estimated value of transmittance t(x);
[0133] Step S7.3: Since fog cannot be completely removed, a correction factor ω is introduced and its range is between [0,1]. It can be expressed as:
[0134]
[0135] The global atmospheric light value A is obtained from the foggy image with the help of the dark channel image. The top 0.1% of pixels in the dark channel image are taken according to the brightness. The point value with the highest brightness in the original foggy image is found among these positions and estimated as the atmospheric light value A.
[0136] Step S7.4, the transmittance cannot be infinitely less than a certain minimum value. We can take t0 as the minimum value and introduce it as an adjustment parameter. The final formula for fog-free image processing can be expressed as:
[0137]
[0138] Step S8: Reference Figure 3 , the defogging process is completed, and a clear image after defogging is output;
[0139] According to the relationship between J(x) and I(x) mentioned above, the transmittance and the estimated atmospheric light value can be solved by reverse deduction respectively. Combining their respective expression relationships in the three channels of R / G / B, the dehazed image can be output.
[0140] Step S9: manually intercept and determine the target container and perform real-time target matching images according to the location of the crane, which specifically includes:
[0141] During the container recognition process, the front and rear cameras located on the container anti-sway spreader will capture more than one container in the same state at the same time in the container scene field of view; therefore, when locating the grabbed container, it is necessary to intercept and locate the specific target container to be grabbed; this problem can be effectively solved by the rectangular window screenshot in the OpenCV function library, the mouse callback function setMouseCallback.
[0142] According to the overall captured image, an M×N matrix area is defined to search for the target container, and the target is captured from the container in the field of view. Finally, template matching is performed with the original image to save the target container.
[0143] The pixel coordinates in the entire image are traversed to find the pixel coordinates of the mouse point and formulate mouse feedback events. When the left mouse button is clicked, the actual coordinates of the upper left corner pixel of the predetermined image are inspired and displayed on the image.
[0144] The mouse feedback event is now delayed to the lower right corner coordinates of the selected intercepted target image, and finally the image reflects the intercepted target image, matching the selected template for the next target image.
[0145] Step S10, performing median fuzzy denoising, Gaussian smoothing and binarization threshold adaptation according to the traversed image pixels, to obtain the pixel coordinates of the target container keyhole image after preprocessing, which specifically includes:
[0146] The preprocessing of the images taken by the test system includes an image smoothing module, an image noise removal module, and an image contour picking module.
[0147] The actual image taken is pre-analyzed to facilitate the subsequent image binarization and the identification of the center of gravity coordinates of the container lifting hole. Gaussian blur processing can achieve better smoothing effects. The processing function uses the cvSmooth() function. It has 4 parameters: param1, param2, param3 and param4. The image area is subjected to Gaussian convolution calculation with the central area being the base of param1×param2. The order of smoothing the image to find the lifting hole is also a factor that affects the final target effect. Take param1×param2 as the Gaussian convolution calculation of the interval of 5×5, first obtain the original image, then extract the contour, and finally perform smoothing.
[0148] Image binarization processing, the captured color image is a matrix display expressed by an array of pixel points on the image according to grayscale values between 0 and 255. Suppose the image grayscale is represented by f(x,y), where x = 1, 2, ....., m; y = 1, 2, ....., n; the thresholding process can be:
[0149]
[0150] Image binarization greatly reduces the amount of data in the image, quickly highlights the target outline, and reduces the amount of image processing. T represents the background threshold. To obtain black, the grayscale value of the pixel on the image can be set to 0, or to obtain white, the grayscale value of the pixel on the image can be set to 255. In this way, the image black and white targets can be obtained purposefully. The OpenCV function library is used to perform image binarization operations, which is cvThreshold().
[0151] After the binarization processing of the container lifting hole, it is necessary to remove the redundant noise interference. The image processing effect combining expansion and erosion can eliminate certain redundant isolated points caused by the influence of light and projection on the edge points.
[0152] The container image feature information extraction scheme compares the container texture and keyhole features for image segmentation, and finds the container keyhole center by combining Hough transform ellipse fitting with binarization centroid method.
[0153] Get the pixel coordinates of the container lock hole in the captured image, and use the barycentric coordinates of the dark part of the hanging hole position in the image to replace the position of the ellipse center. Refer to the barycentric coordinate method in the OpenCV function library. When the image of the ellipse on the camera plane is relatively small, the barycentric method is a better method to extract the center of the ellipse image.
[0154] The first-order moment of the ellipse image after image binarization can be used to calculate the coordinates of the center of gravity of the ellipse. The horizontal and vertical coordinates of the center of gravity are:
[0155]
[0156] Use OpenCV function cvGetSpatialMoment to solve the center of gravity method:
[0157] M pq =sigma(i)sigma(j)i p j q f(i,j)
[0158] Among them, x, y, i, j are the pixel coordinates in the digital image, and the moment set of the bounded function f(x, y) with two variations is defined as:
[0159]
[0160] From the above formula, we can see that j and k can take all non-negative integer values; the parameter j+k is called the order of the moment, and there is only one zero-order moment, which can be expressed as follows:
[0161]
[0162] It can be seen that the above formula represents the area of the image. Let X c ,Y c represents the coordinates of the center of gravity of the region, then:
[0163]
[0164] In the binary image, M 00 Indicates the area of the region. The cvMoments function is used to obtain the moment information of the binary image. At the same time, the function cvGetSpatialMoment can help obtain the moment information results of the required dimension. Since there are only two color states, black and white, after the image is binarized, the black point set in the entire image is traversed, and the statistics of the corresponding x and y direction point sets M of each connected area are accumulated. 10 and M 01 , calculate the area M of the black area connected in each single area 00 ; Finally, the centroid coordinates of each connected area can be expressed as:
[0165]
[0166] According to the above method, the coordinates of the center of gravity of the target point in the image are calculated, and finally the image is displayed as shown in the attached figure. Figure 4 As shown, the target coordinate point is obtained and the expected processing effect is achieved.
[0167] Step S11, calculating the three-dimensional space coordinates of the target container according to the internal parameters of the binocular camera, the translation matrix, the rotation matrix and the pixel coordinates of the keyhole image of the target container, which specifically includes:
[0168] Based on the parallax principle, binocular stereo vision is proposed. A similar triangle model is formed between the image planes of the two cameras and the object to be measured, as shown in the attached figure. Figure 5 shown.
[0169] If the relationship between the parameters and image coordinates of the two cameras is known, the three-dimensional coordinate positions of the spatial feature points of the objects in the images taken by the two cameras can be calculated. The baseline distance refers to the distance between the projection centers of the two cameras, set to B;
[0170] Two cameras view the same feature point P of a spatial object at the same time, and the image coordinates of point P are obtained on the left camera ("left eye") and the right camera ("right eye") as P left =(X left ,Y left ), P right =(X right ,Y right ). According to the principle of two parallel cameras, if the two cameras are on the same plane, the Y coordinate of the feature point P on the image coordinate is the same, that is, Y left =Y right =Y, then the following formula is obtained from the triangle similarity principle:
[0171]
[0172] According to disparity Disparity = X left -X right , then the coordinates of the three-dimensional feature points in space are:
[0173]
[0174] With regard to the point-to-point operation characteristics of this embodiment, as long as any point on the left camera photo can find a corresponding matching point on the right camera photo, the coordinates of the feature point in three-dimensional space can be determined based on the principle of spatial similar triangles.
[0175] Step S12: Transmit the position information to the crane motion control system through the RFID identification method, and automatically archive the lifting process data.
[0176] Although the specific implementation of the invention is described in detail in conjunction with the drawings, it should not be understood as limiting the scope of protection of this patent. Within the scope described in the claims, various modifications and variations that can be made by those skilled in the art without creative work still fall within the scope of protection of this patent.
Claims
1. A method for intelligent positioning of container spreaders, characterized in that: The following steps are involved: S1. Detect corner points of a black and white chessboard calibration plate to obtain multiple sets of corner feature points of images captured by left and right cameras; S2. Based on the acquired multiple groups of image corner feature points, the radial distortion parameters of the binocular camera are obtained by using the linear estimation minimum multiplication method; S3, obtaining the translation and rotation matrices of the binocular camera after correction and optimization according to the maximum likelihood estimation method; S4, determine whether the binocular camera calibration calculation result is within the normal value range, if so, execute step S5, otherwise, execute step S1; S5, start the binocular camera to continuously shoot the target area container and determine the clarity. If the clarity meets the preset requirements, execute step S9, otherwise, execute step S6; S6, extracting a dark channel RGB image from the video image; S7, estimating the atmospheric light value and transmittance according to the dark channel RGB image data, and performing defogging processing; S8, outputting a clear image after defogging; S9, manually intercept and determine the target container according to the location of the crane area and perform real-time target matching images; S10, performing median fuzzy denoising, Gaussian smoothing and binarization threshold adaptation according to the traversed image pixels to obtain the pixel coordinates of the target container keyhole image after preprocessing; S11, calculating the three-dimensional spatial coordinates of the target container according to the internal parameters of the binocular camera, the translation matrix, the rotation matrix and the pixel coordinates of the keyhole image of the target container; S12, using RFID identification method to transmit the position information to the crane motion control system, and automatically archive the lifting process data; S3 includes: S3.1, make Zhang's plane calibration plate; S3.2, move the calibration plate to different angles and take 32 sets of plane calibration images; S3.3, corner point detection, detecting feature points in the calibration image; S3.4, solving the internal and external parameters of the camera based on the OpenCV function library; S3.5, using the linear estimation minimum multiplication method to solve the radial distortion parameters; S3.6, solving the function correction optimization internal and external parameters and distortion parameters based on the maximum likelihood estimation method; S7 includes: Dehazing based on images extracted from the dark channel: Among them, J c is one of the color channels of image J, Ω(x) is a local sub-block centered on x, and the extraction of the dark channel includes the minimum pixel value solution in the three channels of R / G / B and a minimum value filtering process; Simplified to: in, is the estimated value of the transmittance t(x). Since fog cannot be completely removed, a correction factor ω is introduced and its range is between [0,1]. for: Based on the dark channel image, the global atmospheric light value A is obtained from the foggy image. The top 0.1% of pixels are taken from the dark channel image according to the brightness, and the point value with the highest brightness in the original foggy image is found in the top 0.1% of pixel positions, and it is estimated as the atmospheric light value A; the transmittance cannot be infinitely less than a certain minimum value, t0 is taken as the minimum value, and introduced as an adjustment parameter, and the final expression for fog-free image processing is obtained as follows: Among them, J(x) is the haze-free image; S10 includes: The captured image is binarized. The captured color image is a matrix display expressed by an array of grayscale values 0 to 255 composed of pixels on the image. Let the image grayscale be f(x,y), where x = 1, 2, ....., m; y = 1, 2, ....., n, and the thresholding process is: Wherein, T represents the background threshold; The image processing combining dilation and erosion is used to eliminate edge points and redundant isolated points caused by light and projection. Get the pixel coordinates of the container lock hole in the captured image, and use the barycentric coordinates of the dark part of the hanging hole position in the image to replace the position of the ellipse center; refer to the barycentric coordinate method in the OpenCV function library, and use the first-order moment of the ellipse image after the image is binarized to calculate the barycentric coordinates of the ellipse. The horizontal and vertical coordinates of the barycentric coordinates are: Use OpenCV function cvGetSpatialMoment to solve the center of gravity method: M pq =sigma(i)sigma(j)i p j q f(i,j) Among them, x, y, i, j are the pixel coordinates in the digital image, and the moment set of the bounded function f(x, y) with two variations is defined as: Among them, j and k take all non-negative integer values, the parameter j+k is called the order of the moment, and there is only one zero-order moment, which is expressed as: Let X c ,Y c is the coordinate of the center of gravity of the region, then: In the binary image, M 00 Represents the area of the region, traverses the black point set in the entire image, and statistically accumulates the point set M in the x and y directions corresponding to each connected area 10 and M 01 , calculate the area M of the black area connected in each single area 00 , the centroid coordinates of each connected area are expressed as:
2. The method for intelligent positioning of container spreaders according to claim 1, characterized in that: In step S1, the corner point detection of the black and white chessboard calibration plate is used to obtain multiple groups of corner point feature points of the images captured by the left and right cameras, including: The Zhang Zhengyou plane camera calibration method is adopted, which is based on the calibration method of the two-dimensional plane template and uses a black and white chessboard; the camera internal parameters are obtained by calculating the correspondence between the points on the corner point detection template and the corresponding points on the image, and the camera external parameters are solved; Place the black and white chessboard in the calibration area of the container positioning, and use the function cvFindchessboardCorners() in the OpenCV function library to locate the corner points in the chessboard.
3. The method for intelligent positioning of container spreaders according to claim 1, characterized in that: In step S2, a 7*8 chessboard with 32 images is selected for camera calibration.
4. The method for intelligent positioning of container spreaders according to claim 1, characterized in that: The step S6 of extracting and obtaining a dark channel RGB image from the video image includes: Construct an atmospheric light scattering model: I(x)=L ∞ ρ(x)e -βd(x) +L ∞ (1-e -βd(x) ) Where I(x) is the image function obtained by the imaging device, L ∞ β(x)e -βd(x) is the mathematical model of direct attenuation of incident light, L ∞ is the atmospheric light variable, L ∞ (1-e -βd(x) ) is the atmospheric light imaging model, ρ(x) is the reflectivity of the object surface, β is the atmospheric light attenuation coefficient, and d is the distance between the scene and the observation device; Simplified atmospheric light scattering model: I(2)=0t0+A(1-t(2)) Where J(x) = L ∞ ρ(x) is the restored haze-free image, t(x) = e -βd(x) is the transmission rate or transmittance, A=L ∞ is the atmospheric light value.
5. The method for intelligent positioning of container spreaders according to claim 1, characterized in that: The step S9 manually intercepts and determines the target container and matches the image in real time according to the location of the crane area, including: defining an M×N matrix area according to the captured image to search for the target container, intercepting the target from the container in the field of view, performing template matching with the original image, and saving the target container; The pixel coordinates in the entire image are traversed to find the pixel coordinates of the mouse point and a mouse feedback event is formulated. When the left mouse button is clicked, the actual coordinates of the upper left corner pixel of the predetermined image are inspired and displayed on the image. The mouse feedback event is delayed to the lower right corner coordinates of the selected intercepted target image. Finally, the image reflects the intercepted target image and matches the selected template for the next step of the target image.
6. The method for intelligent positioning of container spreaders according to claim 1, characterized in that: The step S10 calculates the three-dimensional space coordinates of the target container according to the internal parameters of the binocular camera, the translation matrix, the rotation matrix and the pixel coordinates of the keyhole image of the target container, including: The baseline distance refers to the distance between the projection centers of the two cameras, which is set as B. The two cameras view the same feature point P of the spatial object at the same time, and the image coordinates of point P are obtained on the left camera and the right camera respectively as P left =(X left ,Y left ), P right =(X right ,Y right ); According to the principle of two parallel cameras, if the two cameras are on the same plane, the Y coordinate of the feature point P on the image coordinate is the same, that is, Y left =Y right =Y, then according to the triangle similarity principle we can get: According to disparity Disparity = X left -X right , then the coordinates of the three-dimensional feature points in space are:
