Calculates the displacement vector field determined by a directed smoothness constraint.
The operator optical_flow1__ determines a displacement vector field (DVF) with the help of a directed smoothness constraint according to Nagel. This is a differential procedure which demands smoothness of the DVF in two indicated directions:
- perpendicular to the direction of the grayvalue gradient - perpendicular to the direction of principle curvature
The solution of the resulting minimal problems is hereby achieved with the help of the method fo the finite elements (FEM). The linear equation system, which can be gained with the help of the FEM, will be resolved by using the procedure of the conjugated gradients and by scaling the equation matrix in order to accelerate the convergency. For capacity reasons, however, only every xth (x = 2^{Zoom}) displacement vector (DV) will be calculated and the resulting DVF will then be "filled" correnspondingly. It is therefore recommendable to smooth (see e.g. gauss__) both input images before calling optical_flow1__.
The parameter Lambda controls the weighting of the smoothing terms in the underlying minimal problem with respect to the similarity term. Therefore the higher the values of the parameter Lambda are chosen, the smoother the calculated DVF will be. Good results can be achieved by setting Lambda approximately to 10. Gamma should be set very low, in order to avoid "blurring" the directed smoothness constraint. This parameter serves only to prevent numerical difficulties (singularity of the linear equation concerning homogenous grayvalue areas). A value around 0.01 would be considered normal.
The calculated DVF describes a displacement of the image points of the image 1 (Image1) in relation to the successor image 2 (Image2). An image point (x,y) of image 1 moves to the position (x,y) + DVF(x,y) in image 2. The displacement vector field (VectorField will be encoded in two images DVF1 and DVF2 as follows:
DVF1 (x,y) being the x-component of the displacement vector in the position (x,y) + 128, DVF2 (x,y) being the y-component of the displacement vector in the position (x,y) + 128. . A positive x (i.e. DVF1 > 128) shows to the right, a positive y (i.e. DVF2 > 128) shows downwards, i.e. in the direction of growing rownumbers.
Before using the operator optical_flow1__, a smoothing filter the size of the step width (2^{Zoom}) should be applied.
The operator optical_flow1__ has only been implemented for byte-images.
Image1 (input_object) |
image(-array) -> object |
First input image. |
Image2 (input_object) |
image(-array) -> object |
Second input image. | |
Number of elements: Image2 == Image1 |
VectorField (output_object) |
image(-array) -> object |
Displacement vector field. | |
Number of elements: VectorField == Image1 |
Lambda (input_control) |
real -> real |
Controls the degree of smoothness of the displacement vector field. | |
Default value: 10.0 | |
Suggested values: 0.1, 0.5, 1.0, 5.0, 10.0, 50.0 | |
Range of values: 0.1 <= Lambda <= 300.0 | |
Minimum increment: 0.1 | |
Recommended increment: 5.0 |
Gamma (input_control) |
real -> real |
In order to prevent numerical difficulties (should be small). | |
Default value: 0.01 | |
Suggested values: 0.001, 0.01, 0.1, 1.0, 10.0, 100.0 | |
Range of values: 0.0 <= Gamma <= 100.0 | |
Minimum increment: 0.001 | |
Recommended increment: 0.10 |
Zoom (input_control) |
integer -> integer |
Only every 2^{Zoom}th vector will be calculated. | |
Default value: 8 | |
Suggested values: 2, 3, 4, 5, 6, 7, 8, 9 | |
Range of values: 1 <= Zoom <= 70 | |
Minimum increment: 1 | |
Recommended increment: 1 | |
Restriction: (Zoom < ld(width(Image1))) && (Zoom < ld(height(Image1))) |
read_image(:B1::) > mean__(B1:L1:16,16::) > read_image(:B2: :) > mean__(B2:L2:16,16::) > optical_flow1__(L1,L2:DVF:10.0,0.01,8:) > disp_image(B1:::) > set_color(::'red':) > disp_image(DVF:::).
If the parameter values are correct, the operator optical_flow1__ returns the value TRUE. If the input is empty (no input images are available) the behaviour can be set via set_system(::'no_object_result',<Result>:). If necessary, an exception is raised.
disp_image, reduce_domain, set_paint
Schnoerr, C. "Zur Schätzung von Geschwindigkeitsvektorfeldern in Bildfolgen mit einer richtungsabhängigen Glattheitsforderung"; IFB 219, 11. DAGM-Symposium, Hamburg, 1989