Disclosure of Invention
The invention aims to solve the technical problems and provides a stereo vision calculation method of a single pan-tilt camera, which adopts the following technical scheme:
the stereoscopic vision computing method of the single pan-tilt camera is characterized in that the pan-tilt camera is provided with a mechanism which rotates 360 degrees horizontally and 120 degrees vertically, an image processor and a camera which acquires images are arranged inside the pan-tilt camera, the focal length of the camera is f, the image processor is used for realizing the stereoscopic vision computing method, and the stereoscopic vision computing method comprises the following steps:
(1) the image processor acquires the image of the environment through the camera to obtain an image f1(x, y), wherein x and y are pixel coordinates;
(2) the tripod head camera rotates by theta degrees in the horizontal direction, the rotation radius is L, and the image processor acquires the image of the environment through the camera to obtain an image f2(x,y);
(3) And image f1(x, y) and f2(x, y) image matching and calculating the parallax dx(i, j) Calculating the depth h (x, y) = f · θ · L/(d)x(i, j)-f·θ)。
Optionally, the image processor is configured to implement a stereo vision calculation method, where the stereo vision calculation method includes the following steps:
(1 '), the image processor acquires an environment image through the camera to obtain an image f'1(x, y), wherein x and y are pixel coordinates;
(2 '), the pan-tilt camera rotates by theta degrees in the vertical direction, the rotation radius is L, and the image processor acquires an image of the environment through the camera to obtain an image f'2(x,y);
(3 '), and an image f'1(x, y) and f'2(x, y) image matching and calculating the parallax dy(i, j) Calculating the depth h (x, y) = f · θ · L/(d)y(i, j)-f·θ)。
The implementation of the invention has the positive effects that: through the two images shot before and after the rotation of the pan-tilt camera, a stereoscopic vision system with crossed optical axes is constructed, the depth information is measured, additional equipment is avoided, the system is simplified, and useful distance information is provided for intelligent function expansion.
Detailed Description
The invention will now be further described with reference to the accompanying drawings in which:
referring to fig. 1-3, in the stereo vision calculation method of a single pan-tilt camera, the pan-tilt camera is provided with a mechanism rotating 360 degrees horizontally and 120 degrees vertically, an image processor and a camera for image acquisition are arranged inside the pan-tilt camera, and the focal length of the camera is f.
The image processor is used for realizing a stereoscopic vision calculation method, and when the pan-tilt camera needs to track a certain target or needs to determine the distance of the certain target, the stereoscopic vision calculation method can be adopted. The stereo vision calculation method comprises the following steps:
(1) the image processor acquires the image of the environment through the camera to obtain an image f1(x, y), wherein x and y are pixel coordinates;
(2) the tripod head camera rotates by theta degrees in the horizontal direction, the rotation radius is L, and the image processor acquires the image of the environment through the camera to obtain an image f2(x,y);
And (3) finishing image acquisition at two positions in the steps (1) and (2), neglecting the movement of the target, and regarding the target as a binocular stereo vision system with crossed optical axes, wherein the intersection point of the optical axes is C.
(3) And image f1(x, y) and f2(x, y) image matching and calculating the parallax dx(i, j) And calculating the depth h = f · θ · L/(d)x(i, j)-f·θ)。
First, for an image f1(x, y), establishing a ratio according to the imaging geometry:
x1/f=X1/h1
then, for the image f2(x, y), establishing a ratio according to the imaging geometry:
x2/f=X2/h2
because the target is to the optical center O1Or O2I.e. the depth is relatively large, h can be reduced1And h2And performing approximate equality processing, and combining and expressing as h, then:
x1/f=X1/h,x2/f=X2/h
the two equations are subtracted to yield:
(x1-x2)/f=(X1-X2)/h
mixing X1-X2Approximated by the length X in fig. 2, X = θ · (L + h), and d according to the approximated triangle principlex(i, j)=x1-x2Bringing into the above formula yields:
dx(i, j)/f=θ·L/h+θ
finishing to obtain:
h=f·θ·L/(dx(i, j)-f·θ)。
optionally, the image processor is configured to implement a stereo vision calculation method, where the stereo vision calculation method includes the following steps:
(1 '), the image processor acquires an environment image through the camera to obtain an image f'1(x, y), wherein x and y are pixel coordinates;
(2 '), the pan-tilt camera rotates by theta degrees in the vertical direction, the rotation radius is L, and the image processor acquires an image of the environment through the camera to obtain an image f'2(x,y);
And (1 ') and (2') finishing image acquisition at two positions, neglecting movement of the target, and regarding the target as a binocular stereo vision system with crossed optical axes, wherein the target forms parallax in the y-axis direction, and the intersection point of the optical axes is C.
(3 '), and an image f'1(x, y) and f'2(x, y) is carried outImage matching and calculating the parallax dy(i, j) And calculating the depth h = f · θ · L/(d)y(i, j)-f·θ)。
First, for image f'1(x, y), establishing a ratio according to the imaging geometry:
y1/f=Y1/h1
then, for image f'2(x, y), establishing a ratio according to the imaging geometry:
y2/f=Y2/h2
because the target is to the optical center O1Or O2I.e. the depth is relatively large, h can be reduced1And h2And performing approximate equality processing, and combining and expressing as h, then:
y1/f=Y1/h,y2/f=Y2/h
the two equations are subtracted to yield:
(y1-y2)/f=(Y1-Y2)/h
will Y1-Y2Approximately length Y in fig. 3, Y = θ · (L + h) according to the approximately triangular principle, and dy(i, j)=y1-y2Bringing into the above formula yields:
dy(i, j)/f=θ·L/h+θ
finishing to obtain:
h=f·θ·L/(dy(i, j)-f·θ)。
to sum up, this patent constructs the criss-cross stereoscopic vision system of optical axis through rotatory cloud platform camera, two images of shooting around rotatory, realizes the depth information and measures, provides useful distance information for intelligent function extension.