# US 2022/0292645 A1 · Method for restoring video data of drainage pipe based on computer vision

> Agents: this data is available as JSON from the patentgrep API and MCP server — see https://patentgrep.com/llms.txt

- Number: US 2022/0292645 A1
- Document ID: US20220292645A1
- Status: Published application
- Kind: A1
- Application number: 17/644,152
- Filed: 2021-12-14
- Published: 2022-09-15
- Earliest claimed: 2021-03-12
- Assignees: China University of Mining and Technology, Beijing
- Applicants: China University of Mining & Technology, Beijing
- Inventors: Ce LI; Mingcun LIU; Feng YANG; Xu QIAO
- Web page: https://patentgrep.com/patent/US20220292645A1

## CPC

- G06T 5/70: Denoising; Smoothing
- F16L 55/26: Pigs or moles, i.e. devices movable in a pipe or conduit with or without self-contained propulsion means
- G06T 3/40: Scaling of whole images or parts thereof, e.g. expanding or contracting
- G06T 3/60: Rotation of whole images or parts thereof
- G06T 5/20: using local operators
- G06T 5/40: using histogram techniques
- G06T 5/94: based on local image properties, e.g. for local contrast enhancement
- G06T 7/0004: {Industrial image inspection}
- G06T 7/13: Edge detection
- G06T 7/44: using image operators, e.g. filters, edge density metrics or local histograms
- G06T 7/62: of area, perimeter, diameter or volume
- G06T 7/70: Determining position or orientation of objects or cameras (camera calibration G06T7/80)
- G06V 10/36: Applying a local operator, i.e. means to operate on image points situated in the vicinity of a given point; Non-linear local filtering operations, e.g. median filtering
- G06V 10/449: {Biologically inspired filters, e.g. difference of Gaussians [DoG] or Gabor filters}
- G06V 10/462: {Salient features, e.g. scale invariant feature transforms [SIFT]}
- G06V 10/48: by mapping characteristic values of the pattern into a parameter space, e.g. Hough transformation
- G06V 10/54: relating to texture
- F16L 2101/30: Inspecting, measuring or testing
- G06T 2207/10016: Video; Image sequence
- G06T 2207/20061: Hough transform
- G06T 2207/30108: Industrial image inspection
- G06V 2201/06: Recognition of objects for industrial automation
- G06V 2201/07: Target detection
- G06T: IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- F16L: PIPES; JOINTS OR FITTINGS FOR PIPES; SUPPORTS FOR PIPES, CABLES OR PROTECTIVE TUBING; MEANS FOR THERMAL INSULATION IN GENERAL
- G06V: IMAGE OR VIDEO RECOGNITION OR UNDERSTANDING

## Abstract

A method for restoring video data of a pipe based on computer vision is provided, including: performing gray stretching on pipe image/video collected by a pipe robot; processing noise interference by smoothing filtering; extracting an iron chain from the center of a video image as a template for location; performing target recognition on the center of video data by an SIFT corner detection algorithm; detecting ropes on left and right sides of a target by Hough transform; performing gray covering on the iron chain at the center of the video image and the ropes on two sides; and restoring data by an FMM image restoration algorithm.

## Claims

### Claim 1

