CN111174764A - Single-camera translation system and single-camera distance measurement method - Google Patents

Single-camera translation system and single-camera distance measurement method Download PDF

Info

Publication number
CN111174764A
CN111174764A CN202010075258.3A CN202010075258A CN111174764A CN 111174764 A CN111174764 A CN 111174764A CN 202010075258 A CN202010075258 A CN 202010075258A CN 111174764 A CN111174764 A CN 111174764A
Authority
CN
China
Prior art keywords
image
point
camera
tracking
distance
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Granted
Application number
CN202010075258.3A
Other languages
Chinese (zh)
Other versions
CN111174764B (en
Inventor
刘德建
陈春雷
郭玉湖
陈宏�
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Fujian Tianquan Educational Technology Ltd
Original Assignee
Fujian Tianquan Educational Technology Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Fujian Tianquan Educational Technology Ltd filed Critical Fujian Tianquan Educational Technology Ltd
Priority to CN202010075258.3A priority Critical patent/CN111174764B/en
Publication of CN111174764A publication Critical patent/CN111174764A/en
Application granted granted Critical
Publication of CN111174764B publication Critical patent/CN111174764B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G01MEASURING; TESTING
    • G01CMEASURING DISTANCES, LEVELS OR BEARINGS; SURVEYING; NAVIGATION; GYROSCOPIC INSTRUMENTS; PHOTOGRAMMETRY OR VIDEOGRAMMETRY
    • G01C11/00Photogrammetry or videogrammetry, e.g. stereogrammetry; Photographic surveying
    • G01C11/02Picture taking arrangements specially adapted for photogrammetry or photographic surveying, e.g. controlling overlapping of pictures
    • GPHYSICS
    • G01MEASURING; TESTING
    • G01CMEASURING DISTANCES, LEVELS OR BEARINGS; SURVEYING; NAVIGATION; GYROSCOPIC INSTRUMENTS; PHOTOGRAMMETRY OR VIDEOGRAMMETRY
    • G01C11/00Photogrammetry or videogrammetry, e.g. stereogrammetry; Photographic surveying
    • G01C11/04Interpretation of pictures
    • G01C11/30Interpretation of pictures by triangulation

Landscapes

  • Engineering & Computer Science (AREA)
  • Multimedia (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Radar, Positioning & Navigation (AREA)
  • Remote Sensing (AREA)
  • Studio Devices (AREA)

Abstract

The invention discloses a single-camera translation system and a single-camera ranging method, wherein the method comprises the following steps: the camera shoots at an initial position preset on the conductor shaft to obtain a first image and a first distance corresponding to the first image; determining a designated point in the first image; controlling the camera to shoot in the process of uniform translation of the camera, and recording current data collected by the current collector during shooting to obtain more than one frame of second image and corresponding current data; respectively calculating first distances corresponding to the second images; tracking the designated point or the tracking point of the previous frame in each second image in sequence according to the photographing time to obtain the tracking point in each second image; randomly selecting two frames of images, and calculating the distance between a target to be measured and the camera according to the focal length of the camera, the abscissa value of a designated point or a tracking point in the two frames of images and the absolute value of the difference value of the first distances corresponding to the two frames of images. The invention can reduce the cost of distance measurement.

Description

Single-camera translation system and single-camera distance measurement method
Technical Field
The invention relates to the technical field of distance measurement, in particular to a single-camera translation system and a single-camera distance measurement method.
Background
The computer vision distance measurement has wide application prospect in robot, monitoring and motion sensing games. At present, a plurality of mature computer vision distance measurement products exist in the market, and the products are mainly divided into RGB binocular distance measurement, infrared structured light distance measurement and infrared TOF distance measurement. The cost of RGB distance measurement is the lowest, and only two RGB cameras are needed; structured light ranging and TOF ranging require an infrared transmitter and an infrared receiver, the former using the principle of triangulation (same RGB binocular ranging), and the latter using the time of flight of light to calculate the object distance.
Wherein, for the principle of binocular distance measurement, as shown in fig. 1, Q is a certain point on the object to be measured, ORAnd OTThe optical centers of the two cameras are respectively, the imaging points of the point Q on the photoreceptors of the two cameras are respectively P and P', and the corresponding abscissa is respectively XRAnd XTF is a camera focal length (the camera focal length f is a fixed parameter and can be given by a camera manufacturer or obtained by calibration in the prior art), B is a center distance of the two cameras, Z is depth information to be measured, and if the distance from the point P to the point P' is dis, then dis is equal to B- (X ═ B { (X) }R-XT) (ii) a And, since triangle QPP' and triangle QOROTSimilarly, dis/B ═ Z-f/Z is thus available; combining the above two formulas, Z ═ fB/(X) can be obtainedR-XT)。
Although the cost of RGB binocular distance measurement is the lowest, the calculation of the object distance needs to go through the necessary steps of feature point extraction and image matching, and the algorithm complexity is high.
Disclosure of Invention
The technical problem to be solved by the invention is as follows: a single-camera translation system and a single-camera ranging method are provided, which can reduce the cost of ranging.
In order to solve the technical problems, the invention adopts the technical scheme that: a single-camera translation system comprises a camera, a conductor shaft, a constant-voltage power supply, a current collector, a pulling device and an upper computer; a sliding sheet is arranged on the conductor shaft and can be arranged on the conductor shaft in a sliding mode; the camera is arranged on the slide sheet; one end of the conductor shaft is provided with a conductive wiring point, the conductive wiring point is connected with one end of the constant voltage power supply through a lead, and the sliding sheet is connected with the other end of the constant voltage power supply through a lead; the conductive connection point and the sliding sheet are respectively connected with the current collector through wires; the upper computer is respectively connected with the camera, the pulling device and the current collector; the pulling device is connected with the camera and used for pulling the camera to slide on the conductor shaft at a constant speed.
The invention also provides a single-camera ranging method based on the single-camera translation system, which comprises the following steps:
the upper computer controls a camera to shoot at an initial position preset on the conductor shaft to obtain a first image, and a first distance corresponding to the first image is obtained according to the distance between the initial position and one end, provided with the conductive wiring point, of the conductor shaft;
the upper computer determines a point to be measured in the first image to obtain a designated point;
the upper computer drives the camera to translate on the conductor shaft at a constant speed by controlling the pulling device;
the upper computer controls the camera to shoot according to a preset sampling rate in the process of uniform translation of the camera, and records current data collected by the current collector during shooting to obtain more than one frame of second image and corresponding current data;
the upper computer calculates a first distance corresponding to each second image according to current data corresponding to each second image, the preset voltage of the constant voltage power supply, the total length of the conductor shaft and the maximum resistance;
the upper computer tracks the appointed point in the first image or the tracking point in the second image of the previous frame in sequence in each second image according to the photographing time to obtain the tracking point in each second image;
the upper computer randomly selects two frames of images, wherein the images comprise a first image and a second image, and calculates the distance between the target to be measured and the camera according to the focal length of the camera, the abscissa value of the designated point or the tracking point in the two frames of images and the absolute value of the difference value of the first distance corresponding to the two frames of images.
The invention has the beneficial effects that: the conductive connection point and the slip sheet are respectively connected with two ends of a constant voltage power supply to form a loop, and the conductive connection point and the slip sheet are also respectively connected with a current collector, so that the current collector can collect current data of a conductor shaft between the conductive connection point and the slip sheet; tracking points are determined in each image as imaging points through a tracking algorithm of the characteristic points, calculation overhead of binocular ranging characteristic point extraction and image matching is avoided, and performance requirements on operating equipment are reduced; and finally, calculating the depth information to be measured according to a formula of a binocular distance measuring principle.
The invention realizes the distance measurement based on the single camera, and compared with the scheme of distance measurement by double cameras, one camera is reduced, thereby reducing the equipment cost of visual distance measurement; the point-based tracking algorithm determines the imaging points in each image, reducing the performance requirements on operating equipment.
Drawings
FIG. 1 is a schematic view of the principle of binocular range finding;
fig. 2 is a schematic structural diagram of a single-camera translation system according to a first embodiment of the present invention;
fig. 3 is a flowchart of a single-camera ranging method according to a second embodiment of the present invention.
Description of reference numerals:
1. a camera; 2. a conductor shaft; 3. a constant voltage power supply; 4. a current collector; 5. a pulling device; 6. an upper computer;
21. and (4) sliding a sheet.
Detailed Description
In order to explain technical contents, objects and effects of the present invention in detail, the following detailed description is given with reference to the accompanying drawings in conjunction with the embodiments.
The most key concept of the invention is as follows: realizing distance measurement based on a single camera; and controlling the camera to move at a constant speed in the horizontal direction, and realizing the tracking of the characteristic points in the adjacent range of the image in the horizontal direction.
Referring to fig. 2, a single-camera translation system includes a camera, a conductor shaft, a constant voltage power supply, a current collector, a pulling device, and an upper computer; a sliding sheet is arranged on the conductor shaft and can be arranged on the conductor shaft in a sliding mode; the camera is arranged on the slide sheet; one end of the conductor shaft is provided with a conductive wiring point, the conductive wiring point is connected with one end of the constant voltage power supply through a lead, and the sliding sheet is connected with the other end of the constant voltage power supply through a lead; the conductive connection point and the sliding sheet are respectively connected with the current collector through wires; the upper computer is respectively connected with the camera, the pulling device and the current collector; the pulling device is connected with the camera and used for pulling the camera to slide on the conductor shaft at a constant speed.
From the above description, the beneficial effects of the present invention are: the camera can translate at a constant speed, the distance between the position of the camera and the conductive wiring point can be accurately obtained in the translation process of the camera, and the subsequent distance measurement is convenient.
Referring to fig. 3, the present invention further provides a single-camera ranging method based on the single-camera translation system, including:
the upper computer controls a camera to shoot at an initial position preset on the conductor shaft to obtain a first image, and a first distance corresponding to the first image is obtained according to the distance between the initial position and one end, provided with the conductive wiring point, of the conductor shaft;
the upper computer determines a point to be measured in the first image to obtain a designated point;
the upper computer drives the camera to translate on the conductor shaft at a constant speed by controlling the pulling device;
the upper computer controls the camera to shoot according to a preset sampling rate in the process of uniform translation of the camera, and records current data collected by the current collector during shooting to obtain more than one frame of second image and corresponding current data;
the upper computer calculates a first distance corresponding to each second image according to current data corresponding to each second image, the preset voltage of the constant voltage power supply, the total length of the conductor shaft and the maximum resistance;
the upper computer tracks the appointed point in the first image or the tracking point in the second image of the previous frame in sequence in each second image according to the photographing time to obtain the tracking point in each second image;
the upper computer randomly selects two frames of images, wherein the images comprise a first image and a second image, and calculates the distance between the target to be measured and the camera according to the focal length of the camera, the abscissa value of the designated point or the tracking point in the two frames of images and the absolute value of the difference value of the first distance corresponding to the two frames of images.
From the above description, the equipment cost of visual ranging and the performance requirement for operating equipment can be reduced.
Further, the upper computer randomly selects two frames of images for multiple times, the distance between the target to be measured and the camera is calculated according to the focal length of the camera, the abscissa value of the designated point or the tracking point in the two frames of images and the absolute value of the difference value of the first distance corresponding to the two frames of images, the distance between the target to be measured and the camera is obtained according to multiple times of calculation, and the optimal distance is calculated.
According to the above description, the accuracy of ranging is improved by performing the optimization again through multiple ranging.
Further, the preset initial position is one end of the conductor shaft, which is provided with a conductive connection point.
Further, the upper computer calculates a first distance corresponding to each second image according to the current data corresponding to each second image, the preset voltage of the constant voltage power supply, the total length of the conductor shaft and the maximum resistance, and specifically comprises:
the upper computer calculates the resistance corresponding to each second image according to the current data corresponding to each second image and the voltage of a preset constant voltage power supply;
and respectively calculating the first distance corresponding to each second image according to the total length and the maximum resistance of the conductor shaft and the resistance corresponding to each second image.
From the above description, based on the principle that the conductor resistance is in direct proportion to the length, the distance between the shooting position of each second image on the conductor shaft and one end of the conductor shaft, which is provided with the conductive wiring point, is calculated, so that the shooting interval distance between any two frames of images can be conveniently calculated subsequently.
Further, the upper computer tracks the designated point in the first image or the tracking point in the second image of the previous frame in sequence in each second image according to the photographing time, and the tracking point in each second image is obtained specifically as follows:
sequencing the first image and each second image according to the photographing time to obtain an image sequence;
sequentially acquiring two adjacent frames of images from the image sequence, wherein the two adjacent frames of images comprise a previous frame of image and a next frame of image;
and tracking the appointed point or the tracking point in the previous frame image in the next frame image to obtain the tracking point in the next frame image.
According to the description, the imaging point corresponding to the target to be detected is determined in each image based on the tracking of the feature point, and compared with algorithms such as feature point extraction and image matching in binocular ranging, the calculation cost is lower, so that the performance requirement on operating equipment is reduced.
Further, the tracking a specified point or a tracking point in the previous frame image in the next frame image to obtain a tracking point in the next frame image specifically includes:
recording the position of a designated point or a tracking point in the previous frame image to obtain a first coordinate value;
recording a gray matrix and/or a gradient matrix corresponding to a neighborhood of a preset size of a designated point or a tracking point in the previous frame image to obtain a first gray matrix and/or a first gradient matrix;
determining a candidate point searching direction according to the translation direction of the camera;
acquiring a continuous preset number of candidate points in the candidate point searching direction of the pixel point corresponding to the first coordinate value in the next frame of image;
respectively acquiring a gray matrix and/or a gradient matrix corresponding to a neighborhood with a preset size of each candidate point;
respectively calculating Euclidean distances between the first gray matrix and/or the first gradient matrix and the gray matrix and/or the gradient matrix corresponding to each candidate point to obtain the Euclidean distances corresponding to each candidate point;
and taking the candidate point corresponding to the minimum Euclidean distance value as the tracking point in the next frame of image.
Further, the candidate point searching direction is opposite to the translation direction of the camera, and the candidate point searching direction is a horizontal left direction or a horizontal right direction.
Further, the step of calculating the euclidean distances between the first gray matrix and/or the first gradient matrix and the gray matrix and/or the gradient matrix corresponding to each candidate point respectively to obtain the euclidean distances corresponding to each candidate point specifically includes:
calculating the Euclidean distance of the gray matrix corresponding to the first gray matrix and a candidate point, and taking the Euclidean distance as the Euclidean distance corresponding to the candidate point;
or calculating the Euclidean distance of the gradient matrix corresponding to the first gradient matrix and a candidate point, and taking the Euclidean distance as the Euclidean distance corresponding to the candidate point;
or calculating the Euclidean distance of the gray matrix corresponding to the first gray matrix and a candidate point to obtain the first Euclidean distance of the candidate point; calculating the Euclidean distance of the gradient matrix corresponding to the first gradient matrix and a candidate point to obtain a second Euclidean distance of the candidate point; and adding and summing the first Euclidean distance and the second Euclidean distance of the candidate point to obtain the Euclidean distance corresponding to the candidate point.
According to the description, based on the characteristic that the camera translates at a constant speed in the horizontal direction, candidate points are selected in the adjacent range of the image in the horizontal direction, and then the candidate point with the minimum difference is selected as a tracking result based on the Euclidean distance between the neighborhood matrixes, so that the tracking point can be determined quickly and accurately.
Example one
Referring to fig. 2, a first embodiment of the present invention is: a single-camera translation system comprises a camera 1, a conductor shaft 2, a constant voltage power supply 3, a current collector 4, a pulling device 5 and an upper computer 6; a sliding piece 21 is arranged on the conductor shaft 2, and the sliding piece 21 is slidably arranged on the conductor shaft 2; the camera 1 is arranged on the slide sheet 21, so that the camera 1 is slidably arranged on the conductor shaft 2 through the slide sheet 21; one end of the conductor shaft 2 is provided with a conductive wiring point a, the conductive wiring point a is connected with one end of the constant voltage power supply 3 through a lead, and the contact b of the sliding sheet and the conductor shaft is connected with the other end of the constant voltage power supply 3 through a lead; the conductive wiring point a and the contact point b are respectively connected with the current collector 4 through wires; the pulling device 5 is connected with the camera 1 and used for pulling the camera 1 to slide on the conductor shaft 2 at a constant speed; and the upper computer 6 is respectively connected with the camera 1, the pulling device 5 and the current collector 4.
The pulling device is a power device, and the camera is driven by the pulling device and can move on the conductor shaft at a constant speed.
The conductive connection point and the slip sheet are respectively connected with two ends of a constant voltage power supply to form a loop, and meanwhile, the conductive connection point and the slip sheet are also respectively connected with a current collector, so that the current collector can collect current data of a conductor shaft between the conductive connection point and the slip sheet. Meanwhile, the voltage of the constant voltage power supply is fixed, so that the resistance of the conductor shaft between the conductive wiring point and the sliding sheet can be calculated according to a resistance calculation formula, and the distance between the conductive wiring point and the sliding sheet can be calculated by combining the total length of the conductor shaft and the maximum resistance.
Further, not shown in fig. 2, the upper computer may be further connected to a constant voltage power supply, so as to control the on and off of the constant voltage power supply, and the constant voltage power supply may also supply power to the upper computer.
Preferably, the length direction of the conductor shaft is parallel to the target to be measured and perpendicular to the shooting direction of the camera in a top plan view.
Preferably, the conductor shaft is a slide rheostat or a slide rheostat; the current collector is a current collecting board supporting a USB protocol, is connected with the upper computer through a USB interface of the upper computer, and sends collected current data to the upper computer.
This embodiment can let the camera carry out the translation at the uniform velocity on the horizontal direction, and can accurately obtain the position of camera and the distance between the electrically conductive wiring point at the in-process of camera translation, is convenient for follow-up carry out the range finding based on single camera.
Example two
Referring to fig. 3, the second embodiment of the present invention is: a single-camera ranging method is based on a single-camera translation system in the first embodiment and comprises the following steps:
s1: the upper computer controls the camera to shoot at an initial position preset on the conductor shaft to obtain a first image, and a first distance corresponding to the first image is obtained according to the distance between the initial position and one end, provided with the conductive wiring point, of the conductor shaft. Furthermore, the target to be detected can be photographed, and the target to be detected can also be photographed directly without the need of photographing.
In this embodiment, the preset initial position is an end of the conductor shaft where the conductive connection point is disposed, and at this time, the first distance corresponding to the first image is 0.
S2: and the upper computer determines a point to be measured in the first image to obtain a designated point. The designated point may be only one or a plurality of points. When the target to be detected is photographed in step S1, the designated point can be detected by using an object detection algorithm, and it is required to ensure that the camera can always photograph the target to be detected in the subsequent camera translation process; when the target to be measured is not photographed in step S1, the designated point may be a fixed point in the image, such as a central point, which is a point in the image to be measured.
S3: the upper computer drives the camera to translate on the conductor shaft at a constant speed by controlling the pulling device.
S4: and the upper computer controls the camera to shoot according to a preset sampling rate in the process of uniform translation of the camera, and records current data collected by the current collector during shooting to obtain more than one frame of second image and corresponding current data. For example, the camera may be controlled to take successive shots at a sampling rate of 30 frames per second.
S5: and the upper computer calculates a first distance corresponding to each second image according to the current data corresponding to each second image, the voltage of a preset constant voltage power supply, the total length of the conductor shaft and the maximum resistance, wherein the first distance is the distance between the shooting position of each second image on the conductor shaft and one end of the conductor shaft, which is provided with a conductive wiring point.
Specifically, according to the preset voltage of the constant voltage power supply and the current data corresponding to a second image, the resistance corresponding to the second image is calculated, namely according to Ri=U/IiPerforming calculation, wherein U is the voltage of the constant voltage power supply, IiA current, R, corresponding to the second imageiA resistance corresponding to the second image; then based on the principle that the conductor resistance is proportional to the length, according to the formula Li1=Ri×(LGeneral assembly/Rmax) Calculating the distance between the shooting position of the second image on the conductor shaft and one end of the conductor shaft provided with a conductive wiring point, wherein LGeneral assemblyTotal length of the conductor shaft, RmaxMaximum resistance of the conductor axis, Li1And the first distance is corresponding to the second image.
S6: and the upper computer tracks the appointed point in the first image or the tracking point in the second image of the previous frame in each second image in sequence according to the photographing time to obtain the tracking point in each second image.
Specifically, the first image and each second image are sequenced according to the photographing time to obtain an image sequence; sequentially acquiring two adjacent frames of images from the image sequence, wherein the two adjacent frames of images comprise a previous frame of image and a next frame of image; and tracking the appointed point or the tracking point in the previous frame image in the next frame image to obtain the tracking point in the next frame image. The tracking points in the second images of the previous frame are sequentially tracked in other second images to obtain the tracking points in other second images.
Further, since the second image is captured by the same camera during translation, the designated point can only move left and right in the image, and the Y value in the coordinate values of the tracking point is consistent with the Y value in the coordinate values of the designated point (in this embodiment, a two-dimensional rectangular coordinate system in the image is established with the upper left corner of the image as the origin, the horizontal right side as the positive direction of the X axis, and the vertical downward side as the positive direction of the Y axis), that is, the epipolar line is always a horizontal line. Therefore, the tracking algorithm can be optimized based on the characteristics so as to simplify the tracking task.
Specifically, the tracking algorithm of the present embodiment includes the following steps:
s601: and recording the position of the appointed point or the tracking point in the previous frame image to obtain a first coordinate value.
S602: recording a gray matrix and a gradient matrix corresponding to a neighborhood of a specified point or a tracking point in the previous frame image with a preset size to obtain a first gray matrix and a first gradient matrix; preferably, the gray matrix and the gradient matrix corresponding to 4 neighborhoods or 8 neighborhoods can be selected.
S603: determining a candidate point searching direction according to the translation direction of the camera; specifically, the candidate point finding direction is opposite to the translation direction of the camera. Further, since the camera is moved in the horizontal direction, the translation direction of the camera is the horizontal left direction or the horizontal right direction, and thus the candidate point searching direction is the horizontal right direction or the horizontal left direction.
S604: and acquiring continuous candidate points with preset number in the candidate point searching direction of the pixel point corresponding to the first coordinate value in the next frame of image.
For example, if the first coordinate value is (x, y), the candidate point search direction is the horizontal left direction, and the preset number is 10, the candidate points in the next frame of image are the first to tenth pixel points on the left of the pixel point with the coordinate (x, y).
S605: and respectively obtaining a gray matrix and a gradient matrix corresponding to the neighborhood of the preset size of each candidate point. The neighborhood size here coincides with that in step S602.
S606: and respectively calculating the Euclidean distance corresponding to each candidate point according to the first gray matrix and the first gradient matrix and the gray matrix and the gradient matrix corresponding to each candidate point.
Specifically, the euclidean distance between the first gray matrix and the gray matrix corresponding to each candidate point can be respectively calculated and used as the euclidean distance corresponding to each candidate point; or respectively calculating the Euclidean distance between the first gradient matrix and the gradient matrix corresponding to each candidate point as the Euclidean distance corresponding to each candidate point; the Euclidean distance of the same candidate point calculated by the two modes can be weighted and summed to be used as the final Euclidean distance of the same candidate point.
S607: and taking the candidate point corresponding to the minimum Euclidean distance value as the tracking point in the next frame of image. Namely, the candidate point with the minimum difference is selected as the tracking result.
Further, as can be seen from the principle of binocular ranging and fig. 1, dis/B ═ Z-f)/Z. In this embodiment, since the length direction of the conductor axis is parallel to the target to be measured, Z is fixed, and the focal length f of the camera is fixed, and since the camera takes continuous pictures according to a fixed sampling rate, the shooting time intervals between two adjacent frames of second images are the same, so when the camera is in a uniform translation state, the shooting interval distance (B) between two adjacent frames of second images is the same, and the deviation of the tracking point in the two adjacent frames of second images is determinedAmount of displacement (dis, i.e. X)R-XT) The same is true.
And the upper computer can analyze how long the camera reaches the constant speed state after beginning to move by analyzing parameters such as the power of the pulling device, the speed of the camera during the constant speed translation, and the like, or analyze that the camera begins to be in the constant speed state when shooting a few frames of second images, thereby determining the second images shot when the camera is in the constant speed translation state from all the second images. For the determined second images, the tracking algorithm is only needed to be carried out on the first two frames of second images, and the offset of the tracking point of the two adjacent frames of images in the constant speed state is calculated according to the abscissa value of the tracking point in the two frames of second images.
Therefore, in step S604, when the upper computer determines that the camera should be in the constant speed state, the position of the tracking point is estimated in the next frame of image according to the offset, and then the position is used as the central point to obtain a continuous preset number of candidate points. At this time, the value of the preset number may be relatively small.
For example, assuming that the calculated offset of the tracking points of two adjacent frames of images in the constant speed state is 5 pixel points, the first coordinate value is (x, y), the candidate point searching direction is the horizontal left direction, and the preset number is 6, then the 5 th pixel point on the left side of the pixel point with the coordinate (x, y) is taken as the central point in the next frame of image, the continuous 6 pixel points are obtained on the left side of the pixel point with the coordinate (x, y) as candidate points, and the finally obtained candidate point is the 2 nd to 7 th pixel points on the left side of the pixel point with the coordinate (x, y), or the 3 rd to 8 th pixel points on the left side of the pixel point with the coordinate (x, y).
Further, based on the method, the method is further expanded, and when the camera is in a non-uniform speed state (namely an acceleration state), the upper computer can predict the position of a tracking point in a third frame image according to the position offset between the tracking point and a specified point in a first frame image after the tracking point in a second frame image in the image sequence is determined, and select a candidate point according to the predicted position; and then, estimating the position of the tracking point in the fourth frame image according to the offset of the tracking point in the second frame image and the third frame image, and so on. Therefore, the tracking task can be further simplified, and the efficiency is improved.
Further, when the offset of the tracking point of two adjacent frames of images for a preset number of consecutive times is consistent, the ranging is considered to be stable, and the subsequent ranging can be stopped in advance.
S7: the upper computer randomly selects two frames of images, namely two frames of images are randomly selected from the first image and each second image, and the distance between the target to be measured and the camera is calculated according to the focal length of the camera, the abscissa value of the appointed point or the tracking point in the two frames of images and the absolute value of the difference value of the first distance corresponding to the two frames of images.
Specifically, the formula Z ═ fB/(X) can be obtained from the principle of binocular rangingR-XT) Wherein Z is depth information to be measured, f is the focal length of the camera, B is the center distance of the camera during two times of shooting, and XRAnd XTAnd respectively taking values of the abscissa of the imaging point in the two frames of images. Therefore, the distance between the target to be measured and the camera can be calculated according to the formula, wherein the abscissa value of the specified point or the tracking point in the two frame images is equivalent to X in the formulaRAnd XT(ii) a And calculating the absolute value of the difference value of the first distances corresponding to the two frames of images to obtain the photographing interval distance of the two frames of images, which is equivalent to B in a formula.
Further, the step S7 is executed multiple times, and it is ensured that at least one image of the combination of two selected frames of images is inconsistent with the combination of two selected frames of images, so as to obtain multiple ranging results, and then the ranging results are preferred, for example, a mode or an average is taken, and the preferred result is used as the final ranging result.
The embodiment realizes distance measurement based on a single camera, and compared with a double-camera distance measurement scheme, the method reduces one camera, reduces the equipment cost of visual distance measurement, does not need binocular stereo calibration, and reduces algorithm complexity; based on the characteristic of camera translation, the tracking of the feature points is realized in the adjacent range of the image in the horizontal direction, the tracking task is greatly simplified, the calculation overhead of binocular ranging feature point extraction and image matching can be avoided, the performance requirement on running equipment is reduced, and the method can be run on a low-end processor or chip; and the accuracy of ranging is improved by multiple ranging and optimization.
In summary, according to the single-camera translation system and the single-camera ranging method provided by the invention, ranging is realized based on a single camera, and compared with a scheme of dual-camera ranging, one camera is reduced, so that the equipment cost of visual ranging is reduced; based on the characteristic that the camera translates at a constant speed in the horizontal direction, candidate points are selected in an adjacent range of the image in the horizontal direction, and then based on the Euclidean distance between the neighborhood matrixes, the candidate point with the minimum difference is selected as a tracking result, so that the tracking point can be determined quickly and accurately; imaging points in each image are determined based on a point tracking algorithm, so that the performance requirement on operating equipment is reduced; and the accuracy of ranging is improved by ranging for multiple times and then carrying out optimization.
The above description is only an embodiment of the present invention, and not intended to limit the scope of the present invention, and all equivalent changes made by using the contents of the present specification and the drawings, or applied directly or indirectly to the related technical fields, are included in the scope of the present invention.

