Self-adaptive target ROI (region of interest) positioning method of solar panel cleaning robotTechnical Field
The invention belongs to the technical field of machine vision image processing, and particularly relates to a method for a solar panel cleaning robot to perform self-adaptive positioning on a target ROI.
Background
In the modern society, with the rapid development of science and technology and economy and the continuous promotion of industrial process, the worldwide demand for energy is continuously increased, and the energy problem becomes a problem which is concerned and urgently hoped to be solved in each country. The solar energy has the advantages of high efficiency, environmental protection, low cost and the like, and is rapidly developed and widely applied in recent years. Because the photovoltaic power generation system is exposed outdoors for a long time, the transmittance of sunlight can be greatly reduced by dust and foreign matters accumulated on the solar panel, so that the power generation efficiency is reduced, and the solar panel is cleaned by removing dust regularly, which is an important task.
The current ways of dust removal cleaning of solar panels can be classified into three categories: the first type is manual cleaning. Manual cleaning requires the employment and training of a large number of professionals, coupled with work environment limitations and task specificity, resulting in low personnel availability, high maintenance costs, dead corners in the cleaning area, and incomplete cleaning. The second type is a fixed-orbit cleaning robot. The robot needs to be installed with an additional guide rail to assist the operation of the robot, so that high equipment cost and maintenance cost are increased, and the flexibility is poor. The third type is an autonomous cleaning robot. The robot can identify a working area, plan a driving path and complete a cleaning task.
Traditional robotic autonomous navigation solutions rely primarily on radar sensors. The scheme has high reliability and mature technology, but has high cost (for example, the price of the laser radar ranges from tens of thousands to hundreds of thousands), complex structure and high installation requirement, and some radars are heavy and are not suitable for being used on solar panels made of special materials. Compared with the prior art, the camera has the advantages of low cost, low power consumption, small size and convenience in installation. However, the solar panel cleaning robot has limited performance of a used processor due to reasons such as power consumption and cost, and has a wide detection range of a working area, a complex background, continuous movement and difficulty in processing a large amount of image data in real time, so that the realization of autonomous navigation by using a vision technology is a problem which is urgently needed to be solved by the solar panel cleaning robot.
Disclosure of Invention
The invention aims to provide a self-adaptive target ROI (region of interest) positioning method of a solar panel cleaning robot, which can detect a target efficiently and accurately in real time and realize autonomous navigation.
The visual solar panel cleaning robot needs to detect targets (such as panel edges, signs, two-dimensional codes and the like) in a picture in real time in the working process, judge a travelable area, adjust the self pose, analyze and execute path planning, and finish a solar panel cleaning task through autonomous navigation. The target may appear at any position in the frame and the robot needs to scan the full image to detect the target. However, the computation amount of the full-image scanning is huge, and the background is complex and constantly moving, so that the requirements on real-time performance and precision are difficult to meet. The self-adaptive target ROI positioning method provided by the invention utilizes the characteristic that the position change of a target in two frames of images is limited, integrates the detection result of the previous frame with the motion information of a sensor, compensates the position change of the target, estimates the region of interest of the target possibly appearing in the current image, reduces the detection range, avoids the interference caused by large calculation amount of the whole image scanning target and useless background regions, concentrates on the effective region, can detect the target in real time, efficiently and accurately and further realizes autonomous navigation.
The invention provides a self-adaptive target ROI positioning method of a solar panel cleaning robot, which comprises the following specific steps
Firstly, carrying out full-image detection by using a target detection algorithm, and screening a result to obtain the position of a target; the method comprises the following specific steps:
step 101: the system captures a frame of image at regular time or according to a command, if the first frame of image is not the system and a detection result is available, the step 201 is skipped;
step 102: according to the purpose of detectionAnd (5) calling a corresponding algorithm to perform full-image detection, and screening a result to obtain the position of the target. E.g. detected object B0Denoted as curt _ B0=(x0,y0,x1,y1) Wherein x is0,y0,x1,y1The coordinates of the top left and bottom right corners of the target, respectively. If the target is not detected in the frame, returning to the step 101 to wait for detecting the next frame of image;
step 103: after the system finishes processing the current image, the system updates pre _ B0=curt_B0Returning to the step 101, waiting for the next frame image to be detected;
secondly, estimating the region of interest of the target in the current image according to the target position in the previous frame image, specifically as follows:
step 201: the object B0The position in the previous frame image is pre _ B0=(x0,y0,x1,y1) Will be pre _ B0Expansion by 1.2 fold gave: ROI _ B'0=(x′0,y′0,x′1,y′1)=(x0-δx,y0-δy,x1+δx,y1+ δ y), where δ x ═ 0.6 × (x)1-x0),δy=0.6×(y1-y0) Is an intermediate variable; extended ROI _ B'0Compare pre _ B0Increase the inclusion of B in the current frame image0The detection success rate and speed are improved;
thirdly, modeling the motion state of the robot, and calculating the position change of the robot in the interval time of the two frames of images, wherein the method specifically comprises the following steps:
step 301: although the target detected by the solar panel cleaning robot is still, the movement of the robot itself causes the position of the target in the image to change, as shown in fig. 2, assuming that the target B is0Center point P at t1P with time instant mapped on image11Point, after the robot has rotated R and translated t, at t2Time of day mapping and p on image22And (4) point.
According to pre _ B0=(x0,y0,x1,y1) Calculate p1=((x0+x1)/2,(y0+y1) /2) and p) are2Is the target B to be solved0Location frame center on image 2;
step 302: object B
0The position change in the two images depends on t
1→t
2]The rotation R and translation t of the robot in the interval are large and small. Sampling IMU (inertial measurement unit) at a timing interval delta t to obtain linear acceleration a of the robot in three axial directions
x,a
y,a
zAnd angular velocities w in three directions
x,w
y,w
zThe invention describes the motion of the robot by using only a few motion parameters, and the storage space and the operation time occupied by the parameters are basically negligible, the IMU data is the sum of a real value omega, a drift value b and a Gaussian error η:
instantaneous angular velocity of movement at time t
And linear acceleration
The calculation formulas of (A) are respectively as follows:
wherein the superscripts g and a denote angular velocity and linear acceleration, respectively, and the left-hand notation w denotes the world coordinate system (the left-hand notation w appearing hereinafter denotes the same meaning, e.g. as
) And R represents a rotation angle.
Step 303: assuming that Δ t is the sampling time interval of the IMU, since the sampling frequency of the IMU is relatively high, above 100HZ, Δ t is short, so it can be assumed that the angular velocity and the linear acceleration in Δ t time remain unchanged. Combining the formula of a physical motion model:
(superscript. denotes derivative), the rotation angle R, velocity v and position p at time t + Δ t are calculated:
R(t+Δt)=R(t)Exp(ω(t)Δt)
wv(t+Δt)=wv(t)+wa(t)Δt
wp(t+Δt)=wp(t)+wa(t)Δt+0.5×wa(t)Δt2
step 304: combining the angular velocity and acceleration measurement formulas described in step 302, obtaining complete formulas of the rotation angle R at the time t + Δ t, the velocity v and the position p (where the superscript d represents a discrete value):
step 305: and calculating the motion state of the robot at the moment of the second frame of image. Since the sampling frequency of the IMU is higher than the image, it is necessary to accumulate IMU data at multiple time instants. Suppose that t is taken from the first frame image1To the second frame t2Samples j-i IMU data in between, then from t1T is obtained by accumulating j-i IMU data at moment2State value at time:
wherein the subscript j equals t2Because both correspond to the same time;
step 306: computing two frame images [ t ]1→t2]The robot motion state within the interval changes. t is t1And t2The difference between the state quantities at the instant of time, i.e. the accumulation of all rotations Δ R of the IMU between i and jijVelocity Δ vijAnd a displacement Δ pijThe calculation formula of the variation amount of (c) is as follows:
fourthly, performing motion estimation and compensation on the region of interest according to the position change of the robot; the method comprises the following specific steps:
step 401: and establishing a conversion relation between a world three-dimensional coordinate system and an image coordinate system. The real world is a three-dimensional space, and a certain point P is set to be used under a world coordinate system (x)w,yw,zw) Expressed as (u, v) in the corresponding image coordinate system, and the conversion relationship is represented by "world coordinate system ═ v>Coordinate system of camera>Physical coordinate system of image>Image pixel coordinate system ", wherein the positional relationship between the camera coordinate system and the world coordinate system is described by a rotation matrix R and a translation vector t, f denotes the camera focal length, dx,dyRespectively representing the unit size of a single pixel on an image row and a single pixel on an image column, Zc represents depth information, and the calculation formula is as follows:
step 402: change in robot attitude (Δ R) calculated in step 305ij,Δvij,Δpij) The position p of the target in the second frame image coordinate system is estimated by integrating the camera model2The formula (where K is a reference calibrated in advance, and is not described here) is as follows:
fifthly, correcting the region of interest and detecting the accurate position of the target, specifically as follows:
step 501: calculating a pixel shift amount, Δ u ═ u2-u1,Δv=v2-v1Compensating for ROI _ B'0=(x′0,y′0,x′1,y′1) Obtaining a new ROI prediction frame ROI _ B0=(x″0,y″0,x″1,y″1)=(x′0+Δu,y′0+Δv,x′1+Δu,y′1+Δv);
Step 502: compensate for said B'0=(x′0,y′0,x′1,y′1) Obtaining a new ROI estimation frame B0=(x″0,y″0,x″1,y″1)=(x′0+Δu,y′0+Δv,x′1+Δu,y′1+Δv);
Step 503: judging a new region of interest ROI _ B0And if the boundary is out of range, adjusting. If the image size is h × w, the judgment and adjustment formula is: x ″)0=min(x″0,0);y″0=min(y″0,0);x″1=max(x″1,w);y″1=max(y″1,h);
Step 504: ROI _ B "in the current picture0Executing corresponding detection algorithm in the range to obtain a target B0Accurate positioning of current _ B0=(x0,y0,x1,y1) If no target is detected, then clear pre _ B0Skipping to step 102 for full-image detection;
step 505: after the system finishes processing the current image, the system updates pre _ B0=curt_B0Returning to step 101.
The self-adaptive dynamic ROI positioning method designed by the invention utilizes the historical detection result to fuse the sensor information to compensate the motion of the target on the image, avoids the detection of large computation and useless areas of the full-image scanning target, solves the problems of low computation speed and poor real-time performance of the cleaning robot on the solar panel due to wide detection range and complex background and the problem of easy target loss in the driving process, and greatly improves the detection efficiency and stability.
Drawings
FIG. 1 is a schematic diagram of the algorithm of the present invention for locating a target ROI.
FIG. 2 is a schematic diagram of the change of an object in an image during the movement process of the present invention.
Detailed Description
In order to make the objects, technical solutions and advantages of the present invention more apparent, the following is a detailed description of the embodiments of the present invention with reference to the accompanying drawings.
Fig. 1 is a schematic diagram of an embodiment. First, sub-graph A is t1The image collected by the camera at any moment is subjected to full-image scanning by using a target detection algorithm and is screened to obtain the position of a target; t is t2Acquiring a second frame of image at a moment, and predicting the position of a target possibly existing in the sub-image B by using a result in the first frame of image; and in the sub-graph C, calculating the motion state of the robot, performing motion estimation and compensation on the image, and correcting the position in the sub-graph B. And finally, calling a target detection algorithm in the corrected region to track out the target, as shown in a subgraph D.
The first step, using target detection algorithm to detect the whole image, screening the result to obtain the position of the target, the implementation steps are as follows:
step 101: the robot system captures a frame of image at regular time or according to a command and stamps a time stamp t, and if the first frame of image is not captured and the last frame has a detection result, the robot system jumps to step 201.
102, calling a corresponding algorithm to perform full-image detection according to the target to be detected, and obtaining the position frame information of the target to be detected by a screening result, calling a sign detection algorithm in the embodiment, and screening out a target sign B according to a preset threshold value of 100-h, w-400, ceter e (100, w) ∩ (100, h)0Is denoted as curt _ B0=(x0,y0,x1,y1). Wherein h and w are respectively image height and width and x0,y0,x1,y1The coordinates of the top left and bottom right corners of the target, respectively. If the frame is not detected or any result is screened out, the process returns to step 101 to wait for the next frame of image to be detected.
Step 103: after the system has processed the current image information and the related procedures (e.g., performing path planning, position shifting), the update is performed
And then returns to step 101 to wait for the next frame image to be detected.
Secondly, estimating the interested area of the target in the current image according to the target position in the previous frame image, and implementing the following steps:
step 201: the object B0The position in the previous frame image is pre _ B0=(x0,y0,x1,y1) Will be pre _ B0Enlarging by 1.2 times to obtain ROI _ B'0=(x′0,y′0,x′1,y′1)=(x0-δx,y0-δy,x1+δx,y1+ δ y), where δ x ═ 0.6 × (x)1-x0),δy=0.6×(y1-y0). Extended ROI _ B'0Compare pre _ B0Increase the inclusion of B in the current frame image0The detection success rate and speed are improvedAnd (4) degree.
Thirdly, modeling the motion state of the robot, and calculating the position change of the robot in the interval time of the two frames of images, wherein the implementation steps are as follows:
step 301: although the target detected by the solar panel cleaning robot is stationary, the movement of the robot itself causes the position of the target in the image to change. The motion in three-dimensional space is composed of three axes, so the robot motion is described by translation in three axes and rotation around three axes, which have six degrees of freedom in total, as shown in fig. 2, and the object B0Center point P at t1P with time instant mapped on image11Point, after the robot has rotated R and translated t, at t2Time of day mapping and p on image22And (4) point. According to pre _ B0=(x0,y0,x1,y1) Calculate p1=((x0+x1)/2,(y0+y1)/2);
Step 302: object B
0The position change in the two images depends on t
1→t
2]The rotation R and translation t of the robot in the interval are large and small. In the embodiment, the IMU inertial measurement unit is used for outputting linear acceleration a of the robot along three axial directions
x,a
y,a
zAnd angular velocities w in three directions
x,w
y,w
zThe invention describes the motion of the robot by only using a few motion parameters, and the storage space and the operation time occupied by the parameters can be basically ignored, the IMU is sampled at a timing interval delta t, and the obtained data is the sum of a real value, a drift value b and a Gaussian error η:
the moving instantaneous angular velocity and linear acceleration are expressed as follows:
step 303: in this embodiment, the IMU sampling interval is set to Δ t equal to 10ms, and a physical motion model formula is combined
And calculating the rotating angle R, the speed v and the position p at the moment t + delta t, wherein the formula is as follows:
R(t+Δt)=R(t)Exp(ω(t)Δt)
wv(t+Δt)=wv(t)+wa(t)Δt
wp(t+Δt)=wp(t)+wa(t)Δt+0.5×wa(t)Δt2
step 304: in conjunction with the angular velocity and acceleration measurement equations described in step 302, the complete rotation angle R, velocity v and position p at time t + Δ t are calculated, where the superscript d represents the dispersion:
step 305: and calculating the motion state of the robot at the moment of the second frame of image. Since the sampling frequency of the IMU is higher than the image, it is necessary to accumulate IMU data at multiple time instants. Suppose that t is taken from the first frame image1To the second frame t2Samples j-i IMU data in between, then from t1T is obtained by accumulating j-i IMU data at moment2State value at time:
step 306: computing two frame images [ t ]1→t2]The robot motion state within the interval changes. t is t1And t2The difference between the state quantities at the instant of time, i.e. the accumulation of all rotations Δ R of the IMU between i and jijVelocity Δ vijAnd a displacement Δ pijThe calculation formula of the variation amount of (c) is as follows:
fourthly, motion estimation and compensation are carried out on the region of interest according to the position change of the robot, and the implementation steps are as follows:
step 401: and establishing a conversion relation between a world three-dimensional coordinate system and an image coordinate system. The real world is a three-dimensional space, and a certain point P is set to be used under a world coordinate system (x)w,yw,zw) Expressed as (u, v) in the corresponding image coordinate system, and the conversion relationship is represented by "world coordinate system ═ v>Coordinate system of camera>Physical coordinate system of image>Image pixel coordinate system ", wherein the positional relationship between the camera coordinate system and the world coordinate system is described by a rotation matrix R and a translation vector t, f denotes the camera focal length, dx,dyRespectively representing the unit size of a single pixel on an image row and a single pixel on an image column, Zc represents depth information, and the calculation formula is as follows:
step 402: using the robot pose change (Δ R) calculated in step 305ij,Δvij,Δpij) The position p of the target in the second frame image coordinate system is estimated by integrating the camera model2The formula (where K is a reference calibrated in advance, and is not described here) is as follows:
fifthly, correcting the region of interest and detecting the accurate position of the target, wherein the implementation steps are as follows:
step 501: calculating a pixel offset Δ u-u2-u1,Δv=v2-v1Compensating to the region of interest ROI _ B 'described in S21'0Obtaining a new region of interest ROI _ B0=(x″0,y″0,x″1,y″1)=(x′0+Δu,y′0+Δv,x′1+Δu,y′1+Δv);
Step 502: compensate for said B'0=(x′0,y′0,x′1,y′1) Obtaining a new ROI estimation frame B0=(x″0,y″0,x″1,y″1)=(x′0+Δu,y′0+Δv,x′1+Δu,y′1+Δv);
Step 503: judging a region of interest ROI _ B0And if the boundary is out of range, adjusting. And if the image size is h multiplied by w, judging and adjusting the mode: x ″)0=min(x″0,0);y″0=min(y″0,0);x″1=max(x″1,w);y″1=max(y″1,h);
Step 504: ROI _ B "in the current picture0Executing corresponding detection algorithm in the range to obtain a target B0Accurate positioning of current _ B0=(x0,y0,x1,y1) If no target is detectedThen clear pre _ B0Skipping to step 102 for full-image detection;
step 505: after the system finishes processing the current image, the system updates pre _ B0=cur_B0Returning to step 101.
The experimental results show that the test comparison results are shown in the following table, and it can be seen that the method of the invention is obviously improved in both accuracy and calculation efficiency.
Table 1: the recognition rate is compared with the time consumption,
| categories | Accuracy of measurement | Recall rate | Correct number of | Number of errors | Average time consumption of single frame |
| Before one | 85.00% | 70.12% | 12992 | 2292 | 81ms |
| Now it is | 98.24% | 93.32% | 15000 | 268 | 23ms |
| Lifting of | 15.58% | 33.09% | 15.46% | 88.30% | 71.60% |
The self-adaptive target ROI positioning method disclosed by the invention utilizes the characteristic that the position change of a target in two frames of images is limited, combines the detection result of the previous frame with the motion information of a sensor to compensate the position change of the target, and estimates the region of interest of the target possibly appearing in the current image, so that the detection region can be reduced by more than 50% (720P camera, 1080 multiplied by 720 resolution ratio), the average speed is improved by 70%, the background interference is reduced, and the detection precision is improved by about 15%. The invention effectively solves the problems of low operation speed, poor real-time performance and easy target loss in the moving process of the cleaning robot on the solar panel due to wide detection range and complex background.