Click4Ai

350.

Hard

### Optical Flow

Optical flow is a technique used in computer vision to track the motion of pixels between two consecutive frames of a video.

Example:

Suppose we have two consecutive frames of a video and we want to track the motion of pixels between them. We can use optical flow algorithms to calculate the velocity of each pixel.

Constraints:

* The video frames should be grayscale and have the same size.

* The optical flow algorithm should be able to handle variations in lighting and motion.

* The algorithm should return the velocity of each pixel in the format (u, v).

Test Cases

Test Case 1
Input: {"frame1": [[1, 2], [3, 4]], "frame2": [[5, 6], [7, 8]]}
Expected: [[0.0, 0.0], [0.0, 0.0]]
Test Case 2
Input: {"frame1": [[9, 10], [11, 12]], "frame2": [[13, 14], [15, 16]]}
Expected: [[0.0, 0.0], [0.0, 0.0]]
+ 3 hidden test cases