A method for restoring video data of a pipe based on computer vision, comprising:
step (1): collecting image/video information of a pipe by a pipe robot with a high-definition camera entering the pipe, and performing gray stretching on the collected pipe image/video; enhancing contrast of the pipe image to make light and shade contrast of the pipe image more distinct and features more obvious; wherein a gray value f(x,y) of each pixel (x,y) in an input image is as an independent variable of a function, H denotes a transform operation performed on f(x,y) in a spatial domain to increase or reduce the gray value, to obtain a dependent variable as a gray value g(x,y) in an output image, and equation (1) is as follows:
g(x,y)=H[f(x,y)] (1)
performing spatial smoothing filtering enhancement on a gray image by using a neighborhood averaging method of a spatial domain method to eliminate jagged contours due to uneven light, local highlighting, and metal reflection caused by a point light source in a real pipe environment, wherein weight of each pixel is equal in the neighborhood averaging method, considering that importance of each pixel is assumed to be same, and equation (2) is as follows:
g
⁡
(
x
,
y
)
=
1
M
⁢
∑
i
,
j
∈
s
f
⁡
(
i
,
j
)
(
2
)
wherein, s is a set of pixel coordinates in a neighborhood of (x,y), (i,j) is coordinates of a pixel in the neighborhood and M is a number of pixels in the set s;
step (2): extracting an iron chain from a center of data as a template for target recognition, and intercepting an image of the iron chain in a center of the video data image after image preprocessing;
step (3): performing target detection on all data by using a scale-invariant feature transform (SIFT) corner detection algorithm to locate the iron chain at the center;
wherein, the scale-invariant feature transform is a description used in a field of image processing; this description is scale-invariant, which allows detection of key points in an image, and is a local feature descriptor; the scale-invariant feature transform has good stability and invariance, and is adaptable to rotation, scaling, and variable brightness, and capable of avoiding interference of variable viewing angle, affine transformation and noise to a certain extent;
the algorithm uses a Gaussian kernel function to perform filtering when constructing a scale space, so that an original image preserves most detail features, and the detail features are gradually reduced after Gaussian filtering to simulate feature representation in a large scale situation; and L(x,y,σ) is defined as a convolution operation of the original image I(x,y) and a scale-variable two-dimensional Gaussian function G(x,y,σ) and equations (3) and (4) are as follows:
G
⁡
(
x
,
y
,
σ
)
=
1
2
⁢
π
⁢
σ
2
⁢
exp
⁡
(
-
(
x
-
m
/
2
)
2
+
(
y
-
n
/
2
)
2
2
⁢
σ
2
)
(
3
)
L
⁡
(
x
,
y
,
σ
)
=
G
⁡
(
x
,
y
,
σ
)
*
I
⁡
(
x
,
y
)
(
4
)
wherein * represents the convolution operation, (x,y) represents a pixel position in an image; m, n represent dimensions of a Gaussian template; and G represents a scale space factor, a smaller value of the scale space factor means the image is smoothed less, and a corresponding scale is smaller; and a large scale corresponds to overview features of the image, while a small scale corresponds to detail features of the image;
in order to finding out extreme points based on scale invariance, it is necessary to assign a reference direction to each key point based on local features of the image, so that the descriptor is invariant to rotation of the image; and for key points detected in a difference of Gaussian (DOG) pyramid, gradient and direction distribution features of pixels in a neighborhood window of a Gaussian pyramid image in which the key points are located, are collected, wherein a module value m(x,y) and a direction θ(x,y) of the gradient are as shown in equations (5) and (6):
m
⁡
(
x
,
y
)
=
(
L
⁡
(
x
+
1
)
,
y
)
-
L
⁡
(
x
-
1
,
y
)
)
2
+
(
L
⁡
(
x
,
y
+
1
)
-
L
⁡
(
x
,
y
-
1
)
)
2
(
5
)
θ
⁡
(
x
,
y
)
=
tan
-
1
(
(
L
⁡
(
x
,
y
+
1
)
-
L
⁡
(
x
,
y
-
1
)
/
(
L
⁡
(
x
+
1
,
y
)
-
L
⁡
(
x
-
1
,
y
)
)
)
(
6
)
the algorithm uses a gradient histogram statistical method to count image pixels in a particular area with a key point as the origin to determine a direction of the key point; after completing the gradient calculation of the key points, a histogram is used to show the gradients and directions of pixels in the neighborhood, with a peak direction of the histogram representing a main direction of the key points, a peak of a direction histogram representing a direction of a neighborhood gradient at this feature point and a maximum value in the histogram being taken as the main direction of the key points; to enhance robustness of matching, only directions in which peaks are greater than 80% of the peak of the main direction are kept as auxiliary directions of the key points; and corner detection is used to perform target detection on the data;
step (4): detecting positions of ropes by using Hough transform after the position of the center of the data is obtained, wherein a main principle is as follows: all straight lines f (x)kx±b that possibly pass through each pixel point (x0,y0) at an edge are mapped into a Hough space, and then appropriate positions are selected, wherein, k represents a straight slope and b represents y-intercept; a straight line perpendicular to x-axis, which does not have the slope and cannot be expressed based on the slope, is expressed by a parametric equation r=x*cos(θ)+y*sin(θ), wherein (x,y) represents a pixel point at an edge, r represents a distance between a straight line passing through this point and the origin, and θ represents an included angle between r and positive x-axis; and voting in the Hough space after mapping of each edge point, and adding 1 to a pixel value of point (r,θ) every time a straight line equation satisfies this point;
step (5): covering positions of the iron chain and the ropes obtained through steps (3) and (4) with pixels having a gray value of 0, thereby getting ready for restoration; and
step (6): restoring the data by using Telea's fast marching method (FMM) image restoration algorithm,
wherein the fast marching restoration algorithm is a fast time-sensitive image restoration method; a basic idea of this algorithm is to start restoration from edge pixels of a damaged area, gradually march to pixels within the damaged area and finally complete a whole restoration process; several parameters are defined first as follows: Ω is defined as the damaged area of the image, and ∂Ω is defined as a boundary where the damaged area is in contact with an undamaged area; nature of fast marching is to obtain distances T between all pixel points in the damaged area Ω and the boundary ∂Ω; a sequence of marching is determined according to a magnitude of T, and restoration is continued until all pixels within Ω are processed; for a damaged point p in ∂Ω, an area Bε(p) with a width of ε on an outside of the boundary is created, and a gray value of a pixel point p in this area is calculated based on gray values of all known pixel points q according to the following equation:
Rq(p)=R(q)+εR(q)(p−q) (7)
wherein R(q) represents the gray value of the known pixel point q and ∇R(q) represents a gradient value of the known pixel point q; obviously, the gray value of the point p needs to be calculated through substitutions of parameters of all undamaged points in the area Bε(p); these undamaged pixel points in the area have different weights in the whole operation process, and the respective weights are obtained by using a weighting calculation equation (8):
R
⁡
(
p
)
=
∑
q
∈
B
ε
(
p
)
w
⁡
(
p
,
q
)
[
R
⁡
(
q
)
+
∇
R
⁡
(
q
)
⁢
(
p
-
q
)
]
∑
q
∈
B
ε
(
p
)
w
⁡
(
p
,
q
)
(
8
)
wherein w(p,q) represents a weight function for a pixel which is used to determine a contribution of each pixel in the domain Bε(p); w(p,q) refers to an iso-illuminance parameter of the damaged point P and is related to a geometric distance parameter between two points; this processing method preserves continuous texture of the data of a local area of the image to a certain extent during updating and calculation of parameters of the damaged point P; and the function is defined as equation (9):
w(p,q)=dir(p,q)*dst(p,q)*lev(p,q) (9)
wherein dir(p,q) represents a texture direction constraint, dst(p,q) represents a geometric distance constraint and lev(p,q) represents a level set constraint; dir(p,q) reflects correlation between point p and point q in the texture direction, and the two points which are more approximate in texture have a greater weight; dst(p,q) reflects correlation of a geometric distance between point p and point q, and obviously, a smaller value means that the weight is greater; and lev(p,q) ensures that the known pixel point closer to the contour of an area to be repaired at the point P contribute more to the point p;
three constraint conditions are as shown in equations (10):
dir
⁡
(
p
,
q
)
=
p
-
q

p
-
q

·
N
⁡
(
p
)
(
10
)
dst
⁡
(
p
,
q
)
=
d
0
2

p
-
q

2
lev
⁡
(
p
,
q
)
=
T
0
1
+
❘
"\[LeftBracketingBar]"
T
⁡
(
p
)
-
T
⁡
(
q
)
❘
"\[RightBracketingBar]"
wherein d0 and T0, as a distance constraint parameter and a level set constraint parameter respectively, are generally set to be 1; dir(p,q) ensures a greater contribution of a known pixel point of N=∇T when closer to a normal direction; N(p) represents the texture direction of point p; dst(p,q) ensures a greater weight of a known point closer to damaged point P in gray updating and calculation thereof; and lev(p,q) ensures a greater contribution of a known point closer to the boundary outside a same boundary ∂Ω;
wherein, a direction of an iso-illuminance curve of the FMM algorithm is updated according to a calculation of a domain T; to ensure that the restoration is started from an initial boundary ∂Ω and to eliminate interference of a large number of irrelevant internal pixels far away from the boundary, a distance domain T on two sides of the initial boundary ∂Ω needs to be calculated; the gray value of pixel point p as described above is calculated based on the known pixels in the domain Bε(p), and then a set −Tout of points outside the boundary is calculated outside the boundary area within a restricted range of T≤ε, and similarly, a set Tin of internal points relative to the boundary is calculated inside the boundary area ∂Ω, thereby defining the whole T domain and guaranteeing that the restoration calculation of FMM is performed on a narrow edge with a width of ε on an outside of the boundary ∂Ω; and the T domain of the whole image is then defined as:
T
⁡
(
p
)
=
{
T
in
(
p
)
,
p
∈
Ω
-
T
out
(
p
)
,
p
∉
Ω
(
11
)
for the value of ε of the selected domain Bε(p), 3-10 pixel points are usually selected for a good effect, thereby achieving a balance between a restoration rate and a restoration effect.