Claims (9)

1. A single-camera translation system is characterized by comprising a camera, a conductor shaft, a constant-voltage power supply, a current collector, a pulling device and an upper computer; a sliding sheet is arranged on the conductor shaft and can be arranged on the conductor shaft in a sliding mode; the camera is arranged on the slide sheet; one end of the conductor shaft is provided with a conductive wiring point, the conductive wiring point is connected with one end of the constant voltage power supply through a lead, and the sliding sheet is connected with the other end of the constant voltage power supply through a lead; the conductive connection point and the sliding sheet are respectively connected with the current collector through wires; the upper computer is respectively connected with the camera, the pulling device and the current collector; the pulling device is connected with the camera and used for pulling the camera to slide on the conductor shaft at a constant speed.
2. A single-camera ranging method based on the single-camera translation system of claim 1, comprising:
the upper computer controls a camera to shoot at an initial position preset on the conductor shaft to obtain a first image, and a first distance corresponding to the first image is obtained according to the distance between the initial position and one end, provided with the conductive wiring point, of the conductor shaft;
the upper computer determines a point to be measured in the first image to obtain a designated point;
the upper computer drives the camera to translate on the conductor shaft at a constant speed by controlling the pulling device;
the upper computer controls the camera to shoot according to a preset sampling rate in the process of uniform translation of the camera, and records current data collected by the current collector during shooting to obtain more than one frame of second image and corresponding current data;
the upper computer calculates a first distance corresponding to each second image according to current data corresponding to each second image, the preset voltage of the constant voltage power supply, the total length of the conductor shaft and the maximum resistance;
the upper computer tracks the appointed point in the first image or the tracking point in the second image of the previous frame in sequence in each second image according to the photographing time to obtain the tracking point in each second image;
the upper computer randomly selects two frames of images, wherein the images comprise a first image and a second image, and calculates the distance between the target to be measured and the camera according to the focal length of the camera, the abscissa value of the designated point or the tracking point in the two frames of images and the absolute value of the difference value of the first distance corresponding to the two frames of images.
3. The single-camera ranging method according to claim 2, wherein the upper computer randomly selects two frames of images for a plurality of times, calculates a distance between the target to be measured and the camera according to a focal length of the camera, an abscissa value of a designated point or a tracking point in the two frames of images, and a difference absolute value of a first distance corresponding to the two frames of images, obtains a distance between the target to be measured and the camera according to the plurality of times of calculation, and calculates an optimal distance.
4. The single-camera ranging method of claim 2, wherein the preset initial position is an end of the conductor shaft where the conductive connection point is provided.
5. The single-camera ranging method according to claim 2, wherein the calculating, by the upper computer, the first distance corresponding to each second image according to the current data corresponding to each second image, the preset voltage of the constant voltage power supply, the total length of the conductor shaft, and the maximum resistance, specifically comprises:
the upper computer calculates the resistance corresponding to each second image according to the current data corresponding to each second image and the voltage of a preset constant voltage power supply;
and respectively calculating the first distance corresponding to each second image according to the total length and the maximum resistance of the conductor shaft and the resistance corresponding to each second image.
6. The single-camera ranging method according to claim 2, wherein the upper computer sequentially tracks the designated point in the first image or the tracking point in the second image of the previous frame in each second image according to the photographing time, and the tracking points in each second image are specifically obtained by:
sequencing the first image and each second image according to the photographing time to obtain an image sequence;
sequentially acquiring two adjacent frames of images from the image sequence, wherein the two adjacent frames of images comprise a previous frame of image and a next frame of image;
and tracking the appointed point or the tracking point in the previous frame image in the next frame image to obtain the tracking point in the next frame image.
7. The single-camera ranging method according to claim 6, wherein the tracking a specified point or a tracking point in the previous frame image in the next frame image to obtain a tracking point in the next frame image specifically comprises:
recording the position of a designated point or a tracking point in the previous frame image to obtain a first coordinate value;
recording a gray matrix and/or a gradient matrix corresponding to a neighborhood of a preset size of a designated point or a tracking point in the previous frame image to obtain a first gray matrix and/or a first gradient matrix;
determining a candidate point searching direction according to the translation direction of the camera;
acquiring a continuous preset number of candidate points in the candidate point searching direction of the pixel point corresponding to the first coordinate value in the next frame of image;
respectively acquiring a gray matrix and/or a gradient matrix corresponding to a neighborhood with a preset size of each candidate point;
respectively calculating Euclidean distances between the first gray matrix and/or the first gradient matrix and the gray matrix and/or the gradient matrix corresponding to each candidate point to obtain the Euclidean distances corresponding to each candidate point;
and taking the candidate point corresponding to the minimum Euclidean distance value as the tracking point in the next frame of image.
8. The single-camera ranging method of claim 7, wherein the candidate point finding direction is opposite to a translation direction of the camera, and the candidate point finding direction is a horizontal left direction or a horizontal right direction.
9. The single-camera ranging method according to claim 7, wherein the respective calculation of the euclidean distances of the first gray matrix and/or the first gradient matrix and the gray matrix and/or the gradient matrix corresponding to each candidate point to obtain the euclidean distances corresponding to each candidate point specifically comprises:
calculating the Euclidean distance of the gray matrix corresponding to the first gray matrix and a candidate point, and taking the Euclidean distance as the Euclidean distance corresponding to the candidate point;
or calculating the Euclidean distance of the gradient matrix corresponding to the first gradient matrix and a candidate point, and taking the Euclidean distance as the Euclidean distance corresponding to the candidate point;
or calculating the Euclidean distance of the gray matrix corresponding to the first gray matrix and a candidate point to obtain the first Euclidean distance of the candidate point; calculating the Euclidean distance of the gradient matrix corresponding to the first gradient matrix and a candidate point to obtain a second Euclidean distance of the candidate point; and adding and summing the first Euclidean distance and the second Euclidean distance of the candidate point to obtain the Euclidean distance corresponding to the candidate point.
CN202010075258.3A 2020-01-22 2020-01-22 Single-camera translation system and single-camera distance measurement method Active CN111174764B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202010075258.3A CN111174764B (en) 2020-01-22 2020-01-22 Single-camera translation system and single-camera distance measurement method

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202010075258.3A CN111174764B (en) 2020-01-22 2020-01-22 Single-camera translation system and single-camera distance measurement method

