Calculating the Displacement vector field by correlation methods.
The operator optical_flow_match determines a displacement vector field (DVF) with the help of correlation methods. Simple- and multichannel Images may be used. A window of the size SizeWindow will be moved inside a mask of the size SizeSearch over a second image and there the grayvalues will be compared with the ones from the first image. The correlation showing the slightest error will determine the vector. In case of two vectors having the same weighting, the shorter vector will be prefered. After having processed one image point, the next image point at a distance of Step will be selected. It is therefore not guaranteed to get a dense displacement vector field.
The parameter Threshold specifies the maximal divergence of previously estimated correlations and the best estimation of a displacement vector.
The method used by the operator is determined by the parameter Mode. The follwing values for Mode can be selected:
'dfd' Calculation of displaced frame difference. 'dfd_norm' Calculation of displaced frame difference normalized by the mean value of the matching windows.
If the image has more than one channel the parameter Weights indicates the weighting of the individual channels. For each channel one weight factor must be passed.
For the parameters SizeWindow, SizeSearch and Step optionally two values can be passed: The first value indicates hereby the width (respectively the row), the second value the height (respectively the column).
|
Image1 (input_object) |
image(-array) -> object : byte / direction / cyclic |
| First input image (optionally with more than one channel). | |
|
Image2 (input_object) |
image(-array) -> object : byte / direction / cyclic |
| Second input image (optionally with more than one channel). | |
| Number of elements: Image2 == Image1 | |
|
VectorField (output_object) |
image(-array) -> object : dvf |
| Displacement vector field to be calculated. | |
| Number of elements: VectorField == Image1 | |
|
Mode (input_control) |
string -> string |
| Kind of correlation. | |
| Default value: 'dfd' | |
| List of values: 'dfd', 'dfd_norm' | |
|
Threshold (input_control) |
integer -> integer |
| Maximal divergence of the previously estimated correlations and the best estimate of a displacement vector. | |
| Default value: 10 | |
| Suggested values: 1, 2, 3, 4, 5, 7, 10, 12, 15, 17, 20 | |
| Typical range of values: 1 <= Threshold <= 300 | |
| Minimum increment: 1 | |
|
Recommended increment: 5 | |
|
Step (input_control) |
integer(-array) -> integer |
| Step width. | |
| Default value: 10 | |
| Suggested values: 1, 2, 3, 5, 7, 10, 15, 20, 30, 50 | |
| Typical range of values: 1 <= Step <= 300 | |
| Minimum increment: 1 | |
|
Recommended increment: 5 | |
|
SizeWindow (input_control) |
integer(-array) -> integer |
| Size of the correlation window. | |
| Default value: 11 | |
| Suggested values: 3, 5, 7, 9, 11, 15, 20, 30 | |
| Typical range of values: 1 <= SizeWindow <= 30 | |
| Minimum increment: 1 | |
|
Recommended increment: 2 | |
|
SizeSearch (input_control) |
integer(-array) -> integer |
| Size of the area to be searched. | |
| Default value: 20 | |
| Suggested values: 3, 5, 7, 10, 20, 30, 40, 50, 60 | |
| Typical range of values: 1 <= SizeSearch <= 60 | |
| Minimum increment: 1 | |
|
Recommended increment: 2 | |
|
Weights (input_control) |
integer(-array) -> integer |
| Weighting of the channels. | |
| Default value: 1 | |
| Suggested values: 1, 3, 5, 7, 10 | |
| Typical range of values: 1 <= Weights <= 10 | |
| Minimum increment: 1 | |
|
Recommended increment: 1 | |
read_image(B1,'image1') mean_image(B1,L1,16,16) read_image(B2,'image2') mean(B2,L2,16,16) optical_flow_match(L1,L2,VVF,'dfd',10,10,11,20,1) disp_image(B1,WindowHandle) set_color(WindowHandle,'red') disp_image(VVF,WindowHandle).
optical_flow_match is reentrant and automatically parallelized (on tuple level).
mean_image, gauss_image, smooth_image
Image filters