JP2020139934A - Video distance calculation device and video distance calculation program - Google Patents

Video distance calculation device and video distance calculation program Download PDF

Info

Publication number
JP2020139934A
JP2020139934A JP2019041980A JP2019041980A JP2020139934A JP 2020139934 A JP2020139934 A JP 2020139934A JP 2019041980 A JP2019041980 A JP 2019041980A JP 2019041980 A JP2019041980 A JP 2019041980A JP 2020139934 A JP2020139934 A JP 2020139934A
Authority
JP
Japan
Prior art keywords
optical flow
distance
moving image
camera
value
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
JP2019041980A
Other languages
Japanese (ja)
Other versions
JP7157449B2 (en
Inventor
嶐一 岡
Ryuichi Oka
嶐一 岡
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.)
University of Aizu
Original Assignee
University of Aizu
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 University of Aizu filed Critical University of Aizu
Priority to US17/427,915 priority Critical patent/US20220156958A1/en
Priority to PCT/JP2019/013289 priority patent/WO2020170462A1/en
Publication of JP2020139934A publication Critical patent/JP2020139934A/en
Application granted granted Critical
Publication of JP7157449B2 publication Critical patent/JP7157449B2/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Landscapes

  • Measurement Of Optical Distance (AREA)
  • Image Analysis (AREA)

Abstract

To calculate the distance to a target object by using a video regardless of the moving direction of the video.SOLUTION: A video distance calculation device 100 includes: optical flow extraction means 104a for extracting the optical flow of M number of target objects in an image of the time T in a video taken by a camera 200; optical flow value calculation means 104b for calculating the size of the optical flow as a value qm (m=1,2, (omitted), M); and distance calculation means 104 for calculating the constants a, b as a=ZL exp((μ/(γ-μ))log(ZL/ZN)) and b=(1/(μ-γ))log(ZL/ZN), in which μ denotes the smallest value and γ denotes the largest value of the value qm of the optical flow, ZN is the shortest distance and ZL is the largest distance of the distances from M number of target objects to the camera 200, and calculating a distance Zm (m=1,2,(omitted), M), which is the distance from M number of target objects to the camera 200, by Zm=a exp(bqm).SELECTED DRAWING: Figure 1

Description

本発明は、動画像距離算出装置および動画像距離算出用プログラムに関し、より詳細には、対象物を撮影した動画像を用いて、動画像に映った対象物からカメラまでの距離を算出する動画像距離算出装置および動画像距離算出用プログラムに関する。 The present invention relates to a moving image distance calculation device and a moving image distance calculation program. More specifically, the present invention uses a moving image of an object to calculate the distance from the object reflected in the moving image to the camera. The present invention relates to an image distance calculation device and a moving image distance calculation program.

近年、車両やドローンなどの移動物体に対して、外界を撮影するためのカメラを設置することが多い。近時では、カメラで外界の様子を単に撮影するだけでなく、撮影された動画像に基づいて、車両等の自動運転に利用可能な周囲の距離情報を取得したいという要望が存在する。 In recent years, cameras for photographing the outside world are often installed on moving objects such as vehicles and drones. Recently, there is a demand not only to take a picture of the outside world with a camera, but also to acquire information on the surrounding distance that can be used for automatic driving of a vehicle or the like based on the taken moving image.

カメラで対象物を撮影し、撮影された動画像に基づいて、対象物からカメラまでの距離を算出する方法が、既に提案されている(例えば、特許文献1および特許文献2参照)。特許文献1において提案されている方法をAMP(Accumulated-Motion-Parallax)法と称し、特許文献2において提案されている方法をFMP(Frontward-Motion-Parallax)法と称する。 A method of photographing an object with a camera and calculating the distance from the object to the camera based on the captured moving image has already been proposed (see, for example, Patent Document 1 and Patent Document 2). The method proposed in Patent Document 1 is referred to as an AMP (Accumulated-Motion-Parallax) method, and the method proposed in Patent Document 2 is referred to as an FMP (Frontward-Motion-Parallax) method.

AMP法は、横方向に移動するカメラで撮影された動画像を用いて、対象物からカメラまでの距離を算出する方法である。FMP法は、前方あるいは後方に移動するカメラで撮影された動画像を用いて、対象物からカメラまでの距離を算出する方法である。AMP法やFMP法を用いることにより、一台のカメラで撮影された動画像に基づいて、撮影された対象物からカメラまでの距離を算出することができる。 The AMP method is a method of calculating the distance from an object to a camera by using a moving image taken by a camera moving in the lateral direction. The FMP method is a method of calculating the distance from an object to a camera by using a moving image taken by a camera moving forward or backward. By using the AMP method or the FMP method, the distance from the photographed object to the camera can be calculated based on the moving image captured by one camera.

特開2018−40789号公報JP-A-2018-40789 特願2017−235198号明細書Japanese Patent Application No. 2017-235198

しかしながら、AMP法は、横方向に移動するカメラで撮影された動画像を用いて、対象物までの距離を算出することを特徴とするため、横方向に移動しないカメラで撮影された動画像からは、対象物までの距離を求めることが難しいという問題があった。また、AMP法によって対象物からカメラまでの距離を算出する場合、対象物は静止している必要がある。このため、撮影された動画像に映る対象物が、移動するものである場合には、対象物からカメラまでの距離を求めることが難しいという問題があった。 However, since the AMP method is characterized in that the distance to the object is calculated using the moving image taken by the camera that moves in the lateral direction, the moving image taken by the camera that does not move in the lateral direction is used. Has a problem that it is difficult to find the distance to the object. Further, when calculating the distance from the object to the camera by the AMP method, the object needs to be stationary. Therefore, when the object reflected in the captured moving image is a moving object, there is a problem that it is difficult to obtain the distance from the object to the camera.

また、FMP法は、前方あるいは後方に移動するカメラで撮影された動画像を用いて、対象物からカメラまでの距離を算出することを特徴とするため、横方向に移動するカメラや、斜め方向に移動するカメラによって撮影された動画像からは、対象物からカメラまでの距離を求めることが難しいという問題があった。 Further, since the FMP method is characterized in that the distance from the object to the camera is calculated by using the moving image taken by the camera moving forward or backward, the camera moving in the lateral direction or the oblique direction There is a problem that it is difficult to obtain the distance from the object to the camera from the moving image taken by the camera moving to.

本発明は、上記問題に鑑みてなされたものであり、対象物を撮影するカメラの移動状態あるいは移動方向に関わらず、対象物を撮影した動画像を用いて、対象物からカメラまでの距離を算出することが可能な動画像距離算出装置および動画像距離算出用プログラムを提供することを課題とする。 The present invention has been made in view of the above problems, and the distance from the object to the camera is determined by using a moving image of the object regardless of the moving state or the moving direction of the camera that captures the object. An object of the present invention is to provide a moving image distance calculation device and a moving image distance calculation program that can be calculated.

上記課題を解決するために、本発明に係る動画像距離算出装置は、M個(M≧3)の対象物を撮影したカメラの動画像を用いて、該動画像の時刻tの画像に映るM個の前記対象物の画素から、それぞれの画素に対応するM個のoptical flowを抽出するオプティカルフロー抽出手段と、該オプティカルフロー抽出手段により抽出されたM個の前記optical flowのそれぞれの大きさを、optical flowの値q(m=1,2,・・・,M)として算出するオプティカルフロー値算出手段と、該オプティカルフロー値算出手段により算出されたM個の前記optical flowの値qのうち、前記optical flowの値が最も小さい値をμとし、前記optical flowの値が最も大きい値をγとし、M個の前記対象物から前記カメラまでのそれぞれの距離のうちで最も近い距離Zと最も遠い距離Zとを予め測定しておき、定数aおよび定数bを、
a=Z・exp((μ/(γ−μ))log(Z/Z))
b=(1/(μ−γ))log(Z/Z
により算出し、M個の前記対象物から前記カメラまでのそれぞれの距離をZ(m=1,2,・・・,M)として、当該距離Zを、前記定数aと、前記定数bと、M個の前記optical flowの値qとに基づいて、
=a・exp(bq
により算出する距離算出手段とを有することを特徴とする。
In order to solve the above problem, the moving image distance calculation device according to the present invention uses a moving image of a camera that has taken M (M ≧ 3) objects and reflects the moving image on the image at time t of the moving image. The magnitudes of the optical flow extraction means for extracting M optical flows corresponding to each pixel from the M pixels of the object and the magnitudes of the M optical flows extracted by the optical flow extraction means. The optical flow value calculating means for calculating the optical flow value q m (m = 1, 2, ..., M) and the M optical flow values q calculated by the optical flow value calculating means. Of m , the value with the smallest optical flow value is μ, the value with the largest optical flow value is γ, and the closest distance among the distances from the M objects to the camera. Z N and the farthest distance Z L are measured in advance, and the constant a and the constant b are set.
a = Z L · exp ((μ / (γ-μ)) log (Z L / Z N ))
b = (1 / (μ-γ)) log (Z L / Z N )
The distance Z m is the constant a and the constant b, where each distance from the M objects to the camera is Z m (m = 1, 2, ..., M). And based on the M values of the optical flow q m .
Z m = a · exp (bq m )
It is characterized by having a distance calculation means calculated by.

また、本発明に係る動画像距離算出用プログラムは、M個(M≧3)の対象物を撮影したカメラの動画像を用いて、該動画像に映るM個の前記対象物から前記カメラまでの距離を算出する動画像距離算出装置の動画像距離算出用プログラムであって、コンピュータに、前記動画像の時刻tの画像に映るM個の前記対象物の画素から、それぞれの画素に対応するM個のoptical flowを抽出させるオプティカルフロー抽出機能と、該オプティカルフロー抽出機能により抽出されたM個の前記optical flowのそれぞれの大きさを、optical flowの値q(m=1,2,・・・,M)として算出させるオプティカルフロー値算出機能と、該オプティカルフロー値算出機能により算出されたM個の前記optical flowの値qのうち、前記optical flowの値が最も小さい値をμとし、前記optical flowの値が最も大きい値をγとし、M個の前記対象物から前記カメラまでのそれぞれの距離のうちで最も近い距離Zと最も遠い距離Zとを予め測定しておき、定数aおよび定数bを、
a=Z・exp((μ/(γ−μ))log(Z/Z))
b=(1/(μ−γ))log(Z/Z
により算出させ、M個の前記対象物から前記カメラまでのそれぞれの距離をZ(m=1,2,・・・,M)として、当該距離Zを、前記定数aと、前記定数bと、M個の前記optical flowの値qとに基づいて、
=a・exp(bq
により算出させる距離算出機能とを実現させることを特徴とする。
Further, the moving image distance calculation program according to the present invention uses moving images of a camera that has captured M (M ≧ 3) objects, from the M objects reflected in the moving image to the camera. It is a program for calculating the moving image distance of the moving image distance calculation device that calculates the distance of the moving image, and corresponds to each pixel from the pixels of the M objects displayed in the image at time t of the moving image on the computer. The size of each of the optical flow extraction function for extracting M optical flows and the M optical flows extracted by the optical flow extraction function is set to the optical flow value q m (m = 1, 2, ... Of the optical flow value calculation function calculated as M) and the M optical flow values q m calculated by the optical flow value calculation function, the value with the smallest optical flow value is defined as μ. Let γ be the value having the largest optical flow value, and measure in advance the shortest distance Z N and the farthest distance Z L among the respective distances from the M objects to the camera. The constant a and the constant b
a = Z L · exp ((μ / (γ-μ)) log (Z L / Z N ))
b = (1 / (μ-γ)) log (Z L / Z N )
The distance Z m from each of the M objects to the camera is Z m (m = 1, 2, ..., M), and the distance Z m is the constant a and the constant b. And based on the M values of the optical flow q m .
Z m = a · exp (bq m )
It is characterized by realizing a distance calculation function that is calculated by.

また、本発明に係る動画像距離算出装置は、M個(M≧3)の対象物を撮影したカメラの動画像を用いて、該動画像の時刻tの画像における全ての画素のoptical flowを抽出する全画素オプティカルフロー抽出手段と、該全画素オプティカルフロー抽出手段により抽出された全ての画素の前記optical flowのそれぞれの大きさを、画素毎のoptical flowの値として算出する全画素オプティカルフロー値算出手段と、前記時刻tの画像に対してmean-shift法を適用することにより、前記時刻tの画像を、K個(K≧M)の領域に分割する領域分割手段と、該領域分割手段により分割されたK個の前記領域のうち、前記時刻tの画像において前記対象物が映る画素が含まれるM個の領域を抽出し、それぞれの領域毎に当該領域内の全ての画素のoptical flowの値の平均を求めることにより、M個の前記対象物に対応するそれぞれのoptical flowの値q(m=1,2,・・・,M)を算出する領域別オプティカルフロー値算出手段と、該領域別オプティカルフロー値算出手段により算出されたM個の前記optical flowの値qのうち、前記optical flowの値が最も小さい値をμとし、前記optical flowの値が最も大きい値をγとし、M個の前記対象物から前記カメラまでのそれぞれの距離のうちで最も近い距離Zと最も遠い距離Zとを予め測定しておき、定数aおよび定数bを、
a=Z・exp((μ/(γ−μ))log(Z/Z))
b=(1/(μ−γ))log(Z/Z
により算出し、M個の前記対象物から前記カメラまでのそれぞれの距離をZ(m=1,2,・・・,M)として、当該距離Zを、前記定数aと、前記定数bと、M個の前記optical flowの値qとに基づいて、
=a・exp(bq
により算出する距離算出手段とを有することを特徴とする。
Further, the moving image distance calculation device according to the present invention uses the moving images of a camera that has taken M objects (M ≧ 3) to obtain the optical flow of all the pixels in the image at time t of the moving images. All-pixel optical flow value calculated by calculating the respective sizes of the optical flow of all the pixels extracted by the all-pixel optical flow extraction means and the all-pixel optical flow extraction means as the optical flow value for each pixel. A region dividing means for dividing the image at time t into K (K ≧ M) regions by applying the mean-shift method to the calculation means and the image at time t, and the region dividing means. Of the K regions divided by, M regions including pixels in which the object is reflected in the image at the time t are extracted, and the optical flow of all the pixels in the region is extracted for each region. An optical flow value calculation means for each region that calculates the optical flow value q m (m = 1, 2, ..., M) corresponding to the M objects by calculating the average of the values of. Of the M optical flow values q m calculated by the region-specific optical flow value calculating means, the value with the smallest optical flow value is μ, and the value with the largest optical flow value is γ. Then, the shortest distance Z N and the farthest distance Z L among the respective distances from the M objects to the camera are measured in advance, and the constant a and the constant b are set.
a = Z L · exp ((μ / (γ-μ)) log (Z L / Z N ))
b = (1 / (μ-γ)) log (Z L / Z N )
The distance Z m is the constant a and the constant b, where each distance from the M objects to the camera is Z m (m = 1, 2, ..., M). And based on the M values of the optical flow q m .
Z m = a · exp (bq m )
It is characterized by having a distance calculation means calculated by.

また、本発明に係る動画像距離算出用プログラムは、M個(M≧3)の対象物を撮影したカメラの動画像を用いて、該動画像に映るM個の前記対象物から前記カメラまでの距離を算出する動画像距離算出装置の動画像距離算出用プログラムであって、コンピュータに、前記動画像の時刻tの画像における全ての画素のoptical flowを抽出させる全画素オプティカルフロー抽出機能と、該全画素オプティカルフロー抽出機能により抽出された全ての画素の前記optical flowのそれぞれの大きさを、画素毎のoptical flowの値として算出させる全画素オプティカルフロー値算出機能と、前記時刻tの画像に対してmean-shift法を適用することにより、前記時刻tの画像を、K個(K≧M)の領域に分割させる領域分割機能と、該領域分割機能により分割されたK個の前記領域のうち、前記時刻tの画像において前記対象物が映る画素が含まれるM個の領域を抽出させ、それぞれの領域毎に当該領域内の全ての画素のoptical flowの値の平均を求めさせることにより、M個の前記対象物に対応するそれぞれのoptical flowの値q(m=1,2,・・・,M)を算出させる領域別オプティカルフロー値算出機能と、該領域別オプティカルフロー値算出機能により算出されたM個の前記optical flowの値qのうち、前記optical flowの値が最も小さい値をμとし、前記optical flowの値が最も大きい値をγとし、M個の前記対象物から前記カメラまでのそれぞれの距離のうちで最も近い距離Zと最も遠い距離Zとを予め測定しておき、定数aおよび定数bを、
a=Z・exp((μ/(γ−μ))log(Z/Z))
b=(1/(μ−γ))log(Z/Z
により算出させ、M個の前記対象物から前記カメラまでのそれぞれの距離をZ(m=1,2,・・・,M)として、当該距離Zを、前記定数aと、前記定数bと、M個の前記optical flowの値qとに基づいて、
=a・exp(bq
により算出させる距離算出機能とを実現させることを特徴とする。
Further, the moving image distance calculation program according to the present invention uses moving images of a camera that has captured M (M ≧ 3) objects, from the M objects reflected in the moving image to the camera. It is a moving image distance calculation program of the moving image distance calculation device that calculates the distance of the moving image, and has an all-pixel optical flow extraction function that causes a computer to extract the optical flow of all the pixels in the image at time t of the moving image. The all-pixel optical flow value calculation function that calculates the respective magnitudes of the optical flow of all the pixels extracted by the all-pixel optical flow extraction function as the optical flow value for each pixel, and the image at the time t On the other hand, by applying the mean-shift method, a region division function for dividing the image at time t into K regions (K ≧ M) and a region division function for K regions divided by the region division function. Among them, M regions including the pixels in which the object is reflected are extracted from the image at the time t, and the average of the optical flow values of all the pixels in the region is calculated for each region. A region-specific optical flow value calculation function for calculating each optical flow value q m (m = 1, 2, ..., M) corresponding to the M objects, and a region-specific optical flow value calculation function. Of the M optical flow values q m calculated by the above, the value with the smallest optical flow value is μ, the value with the largest optical flow value is γ, and from the M objects. Of the respective distances to the camera, the shortest distance Z N and the farthest distance Z L are measured in advance, and the constant a and the constant b are set.
a = Z L · exp ((μ / (γ-μ)) log (Z L / Z N ))
b = (1 / (μ-γ)) log (Z L / Z N )
The distance Z m from each of the M objects to the camera is Z m (m = 1, 2, ..., M), and the distance Z m is the constant a and the constant b. And based on the M values of the optical flow q m .
Z m = a · exp (bq m )
It is characterized by realizing a distance calculation function that is calculated by.

動画像を用いてoptical flowを抽出する処理や、画像に対してmean-shift法を適用することにより領域分割を行う処理は、Open CV(Open Source Computer Vision Library)と呼ばれる、広く公開されたオープンソースのコンピュータビジョン向けのライブラリを利用することによって実現される。 The process of extracting an optical flow using a moving image and the process of dividing an area by applying the mean-shift method to an image are called Open CV (Open Source Computer Vision Library), which is open to the public. This is achieved by using the source computer vision library.

また、オプティカルフロー抽出手段または全画素オプティカルフロー抽出手段によって抽出されるoptical flowは、ベクトルとして求められる。従って、オプティカルフロー値算出手段または全画素オプティカルフロー値算出手段によって算出されるoptical flowの値は、optical flowのベクトルの絶対値を意味している。例えば、ベクトルが(V1,V2)の場合には、V1+V2の値の平方根を求めることによって、optical flowの値を算出することができる。 Further, the optical flow extracted by the optical flow extraction means or the all-pixel optical flow extraction means is obtained as a vector. Therefore, the optical flow value calculated by the optical flow value calculating means or the all-pixel optical flow value calculating means means the absolute value of the vector of the optical flow. For example, when the vector is (V1, V2), the optical flow value can be calculated by obtaining the square root of the value of V1 2 + V2 2 .

さらに、上述した動画像距離算出装置において、前記オプティカルフロー値算出手段は、前記オプティカルフロー抽出手段により抽出されたM個の前記optical flowの大きさの総和を算出し、それぞれの前記optical flowの大きさを前記総和で割ることによって求められた、正規化されたそれぞれのoptical flowの大きさを、前記optical flowの値q(m=1,2,・・・,M)とするものであってもよい。 Further, in the moving image distance calculation device described above, the optical flow value calculating means calculates the sum of the sizes of the M optical flows extracted by the optical flow extracting means, and the size of each optical flow. The magnitude of each normalized optical flow obtained by dividing the sum by the sum is taken as the optical flow value q m (m = 1, 2, ..., M). You may.

また、上述した動画像距離算出装置において、前記全画素オプティカルフロー値算出手段は、前記全画素オプティカルフロー抽出手段により抽出された全ての画素の前記optical flowの大きさの総和を算出し、それぞれの画素の前記optical flowの大きさを前記総和で割ることによって求められた、正規化された画素毎のoptical flowの大きさを、前記画素毎のoptical flowの値とするものであってもよい。 Further, in the moving image distance calculation device described above, the all-pixel optical flow value calculating means calculates the sum of the sizes of the optical flow of all the pixels extracted by the all-pixel optical flow extracting means, and each of them. The size of the normalized optical flow for each pixel, which is obtained by dividing the size of the optical flow of the pixels by the sum, may be used as the value of the optical flow for each pixel.

また、上述した動画像距離算出用プログラムは、前記オプティカルフロー値算出機能において、前記コンピュータに、前記オプティカルフロー抽出機能により抽出されたM個の前記optical flowの大きさの総和を算出させ、それぞれの前記optical flowの大きさを前記総和で割ることによって求められた、正規化されたそれぞれのoptical flowの大きさを、前記optical flowの値q(m=1,2,・・・,M)とするものであってもよい。 Further, in the above-mentioned moving image distance calculation program, in the optical flow value calculation function, the computer is made to calculate the sum of the sizes of the M optical flows extracted by the optical flow extraction function, respectively. The value of each optical flow obtained by dividing the magnitude of the optical flow by the sum is calculated as the value of the optical flow q m (m = 1, 2, ..., M). It may be.

さらに、上述した動画像距離算出用プログラムは、前記全画素オプティカルフロー値算出機能において、前記コンピュータに、前記全画素オプティカルフロー抽出機能により抽出された全ての画素の前記optical flowの大きさの総和を算出させ、それぞれの画素の前記optical flowの大きさを前記総和で割ることによって求められた、正規化された画素毎のoptical flowの大きさを、前記画素毎のoptical flowの値とするものであってもよい。 Further, in the moving image distance calculation program described above, in the all-pixel optical flow value calculation function, the sum of the magnitudes of the optical flow of all the pixels extracted by the all-pixel optical flow extraction function is sent to the computer. The size of the normalized optical flow for each pixel, which is calculated and obtained by dividing the size of the optical flow for each pixel by the sum, is used as the value of the optical flow for each pixel. There may be.

また、上述した動画像距離算出装置において、前記M個は、前記動画像における時刻tの画像の画素数であり、前記距離算出手段は、時刻tの前記画像の全ての画素毎に、当該画素に映る対象物から前記カメラまでの距離Zを算出するものであってもよい。 Further, in the moving image distance calculation device described above, the M elements are the number of pixels of the image at time t in the moving image, and the distance calculating means has the pixels for each pixel of the image at time t. The distance Z m from the object reflected in the camera to the camera may be calculated.

さらに、上述した動画像距離算出用プログラムにおいて、前記M個は、前記動画像における時刻tの画像の画素数であり、前記距離算出機能において、前記コンピュータに、時刻tの前記画像の全ての画素毎に、当該画素に映る対象物から前記カメラまでの距離Zを算出させるものであってもよい。 Further, in the moving image distance calculation program described above, the M elements are the number of pixels of the image at time t in the moving image, and in the distance calculation function, all the pixels of the image at time t are displayed on the computer. The distance Z m from the object reflected in the pixel to the camera may be calculated for each time.

本発明に係る動画像距離算出装置および動画像距離算出用プログラムによれば、対象物を撮影したカメラの移動状態あるいは移動方向に関わらず、対象物を撮影した動画像を用いて、対象物からカメラまでの距離を算出することが可能になる。 According to the moving image distance calculation device and the moving image distance calculation program according to the present invention, the moving image obtained by photographing the object is used from the object regardless of the moving state or the moving direction of the camera that captured the object. It becomes possible to calculate the distance to the camera.

また、本発明に係る動画像距離算出装置および動画像距離算出用プログラムによれば、正規化されたそれぞれのoptical flowの大きさを、optical flowの値q(m=1,2,・・・,M)として用いることによって、対象物からカメラまでの距離の算出を精度よく行うことが可能になる。 Further, according to the moving image distance calculation device and the moving image distance calculation program according to the present invention, the magnitude of each normalized optical flow is set to the optical flow value q m (m = 1, 2, ... By using it as M), it becomes possible to accurately calculate the distance from the object to the camera.

実施の形態に係る動画像距離算出装置の概略構成を示したブロック図である。It is a block diagram which showed the schematic structure of the moving image distance calculation apparatus which concerns on embodiment. 実施の形態に係る動画像距離算出装置のCPUが対象物までの距離を算出する処理を示したフローチャートである。It is a flowchart which showed the process which CPU of the moving image distance calculation apparatus which concerns on embodiment calculate the distance to an object. 対象物(人物群)を撮影した動画像の時刻tの画像を示した図である。It is a figure which showed the image of the time t of the moving image which photographed the object (person group). 図3に示す画像に基づいて全ての画素のoptical flowを抽出した状態を示した図である。It is a figure which showed the state which extracted the optical flow of all the pixels based on the image shown in FIG. 図3に示す画像に対してmean-shift法を適用して領域分割を行った状態を示した図である。It is a figure which showed the state which performed the region division by applying the mean-shift method to the image shown in FIG. mean-shift法により分割されたそれぞれの領域のoptical flowの平均を求めて、optical flowの平均の方向とoptical flowの値の平均の大きさとを、それぞれの領域の中心(白丸P)から伸びる線分Lの向きと長さとで示した図である。The average of the optical flow of each region divided by the mean-shift method is calculated, and the average direction of the optical flow and the average magnitude of the optical flow values are determined by the line extending from the center of each region (white circle P). It is a figure shown by the direction and length of a minute L. 動的視差に基づいて、対象物からカメラまでの距離を求める方法を説明するための幾何モデルを示した図である。It is a figure which showed the geometric model for demonstrating the method of finding the distance from an object to a camera based on dynamic parallax. 図3に示した画像の様子を、異なる視点から立体的に示した図である。It is a figure which showed the state of the image shown in FIG. 3 three-dimensionally from a different viewpoint. 上空から撮影した動画像より取得した位置情報に基づいて、都市の様子を立体的に示した図である。It is a figure which showed the state of a city three-dimensionally based on the position information acquired from the moving image taken from the sky. 走行する車両の正面をカメラで撮影した動画像を用いて、車両前方の距離情報を取得し、車両前方の様子を立体的に示した図である。It is a figure which acquired the distance information in front of a vehicle by using the moving image which took the front of the traveling vehicle with a camera, and showed the state of the front of a vehicle three-dimensionally. 室内を移動するロボットにカメラを設置し、カメラで撮影された動画像を用いて距離情報を取得し、室内の状況を立体的に示した図である。It is a figure which showed the situation in a room three-dimensionally by installing a camera on a robot moving in a room, acquiring distance information using a moving image taken by the camera.

以下、本発明に係る動画像距離算出装置の一例を示し、図面を用いて詳細に説明する。図1は、動画像距離算出装置の概略構成を示したブロック図である。動画像距離算出装置100は、記録部101と、ROM(Read Only Memory)102と、RAM(Random Access Memory)103と、CPU(Central Processing Unit:コンピュータ、オプティカルフロー抽出手段、オプティカルフロー値算出手段、距離算出手段、全画素オプティカルフロー抽出手段、全画素オプティカルフロー値算出手段、領域分割手段、領域別オプティカルフロー値算出手段)104とを有している。 Hereinafter, an example of the moving image distance calculation device according to the present invention will be shown and described in detail with reference to the drawings. FIG. 1 is a block diagram showing a schematic configuration of a moving image distance calculation device. The moving image distance calculation device 100 includes a recording unit 101, a ROM (Read Only Memory) 102, a RAM (Random Access Memory) 103, a CPU (Central Processing Unit: a computer, an optical flow extraction means, an optical flow value calculation means, and the like. It has a distance calculation means, an all-pixel optical flow extraction means, an all-pixel optical flow value calculation means, a region division means, and an area-specific optical flow value calculation means) 104.

動画像距離算出装置100には、カメラ200が接続される。カメラ200を用いることにより、周囲の様子を動画像として撮影することが可能である。カメラは、例えば、車両、飛行機、ドローンなどに搭載することが可能になっている。 A camera 200 is connected to the moving image distance calculation device 100. By using the camera 200, it is possible to capture the surrounding state as a moving image. Cameras can be mounted on vehicles, airplanes, drones, etc., for example.

カメラ200には、CCDイメージセンサやCMOSイメージセンサ等の固体撮像素子が設けられている。カメラ200で撮影された動画像は、記録部101に記録される。また、動画像距離算出装置100には、モニタ210が接続されている。 The camera 200 is provided with a solid-state image sensor such as a CCD image sensor or a CMOS image sensor. The moving image taken by the camera 200 is recorded in the recording unit 101. A monitor 210 is connected to the moving image distance calculation device 100.

記録部101には、カメラ200により撮影された動画像が記録される。より詳細には、カメラ200によって撮影された動画像が、複数のフレーム画像を時系列的に記録したデジタルデータとして、記録部101に記録される。例えば、T時間分の動画像を、カメラ200で撮影した場合を考える。カメラ200が、ΔT時間毎に1枚の割合でフレームの画像(フレーム画像)を撮影する能力がある場合、記録部101には、T/ΔT枚のフレーム画像が時系列的に記録される。 A moving image taken by the camera 200 is recorded in the recording unit 101. More specifically, the moving image taken by the camera 200 is recorded in the recording unit 101 as digital data in which a plurality of frame images are recorded in time series. For example, consider the case where a moving image for T hours is taken by the camera 200. When the camera 200 has the ability to capture a frame image (frame image) at a rate of one for each ΔT time, the recording unit 101 records T / ΔT frame images in time series.

動画像距離算出装置100あるいはカメラ200に、フレームバッファーを設けて、カメラ200で撮影された単位時間毎のフレーム画像がフレームバッファーに一時的に記録され、フレームバッファーに記録されたフレーム画像が、時系列的に記録部101に記録される構成であってもよい。また、記録部101に記録される動画像は、カメラ200によりリアルタイムに撮影された動画像には限定されず、予めカメラ200によって撮影された動画像(過去の動画像)であってもよい。 A frame buffer is provided in the moving image distance calculation device 100 or the camera 200, and the frame image for each unit time taken by the camera 200 is temporarily recorded in the frame buffer, and the frame image recorded in the frame buffer is the time. It may be configured to be sequentially recorded in the recording unit 101. Further, the moving image recorded in the recording unit 101 is not limited to the moving image taken in real time by the camera 200, and may be a moving image (past moving image) taken by the camera 200 in advance.

対象物からカメラ200までの距離を算出するために用いられる動画像は、デジタルデータで記録されるものだけには限定されない。例えば、アナログデータで記録された動画像であっても、デジタル変換処理を施すことによって、時系列的なフレーム画像として、記録部101に記録することが可能である。時系列的に記録されたフレーム画像を用いることにより、動画像距離算出装置100で距離算出処理を行うことが可能である。 The moving image used to calculate the distance from the object to the camera 200 is not limited to that recorded as digital data. For example, even a moving image recorded as analog data can be recorded in the recording unit 101 as a time-series frame image by performing a digital conversion process. By using the frame images recorded in time series, it is possible for the moving image distance calculation device 100 to perform the distance calculation process.

また、カメラ200は、周囲の景色等を動画像として撮影可能な撮影手段であれば、その種類・構成は特に限定されない。例えば、一般的なムービーカメラであってもよく、また、スマートフォン等の携帯端末に設けられるカメラであってもよい。 The type and configuration of the camera 200 is not particularly limited as long as it is a photographing means capable of capturing a surrounding landscape or the like as a moving image. For example, it may be a general movie camera, or it may be a camera provided in a mobile terminal such as a smartphone.

記録部101は、一般的なハードディスク等によって構成されている。なお、記録部101の構成は、ハードディスクだけに限定されるものではなく、フラッシュメモリ、SSD(Solid State Drive / Solid State Disk)などであってもよい。記録部101は、動画像を、時系列的な複数のフレーム画像として記録することが可能な記録媒体であるならば、具体的な構成は特に限定されない。 The recording unit 101 is composed of a general hard disk or the like. The configuration of the recording unit 101 is not limited to the hard disk, and may be a flash memory, an SSD (Solid State Drive / Solid State Disk), or the like. The specific configuration of the recording unit 101 is not particularly limited as long as it is a recording medium capable of recording a moving image as a plurality of frame images in a time series.

CPU104は、記録部101に時系列的に記録された複数のフレーム画像(動画像)に基づいて、フレーム画像(動画像)に映っている対象物からカメラ200までの距離を算出する処理を行う。CPU104は、プログラム(図2のフローチャートに基づくプログラム)に基づいて、距離算出処理を行うが、その詳細については後述する。 The CPU 104 performs a process of calculating the distance from the object reflected in the frame image (moving image) to the camera 200 based on a plurality of frame images (moving images) recorded in the recording unit 101 in time series. .. The CPU 104 performs the distance calculation process based on the program (the program based on the flowchart of FIG. 2), the details of which will be described later.

ROM102には、カメラ200からフレーム画像に映っている対象物までの距離を算出するためのプログラム等が記録される。RAM103は、CPU104の処理に利用されるワークエリアとして用いられる。 A program or the like for calculating the distance from the camera 200 to the object reflected in the frame image is recorded in the ROM 102. The RAM 103 is used as a work area used for processing the CPU 104.

実施の形態に係る動画像距離算出装置100では、プログラム(図2に示すフローチャートに基づくプログラム:動画像距離算出用プログラム)が、ROM102に記録される構成について説明する。しかしながら、プログラムが記録される記録媒体は、ROM102だけに限定されるものではなく、記録部101にプログラムを記録する構成であってもよい。 In the moving image distance calculation device 100 according to the embodiment, a configuration in which a program (a program based on the flowchart shown in FIG. 2: a moving image distance calculation program) is recorded in the ROM 102 will be described. However, the recording medium on which the program is recorded is not limited to the ROM 102, and may be configured to record the program in the recording unit 101.

モニタ210には、カメラ200で撮影された動画像や、距離算出処理により3次元的に変換された画像や動画像等(例えば、後述する図8〜図11に示す画像等)が表示される。モニタ210として、例えば、液晶ディスプレイや、CRTディスプレイなどの一般的な表示装置が用いられる。 On the monitor 210, a moving image taken by the camera 200, an image three-dimensionally converted by a distance calculation process, a moving image, and the like (for example, images shown in FIGS. 8 to 11 described later) are displayed. .. As the monitor 210, for example, a general display device such as a liquid crystal display or a CRT display is used.

次に、CPU104が、記録部101に記録された動画像(時系列的に記録されるフレーム画像)に基づいて、動画像に映った対象物からカメラ200までの距離を算出する方法について説明する。 Next, a method will be described in which the CPU 104 calculates the distance from the object reflected in the moving image to the camera 200 based on the moving image (frame image recorded in time series) recorded in the recording unit 101. ..

ユークリッド(Euclid)は、2000年以上前に、動的視差(motion parallax)という視覚的現象について論じている。動的視差による視覚的現象とは、物体が等速で動いているときに、遠くの物の方が、近くの物よりも、視覚的に動きが小さくなる現象である。動的視差による視覚的現象は、日常的に観測される。既に説明した、AMP法やFMP法では、動的視差による視覚的現象を利用して、動画像に映る対象物からカメラまでの距離を算出する。 Euclid discussed the visual phenomenon of motion parallax more than 2000 years ago. The visual phenomenon due to dynamic parallax is a phenomenon in which when an object is moving at a constant velocity, a distant object visually moves less than a near object. Visual phenomena due to dynamic parallax are routinely observed. In the AMP method and the FMP method already described, the distance from the object reflected in the moving image to the camera is calculated by using the visual phenomenon due to the dynamic parallax.

動画像距離算出装置100では、動的視差による視覚的現象を利用し、カメラで撮影された動画像を用いて、対象物からカメラ200までの距離を算出する。AMP法やFMP法では、動画像におけるいずれかの座標の画素をターゲットピクセルとして設定し、ターゲットピクセルが動画像においてどのように移動するかを求めることによって、動的視差の値を求めている。 The moving image distance calculation device 100 uses a visual phenomenon due to dynamic parallax and calculates the distance from the object to the camera 200 using the moving image taken by the camera. In the AMP method and the FMP method, a pixel at any coordinate in a moving image is set as a target pixel, and the value of dynamic parallax is obtained by finding how the target pixel moves in the moving image.

動画像距離算出装置100では、動画像に映った対象物がどのように移動したかを求める方法として、optical flowと呼ばれる技術を用いる。optical flowとは、動画像(時間的に連続する複数のフレーム画像)における対象物の動きを、ベクトルで表したものである。 The moving image distance calculation device 100 uses a technique called optical flow as a method of determining how an object reflected in a moving image has moved. The optical flow is a vector representation of the movement of an object in a moving image (a plurality of frame images that are continuous in time).

ここで、optical flowが適用される対象は、時間tにおける2次元のスカラー場である必要がある。時間tにおける2次元のスカラー場をf(x,y,t)で示す。f(x,y,t)のうち、(x,y)は画像の座標を示しており、tは時間(時刻)を示している。このように、2次元のスカラー場をf(x,y,t)と示すことにより、x,yの偏微分である∂f/∂x,∂f/∂yを計算することが可能となる。 Here, the object to which the optical flow is applied needs to be a two-dimensional scalar field at time t. The two-dimensional scalar field at time t is indicated by f (x, y, t). Of f (x, y, t), (x, y) indicates the coordinates of the image, and t indicates the time (time). By indicating the two-dimensional scalar field as f (x, y, t) in this way, it is possible to calculate ∂f / ∂x, ∂f / ∂y, which are partial derivatives of x, y. ..

optical flowは、動画像における対象物(座標)の動きであるため、optical flowを(dx/dt,dy/dt)と表すことができる。この場合、
−∂f/∂t=(∂f/∂x)(dx/dt)+(∂f/∂y)(dy/dt)
の関係式から、optical flow(dx/dt,dy/dt)を求めることが可能となる。
Since the optical flow is the movement of an object (coordinates) in a moving image, the optical flow can be expressed as (dx / dt, dy / dt). in this case,
−∂f / ∂t = (∂f / ∂x) (dx / dt) + (∂f / ∂y) (dy / dt)
It is possible to obtain the optical flow (dx / dt, dy / dt) from the relational expression of.

また、この関係式に基づいてoptical flowを求める場合には、時間tに関する偏微分∂f/∂tを用いる。このため、optical flowが適用される対象は、時間tについて偏微分の計算が可能となる条件として、画像が連続していることが必要になる。従って、optical flowの適用の対象となる時間tと座標(x,y)とを備えるスカラー場として、カメラ200で撮影される動画像(時間的に連続する複数のフレーム画像)を用いることが可能であり、動画像における対象物の動きを、optical flowとして画素単位で抽出することが可能である。 Further, when the optical flow is obtained based on this relational expression, the partial differential ∂f / ∂t with respect to the time t is used. Therefore, the object to which the optical flow is applied needs that the images are continuous as a condition that the partial differential can be calculated with respect to the time t. Therefore, it is possible to use a moving image (a plurality of frame images that are continuous in time) taken by the camera 200 as a scalar field having a time t and coordinates (x, y) to which the optical flow is applied. Therefore, it is possible to extract the movement of an object in a moving image as an optical flow in pixel units.

なお、動画像における対象物の動きには、対象物そのものが動画像内で積極的に動く場合と、カメラの動きに伴って対象物が動画像内で受動的に動かされる場合とが含まれる。従って、optical flowは、対象物の積極的な動きや、カメラの移動等に伴う対象物の受動的な動きが、ベクトルとして抽出されたものである。 The movement of the object in the moving image includes a case where the object itself actively moves in the moving image and a case where the object is passively moved in the moving image with the movement of the camera. .. Therefore, the optical flow is a vector extracted of the positive movement of the object and the passive movement of the object due to the movement of the camera or the like.

動画像よりOptical flowを抽出する場合には、コンピュータビジョン向けのライブラリを利用することができる。具体的には、Open CVと呼ばれる、広く公開されたオープンソースのコンピュータビジョン向けのライブラリを利用することによって、Optical flowを抽出することが可能である。 When extracting the optical flow from a moving image, a library for computer vision can be used. Specifically, it is possible to extract the optical flow by using a publicly available library for open source computer vision called Open CV.

図2は、動画像距離算出装置100のCPU104が、動画像からoptical flowを抽出して、動画像に映っている対象物までの距離を算出するための処理内容を示したフローチャートである。CPU104は、ROM102に記録されるプログラムを読み出し、プログラムに従って、図2に示す処理を実行する。また、既に説明したように、カメラ200によって撮影された動画像は、フレーム画像毎に記録部101に記録されている。CPU104は、記録部101に記録されたフレーム毎の動画像に基づいて、時刻tにおけるOptical flowを抽出する。 FIG. 2 is a flowchart showing a processing content for the CPU 104 of the moving image distance calculation device 100 to extract an optical flow from a moving image and calculate the distance to an object reflected in the moving image. The CPU 104 reads the program recorded in the ROM 102 and executes the process shown in FIG. 2 according to the program. Further, as described above, the moving image taken by the camera 200 is recorded in the recording unit 101 for each frame image. The CPU 104 extracts the optical flow at time t based on the moving image for each frame recorded in the recording unit 101.

図3は、カメラ200で撮影された動画像のうち、時刻tのフレーム画像を一例として示した画像である。図3に示す画像は、スクランブル交差点の様子を、ビルの高層部から撮影した様子を示している。図3に示された画像のそれぞれの画素には、赤 (Red)、緑 (Green)、青 (Blue)の3色の色情報(以下、RGB情報と称する)が付加されている。optical flowを抽出するアルゴリズムでは、「連続するフレーム画像間で対象物の画像上の明るさは変わらない」ことと、「隣接する画素は似たような動きをする」こととを前提としている。このため、各画素のRGB情報は、optical flowを抽出するために重要な要素である。 FIG. 3 is an image showing a frame image at time t as an example among the moving images taken by the camera 200. The image shown in FIG. 3 shows a state of a scrambled intersection taken from a high-rise part of a building. Color information (hereinafter referred to as RGB information) of three colors of red (Red), green (Green), and blue (Blue) is added to each pixel of the image shown in FIG. The algorithm for extracting optical flow is based on the premise that "the brightness of an object on an image does not change between consecutive frame images" and "adjacent pixels behave similarly". Therefore, the RGB information of each pixel is an important element for extracting the optical flow.

また、各画素のRGB情報に基づいてoptical flowが抽出されるため、近接する画素が同じようなRGB情報を有する場合(このような画素の集まりをテクスチャーのない状態と称する)には、optical flowによる対象物の動きの抽出が困難となる。ただし、テクスチャーのない状態に該当する部分は、例えば、アスファルト(地面)等であって、移動する対象物が存在しない部分になることが多い。従って、optical flowにより対象物の動きが検出されない場合であっても、問題等が生じにくい。 Further, since the optical flow is extracted based on the RGB information of each pixel, when adjacent pixels have similar RGB information (such a group of pixels is referred to as a state without texture), the optical flow is extracted. It becomes difficult to extract the movement of the object by. However, the portion corresponding to the state without texture is often, for example, asphalt (ground) or the like, where there is no moving object. Therefore, even if the movement of the object is not detected by the optical flow, problems and the like are unlikely to occur.

カメラ200によって、図3に示したスクランブル交差点の様子が撮影される場合、主として距離算出の対象物となるものは、交差点を移動する歩行者等の人物群である。 When the state of the scrambled intersection shown in FIG. 3 is photographed by the camera 200, the object of distance calculation is mainly a group of people such as pedestrians moving at the intersection.

CPU104は、記録部101に記録された動画像を読み出し(図2のS.1)、時刻t−2から時刻t+2までのフレーム画像(動画像)に基づいて、時刻tの画像のOptical flowを抽出する(図2のS.2)。CPU104は、プログラムに基づいて、動画像から時刻tの画像のoptical flowを抽出する処理(オプティカルフロー抽出機能、全画素オプティカルフロー抽出機能)を行うため、「オプティカルフロー抽出手段」104aや「全画素オプティカルフロー抽出手段」104d(図1参照)に該当する。 The CPU 104 reads out the moving image recorded in the recording unit 101 (S.1 in FIG. 2), and performs an optical flow of the image at time t based on the frame image (moving image) from time t-2 to time t + 2. Extract (S.2 in FIG. 2). Since the CPU 104 performs a process of extracting the optical flow of the image at time t from the moving image (optical flow extraction function, all-pixel optical flow extraction function) based on the program, the “optical flow extraction means” 104a or “all pixels” Corresponds to "optical flow extraction means" 104d (see FIG. 1).

図4は、図3に示した画像に対し、時刻tにおいて抽出されたOptical flowを重ねて表示させた画像を示している。 FIG. 4 shows an image in which the optical flow extracted at time t is superimposed on the image shown in FIG.

実施の形態に係るCPU104では、時刻t−2から時刻t+2までの動画像に基づいて、時刻tの画像のOptical flowを抽出する場合を一例として説明するが、Optical flowを抽出するための動画像は、時刻t−2から時刻t+2までの動画像には限定されない。また、Optical flowを抽出するための動画像の時間的な長さは、時刻t−2から時刻t+2までの長さに限定されず、これよりも長くても短くてもよい。例えば、対象物の動きの特徴等に応じて、それぞれの動画像のデータ区間(開始時刻と終了時刻)やその長さを変更する場合もあり得る。 In the CPU 104 according to the embodiment, a case where the optical flow of the image at time t is extracted based on the moving image from time t-2 to time t + 2 will be described as an example, but the moving image for extracting the optical flow will be described. Is not limited to moving images from time t-2 to time t + 2. Further, the temporal length of the moving image for extracting the optical flow is not limited to the length from the time t-2 to the time t + 2, and may be longer or shorter than this. For example, the data section (start time and end time) and the length of each moving image may be changed according to the characteristics of the movement of the object.

また、カメラ200によって予め撮影された動画像(過去に撮影された動画像)に基づいてOptical flowを抽出する場合には、時刻t−2から時刻t+2までの動画像に基づいて、時刻tの画像のOptical flowを抽出することが可能である。しかしながら、カメラ200により撮影された時刻tを現在の時刻として捉える場合には、時刻t+1および時刻t+2のフレーム画像(動画像)はまだ撮影されていないため、時刻tのOptical flowを抽出することが難しくなる。この場合には、例えば、時刻t−4から時刻tまでの動画像に基づいて、時刻t−2の画像のOptical flowを抽出することにより、バッチ処理を行うことなく、カメラ200による撮影を継続しながら、optical flowを時系列的に抽出することが可能となる。 Further, when the optical flow is extracted based on the moving image taken in advance by the camera 200 (moving image taken in the past), the time t is based on the moving image from time t-2 to time t + 2. It is possible to extract the optical flow of the image. However, when the time t taken by the camera 200 is captured as the current time, the frame images (moving images) of the time t + 1 and the time t + 2 have not been taken yet, so that the optical flow at the time t can be extracted. It gets harder. In this case, for example, by extracting the optical flow of the image at time t-2 based on the moving image from time t-4 to time t, shooting with the camera 200 is continued without performing batch processing. However, it is possible to extract the optical flow in chronological order.

図4に示すように、optical flowは、動画像のそれぞれの画素毎に抽出される。図4において、optical flowは線分で示されているが、Open CVのライブラリを用いて抽出される画素毎のoptical flowは、ベクトルとして求められる。図4では、各画素における対象物の移動方向を線分の向きで示し、移動距離を線分の長さで示している。画素毎に抽出されたoptical flowは、図4に示すように、様々な方向を向いている。optical flowの方向から、対象物が様々な方向に移動したと判断することができる。 As shown in FIG. 4, the optical flow is extracted for each pixel of the moving image. In FIG. 4, the optical flow is shown by a line segment, but the optical flow for each pixel extracted by using the OpenCV library is obtained as a vector. In FIG. 4, the moving direction of the object in each pixel is shown by the direction of the line segment, and the moving distance is shown by the length of the line segment. As shown in FIG. 4, the optical flow extracted for each pixel is oriented in various directions. From the direction of optical flow, it can be determined that the object has moved in various directions.

optical flowが抽出される条件は、対象物だけが移動する場合には限定されない。例えば、カメラ200が任意の方向に移動する場合や、カメラ200が静止している状態で対象物だけが移動する場合や、カメラ200および対象物の両方が移動する場合が考えられる。撮影時にカメラ200が移動した場合には、カメラ200の移動に伴って静止物が一斉に動いたようにして、動画像に記録(撮影)される。カメラ200が移動する場合に抽出された静止物のoptical flowは、カメラの移動方向および移動距離に応じて、静止物毎に一斉に抽出されるので、抽出されるoptical flowの特性によって、カメラ200が移動したか否かの判断を行うことができる。カメラ200が移動することによって静止物のoptical flowが抽出される場合には、それぞれのoptical flowの値に基づいて、後述する方法を用いることにより、カメラ200からそれぞれの静止物までの距離を求めることが可能である。一方で、カメラ200が静止している状態で対象物だけが移動する場合には、静止物のoptical flowは抽出されず、移動した対象物のoptical flowが抽出されることになる。 The conditions under which the optical flow is extracted are not limited to the case where only the object moves. For example, there may be a case where the camera 200 moves in an arbitrary direction, a case where only the object moves while the camera 200 is stationary, or a case where both the camera 200 and the object move. When the camera 200 moves during shooting, the moving objects are recorded (photographed) in a moving image as if the stationary objects moved all at once as the camera 200 moved. Since the optical flow of the stationary object extracted when the camera 200 moves is simultaneously extracted for each stationary object according to the moving direction and the moving distance of the camera, the camera 200 depends on the characteristics of the extracted optical flow. Can be determined whether or not has moved. When the optical flow of a stationary object is extracted by moving the camera 200, the distance from the camera 200 to each stationary object is obtained by using the method described later based on the value of each optical flow. It is possible. On the other hand, when only the object moves while the camera 200 is stationary, the optical flow of the stationary object is not extracted, and the optical flow of the moved object is extracted.

次に、CPU104は、抽出されたoptical flowに基づいて、optical flowの大きさを示すoptical flowの値を算出する(図2のS.3)。CPU104は、プログラムに基づいて、optical flowの大きさを、optical flowの値として算出する処理(オプティカルフロー値算出機能、全画素オプティカルフロー値算出機能)を行うため、「オプティカルフロー値算出手段」104bや「全画素オプティカルフロー値算出手段」104e(図1参照)に該当する。 Next, the CPU 104 calculates the value of the optical flow indicating the magnitude of the optical flow based on the extracted optical flow (S.3 in FIG. 2). Since the CPU 104 performs a process of calculating the magnitude of the optical flow as an optical flow value (optical flow value calculation function, all-pixel optical flow value calculation function) based on the program, the “optical flow value calculation means” 104b. Or "All-pixel optical flow value calculation means" 104e (see FIG. 1).

optical flowはベクトルで表されるため、optical flowの値は、ベクトルの大きさ(ベクトルの絶対値)によって算出される。例えば、optical flowのベクトルを(V1,V2)とすると、V1の2乗の値(V1)とV2の2乗の値(V2)との和の値(V1+V2)を求めて、求められた和の値(V1+V2)の平方根を計算することによって、optical flowの値が算出される。 Since optical flow is represented by a vector, the value of optical flow is calculated by the magnitude of the vector (absolute value of the vector). For example, when the vector of Optical flow and (V1, V2), seeking the value (V1 2 + V2 2) of the sum of the square of the value (V1 2) and the square of the value of V2 of V1 (V2 2) , The value of optical flow is calculated by calculating the square root of the obtained sum value (V1 2 + V2 2 ).

動画像距離算出装置100のCPU104では、算出されたoptical flowの値を、動的視差として捉えて対象物からカメラ200までの距離を算出する。このため、静止物(静止した対象物)によって算出されたoptical flowの値も、移動する対象物によって算出されたoptical flowの値も、動的視差と捉えることにより、同じものと判断することができる。 The CPU 104 of the moving image distance calculation device 100 captures the calculated optical flow value as dynamic parallax and calculates the distance from the object to the camera 200. Therefore, the optical flow value calculated by a stationary object (stationary object) and the optical flow value calculated by a moving object can be judged to be the same by regarding them as dynamic parallax. it can.

また、カメラ200と対象物との両方が動く場合には、カメラ200の動きに対して対象物の動きが大きい場合であっても、対象物の動きに対してカメラ200の動きが大きい場合であっても、それぞれのoptical flowを抽出することができる。従って、後述する動的視差を用いた距離計算によって、対象物からカメラ200までの距離を算出することができる。 Further, when both the camera 200 and the object move, even if the movement of the object is large with respect to the movement of the camera 200, the movement of the camera 200 is large with respect to the movement of the object. Even if there is, each optical flow can be extracted. Therefore, the distance from the object to the camera 200 can be calculated by the distance calculation using the dynamic parallax described later.

しかしながら、カメラ200と対象物との動きが同じ方向に同程度動く場合には、対象物のoptical flowを抽出することが困難となる。このため、カメラ200と同じ方向に同程度動いた対象物に関しては、対象物からカメラ200までの距離を算出することが難しい。一方で、カメラ200と反対方向に対象物が動く場合、例えば、カメラ200を設置した自車両が前方に移動する状況で、対向車が自車両の方に向かって移動する状態を撮影した場合には、対向車のoptical flowの値が、自車両の速度と対向車の速度との加算により大きな値になる。この場合には、optical flowの値に基づいて求められる、対向車からカメラ200までの距離が、実際の距離よりも近い距離として算出されてしまう。 However, when the movements of the camera 200 and the object move in the same direction to the same extent, it becomes difficult to extract the optical flow of the object. For this reason, it is difficult to calculate the distance from the object to the camera 200 for an object that has moved to the same extent as the camera 200. On the other hand, when the object moves in the opposite direction to the camera 200, for example, when the own vehicle on which the camera 200 is installed moves forward and the oncoming vehicle moves toward the own vehicle. The value of the optical flow of the oncoming vehicle becomes a large value by adding the speed of the own vehicle and the speed of the oncoming vehicle. In this case, the distance from the oncoming vehicle to the camera 200, which is obtained based on the value of optical flow, is calculated as a distance closer than the actual distance.

このように、近づいてくる対向車のoptical flowの値により求められる距離が、実際の対向車からカメラ200までの距離よりも近くなってしまう場合には、この傾向を考慮して、周辺の静止物により算出されるoptical flowの値と、近づいてくる対象物のoptical flowの値とを比較することによって、対向車等の同定を行うことが可能である。 In this way, when the distance obtained from the optical flow value of the approaching oncoming vehicle is closer than the actual distance from the oncoming vehicle to the camera 200, this tendency is taken into consideration and the surrounding area is stationary. By comparing the optical flow value calculated by the object with the optical flow value of the approaching object, it is possible to identify the oncoming vehicle or the like.

図4に示されたoptical flowを確認すると、人物群(歩行者等)のような移動する対象物だけでなく、静止物に対してもoptical flowの抽出が行われている。このため時刻t−2から時刻t+2までの動画像では、カメラ200と対象物(人物群)との両方が動いていることが確認できる。しかしながら、optical flowを抽出するために用いた動画像では、カメラ200の動きに比べて人物群の動きの方が大きいため、optical flowは主として人物群の動きによって生じていると判断できる。 When the optical flow shown in FIG. 4 is confirmed, the optical flow is extracted not only for moving objects such as a group of people (pedestrians and the like) but also for stationary objects. Therefore, in the moving image from time t-2 to time t + 2, it can be confirmed that both the camera 200 and the object (person group) are moving. However, in the moving image used for extracting the optical flow, the movement of the person group is larger than the movement of the camera 200, so it can be determined that the optical flow is mainly caused by the movement of the person group.

一般的に、動画像からoptical flowを抽出する場合には、極めて短い時間の動画像を用いて抽出処理を行う。従って、極端にカメラ200の動きが大きい場合、つまり、極めて短い時間の間にフレーム画像の撮影範囲が大きく変化する場合には、カメラ200の動きに対して対象物の動きが小さくなる。また、フレーム画像の撮影範囲が大きく変化しない場合には、カメラ200の動きに対して対象物の動きの方が大きくなり、動画像より抽出されたoptical flowは、対象物(人物群)の動きによって生じたものと判断することができる。 Generally, when extracting an optical flow from a moving image, the extraction process is performed using the moving image for an extremely short time. Therefore, when the movement of the camera 200 is extremely large, that is, when the shooting range of the frame image changes significantly in an extremely short time, the movement of the object becomes smaller than the movement of the camera 200. Further, when the shooting range of the frame image does not change significantly, the movement of the object becomes larger than the movement of the camera 200, and the optical flow extracted from the moving image is the movement of the object (person group). It can be judged that it was caused by.

実施の形態に係るCPU104では、各時刻tにおいて、時刻t−2から時刻t+2までの動画像に基づいてoptical flowを抽出しているが、既に説明したように、この動画像の長さ(開始時刻から終了時刻までの間隔)は、任意に設定・変更することが可能である。この動画像の長さを調整することによって、効果的に対象物の動きをoptical flowとして抽出することが可能になる。 In the CPU 104 according to the embodiment, the optical flow is extracted based on the moving image from the time t-2 to the time t + 2 at each time t, but as described above, the length of this moving image (start). The interval from the time to the end time) can be set and changed arbitrarily. By adjusting the length of this moving image, it is possible to effectively extract the movement of the object as an optical flow.

また、カメラ200の動きに伴って動画像の道路や道路の白線などの表示状態が変化する場合には、この変化に伴って道路や白線等のoptical flowが抽出される。道路などはテクスチャーのない状態(近接する画素が同じようなRGB情報を有する場合)に該当することが多いため、算出されるoptical flowの値は比較的小さくなる傾向がある。optical flowの値が小さい場合には、後述する対象物からカメラまでの距離算出処理によって算出される距離が、大きく(遠く)なる。一方で、人物群のように積極的に動く対象物により算出されるoptical flowの値は、道路などで算出されるoptical flowの値よりも大きくなる傾向があり、optical flowの値が大きい場合には、対象物からカメラまでの距離が小さく(近く)なる。 Further, when the display state of the road or the white line of the moving image changes with the movement of the camera 200, the optical flow of the road or the white line is extracted with this change. Since roads and the like often correspond to a state without texture (when adjacent pixels have similar RGB information), the calculated optical flow value tends to be relatively small. When the value of optical flow is small, the distance calculated by the distance calculation process from the object to the camera, which will be described later, becomes large (far). On the other hand, the value of optical flow calculated by an object that actively moves such as a group of people tends to be larger than the value of optical flow calculated by a road or the like, and when the value of optical flow is large. Makes the distance from the object to the camera smaller (closer).

従って、対象物からカメラ200までの距離に所定の閾値を設定し、算出された距離が閾値よりも大きいか小さいかを判断することによって、抽出されたoptical flowが歩行者等の対象物の動きに対応するものであるか、カメラ200の動きに伴う道路等の動きに対応するものであるかを判別することが可能である。但し、optical flowの値の大きさや、閾値に対する大小だけを用いて、全ての歩行者等の対象物を一律に抽出することは難しい。このため、撮影された対象物の動きやカメラの撮影範囲等に応じて柔軟に閾値等を設定して、対象物の検出精度を高めることが好ましい。 Therefore, by setting a predetermined threshold value for the distance from the object to the camera 200 and determining whether the calculated distance is larger or smaller than the threshold value, the extracted optical flow is the movement of the object such as a pedestrian. It is possible to determine whether the camera 200 corresponds to the movement of the road or the like accompanying the movement of the camera 200. However, it is difficult to uniformly extract all objects such as pedestrians by using only the magnitude of the optical flow value and the magnitude with respect to the threshold value. Therefore, it is preferable to flexibly set the threshold value and the like according to the movement of the photographed object, the shooting range of the camera, and the like to improve the detection accuracy of the object.

次に、動画像距離算出装置100のCPU104は、時刻tの画像に対してmean-shift法(中間値シフト法)を適用することにより、画像の領域分割処理を行う(図2のS.4)。CPU104は、プログラムに基づいて、対象物に対応する領域に画像を分割する処理(領域分割機能)を行うため、「領域分割手段」104f(図1参照)に該当する。図5は、図3に示した時刻tの画像に対してmean-shift法を適用した結果を示した図である。 Next, the CPU 104 of the moving image distance calculation device 100 performs the image region division processing by applying the mean-shift method (intermediate value shift method) to the image at time t (S.4 in FIG. 2). ). Since the CPU 104 performs a process of dividing an image into an area corresponding to an object (area division function) based on a program, it corresponds to the "area division means" 104f (see FIG. 1). FIG. 5 is a diagram showing the result of applying the mean-shift method to the image at time t shown in FIG.

mean-shift法(中間値シフト法)は、既存の領域分割手法のうち最も有力な手法の一つとして知られている。mean-shift法は、広く知られた領域分割手法であって、Open CVと呼ばれる、広く公開されたオープンソースのコンピュータビジョン向けのライブラリを利用することによって実現される。mean-shift法を時刻tの画像(フレーム画像)に適用することにより、画像の画素毎のRGB値(色情報)などに基づき、対象物等の有無に応じて画像の領域分割が行われる。分割された領域のうち同一領域と判断される部分については、カメラからの距離がほぼ等しいと解釈することができる。 The mean-shift method (median shift method) is known as one of the most promising methods among existing area division methods. The mean-shift method is a well-known area division method, and is realized by using a widely open library for computer vision called Open CV. By applying the mean-shift method to an image (frame image) at time t, the area of the image is divided according to the presence or absence of an object or the like based on the RGB value (color information) for each pixel of the image. It can be interpreted that the distances from the camera are almost the same for the portions of the divided regions that are determined to be the same region.

mean-shift法では、様々なパラメータを設定することが可能であり、パラメータの設定値の調整を行うことにより、分割領域の大きさを調整することが可能である。パラメータの設定値を適切に設定することにより、歩行者等の人物が、一つの分割領域あたり一人だけになるように調整することが可能である。 In the mean-shift method, various parameters can be set, and the size of the divided area can be adjusted by adjusting the set values of the parameters. By appropriately setting the parameter setting values, it is possible to adjust so that there is only one person such as a pedestrian per divided area.

例えば、カメラ200からの距離を算出する対象物がM個(M≧3)ある場合、パラメータを適切に設定し、分割領域が比較的小さくなるように調整することにより、時刻tの画像を、M個の対象物に対応する領域を含むK個(K≧M)の領域に分割することが可能である。ただし、パラメータを設定することによって、分割領域の大きさを大きくしたり、小さくしたりすることは可能であるが、分割領域の数Kは、結果として画像に依存する。このため、パラメータを設定することによって、分割領域の大きさを調整し、分割領域の数の増減の調整を行うことはできても、分割領域の数が予め決められた数になるように、パラメータを設定することは難しい。 For example, when there are M objects (M ≧ 3) for which the distance from the camera 200 is calculated, the image at time t can be obtained by appropriately setting the parameters and adjusting so that the divided area becomes relatively small. It is possible to divide into K (K ≧ M) regions including regions corresponding to M objects. However, although it is possible to increase or decrease the size of the divided area by setting the parameters, the number K of the divided areas depends on the image as a result. Therefore, although it is possible to adjust the size of the divided area and adjust the increase or decrease in the number of divided areas by setting the parameters, the number of divided areas is set to a predetermined number. It is difficult to set the parameters.

図5に示した、mean-shift法を適用した画像では、パラメータを適切に設定することによって、結果として、歩行者の一人一人に対応するように、領域境界を示す線分が形成された場合が示されている。また、横断歩道等もテクスチャーが存在するため、横断歩道の白線に対応するようにして、領域境界を示す線分が形成されている。一方で、交差点のアスファルト部分は、テクスチャーのない状態である。このため、アスファルト部分等には、領域境界を示す線分があまり形成されておらず、比較的大きな領域として示されている。 In the image to which the mean-shift method is applied shown in FIG. 5, when the parameters are set appropriately, as a result, a line segment indicating the region boundary is formed so as to correspond to each pedestrian. It is shown. Further, since the pedestrian crossing and the like also have a texture, a line segment indicating the region boundary is formed so as to correspond to the white line of the pedestrian crossing. On the other hand, the asphalt part of the intersection is in a state without texture. For this reason, a line segment indicating a region boundary is not formed so much in the asphalt portion or the like, and is shown as a relatively large region.

次に、CPU104は、mean-shift法によって領域分割された領域毎に、それぞれの領域内で求められたoptical flowの値の平均を算出する(図2のS.5)。CPU104は、プログラムに基づいて、領域分割された領域毎に、optical flowの値の平均を算出する処理(領域別オプティカルフロー値算出機能)を行うため、「領域別オプティカルフロー値算出手段」104g(図1参照)に該当する。 Next, the CPU 104 calculates the average of the optical flow values obtained in each area for each area divided by the mean-shift method (S.5 in FIG. 2). Since the CPU 104 performs a process of calculating the average of the optical flow values for each region divided region based on the program (region-specific optical flow value calculation function), the "region-specific optical flow value calculation means" 104 g ( (See Fig. 1).

mean-shift法では、画像の画素毎のRGB値(色情報)などに基づいて、対象物等の有無に応じた領域分割が行われる。特に、mean-shift法のパラメータを適切に設定することにより、歩行者等の人物が一つの分割領域あたり一人になるように、分割を行うことが可能である。分割領域毎に、optical flowの値の平均を求めることにより、分割領域に存在する歩行者等のoptical flowの値を、正規化することが可能となる。 In the mean-shift method, region division is performed according to the presence or absence of an object or the like based on the RGB value (color information) for each pixel of the image. In particular, by appropriately setting the parameters of the mean-shift method, it is possible to perform division so that one person such as a pedestrian is one person per division area. By calculating the average of the optical flow values for each divided region, it is possible to normalize the optical flow values of pedestrians and the like existing in the divided regions.

図6は、mean-shift法により領域分割されたそれぞれの領域の中心に、それぞれの領域のoptical flowの平均を配置した図である。領域の中心の位置(画素)に白丸(○)Pが示されており、optical flowの平均の方向とoptical flowの値の平均の大きさとが、白丸Pから伸びる線分Lの向きと長さとで示されている。但し、図6に示した画像では、地面に該当する部分のoptical flowの線分Lおよび白丸Pは表示されていない。 FIG. 6 is a diagram in which the average of the optical flow of each region is arranged at the center of each region divided by the mean-shift method. A white circle (○) P is shown at the center position (pixel) of the region, and the average direction of the optical flow and the average magnitude of the optical flow value are the direction and length of the line segment L extending from the white circle P. It is indicated by. However, in the image shown in FIG. 6, the line segment L and the white circle P of the optical flow of the portion corresponding to the ground are not displayed.

上述したように、図3に示した画像は、カメラ200と人物群(対象物)との両方が動いた状態を示している。このため、図4に示すように、カメラ200の動きに伴って道路に該当する画素にも、optical flowが抽出される。しかしながら、カメラ200の動きに伴って抽出されたoptical flowに基づき算出される、カメラ200から道路までの距離と、カメラ200と人物との両方の動きに伴って抽出されたoptical flowに基づき算出される、カメラからそれぞれの人物までの距離とを比較すると、距離に差が生じる。図3に示す時刻tの画像では、人物が道路の上に立っているため、人物の方が道路よりも、カメラからの距離が短くなる。つまり、人物の背の高さ分だけ、距離に違いが生じる。 As described above, the image shown in FIG. 3 shows a state in which both the camera 200 and the group of people (objects) are moving. Therefore, as shown in FIG. 4, the optical flow is also extracted from the pixels corresponding to the road as the camera 200 moves. However, it is calculated based on the distance from the camera 200 to the road and the optical flow extracted with the movement of both the camera 200 and the person, which is calculated based on the optical flow extracted with the movement of the camera 200. When comparing the distance from the camera to each person, there is a difference in the distance. In the image at time t shown in FIG. 3, since the person is standing on the road, the distance from the camera is shorter for the person than for the road. In other words, the distance differs by the height of the person.

従って、道路に対して一定の高さ(距離)を有する対象物を、人物として判定することによって、道路と人物とを区別することが可能となる。このような道路と人物との違いを判断するための閾値を、予め実験等により決定しておくことによって、道路を除いた人物群だけのoptical flowを抽出することが可能になる。図6では、mean-shift法によって分割された領域のうち、道路ではなく人物群を示すと判断された領域内のoptical flowの値の平均を領域毎に求めて、それぞれの領域の中心に白丸Pを示し、optical flowの値の平均の距離と向きとを、白丸Pから延びる線分Lで示している。図6では、複数の人物のそれぞれの位置に対応して、様々な方向に移動する人物のoptical flowが抽出されている。 Therefore, it is possible to distinguish between a road and a person by determining an object having a certain height (distance) with respect to the road as a person. By determining in advance a threshold value for determining such a difference between a road and a person by an experiment or the like, it is possible to extract an optical flow of only a group of people excluding the road. In FIG. 6, among the areas divided by the mean-shift method, the average of the optical flow values in the areas determined to indicate a group of people instead of roads is calculated for each area, and a white circle is formed in the center of each area. P is shown, and the average distance and direction of the optical flow values are shown by a line segment L extending from the white circle P. In FIG. 6, the optical flows of the persons moving in various directions are extracted corresponding to the respective positions of the plurality of persons.

次に、CPU104は、算出された領域毎のoptical flowの値の平均に基づいて、領域毎に、対象物からカメラ200までの距離を算出する(図2のS.6)。CPU104は、プログラムに基づいて、対象物からカメラまでの距離を、optical flowの値を用いて算出する処理(距離算出機能)を行うため、「距離算出手段」104c(図1参照)に該当する。 Next, the CPU 104 calculates the distance from the object to the camera 200 for each area based on the average of the calculated optical flow values for each area (S.6 in FIG. 2). Since the CPU 104 performs a process (distance calculation function) of calculating the distance from the object to the camera using the optical flow value based on the program, it corresponds to the "distance calculation means" 104c (see FIG. 1). ..

CPU104は、領域毎に算出されたoptical flowの値を動的視差と見なして、対象物からカメラ200までの距離を算出する。動的視差に基づいて対象物からカメラ200までの距離を算出する方法は、AMP法やFMP法において、既に提案されている。 The CPU 104 considers the optical flow value calculated for each area as dynamic parallax, and calculates the distance from the object to the camera 200. A method of calculating the distance from the object to the camera 200 based on the dynamic parallax has already been proposed in the AMP method and the FMP method.

図7は、動的視差に基づいて、対象物からカメラ200までの距離を求める方法を説明するための幾何モデルを示した図である。図7の縦軸は、対象物からカメラ200までの仮想距離Zvを示す。仮想距離Zvのプラスの方向は図の下方向である。図7の横軸は、動的視差qを示す。動的視差qは、optical flowによって求められるピクセル軌跡による実験値、つまり、optical flowの値である。動的視差qのプラスの方向は、図の右方向である。 FIG. 7 is a diagram showing a geometric model for explaining a method of obtaining a distance from an object to the camera 200 based on dynamic parallax. The vertical axis of FIG. 7 shows the virtual distance Zv from the object to the camera 200. The positive direction of the virtual distance Zv is the lower direction in the figure. The horizontal axis of FIG. 7 indicates the dynamic parallax q. The dynamic parallax q is an experimental value based on the pixel locus obtained by the optical flow, that is, a value of the optical flow. The positive direction of the dynamic parallax q is the right direction in the figure.

仮想距離Zvの値は、仮想であるため、動的視差qの事後的に定まる係数の視差qの値に対応するものとする。動的視差の特性として、動的視差の値が大きいほど、対象物からカメラまでの距離は短く、動的視差の値が小さいほど、対象物からカメラまでの距離は長くなる。仮想距離Zvを詳細に表すと、実際には、Zv(q)という関数で表される。 Since the value of the virtual distance Zv is virtual, it corresponds to the value of the parallax q 0 , which is a coefficient determined after the fact of the dynamic parallax q. As a characteristic of dynamic parallax, the larger the value of dynamic parallax, the shorter the distance from the object to the camera, and the smaller the value of dynamic parallax, the longer the distance from the object to the camera. When the virtual distance Zv is expressed in detail, it is actually expressed by a function called Zv (q 0 ).

事後的に定まる定数である視差qに微少量Δqを加えたもの(q+Δq)を、optical flowにより1つの画素で定まったoptical flowの値qと仮定する。すなわち、q=q+Δqとなる。また、Zvは、qに対応し、仮想距離Zvの微少量ΔZvは、Δqに対応すると仮定する。このとき、両者の関係を線形と仮定すると、図7に示す幾何モデルのような関係となり、次のような線形の比例関係が成立する。
Zv:q=−ΔZv:Δq
It is assumed that the parallax q 0 , which is a constant determined after the fact, plus a small amount of Δq (q 0 + Δq) is the value q of the optical flow determined by one pixel by the optical flow. That is, q = q 0 + Δq. Further, it is assumed that Zv corresponds to q 0 and the minute amount ΔZv of the virtual distance Zv corresponds to Δq. At this time, assuming that the relationship between the two is linear, the relationship is as shown in the geometric model shown in FIG. 7, and the following linear proportional relationship is established.
Zv: q 0 = −ΔZv: Δq

この比例関係から、以下のような線形微分方程式が成立する。この線形微分方程式を解くと、
−q・ΔZv=Zv・Δq
ΔZv/Zv=−Δq/q
logZv=−q/q+c (cは定数)
となり、上記式を変形することにより
Zv=a・exp(bq)
が成立する。ここで、b=−1/qの関係があり、bが境界条件として定まると、事後的にqが定まることになる。
From this proportional relationship, the following linear differential equation is established. Solving this linear differential equation
−Q 0・ ΔZv = Zv ・ Δq
ΔZv / Zv = −Δq / q 0
logZv = -q / q 0 + c (c is a constant)
By transforming the above equation, Zv = a · exp (bq)
Is established. Here, there is a relationship of b = -1 / q 0 , and if b is determined as a boundary condition, q 0 will be determined ex post facto.

また、a,b(a>0,b<0)は不定係数である。またexp(bq)は、自然対数の底の値(ネイピア数:Napier's constant)のbq乗を示している。係数a,bの値は、個別の境界条件で決定することができる。係数a,bが決定されると、カメラ200で撮影された動画像に基づいて、動的視差qの値を算出することができ、Zvの値を、仮想距離ではなく現実世界の実距離として求めることが可能になる。 Further, a and b (a> 0, b <0) are indefinite coefficients. Further, exp (bq) indicates the bq power of the base value of the natural logarithm (Napier's constant). The values of the coefficients a and b can be determined by individual boundary conditions. Once the coefficients a and b are determined, the value of the dynamic parallax q can be calculated based on the moving image taken by the camera 200, and the value of Zv is used as the real distance in the real world instead of the virtual distance. It becomes possible to ask.

定数a,bの値は、変数Zvと変数qとの変動範囲に基づいて決定される。Zvは、既に説明したように、対象物からカメラ200までの仮想距離を示している。仮想距離は、対象世界(対象となる世界、対象となる環境)によって変わり得る値であり、現実世界の実距離とは異なる値である。このため、動画像の3次元空間(対象世界)の仮想距離Zvに対応する、現実世界の実距離の変動範囲を、レーザーを用いた距離計測(以下、レーザー計測と称する)や視察等の方法で、予め測定しておく(事前に決定しておく)ことにより、対象世界の距離から現実世界の実距離を対応づけて求めることが可能になる。このように、動的視差qの値(optical flowの値)を用いて仮想距離Zvを算出する方法は、相対距離を検出することを示している。 The values of the constants a and b are determined based on the fluctuation range of the variable Zv and the variable q. Zv indicates the virtual distance from the object to the camera 200, as described above. The virtual distance is a value that can change depending on the target world (target world, target environment), and is a value different from the real distance in the real world. Therefore, a method such as distance measurement using a laser (hereinafter referred to as laser measurement) or inspection of the fluctuation range of the real distance in the real world corresponding to the virtual distance Zv in the three-dimensional space (target world) of the moving image. Therefore, by measuring in advance (determining in advance), it is possible to obtain the actual distance in the real world in association with the distance in the target world. As described above, the method of calculating the virtual distance Zv using the value of the dynamic parallax q (the value of the optical flow) shows that the relative distance is detected.

現実世界の実距離Z(対象物からカメラまでの距離Z)を、対象世界の仮想距離Zvに対応づけることができれば、
Z=a・exp(bq) ・・・式1
によって、現実世界の実距離Zを求めることができる。つまり、現実世界における対象物からカメラ200までの距離Zを、理論から決定される距離関数として求めることができる。
If the real distance Z (distance Z from the object to the camera) in the real world can be associated with the virtual distance Zv in the target world,
Z = a · exp (bq) ・ ・ ・ Equation 1
Can be used to obtain the real distance Z in the real world. That is, the distance Z from the object to the camera 200 in the real world can be obtained as a distance function determined from theory.

実施の形態に係る動画像距離算出装置100では、動画像の3次元空間(対象世界)の仮想距離Zvに対応する現実世界の実距離の変動範囲を、一例として、レーザー計測によって予め測定する。レーザー計測によって測定された仮想距離Zvの距離範囲を、Z≦Zv≦Zで表す(Z≦Z)。 In the moving image distance calculation device 100 according to the embodiment, the fluctuation range of the real distance in the real world corresponding to the virtual distance Zv in the three-dimensional space (target world) of the moving image is measured in advance by laser measurement as an example. The distance range of the virtual distance Zv measured by the laser measurement is represented by Z N ≤ Zv ≤ Z L (Z N ≤ Z L ).

より詳細には、複数の対象物、例えばM個の対象物が動画像に映っており、M個の対象物からカメラ200までのそれぞれの距離(現実世界の実距離)を算出する場合には、M個の対象物のうち、カメラ200から最も近い場所に位置する対象物までの距離(実距離)と、最も遠い場所に位置する対象物までの距離(実距離)とを、レーザー計測によって予め測定する。M個の対象物のうちでカメラ200から最も遠い場所に位置する対象物までの距離をZとし、最も近い場所に位置する対象物までの距離をZとする。M個の対象物のうちで、カメラ200から最も近い対象物と最も遠い対象物とを除いた、M−2個の対象物のそれぞれに対し、optical flowの値に基づいて、対象物からカメラまでの距離(実距離)が、算出されることになる。従って、対象物からカメラ200までの距離を算出するためには、対象物が3個以上(M−2>0)であることが望ましい。 More specifically, when a plurality of objects, for example, M objects are shown in a moving image, and the distances from the M objects to the camera 200 (actual distance in the real world) are calculated. , Of the M objects, the distance from the camera 200 to the object located at the nearest location (actual distance) and the distance to the object located at the farthest location (actual distance) are measured by laser measurement. Measure in advance. Of the M objects, the distance from the camera 200 to the object located at the farthest place is Z L, and the distance to the object located at the closest place is Z N. Of the M objects, for each of the M-2 objects, excluding the object closest to the camera 200 and the object farthest from the camera 200, the camera from the object based on the optical flow value. The distance to (actual distance) will be calculated. Therefore, in order to calculate the distance from the object to the camera 200, it is desirable that the number of objects is three or more (M-2> 0).

動的視差qの値の変動範囲は、個別に動画像から求められる実験的な値により決定される。つまり、予め測定等しておく必要はない。動的視差qの変動範囲は、複数の対象物のoptical flowの値の変動範囲によって求めることができる。このように求められる動的視差qの最大・最小範囲を、μ≦q≦γとする。つまり、複数の対象物のoptical flowの値のうち、最も小さい値がμに該当し、最も大きい値がγに該当することになる。つまり、μとγとは、動画像に基づいて算出された複数のoptical flowの値により定まる実験的な値である。 The fluctuation range of the value of the dynamic parallax q is determined by the experimental value individually obtained from the moving image. That is, it is not necessary to measure in advance. The fluctuation range of the dynamic parallax q can be obtained from the fluctuation range of the optical flow values of a plurality of objects. The maximum / minimum range of the dynamic parallax q obtained in this way is set to μ ≦ q ≦ γ. That is, among the optical flow values of a plurality of objects, the smallest value corresponds to μ and the largest value corresponds to γ. That is, μ and γ are experimental values determined by a plurality of optical flow values calculated based on a moving image.

また、μ,γとZ,Zとの対応関係は、動的視差の性質に基づいて求めることができる。μはZに対応し、γはZに対応する。これは、仮想距離Zvが遠いほど、動画像の物体点(物体位置)の移動量が少なくなり、仮想距離Zvが近いほど、動画像の物体点(物体位置)の移動量が多くなるという、動的視差の性質によるものである。このように、仮想距離Zvの距離範囲のうち距離が最も短い距離Zは、動的視差qの変動範囲のうち最も移動量が多いγに対応し、仮想距離Zvの距離範囲のうち距離が最も長い距離Zは、動的視差qの変動範囲のうち最も移動量が少ないμに対応することになる。 Further, the correspondence between μ, γ and Z L , Z N can be obtained based on the nature of dynamic parallax. μ corresponds to Z L and γ corresponds to Z N. This is because the farther the virtual distance Zv is, the smaller the amount of movement of the object point (object position) of the moving image is, and the closer the virtual distance Zv is, the larger the amount of movement of the object point (object position) of the moving image is. This is due to the nature of dynamic parallax. In this way, the distance Z N having the shortest distance in the distance range of the virtual distance Zv corresponds to γ having the largest amount of movement in the fluctuation range of the dynamic parallax q, and the distance in the distance range of the virtual distance Zv is The longest distance Z L corresponds to μ, which has the smallest amount of movement in the fluctuation range of the dynamic parallax q.

従って、Zv=a・exp(bq)のZvとqの値に、μとZ、およびγとZとを対応づけて代入することにより、次のa,bに関する連立方程式が成立する。 Therefore, by substituting the values of Zv and q of Zv = a · exp (bq) with μ and Z L , and γ and Z N , the following simultaneous equations for a and b are established.

=a・exp(bμ) ・・・式2
=a・exp(bγ) ・・・式3
この式2および式3が、境界条件に該当することになる。
Z L = a · exp (bμ) ・ ・ ・ Equation 2
Z N = a · exp (bγ) ・ ・ ・ Equation 3
The equations 2 and 3 correspond to the boundary conditions.

この連立方程式を解くと、下記のように、定数a,bを求めることができる。
a=Z・exp((μ/(γ−μ))log(Z/Z)) ・・・式4
b=(1/(μ―γ))log(Z/Z) ・・・式5
このように、定数a,bを求めて、上述した式1に適用することによって、仮想距離Zvの値を現実世界の実距離Zとして算出することが可能になる。
By solving this simultaneous equation, the constants a and b can be obtained as follows.
a = Z L · exp ((μ / (γ-μ)) log (Z L / Z N )) ・ ・ ・ Equation 4
b = (1 / (μ-γ)) log (Z L / Z N ) ・ ・ ・ Equation 5
In this way, by obtaining the constants a and b and applying them to the above equation 1, the value of the virtual distance Zv can be calculated as the real distance Z in the real world.

上述した距離Zは、分割領域毎に求められる。既に説明したように、mean-shift法のパラメータを適切に設定することにより、例えば、結果として、歩行者等の人物が一つの分割領域あたり一人になるように、領域分割を行うことが可能である。つまり、mean-shift法のパラメータを適切に設定することにより、M個の対象物のそれぞれが異なる分割領域になるように、M個よりも多いK個の領域に画像を分割することが可能である。従って、動画像に映った対象物がそれぞれ異なる領域になるように、mean-shift法のパラメータを設定することにより、カメラ200からそれぞれの対象物までの距離Zを求めることができる。 The above-mentioned distance Z is obtained for each divided region. As described above, by appropriately setting the parameters of the mean-shift method, for example, it is possible to divide the area so that there is only one person such as a pedestrian per divided area. is there. That is, by appropriately setting the parameters of the mean-shift method, it is possible to divide the image into K regions, which is more than M, so that each of the M objects has a different division region. is there. Therefore, the distance Z from the camera 200 to each object can be obtained by setting the parameters of the mean-shift method so that the objects reflected in the moving image are in different regions.

その後、CPU104は、時刻tの画像におけるそれぞれの領域の距離Zの値を、領域内の各画素に対応づけて記録する(図2におけるS.7)。つまり、時刻tの画像における各画素に対して、領域毎に求められた距離Zの値を貼り付ける処理を行う。このように、求められた距離Zを各画素に対応づけて貼り付ける(記録する)ことによって、動画像の時刻tが変化した場合であっても、それぞれの時刻の画像のそれぞれの画素毎に、対象物からカメラ200までの距離を瞬時に取得することが可能になる。距離情報が画素に対応づけられて記録されることにより、各時刻の画像において画素毎に対応づけられる情報は、色情報と距離情報Dからなる(r,g,b,D)となる。この情報は、記録部101に記録される。 After that, the CPU 104 records the value of the distance Z of each region in the image at time t in association with each pixel in the region (S.7 in FIG. 2). That is, the process of pasting the value of the distance Z obtained for each region is performed for each pixel in the image at time t. By pasting (recording) the obtained distance Z in association with each pixel in this way, even if the time t of the moving image changes, for each pixel of the image at each time. , It becomes possible to instantly acquire the distance from the object to the camera 200. Since the distance information is recorded in association with the pixels, the information associated with each pixel in the image at each time becomes (r, g, b, D) consisting of color information and distance information D. This information is recorded in the recording unit 101.

記録部101に対して動画像の各画素の距離情報Dを記録することにより、動画像に映る対象物の状態を距離情報Dを用いて立体的に把握することが可能になる。図8は、図3に示したスクランブル交差点の状態を、異なる視点から立体的に示した画像である。図8に示した画像では、各領域の中心に配置された平均的なoptical flowの値の大きさを、距離に変換することにより、画像内に位置する人物群毎の位置,高さを求めて、スクランブル交差点の地面や人物群の状態を、視点変換して示している。 By recording the distance information D of each pixel of the moving image in the recording unit 101, it is possible to three-dimensionally grasp the state of the object reflected in the moving image by using the distance information D. FIG. 8 is an image showing the state of the scrambled intersection shown in FIG. 3 three-dimensionally from different viewpoints. In the image shown in FIG. 8, the position and height of each group of people located in the image are obtained by converting the size of the average optical flow value arranged in the center of each area into a distance. The state of the ground and the group of people at the scrambled intersection is shown by changing the viewpoint.

図7に示した幾何モデルにおいて、動的視差qとして用いられるoptical flowは、任意の方向をとることができ、その方向が制限されることはない。例えば、ドローンや飛行機等に設置されたカメラ200で都市の様子を上空から撮影し、撮影された動画像を用いて、都市の立体的な距離情報を取得することも可能である。 In the geometric model shown in FIG. 7, the optical flow used as the dynamic parallax q can take any direction, and the direction is not limited. For example, it is possible to take a picture of the city from the sky with a camera 200 installed in a drone, an airplane, or the like, and obtain three-dimensional distance information of the city by using the taken moving image.

図9は、上空から撮影した動画像を用いて画素毎に位置情報を取得して、都市の様子を立体的に示した画像である。動画像を撮影するカメラ200の移動方向は、撮影対象となる都市の建物等に対して必ずしも水平移動したものではない。実施の形態に係る動画像距離算出装置100で距離情報を取得するための条件として、AMP法のように、撮影対象物を撮影するカメラ200の移動方向を、横方向に移動させる必要はなく、また、FMP法のように、カメラ200の移動方向を前方あるいは後方に限定する必要もない。このため、対象物までの距離を算出するための動画像の制約を少なくすることができ、様々な方向に移動するカメラ200で撮影された動画像を用いて、対象物までの距離情報を画素毎に求めることが可能になる。 FIG. 9 is an image showing the state of the city in three dimensions by acquiring position information for each pixel using a moving image taken from the sky. The moving direction of the camera 200 that captures a moving image is not necessarily horizontal movement with respect to a building or the like in the city to be captured. As a condition for acquiring the distance information by the moving image distance calculation device 100 according to the embodiment, it is not necessary to move the moving direction of the camera 200 for shooting the object to be photographed laterally as in the AMP method. Further, unlike the FMP method, it is not necessary to limit the moving direction of the camera 200 to the front or the rear. Therefore, it is possible to reduce the restrictions on the moving image for calculating the distance to the object, and the distance information to the object is pixelated using the moving image taken by the camera 200 moving in various directions. It becomes possible to obtain it every time.

図10は、走行する車両の正面をカメラ200で撮影した動画像に基づいて、車両前方の対象物の距離を画素毎に算出し、算出された距離情報に基づいて車両前方の様子を立体的に示した画像である。走行車両の正面を撮影した動画像に基づいて、対象物からカメラ200までの距離を測定する場合、従来はFMP法を用いていた。図10に示すように、車両の正面を撮影した動画像に基づいて、optical flowを用いて対象物からカメラ200までの距離を算出する場合であっても、FMP法を用いて作成した立体的な画像と変わらない精度で、立体的な画像を作成することができる。 In FIG. 10, the distance of an object in front of the vehicle is calculated for each pixel based on a moving image of the front of the traveling vehicle taken by the camera 200, and the state in front of the vehicle is three-dimensionally based on the calculated distance information. It is an image shown in. Conventionally, the FMP method has been used to measure the distance from an object to the camera 200 based on a moving image of the front of a traveling vehicle. As shown in FIG. 10, even when the distance from the object to the camera 200 is calculated using optical flow based on a moving image of the front of the vehicle, a three-dimensional object created by using the FMP method is used. It is possible to create a three-dimensional image with the same accuracy as a normal image.

上述したように、動画像距離算出装置100では、AMP法やFMP法のように、カメラの移動方向等の制約を受けないので、様々な方向に移動するカメラ200で撮影された動画像に基づいて、対象物からカメラ200までの距離を算出することが可能である。 As described above, the moving image distance calculation device 100 is not restricted by the moving direction of the camera unlike the AMP method and the FMP method, and is based on the moving images taken by the camera 200 moving in various directions. Therefore, it is possible to calculate the distance from the object to the camera 200.

従って、例えば、ロボットに設置されたカメラで撮影される動画像に基づいて、ロボットの周囲の空間の状況を求めることが可能である。災害時等であって人間が容易に入ることができない空間にロボットを進入させる場合、ロボットのカメラで撮影された動画像に基づいて周囲の状況を判断する必要が生じる。ロボットのカメラで撮影される動画像は、必ずしもロボットの進行方向正面の動画像や横方向に移動された動画像に限定されるものではない。必要に応じてロボットの頭部や胸部や腕部や指部にカメラが設置され、ロボットの動きに応じてカメラが任意の方向に移動されて、動画像が撮影される。任意の方向にカメラが動かされる場合であっても、カメラの動きに応じて、あるいは撮影された対象物の動きに応じてoptical flowが抽出されるため、抽出されたoptical flowに基づいて、対象物等までの距離(壁や床等までの距離を含む)を算出することが可能になる。 Therefore, for example, it is possible to obtain the state of the space around the robot based on a moving image taken by a camera installed in the robot. When a robot enters a space that humans cannot easily enter, such as during a disaster, it is necessary to judge the surrounding situation based on the moving image taken by the robot's camera. The moving image taken by the robot camera is not necessarily limited to the moving image in front of the robot in the traveling direction or the moving image moved in the lateral direction. Cameras are installed on the robot's head, chest, arms, and fingers as needed, and the cameras are moved in any direction according to the movement of the robot to capture moving images. Even if the camera is moved in any direction, the optical flow is extracted according to the movement of the camera or the movement of the captured object, so the target is based on the extracted optical flow. It becomes possible to calculate the distance to an object (including the distance to a wall, floor, etc.).

算出された対象物等までの距離に基づいて、ロボットの胸部や腕部や指部等の制御を行うことにより、災害現場において円滑にロボットを移動等させることができ、より精度の高い制御を行うことが可能になる。また、カメラ200で撮影された動画像に基づいて周囲の距離情報を3次元的に取得することによって、災害現場等における3次元的な地図を作成することが可能となり、その後の救護活動等における機動性を高めることが可能になる。 By controlling the chest, arms, fingers, etc. of the robot based on the calculated distance to the object, etc., the robot can be moved smoothly at the disaster site, and more accurate control can be performed. It will be possible to do. In addition, by acquiring the surrounding distance information three-dimensionally based on the moving image taken by the camera 200, it becomes possible to create a three-dimensional map at a disaster site or the like, and in subsequent relief activities or the like. It becomes possible to increase mobility.

図11は、室内を移動するロボットにカメラを設置し、ロボットのカメラで撮影された動画像を用いて距離情報に取得し、室内の周囲の状況を立体的に示した図である。ロボットを制御することによって、図11に示されるバルブVへ移動して、ロボットの腕部と指部とでバルブVを回転させる場合を考える。この場合、ロボットは必ずしも連続的に移動しているとは限らないため、カメラで撮影された動画像の周囲の状況が全く変化しない時間が生じ得る。 FIG. 11 is a diagram in which a camera is installed in a robot moving in a room, a moving image taken by the robot's camera is used to acquire distance information, and the surrounding situation in the room is shown three-dimensionally. Consider a case where the robot is controlled to move to the valve V shown in FIG. 11 and the valve V is rotated by the arm and the finger of the robot. In this case, since the robot does not always move continuously, there may be a time when the surrounding situation of the moving image taken by the camera does not change at all.

既に説明したように、optical flowは、動画像に映る対象物の動き等を、ベクトルで示したものである。このため、室内において積極的に動く対象物が存在せず、さらにロボットの動きが停止することによって、動画像に変化が生じない状態が継続されると、optical flowを抽出することができず、室内の周囲の距離を算出することができない。この場合には、最後にカメラが動いたときに算出された室内の周囲の距離情報を、カメラが動かない状態(動画像に変化が生じない状態)で維持し続けて、次にカメラが動いた場合に、すでに算出された距離情報を継続的に利用することによって、連続的に室内の周囲の距離を判断することができる。 As described above, the optical flow is a vector representation of the movement of an object reflected in a moving image. For this reason, if there is no object that actively moves in the room and the movement of the robot is stopped so that the moving image does not change, the optical flow cannot be extracted. It is not possible to calculate the distance around the room. In this case, the distance information around the room calculated when the camera last moved is maintained in a state where the camera does not move (a state in which the moving image does not change), and then the camera moves. In such a case, the distance around the room can be continuously determined by continuously using the already calculated distance information.

また、カメラが移動する場合であっても、カメラの移動速度は必ずしも一定であるとは限らない。この場合、対象物からカメラまでの距離が同じであっても、時刻毎に算出されるoptical flowの値が異なる値となってしまう。 Further, even when the camera moves, the moving speed of the camera is not always constant. In this case, even if the distance from the object to the camera is the same, the optical flow value calculated for each time will be different.

さらに、対象物からカメラ200までの距離を算出する場合には、既に説明したように、2つのダイナミックレンジが必要になる。optical flowの値のダイナミックレンジ(μ,γ)と、求めようとする距離のダイナミックレンジ(Z,Z)である。optical flowの値のダイナミックレンジは動画像から算出することができるが、距離のダイナミックは、視察やレーザー計測によって予め測定する必要がある。しかしながら、対象物からカメラまでの距離が長い(距離値が大きい)場合に、距離のダイナミックレンジが正確に定まる保証がない。 Further, when calculating the distance from the object to the camera 200, two dynamic ranges are required as described above. The dynamic range of the optical flow value (μ, γ) and the dynamic range of the distance to be obtained (Z N , Z L ). The dynamic range of the optical flow value can be calculated from the moving image, but the dynamic range of the distance needs to be measured in advance by inspection or laser measurement. However, when the distance from the object to the camera is long (the distance value is large), there is no guarantee that the dynamic range of the distance will be accurately determined.

また、動画像に基づいて算出されるoptical flowの値は、近距離の対象物に比べて遠距離の対象物ほど小さな値になる。また、optical flowの値は、対象物の移動だけでなくカメラの移動によっても変動する。 In addition, the optical flow value calculated based on the moving image is smaller for a long-distance object than for a short-distance object. In addition, the value of optical flow fluctuates not only with the movement of the object but also with the movement of the camera.

このように、対象物からカメラまでの距離が近距離であるか遠距離であるかによって生じる影響や、カメラの移動速度によって生じる影響によりoptical flowの値が不正確にならないように、CPU104では、optical flowの値の正規化を行うことにより補正を施す。具体的には、各時刻のそれぞれの画像毎に全画素のoptical flowの値を加算し(総和を求めて)、その加算値(総和)で、対応する時刻の画像のそれぞれの画素のoptical flowの値を割ることにより正規化を行う。 In this way, in the CPU 104, the optical flow value is not inaccurate due to the influence caused by whether the distance from the object to the camera is a short distance or a long distance, or the influence caused by the moving speed of the camera. Correction is performed by normalizing the value of optical flow. Specifically, the optical flow values of all pixels are added (total) for each image at each time, and the added value (sum) is used to determine the optical flow of each pixel of the image at the corresponding time. Normalization is performed by dividing the value of.

このように正規化を行うことによって、カメラの移動速度等が異なることにより、抽出されるoptical flowが時刻毎に異なる場合であっても、対象物までの距離が近距離あるいは遠距離であってoptical flowに影響が生じ得る場合であっても、対象物からカメラまでの距離の算出を精度よく行うことが可能になる。この正規化の方法は、カメラの移動速度が一定でない場合等だけでなく、様々な場合に用いることができる。 By performing the normalization in this way, even if the extracted optical flow differs for each time due to the difference in the moving speed of the camera, the distance to the object is short or long. Even if the optical flow may be affected, the distance from the object to the camera can be calculated accurately. This normalization method can be used not only when the moving speed of the camera is not constant, but also in various cases.

なお、対象物からカメラまでの距離が長い(距離値が大きい)場合には、計算された距離Z(q)に対して係数Cを掛け合わせたCZ(q)を求めて、遠距離の対象物に対応する画素の距離値を算出する。この係数Cは、GPS等の何らかの方法を用い定めることができる。 When the distance from the object to the camera is long (the distance value is large), the calculated distance Z (q) is multiplied by the coefficient C to obtain CZ (q), which is a long-distance object. Calculate the distance value of the pixel corresponding to the object. This coefficient C can be determined by using some method such as GPS.

また、動画像を撮影するためのカメラと、動画像を用いて対象物までの距離を算出するためのCPUとを備えていれば、実施の形態に係る動画像距離算出装置100と見なすことができる。 Further, if a camera for capturing a moving image and a CPU for calculating a distance to an object using the moving image are provided, it can be regarded as the moving image distance calculation device 100 according to the embodiment. it can.

近時のスマートフォン等の携帯端末では、一般的にカメラが設けられており、動画像を撮影することが可能になっている。このため、携帯端末のカメラで動画像を撮影し、撮影された動画像を用いて、携帯端末のCPUで各時刻のoptical flowを抽出して、対象物から携帯端末までの距離を算出することが可能である。また、撮影された動画像に基づいて3次元的な画像を作成することが可能である。 Mobile terminals such as smartphones these days are generally equipped with a camera, and it is possible to take a moving image. Therefore, a moving image is taken by the camera of the mobile terminal, and the optical flow at each time is extracted by the CPU of the mobile terminal using the taken moving image to calculate the distance from the object to the mobile terminal. Is possible. In addition, it is possible to create a three-dimensional image based on the captured moving image.

近年、3次元的な画像を作成する方法として、ToF(Time of Flight)という方式が提案されている。ToFでは、対象物に対して光を投射し、その光の反射光を受光することによって、光の投射から反射光の受光までの時間を計測し、計測された時間に基づいて対象物までの距離を計算する。ToFを用いて3次元的な画像を作成するためには、対象物が乱反射するものであることが必要である。従って、金物や瀬戸物などのように鏡面反射するものに対しては測定精度が低下してしまうという問題があった。また、対象物との間に、雨や煙などのように光の進行を妨げるものが存在しない環境であることが必要であった。また、実際にToFを用いて3次元的な画像を作成できる範囲は、約50cmから約4mまでの範囲であり、適用範囲が制限されるという問題がある。さらに、測定される対象物までの距離とカメラの画素との対応精度が十分でなく、それらの機能を実現するためのハードウェアは、性能向上のための改良が続いている状況であった。 In recent years, a method called ToF (Time of Flight) has been proposed as a method for creating a three-dimensional image. In ToF, light is projected onto an object, and by receiving the reflected light of the light, the time from the projection of the light to the reception of the reflected light is measured, and the object is reached based on the measured time. Calculate the distance. In order to create a three-dimensional image using ToF, it is necessary that the object is diffusely reflected. Therefore, there is a problem that the measurement accuracy is lowered for specular reflection objects such as hardware and seto objects. In addition, it was necessary to have an environment in which there was no object such as rain or smoke that obstructed the progress of light. Further, the range in which a three-dimensional image can be actually created using ToF is a range from about 50 cm to about 4 m, and there is a problem that the applicable range is limited. Furthermore, the accuracy of correspondence between the distance to the object to be measured and the pixels of the camera is not sufficient, and the hardware for realizing these functions has been continuously improved for performance improvement.

これに対して、実施の形態に係る動画像距離算出装置100のように、撮影されたカメラの動画像に基づいてoptical flowを抽出し、対象物までの距離を求める場合には、一般的なカメラと、optical flowの抽出処理を行うことが可能なCPU等を備えれば十分である。このため、一般的なスマートフォン等であっても、精度よく対象物までの距離を算出するとこが可能である。 On the other hand, when the optical flow is extracted based on the moving image of the captured camera and the distance to the object is obtained as in the moving image distance calculating device 100 according to the embodiment, it is general. It suffices to have a camera and a CPU or the like capable of performing optical flow extraction processing. Therefore, even with a general smartphone or the like, it is possible to calculate the distance to the object with high accuracy.

具体的には、スマートフォン等の携帯端末で動画像を撮影する場合に、少しだけ携帯端末を振ることによって、携帯端末の動きに基づくoptical flowを動画像から抽出することができる。携帯端末を振った瞬間の数フレームのフレーム画像から、optical flowを抽出することによって、3次元的な画像を作成することが可能になる。また、携帯端末を静止させた状態で動画像を撮影することにより、動く対象物のoptical flowに基づいて、3次元的な画像を作成することができる。このように、optical flowを抽出して距離を算出することにより、近距離の対象物だけに限らず、遠距離の対象物や、動く対象物を対象として、対象物からカメラまでの距離を算出することができ、3次元的な画像を作成することが可能である。 Specifically, when a moving image is taken by a mobile terminal such as a smartphone, an optical flow based on the movement of the mobile terminal can be extracted from the moving image by shaking the mobile terminal slightly. By extracting the optical flow from the frame image of several frames at the moment when the mobile terminal is shaken, it becomes possible to create a three-dimensional image. Further, by taking a moving image while the mobile terminal is stationary, a three-dimensional image can be created based on the optical flow of a moving object. By extracting the optical flow and calculating the distance in this way, the distance from the object to the camera is calculated not only for short-distance objects but also for long-distance objects and moving objects. It is possible to create a three-dimensional image.

以上、本発明に係る動画像距離算出装置および動画像距離算出用プログラムについて、実施の形態に係る動画像距離算出装置100を一例として示し、詳細に説明を行ったが、本発明に係る動画像距離算出装置および動画像距離算出用プログラムは、実施の形態に示した例には限定されない。 The moving image distance calculation device and the moving image distance calculation program according to the present invention have been described in detail by showing the moving image distance calculation device 100 according to the embodiment as an example. The distance calculation device and the moving image distance calculation program are not limited to the examples shown in the embodiments.

例えば、実施の形態に係る動画像距離算出装置100では、CPU104が時刻tの画像に対してmean-shift法を適用することによって領域分割を行い、領域内の全ての画素のoptical flowの値の平均を求めることによって、対象物からカメラ200までの距離を算出する場合について説明した。しかしながら、時刻tの画像に映る対象物からカメラ200までの距離の算出のために、必ずしもmean-shift法を適用する必要はない。 For example, in the moving image distance calculation device 100 according to the embodiment, the CPU 104 divides the area by applying the mean-shift method to the image at time t, and the optical flow values of all the pixels in the area are calculated. The case where the distance from the object to the camera 200 is calculated by calculating the average has been described. However, it is not always necessary to apply the mean-shift method for calculating the distance from the object displayed in the image at time t to the camera 200.

例えば、mean-shift法を適用しない場合、すなわち画素毎にoptical flowの値を求めて、画素毎にそれぞれの距離を算出する場合であっても、既に説明したように、時刻tの画像における全ての画素のoptical flowの値の総和を求めて、それぞれの画素のoptical flowの値を全ての画素のoptical flowの値の総和で割ることによって、近距離や遠距離に対する補正や、カメラの移動速度に対する補正を考慮したoptical flowの値を、画素毎に求めることが可能になる。このため、mean-shift法を用いない方法であっても、画素毎の距離を精度よく算出することが可能である。 For example, even when the mean-shift method is not applied, that is, when the optical flow value is obtained for each pixel and the distance for each pixel is calculated, as described above, all in the image at time t. By finding the sum of the optical flow values of the pixels and dividing the optical flow value of each pixel by the sum of the optical flow values of all the pixels, correction for short and long distances and the movement speed of the camera It becomes possible to obtain the value of optical flow in consideration of the correction for each pixel. Therefore, even if the method does not use the mean-shift method, it is possible to accurately calculate the distance for each pixel.

なお、mean-shift法を時刻tの画像に適用しない場合であっても、道路のようにテクスチャーのない状態で算出されるoptical flowの値は、極めて小さな値となるか、あるいはゼロになる。mean-shift法を適用する場合であっても同様に、テクスチャーがない状態で算出されたoptical flowの値の平均は、極めて小さくなる。このため、mean-shift法を適用して算出されたoptical flowの値の平均が小さい領域では、その領域における実際の距離よりも遠い距離が算出されてしまう恐れがある。このような場合には、optical flowの値が小さい領域で算出された距離を、その領域の周辺の領域であって、optical flowの値が小さくない領域で算出された距離で、内挿することによって補正を行う。 Even when the mean-shift method is not applied to the image at time t, the value of optical flow calculated in a state without texture such as a road becomes an extremely small value or becomes zero. Similarly, even when the mean-shift method is applied, the average of the optical flow values calculated in the absence of texture becomes extremely small. Therefore, in a region where the average of the optical flow values calculated by applying the mean-shift method is small, there is a risk that a distance farther than the actual distance in that region will be calculated. In such a case, interpolate the distance calculated in the area where the optical flow value is small with the distance calculated in the area around the area where the optical flow value is not small. Make corrections by.

また、実施の形態に係る動画像距離算出装置100では、時刻tの画像に映る対象物が、例えばM個の場合であって、CPU104が、対象物に対応するM個のoptical flowを抽出して、M個のそれぞれの対象物までの距離を算出する場合について説明した。ここで、Mの数は、視察やレーザー計測により予め測定される最も近い距離Zの対象物と、最も遠い距離Zの対象物が含まれていれば十分であり、距離測定の対象となる別の対象物を入れて、M≧3以上であればよい。このため、カメラからの距離を算出する対象物の数は、3以上であれば特に限定されない。 Further, in the moving image distance calculation device 100 according to the embodiment, when the number of objects displayed in the image at time t is, for example, M, the CPU 104 extracts M optical flows corresponding to the objects. The case of calculating the distance to each of the M objects has been described. Here, it is sufficient that the number of M includes the object of the shortest distance Z N measured in advance by inspection or laser measurement and the object of the farthest distance Z L , and the object of the distance measurement is It is sufficient that M ≧ 3 or more by inserting another object. Therefore, the number of objects for which the distance from the camera is calculated is not particularly limited as long as it is 3 or more.

さらに、対象物は時刻tの画像に写るものであればよいため、時刻tの画像の全ての画素をそれぞれ対象物とするものであってもよい。つまり、対象物の個数Mが、M=全ての画素数となってもよい。全ての画素毎に、対象物からカメラまでの距離を算出することによって、全ての画素の距離情報を取得することが可能である。また、時刻tの画像の全ての画素をそれぞれ対象物とする場合には、mean-shift法によって、時刻tの画像をM個の対象物に対応するように領域分割する必要がない。 Further, since the object may be an object that appears in the image at time t, all the pixels of the image at time t may be the objects. That is, the number M of the objects may be M = the total number of pixels. By calculating the distance from the object to the camera for each pixel, it is possible to acquire the distance information of all the pixels. Further, when all the pixels of the image at time t are objects, it is not necessary to divide the image at time t into regions so as to correspond to M objects by the mean-shift method.

さらに、対象物の個数Mを全ての画素数とするのではなく、全画素数の数分の1とすることも可能である。例えば、縦2画素かつ横2画素の合計4画素分の領域を一領域として設定し、領域毎に一つの画素を対象物に設定することにより、4画素に対して一画素ずつ、カメラから該当する画素の対象物までの距離を算出することが可能になる。全画素で距離を算出するのでははく、数画素に一画素の割合で距離の算出を行うことによって、CPU104の処理負担の軽減と処理の高速化を図ることが可能になる。 Further, it is possible to set the number M of the objects to be a fraction of the total number of pixels instead of setting the total number of pixels. For example, by setting an area of a total of 4 pixels of 2 vertical pixels and 2 horizontal pixels as one area and setting one pixel for each area as an object, one pixel for each of the four pixels corresponds to the camera. It becomes possible to calculate the distance of the pixel to the object. By calculating the distance at a ratio of one pixel to several pixels instead of calculating the distance with all pixels, it is possible to reduce the processing load of the CPU 104 and speed up the processing.

100 …動画像距離算出装置
101 …記録部
102 …ROM
103 …RAM
104 …CPU(コンピュータ、オプティカルフロー抽出手段、オプティカルフロー値算出手段、距離算出手段、全画素オプティカルフロー抽出手段、全画素オプティカルフロー値算出手段、領域分割手段、領域別オプティカルフロー値算出手段)
200 …カメラ
210 …モニタ
V …バルブ
L …(領域内のoptical flowの値の平均を示す)線分
P …(分割された領域の中心を示す)白丸
100 ... Moving image distance calculation device 101 ... Recording unit 102 ... ROM
103 ... RAM
104 ... CPU (computer, optical flow extraction means, optical flow value calculation means, distance calculation means, all pixel optical flow extraction means, all pixel optical flow value calculation means, area division means, area-specific optical flow value calculation means)
200 ... Camera 210 ... Monitor V ... Valve L ... (Indicating the average of the optical flow values in the area) Line segment P ... (Indicating the center of the divided area) White circle

Claims (10)

M個(M≧3)の対象物を撮影したカメラの動画像を用いて、該動画像の時刻tの画像に映るM個の前記対象物の画素から、それぞれの画素に対応するM個のoptical flowを抽出するオプティカルフロー抽出手段と、
該オプティカルフロー抽出手段により抽出されたM個の前記optical flowのそれぞれの大きさを、optical flowの値q(m=1,2,・・・,M)として算出するオプティカルフロー値算出手段と、
該オプティカルフロー値算出手段により算出されたM個の前記optical flowの値qのうち、前記optical flowの値が最も小さい値をμとし、前記optical flowの値が最も大きい値をγとし、M個の前記対象物から前記カメラまでのそれぞれの距離のうちで最も近い距離Zと最も遠い距離Zとを予め測定しておき、定数aおよび定数bを、
a=Z・exp((μ/(γ−μ))log(Z/Z))
b=(1/(μ−γ))log(Z/Z
により算出し、
M個の前記対象物から前記カメラまでのそれぞれの距離をZ(m=1,2,・・・,M)として、当該距離Zを、前記定数aと、前記定数bと、M個の前記optical flowの値qとに基づいて、
=a・exp(bq
により算出する距離算出手段と
を有することを特徴とする動画像距離算出装置。
Using the moving image of the camera that captured M (M ≧ 3) objects, from the pixels of the M objects reflected in the image at time t of the moving image, M corresponding to each pixel. An optical flow extraction method that extracts optical flow,
An optical flow value calculating means for calculating the magnitude of each of the M optical flows extracted by the optical flow extracting means as an optical flow value q m (m = 1, 2, ..., M). ,
Of the M optical flow values q m calculated by the optical flow value calculating means, μ is the value with the smallest optical flow value, γ is the value with the largest optical flow value, and M is M. Of the respective distances from the object to the camera, the shortest distance Z N and the farthest distance Z L are measured in advance, and the constant a and the constant b are set.
a = Z L · exp ((μ / (γ-μ)) log (Z L / Z N ))
b = (1 / (μ-γ)) log (Z L / Z N )
Calculated by
Let the distances from the M objects to the camera be Z m (m = 1, 2, ..., M), and set the distances Z m to the constant a, the constant b, and M. Based on the optical flow value q m and
Z m = a · exp (bq m )
A moving image distance calculation device characterized by having a distance calculation means calculated by
前記オプティカルフロー値算出手段は、
前記オプティカルフロー抽出手段により抽出されたM個の前記optical flowの大きさの総和を算出し、それぞれの前記optical flowの大きさを前記総和で割ることによって求められた、正規化されたそれぞれのoptical flowの大きさを、前記optical flowの値q(m=1,2,・・・,M)とすること
を特徴とする請求項1に記載の動画像距離算出装置。
The optical flow value calculation means is
The sum of the sizes of the M optical flows extracted by the optical flow extraction means is calculated, and the size of each optical flow is divided by the sum to obtain each normalized optical. The moving image distance calculation device according to claim 1, wherein the magnitude of the flow is set to the optical flow value q m (m = 1, 2, ..., M).
前記M個は、前記動画像における時刻tの画像の画素数であり、
前記距離算出手段は、時刻tの前記画像の全ての画素毎に、当該画素に映る対象物から前記カメラまでの距離Zを算出すること
を特徴とする請求項1または請求項2に記載の動画像距離算出装置。
The M number is the number of pixels of the image at time t in the moving image.
The first or second aspect of the invention, wherein the distance calculating means calculates a distance Z m from an object reflected in the pixel to the camera for each pixel of the image at time t. Moving image distance calculation device.
M個(M≧3)の対象物を撮影したカメラの動画像を用いて、該動画像の時刻tの画像における全ての画素のoptical flowを抽出する全画素オプティカルフロー抽出手段と、
該全画素オプティカルフロー抽出手段により抽出された全ての画素の前記optical flowのそれぞれの大きさを、画素毎のoptical flowの値として算出する全画素オプティカルフロー値算出手段と、
前記時刻tの画像に対してmean-shift法を適用することにより、前記時刻tの画像を、K個(K≧M)の領域に分割する領域分割手段と、
該領域分割手段により分割されたK個の前記領域のうち、前記時刻tの画像において前記対象物が映る画素が含まれるM個の領域を抽出し、それぞれの領域毎に当該領域内の全ての画素のoptical flowの値の平均を求めることにより、M個の前記対象物に対応するそれぞれのoptical flowの値q(m=1,2,・・・,M)を算出する領域別オプティカルフロー値算出手段と、
該領域別オプティカルフロー値算出手段により算出されたM個の前記optical flowの値qのうち、前記optical flowの値が最も小さい値をμとし、前記optical flowの値が最も大きい値をγとし、M個の前記対象物から前記カメラまでのそれぞれの距離のうちで最も近い距離Zと最も遠い距離Zとを予め測定しておき、定数aおよび定数bを、
a=Z・exp((μ/(γ−μ))log(Z/Z))
b=(1/(μ−γ))log(Z/Z
により算出し、
M個の前記対象物から前記カメラまでのそれぞれの距離をZ(m=1,2,・・・,M)として、当該距離Zを、前記定数aと、前記定数bと、M個の前記optical flowの値qとに基づいて、
=a・exp(bq
により算出する距離算出手段と
を有することを特徴とする動画像距離算出装置。
An all-pixel optical flow extraction means that extracts optical flow of all pixels in an image at time t of the moving image using a moving image of a camera that has taken M objects (M ≧ 3).
An all-pixel optical flow value calculating means that calculates the respective magnitudes of the optical flow of all the pixels extracted by the all-pixel optical flow extracting means as a value of the optical flow for each pixel.
By applying the mean-shift method to the image at time t, the area dividing means for dividing the image at time t into K (K ≧ M) regions and
From the K regions divided by the region dividing means, M regions including pixels in which the object is reflected in the image at the time t are extracted, and all the regions in the region are extracted for each region. By calculating the average of the optical flow values of the pixels, the optical flow values q m (m = 1, 2, ..., M) corresponding to each of the M objects are calculated. Value calculation means and
Of the M optical flow values q m calculated by the region-specific optical flow value calculating means, the value with the smallest optical flow value is μ, and the value with the largest optical flow value is γ. , The shortest distance Z N and the farthest distance Z L among the respective distances from the M objects to the camera are measured in advance, and the constant a and the constant b are set.
a = Z L · exp ((μ / (γ-μ)) log (Z L / Z N ))
b = (1 / (μ-γ)) log (Z L / Z N )
Calculated by
Let the distances from the M objects to the camera be Z m (m = 1, 2, ..., M), and set the distances Z m to the constant a, the constant b, and M. Based on the optical flow value q m and
Z m = a · exp (bq m )
A moving image distance calculation device characterized by having a distance calculation means calculated by
前記全画素オプティカルフロー値算出手段は、
前記全画素オプティカルフロー抽出手段により抽出された全ての画素の前記optical flowの大きさの総和を算出し、それぞれの画素の前記optical flowの大きさを前記総和で割ることによって求められた、正規化された画素毎のoptical flowの大きさを、前記画素毎のoptical flowの値とすること
を特徴とする請求項4に記載の動画像距離算出装置。
The all-pixel optical flow value calculation means is
Normalization obtained by calculating the sum of the optical flow sizes of all the pixels extracted by the all-pixel optical flow extraction means and dividing the optical flow size of each pixel by the sum. The moving image distance calculation device according to claim 4, wherein the magnitude of the optical flow for each pixel is set as the value of the optical flow for each pixel.
M個(M≧3)の対象物を撮影したカメラの動画像を用いて、該動画像に映るM個の前記対象物から前記カメラまでの距離を算出する動画像距離算出装置の動画像距離算出用プログラムであって、
コンピュータに、
前記動画像の時刻tの画像に映るM個の前記対象物の画素から、それぞれの画素に対応するM個のoptical flowを抽出させるオプティカルフロー抽出機能と、
該オプティカルフロー抽出機能により抽出されたM個の前記optical flowのそれぞれの大きさを、optical flowの値q(m=1,2,・・・,M)として算出させるオプティカルフロー値算出機能と、
該オプティカルフロー値算出機能により算出されたM個の前記optical flowの値qのうち、前記optical flowの値が最も小さい値をμとし、前記optical flowの値が最も大きい値をγとし、M個の前記対象物から前記カメラまでのそれぞれの距離のうちで最も近い距離Zと最も遠い距離Zとを予め測定しておき、定数aおよび定数bを、
a=Z・exp((μ/(γ−μ))log(Z/Z))
b=(1/(μ−γ))log(Z/Z
により算出させ、
M個の前記対象物から前記カメラまでのそれぞれの距離をZ(m=1,2,・・・,M)として、当該距離Zを、前記定数aと、前記定数bと、M個の前記optical flowの値qとに基づいて、
=a・exp(bq
により算出させる距離算出機能と
を実現させることを特徴とする動画像距離算出用プログラム。
The moving image distance of the moving image distance calculation device that calculates the distance from the M objects reflected in the moving image to the camera by using the moving image of the camera that has taken M (M ≧ 3) objects. It is a calculation program
On the computer
An optical flow extraction function that extracts M optical flows corresponding to each pixel from M pixels of the object displayed in the image at time t of the moving image, and
An optical flow value calculation function that calculates the respective magnitudes of the M optical flows extracted by the optical flow extraction function as optical flow values q m (m = 1, 2, ..., M). ,
Of the M optical flow values q m calculated by the optical flow value calculation function, μ is the value with the smallest optical flow value, γ is the value with the largest optical flow value, and M is M. Of the respective distances from the object to the camera, the shortest distance Z N and the farthest distance Z L are measured in advance, and the constant a and the constant b are set.
a = Z L · exp ((μ / (γ-μ)) log (Z L / Z N ))
b = (1 / (μ-γ)) log (Z L / Z N )
Calculated by
Let the distances from the M objects to the camera be Z m (m = 1, 2, ..., M), and set the distances Z m to the constant a, the constant b, and M. Based on the optical flow value q m and
Z m = a · exp (bq m )
A moving image distance calculation program characterized by realizing a distance calculation function calculated by
前記オプティカルフロー値算出機能において、
前記コンピュータに、
前記オプティカルフロー抽出機能により抽出されたM個の前記optical flowの大きさの総和を算出させ、それぞれの前記optical flowの大きさを前記総和で割ることによって求められた、正規化されたそれぞれのoptical flowの大きさを、前記optical flowの値q(m=1,2,・・・,M)とすること
を特徴とする請求項6に記載の動画像距離算出用プログラム。
In the optical flow value calculation function,
On the computer
Each normalized optical was obtained by calculating the sum of the sizes of the M optical flows extracted by the optical flow extraction function and dividing the size of each optical flow by the sum. The moving image distance calculation program according to claim 6, wherein the magnitude of the flow is set to the optical flow value q m (m = 1, 2, ..., M).
前記M個は、前記動画像における時刻tの画像の画素数であり、
前記距離算出機能において、前記コンピュータに、
時刻tの前記画像の全ての画素毎に、当該画素に映る対象物から前記カメラまでの距離Zを算出させること
を特徴とする請求項6または請求項7に記載の動画像距離算出用プログラム。
The M number is the number of pixels of the image at time t in the moving image.
In the distance calculation function, the computer
The moving image distance calculation program according to claim 6 or 7, wherein the distance Z m from the object reflected in the pixel to the camera is calculated for each pixel of the image at time t. ..
M個(M≧3)の対象物を撮影したカメラの動画像を用いて、該動画像に映るM個の前記対象物から前記カメラまでの距離を算出する動画像距離算出装置の動画像距離算出用プログラムであって、
コンピュータに、
前記動画像の時刻tの画像における全ての画素のoptical flowを抽出させる全画素オプティカルフロー抽出機能と、
該全画素オプティカルフロー抽出機能により抽出された全ての画素の前記optical flowのそれぞれの大きさを、画素毎のoptical flowの値として算出させる全画素オプティカルフロー値算出機能と、
前記時刻tの画像に対してmean-shift法を適用することにより、前記時刻tの画像を、K個(K≧M)の領域に分割させる領域分割機能と、
該領域分割機能により分割されたK個の前記領域のうち、前記時刻tの画像において前記対象物が映る画素が含まれるM個の領域を抽出させ、それぞれの領域毎に当該領域内の全ての画素のoptical flowの値の平均を求めさせることにより、M個の前記対象物に対応するそれぞれのoptical flowの値q(m=1,2,・・・,M)を算出させる領域別オプティカルフロー値算出機能と、
該領域別オプティカルフロー値算出機能により算出されたM個の前記optical flowの値qのうち、前記optical flowの値が最も小さい値をμとし、前記optical flowの値が最も大きい値をγとし、M個の前記対象物から前記カメラまでのそれぞれの距離のうちで最も近い距離Zと最も遠い距離Zとを予め測定しておき、定数aおよび定数bを、
a=Z・exp((μ/(γ−μ))log(Z/Z))
b=(1/(μ−γ))log(Z/Z
により算出させ、
M個の前記対象物から前記カメラまでのそれぞれの距離をZ(m=1,2,・・・,M)として、当該距離Zを、前記定数aと、前記定数bと、M個の前記optical flowの値qとに基づいて、
=a・exp(bq
により算出させる距離算出機能と
を実現させることを特徴とする動画像距離算出用プログラム。
The moving image distance of the moving image distance calculation device that calculates the distance from the M objects reflected in the moving image to the camera by using the moving image of the camera that has taken M (M ≧ 3) objects. It is a calculation program
On the computer
An all-pixel optical flow extraction function that extracts the optical flow of all pixels in the image at time t of the moving image, and
An all-pixel optical flow value calculation function that calculates the respective magnitudes of the optical flow of all the pixels extracted by the all-pixel optical flow extraction function as the optical flow value for each pixel, and
By applying the mean-shift method to the image at time t, the area division function for dividing the image at time t into K (K ≧ M) regions and
Of the K regions divided by the region division function, M regions including pixels in which the object is reflected in the image at time t are extracted, and all the regions in the region are extracted for each region. By having the average of the optical flow values of the pixels calculated, the optical flow values q m (m = 1, 2, ..., M) corresponding to the M objects are calculated for each region. Flow value calculation function and
Of the M optical flow values q m calculated by the region-specific optical flow value calculation function, the value with the smallest optical flow value is μ, and the value with the largest optical flow value is γ. , The closest distance Z N and the farthest distance Z L of the respective distances from the M objects to the camera are measured in advance, and the constant a and the constant b are set.
a = Z L · exp ((μ / (γ-μ)) log (Z L / Z N ))
b = (1 / (μ-γ)) log (Z L / Z N )
Calculated by
Let the distances from the M objects to the camera be Z m (m = 1, 2, ..., M), and set the distances Z m to the constant a, the constant b, and M. Based on the optical flow value q m and
Z m = a · exp (bq m )
A moving image distance calculation program characterized by realizing a distance calculation function calculated by
前記全画素オプティカルフロー値算出機能において、
前記コンピュータに、
前記全画素オプティカルフロー抽出機能により抽出された全ての画素の前記optical flowの大きさの総和を算出させ、それぞれの画素の前記optical flowの大きさを前記総和で割ることによって求められた、正規化された画素毎のoptical flowの大きさを、前記画素毎のoptical flowの値とすること
を特徴とする請求項9に記載の動画像距離算出用プログラム。
In the all-pixel optical flow value calculation function,
On the computer
Normalization obtained by calculating the sum of the optical flow sizes of all the pixels extracted by the all-pixel optical flow extraction function and dividing the optical flow size of each pixel by the sum. The moving image distance calculation program according to claim 9, wherein the magnitude of the optical flow for each pixel is set as the value of the optical flow for each pixel.
JP2019041980A 2019-02-22 2019-03-07 Moving Image Distance Calculation Device and Moving Image Distance Calculation Program Active JP7157449B2 (en)

Priority Applications (2)

Application Number Priority Date Filing Date Title
US17/427,915 US20220156958A1 (en) 2019-02-22 2019-03-27 Moving image distance calculator and computer-readable storage medium storing moving image distance calculation program
PCT/JP2019/013289 WO2020170462A1 (en) 2019-02-22 2019-03-27 Moving image distance calculation device, and computer-readable recording medium whereon moving image distance calculation program is recorded

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
JP2019030904 2019-02-22
JP2019030904 2019-02-22

Publications (2)

Publication Number Publication Date
JP2020139934A true JP2020139934A (en) 2020-09-03
JP7157449B2 JP7157449B2 (en) 2022-10-20

Family

ID=72280224

Family Applications (1)

Application Number Title Priority Date Filing Date
JP2019041980A Active JP7157449B2 (en) 2019-02-22 2019-03-07 Moving Image Distance Calculation Device and Moving Image Distance Calculation Program

Country Status (1)

Country Link
JP (1) JP7157449B2 (en)

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2000315255A (en) * 1999-03-01 2000-11-14 Yazaki Corp Back side direction monitoring device for vehicle and back side direction monitoring alarm device for vehicle
WO2017212929A1 (en) * 2016-06-08 2017-12-14 ソニー株式会社 Imaging control device and method, and vehicle
JP2018040789A (en) * 2016-09-01 2018-03-15 公立大学法人会津大学 Image distance calculation device, image distance calculation method, and program for image distance calculation

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2000315255A (en) * 1999-03-01 2000-11-14 Yazaki Corp Back side direction monitoring device for vehicle and back side direction monitoring alarm device for vehicle
WO2017212929A1 (en) * 2016-06-08 2017-12-14 ソニー株式会社 Imaging control device and method, and vehicle
JP2018040789A (en) * 2016-09-01 2018-03-15 公立大学法人会津大学 Image distance calculation device, image distance calculation method, and program for image distance calculation

Also Published As

Publication number Publication date
JP7157449B2 (en) 2022-10-20

Similar Documents

Publication Publication Date Title
US10515271B2 (en) Flight device and flight control method
CN109151439B (en) Automatic tracking shooting system and method based on vision
WO2017045326A1 (en) Photographing processing method for unmanned aerial vehicle
CN106960454B (en) Depth of field obstacle avoidance method and equipment and unmanned aerial vehicle
WO2020107372A1 (en) Control method and apparatus for photographing device, and device and storage medium
CN111462503B (en) Vehicle speed measuring method and device and computer readable storage medium
WO2021128747A1 (en) Monitoring method, apparatus, and system, electronic device, and storage medium
CN105282421B (en) A kind of mist elimination image acquisition methods, device and terminal
WO2018211926A1 (en) Image generation device, image generation system, image generation method, and image generation program
CN108897342B (en) Positioning and tracking method and system for fast-moving civil multi-rotor unmanned aerial vehicle
CN111105347B (en) Method, device and storage medium for generating panoramic image with depth information
EP3296950A1 (en) Method and device for blurring a virtual object in a video
JP2017072986A (en) Autonomous flying device, control method and program of autonomous flying device
CN113391644B (en) Unmanned aerial vehicle shooting distance semi-automatic optimization method based on image information entropy
WO2022057800A1 (en) Gimbal camera, gimbal camera tracking control method and apparatus, and device
WO2021081707A1 (en) Data processing method and apparatus, movable platform and computer-readable storage medium
WO2022047701A1 (en) Image processing method and apparatus
CN110944101A (en) Image pickup apparatus and image recording method
CN115238018A (en) Method for managing 3D flight path and related system
WO2020207411A1 (en) Image data processing method and apparatus, image processing chip and aircraft
WO2020170462A1 (en) Moving image distance calculation device, and computer-readable recording medium whereon moving image distance calculation program is recorded
WO2021217403A1 (en) Method and apparatus for controlling movable platform, and device and storage medium
WO2021146970A1 (en) Semantic segmentation-based distance measurement method and apparatus, device and system
JP7315216B2 (en) Corrected Distance Calculation Device, Corrected Distance Calculation Program, and Corrected Distance Calculation Method
JP7157449B2 (en) Moving Image Distance Calculation Device and Moving Image Distance Calculation Program

Legal Events

Date Code Title Description
A621 Written request for application examination

Free format text: JAPANESE INTERMEDIATE CODE: A621

Effective date: 20211224

TRDD Decision of grant or rejection written
A01 Written decision to grant a patent or to grant a registration (utility model)

Free format text: JAPANESE INTERMEDIATE CODE: A01

Effective date: 20220927

A61 First payment of annual fees (during grant procedure)

Free format text: JAPANESE INTERMEDIATE CODE: A61

Effective date: 20220930

R150 Certificate of patent or registration of utility model

Ref document number: 7157449

Country of ref document: JP

Free format text: JAPANESE INTERMEDIATE CODE: R150