$34.99
Instructions:
• For this assignment, use the images first frame.png and second frame.png posted along with this document.
• Do not use built-in functions.
• Please turn in Python Notebooks with the following notation for the file name: your-roll-number-hw3.ipynb.
• Divide each frame into non-overlapping macroblocks of size 16×16 pixels. Note that the images are of size 176 × 144.
• Generate motion vectors at each macroblock in the second frame from the first.
1 Motion Estimation
In this problem you will implement the most critical part of the video codec – the motion estimator. Do the following:
1. Use the 3-step search to find motion vectors (check slides for description). (10)
• Use mean absolute distance (MAD) as your metric.
• Step 1: Search at 8 location ±4 pixels around current macroblock including (0, 0) (relative to current macroblock).
• Step 2: search at 8 location ±2 pixels around best match location in Step 1 including best match location.
• Step 3: search at 8 location ±1 pixels around best match location in Step 2 including best match location.
2. Plot the motion vector at each macroblock. You can use the arrow function in matplotlib. (5)
3. Generate the motion compensated predicted frame using the motion vectors and the first frame. (10)
4. Compute the error between the second frame and its motion compensated predicted version and display it.
(5)