Publications (2)

Publication Number Publication Date
CN111174764A true CN111174764A (en) 2020-05-19
CN111174764B CN111174764B (en) 2022-02-11

Family

ID=70651194

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202010075258.3A Active CN111174764B (en) 2020-01-22 2020-01-22 Single-camera translation system and single-camera distance measurement method

Country Status (1)

Country Link
CN (1) CN111174764B (en)

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113034618A (en) * 2021-04-20 2021-06-25 延锋伟世通汽车电子有限公司 Method and system for measuring imaging distance of automobile head-up display
CN113556607A (en) * 2021-07-07 2021-10-26 深圳创维-Rgb电子有限公司 Watching distance reminding method, device, equipment and storage medium of smart television
CN114279410A (en) * 2021-12-02 2022-04-05 合肥晟泰克汽车电子股份有限公司 Camera ranging method

Citations (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106524889A (en) * 2016-10-21 2017-03-22 安徽沃巴弗电子科技有限公司 Pull rod linear displacement sensor

Patent Citations (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106524889A (en) * 2016-10-21 2017-03-22 安徽沃巴弗电子科技有限公司 Pull rod linear displacement sensor

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113034618A (en) * 2021-04-20 2021-06-25 延锋伟世通汽车电子有限公司 Method and system for measuring imaging distance of automobile head-up display
CN113556607A (en) * 2021-07-07 2021-10-26 深圳创维-Rgb电子有限公司 Watching distance reminding method, device, equipment and storage medium of smart television
CN114279410A (en) * 2021-12-02 2022-04-05 合肥晟泰克汽车电子股份有限公司 Camera ranging method
CN114279410B (en) * 2021-12-02 2024-02-02 合肥晟泰克汽车电子股份有限公司 Camera ranging method

Also Published As

Publication number Publication date
CN111174764B (en) 2022-02-11

Similar Documents

Publication Publication Date Title
CN111174764B (en) Single-camera translation system and single-camera distance measurement method
US10375376B2 (en) Pose estimation apparatus and vacuum cleaner system
JP4809291B2 (en) Measuring device and program
CN108028887B (en) Photographing focusing method, device and equipment for terminal
WO2016049889A1 (en) Autofocus method, device and electronic apparatus
CN108470356B (en) Target object rapid ranging method based on binocular vision
CN110969644B (en) Personnel track tracking method, device and system
CN101086604A (en) Imaging apparatus, control method of imaging apparatus, and computer program
CN110084842B (en) Servo secondary alignment method and device for robot holder
KR101347450B1 (en) Image sensing method using dual camera and apparatus thereof
CN105744138A (en) Quick focusing method and electronic equipment
TWI526879B (en) Interactive system, remote controller and operating method thereof
JP6694281B2 (en) Stereo camera and imaging system
CN112889272A (en) Depth image acquisition method, depth image acquisition device and electronic device
CN113506340A (en) Method and equipment for predicting cloud deck pose and computer readable storage medium
JP3988574B2 (en) Image processing device
JP2001266128A (en) Method and device for obtaining depth information and recording medium recording depth information obtaining program
CN111935389B (en) Shot object switching method and device, shooting equipment and readable storage medium
WO2023273427A1 (en) Speed measurement method and apparatus based on multiple cameras
JP3221384B2 (en) 3D coordinate measuring device
CN112601021B (en) Method and system for processing monitoring video of network camera
JP4584405B2 (en) 3D object detection apparatus, 3D object detection method, and recording medium
CN113066104A (en) Angular point detection method and angular point detection device
CN112804439A (en) Device and method for adaptively shooting moving target
KR20160082659A (en) Method for the three-dimensional automatic measurement of structural vibration by multi-channel sequence digital images

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant