The present invention relates to an optical flow accuracy calculating device for and an optical flow accuracy calculating method of calculating the accuracy of optical flows between two images.
For example, in Patent Literature 1, a method of determining whether or not a pixel-to-pixel mapping between two images is correct is described. An optical flow is a set of vectors showing to which point of one of two images a point of the other one of the two images corresponds.
Therefore, the pixel-to-pixel mapping described in Patent Literature 1 is equivalent to an optical flow.
Patent Literature 1: Japanese Unexamined Patent Application Publication No. 2001-124519
However, the method described in Patent Literature 1 is one of determining whether or not a pixel-to-pixel mapping between two images is correct, but is not one of explicitly showing the accuracy of optical flows.
Therefore, degree of the accuracy or the error of optical flows cannot be acquired as quantitative data.
The present invention is made in order to solve the above-mentioned problem, and it is therefore an object of the present invention to provide an optical flow accuracy calculating device and an optical flow accuracy calculating method capable of calculating the accuracy of optical flows.
An optical flow accuracy calculating device according to the present invention includes a return point acquiring unit and an accuracy calculating unit. The return point acquiring unit refers to both a first optical flow from one of two images to another one of the two images, and a second optical flow returning from an end point of the first optical flow to a start point of the first optical flow, to acquire the coordinates of a return point which is an end point of the second optical flow. The accuracy calculating unit calculates the accuracy of the optical flows between the two images on the basis of the difference between the coordinates of the start point of the first optical flow and the coordinates of the return point acquired by the return point acquiring unit.
According to the present invention, the difference between the coordinates of a start point of the first optical flow from one of the two images to the other image and the coordinates of a return point which is an end point of the second optical flow returning from the other image to the one of the images is calculated. As a result, the accuracy of the optical flows can be calculated on the basis of this difference.
Hereafter, in order to explain the present invention in greater detail, embodiments of the present invention will be described with reference to the accompanying drawings.
Hereafter, it is assumed that the optical flow accuracy calculating device 1 calculates an accuracy P of optical flows between an image A and an image B.
As the images A and B, for example, two continuous time series frame images in video data are provided.
The optical flow calculating unit 2 calculates both a first optical flow from the image A to the image B, and a second optical flow from the image B to the image A.
The first optical flow is information showing a vector extending from a start point on the image A to an end point on the image B, the end point corresponding to the start point.
Further, the second optical flow is information showing a vector extending from the end point of the first optical flow on the image B to an end point on the image A, this end point corresponding to the end point of the first optical flow, i.e., extending from the end point of the first optical flow toward the start point of the first optical flow.
Therefore, when there is no error in the optical flows between the images A and B, the end point of the second optical flow matches the start point of the first optical flow on the image A.
The storage unit 3 stores the optical flows calculated by the optical flow calculating unit 2. The storage unit 3 can be disposed on a storage area of a storage device which is included in the optical flow accuracy calculating device 1, or can be disposed on a storage area of an external device with which the optical flow accuracy calculating device 1 can exchange data.
The return point acquiring unit 4 refers to the first and second optical flows stored in the storage unit 3, to acquire the coordinates of a return point which is the end point of the second optical flow. Hereafter, referring to the first and second optical flows between the images A and B is referred to as the cross reference of the optical flows.
The cross reference of the optical flows is performed in accordance with the following procedure.
First, by referring to the first optical flow while paying attention to the coordinates (x, y) of a point p on the image A, the coordinates (x′, y′) of a point p′ on the image B which is the end point of the first optical flow starting from the point p are acquired. Then, by referring to the second optical flow starting from the point p′ and extending toward the point p on the image A, the coordinates (x″, y″) of a point p″ on the image A which is the end point of the second optical flow are acquired as the return point.
As mentioned above, when there is no error in the optical flows between the images A and B, the coordinates (x, y) of the point p obviously match the coordinates (x″, y″) of the point p.
The accuracy calculating unit 5 calculates the accuracy P of the optical flows between the images A and B on the basis of the difference between the coordinates (x, y) of the point p and the coordinates (x″, y″) of the point p″, on the image A.
For example, the return point acquiring unit 4 sets each of multiple pixels on the image A as a point p, and acquires the coordinates (x″, y″) of the return point corresponding to each of these points.
The accuracy calculating unit 5 calculates the root mean square error (RMSE) between the coordinates of the multiple points p and the coordinates of the multiple return points corresponding to these points p, and calculates, as the accuracy P of the optical flows, the value which is the result of further dividing the RMSE calculated thereby by the square root of 2.
Although in
More specifically, because the optical flow accuracy calculating device 1 according to Embodiment 1 can calculate the accuracy P by using the existing optical flow information, the optical flow accuracy calculating device should just include at least the return point acquiring unit 4 and the accuracy calculating unit 5.
Each of the functions of the optical flow calculating unit 2, the storage unit 3, the return point acquiring unit 4, and the accuracy calculating unit 5 of the optical flow accuracy calculating device 1 shown in
More specifically, the optical flow accuracy calculating device 1 includes a processing circuit for performing these functions successively.
The processing circuit can be hardware for exclusive use, or can be a CPU (Central Processing Unit) or a GPU (Graphic Processing Unit) that reads and executes a program stored in a memory.
In a case in which the processing circuit is a processing circuit 100 shown in
Further, the functions of the optical flow calculating unit 2, the storage unit 3, the return point acquiring unit 4, and the accuracy calculating unit 5 can be implemented by respective processing circuits, or the functions of the units can be implemented collectively by a single processing circuit.
In a case in which the above-mentioned processing circuit is a CPU 101 as shown in
Software and firmware are described as programs and the programs are stored in a memory 102. The CPU 101 implements the function of each of the units by reading and executing a program stored in the memory 102. More specifically, the memory 102 is included for storing a program which implements each of the functions as a result when the program is executed by the CPU 101.
Further, these programs cause a computer to perform procedures or methods which are used by the optical flow calculating unit 2, the storage unit 3, the return point acquiring unit 4, and the accuracy calculating unit 5.
Here, the memory is, for example, a non-volatile or volatile semiconductor memory, such as a RAM (Random Access Memory), a ROM, a flash memory, an EPROM (Erasable Programmable ROM), or an EEPROM (Electrically EPROM); a magnetic disk, a flexible disk, an optical disc, a compact disc, a mini disc, a DVD (Digital Versatile Disk), or the like.
A part of the functions of the optical flow calculating unit 2, the storage unit 3, the return point acquiring unit 4, and the accuracy calculating unit 5 can be implemented by hardware for exclusive use, and a rest of the functions can be implemented by software or firmware.
For example, the functions of the optical flow calculating unit 2, the storage unit 3, and the return point acquiring unit 4 are implemented by using the processing circuit 100 which is hardware for exclusive use, and the function of the accuracy calculating unit 5 is implemented by the CPU 101's execution of a program stored in the memory 102.
In this way, the above-mentioned processing circuit can implement the above-mentioned functions by using hardware, software, firmware, or a combination of hardware, software, and firmware.
Next, the principle of the calculation of the accuracy P of the optical flows in Embodiment 1 will be explained using
Further, by referring to the second optical flow starting from the coordinates (x′, y′) of the point p′, the coordinates (x″, y″) of the point p″ on the image A which is the end point of the second optical flow can be acquired.
Because at least one of the coordinates (x′, y′) of the point p′ and the coordinates (x″, y″) of the point p″, which are acquired here, differs from that in the case in which there is no error in the optical flows, the coordinates (x, y) of the point p and the coordinates (x″, y″) of the point p″ do not match each other, as shown in
It can be considered that when the optical flows have a large error, the degree of mismatch between the coordinates (x, y) of the point p and the coordinates (x″, y″) of the point p″ is usually larger than that in the case in which the optical flows have a small error, as shown in
Therefore, by assuming the coordinates (x, y) of a point p on the image A which is a start point of the first optical flow to be true values, each of multiple pixels on the image A is set as the point p. By calculating the RMSE between the coordinates (x″, y″) of the points p″ corresponding to the points pset in this way, and the coordinates (x, y) of the points p, a quantification of the accuracy P of the optical flows is possible.
In order to acquire the coordinates (x, y) of the point p and the coordinates (x″, y″) of the point p″, it is necessary to refer to the first and second optical flows, as mentioned above.
More specifically, in the acquisition of these coordinates, the optical flows are referred twice.
This process corresponds to the case of the number of trials n=2 in the random walk problem described in, for example, the following reference literature.
(Reference Literature) “Knowledge of random numbers” written by Kazumasa Wakimoto, Morikita Shuppan, August 1970
On the basis of the principle shown in the above-mentioned reference literature, the accuracy P of the optical flows between the images A and B can be calculated from the following equation (1).
P=RMSE/√2 (1)
Next, an operation will be explained.
First, the return point acquiring unit 4 refers to the first optical flow starting from the coordinates (x, y) of a point p on the image A, and stored in the storage unit 3 (step ST1). As a result, the return point acquiring unit 4 acquires the coordinates (x′, y′) of a point p′ on the image B which is an end point of the first optical flow. Here, all the pixels of the image A are set as points p, and the coordinates of the point p′ corresponding to these points p are acquired.
Next, the return point acquiring unit 4 refers to the second optical flow starting from the point p′ on the image B, and stored in the storage unit 3 (step ST2). As a result, the return point acquiring unit 4 acquires, as a return point, the coordinates (x″, y″) of a point p″ on the image A which is an end point of the second optical flow (step ST3).
Here, all the pixels of the image B are set as points p′, and the coordinates of the points p″ corresponding to these points p′ are acquired. More specifically, return points starting from all the pixels of the image A are acquired.
Next, the accuracy calculating unit 5 calculates the RMSE of the coordinates of the return points in a case in which the coordinates of the start points of the first optical flow are assumed to be true values (step ST4). More specifically, by assuming that the coordinates of the points p are true values, the RMSE of the coordinates of the return points with respect to these true values is calculated.
After that, the accuracy calculating unit 5 calculates, as the accuracy P of the optical flows between the images A and B, a value which is the result of dividing the RMSE by the square root of 2 (step ST5).
This display process is an existing technique.
Further,
In
For example, when the coordinates (100.00, 100.00) are the coordinates (x, y) of a point p, the first optical flow is (−26.78, −41.09), as shown in (3) and (4). The return point acquiring unit 4 calculates the coordinates (73.22, 58.91) shown in (5) and (6) by referring to this first optical flow. This point is the coordinates (x′, y′) of a point p′ on the image B which is an end point of the first optical flow.
On the other hand, as shown in (7) and (8), the second optical flow starting from the coordinates (x′, y′) of the point p′ on the image B are (26.90, 41.03).
The return point acquiring unit 4 acquires the coordinates (100.12, 99.94) shown in (9) and (10) by referring to this second optical flow.
This point corresponds to the coordinates (x″, y″) of the point p″ on the image A which is an end point of the second optical flow, i.e., a return point.
As to the coordinates of each of the nine start points, the return point acquiring unit 4 acquires the coordinates of the corresponding return point in this way.
The accuracy calculating unit 5 assumes the coordinates of each of the nine start points to be true values and calculates the RMSE of the return points, so that BRfSE=0.22 is acquired.
Next, the accuracy calculating unit 5 divides the RMSE by the square root of 2 in accordance with the above-mentioned equation (1), so that the accuracy P=0.15 of the optical flows between the images A and B is acquired.
Therefore, the accuracy P of these optical flows can be quantified to be a quantitative value such as 0.15 pixels. For example, in a case in which there are several different algorithms for calculating optical flows, by using, as a reference, the accuracy P of the optical flows, it becomes possible to quantitatively make a comparison to determine how accurately and as to which target which algorithm can calculate the optical flows.
Although the example in which the value which is the result of dividing by the square root of 2 the RMSE between the coordinates of points p each of which is a start point of the first optical flow and the coordinates of points p″ each of which is a return point corresponding to the start point is defined as the accuracy P of the optical flows has been explained up to now, the embodiment is not limited to this example. For example, any value can be used as the accuracy P of the optical flows as long as the value can quantify the difference between the coordinates of the points p and the coordinates of the points p″.
More specifically, the optical flow accuracy calculating device 1 quantifies (digitizes) the accuracy P of the optical flows on the basis of the difference between the coordinates of the points p and the coordinates of the points p″.
As mentioned above, the optical flow accuracy calculating device 1 according to Embodiment 1 includes the return point acquiring unit 4 and the accuracy calculating unit 5. The accuracy calculating unit 5 can calculate the accuracy P of the optical flows on the basis of the difference between the coordinates of points p each of which is a start point of the first optical flow and the coordinates of points p″ each of which is an end point of the second optical flow returning from the image B to the image A.
The above-mentioned difference can be the RMSE between the coordinates of start points of the first optical flow and the coordinates of return points corresponding to these start points, and, in this case, a value which is the result of dividing the RNSE by the square root of 2 is the accuracy P.
While the present invention has been described in its preferred embodiment, it is to be understood that various changes can be made in an arbitrary component according to the embodiment, or an arbitrary component according to the embodiment can be omitted within the scope of the invention.
Because the optical flow accuracy calculating device according to the present invention can calculate the accuracy of optical flows, the optical flow accuracy calculating device is suitable for, for example, an object detection device or the like that detects an object from image information.
1 optical flow accuracy calculating device, 2 optical flow calculating unit, 3 storage unit, 4 return point acquiring unit, 5 accuracy calculating unit, 100 processing circuit, 101 CPU, and 102 memory.
Filing Document | Filing Date | Country | Kind |
---|---|---|---|
PCT/JP2016/077487 | 9/16/2016 | WO | 00 |