2022/5/5 20:16 Project 3 – Block-based Motion Compensation
Project 3 – Block-based Motion Compensation
5 16 23:59 120 java txt 4 20 0:00 5 16 23:59 27
In this project, we’ll work on one essential technique in video compression, block-based motion compensation.
Copyright By PowCoder代写 加微信 powcoder
Project 3 Template Codes Project 3 Video Frames PPM Image Format
Programming requirements:
You are not allowed to use any Java built-in image class methods, library, or tools to complete this homework.
Do not create one mega-size main class.
Do not change any given methods of MImage class nor create a new class that duplicates MImage class. Treat MImage as a part of imported library.
Test your program with all test data.
If you do not meet any of the requirements above, you will receive a significant reduction.
What your program should do
Name your main application CS4551_[YourLastName].java (eg. CS4551_Doe.java) and expand the given template program to perform the required tasks.
Receive the input image file as command line arguments.
https://calstatela.instructure.com/courses/73236/assignments/1083800
天 日月至日月用可 和 型类件文 件文传上份一 交提 分得 辑编 由日 月 止截
2022/5/5 20:16 Project 3 – Block-based Motion Compensation
Main Menu———————————– 1. Block-based Motion Compensation 2. Fast Motion Compensation
Please enter the task number [1-3]:
After performing a selected task, go back to display the menu again.
Task 1 – Block-based Motion Compensation (80 pts)
Write a routine(method) that compensates motions between two images (one is the target image and the other one is the reference image). Receive two images as parameters. Make the routine perform the followings:
Receive an integer n for the macro block size from the user. n must be 8, 16, or 24. Receive an integer p for search window from the user. p must be 2, 4, 8, 12, or 16. Divide the target image into a set of n×n macro blocks.
For each target macro block:
Estimate one motion vector by finding the best matched macro block (a.k.a. predicted block) in the reference image using p for the search area size and MSD (Mean Square Difference) for the matching criteria. When you compute MSD, use Gray values:
Gray = round(0.299 * R + 0.587 * G + 0.114 * B)
After finding the best matched block, compute the motion vector and the error block Compute the motion vector using
where is the upper left corner location of the target block and is the upper left corner location of the best matched block location in the reference frame.
Compute the error block (a.k.a. residual block) consisting of pixel differences (absolute values) between the target block and the best matched block (a.k.a. predicted block).
Display and Save your error (or residual) image. Your error image is a composition of all error blocks. Scale error values to range [0, 255]. In order to do so, compute and
and map values from to [0, 255] using
Save the estimated motion vectors to the “mv.txt”. It should have motion vectors of all target blocks.
https://calstatela.instructure.com/courses/73236/assignments/1083800
2022/5/5 20:16 Project 3 – Block-based Motion Compensation
Extra credit (20 pts) Implement matching in the half-pixel accuracy:
Use the best matched block at full-pel position as the starting point, shown as the red dot in the figure below.
Check the neighboring candidate blocks in half-pel positions, which are shown as the blue diamonds.
Select the block with the least MSD among the 8 half-pel blocks and one best full-pel block as the final matched block in the half-pel block-based motion compensation.
Task 2 – Fast Motion Compensation (20 pts)
Implement logarithmic search for matching. Provide an additional menu option for this. Display and save motion vectors and a residual image. Also, display the number of matches performed given p.
Submission Format
Submit source codes with necessary files for “compile and run”.
Do NOT submit data files.
You MUST provide a readme.txt file containing all information to help with the grading process.
If your program produces any compile errors, you will receive 0 automatically no matter how close your program is to the solution.
https://calstatela.instructure.com/courses/73236/assignments/1083800
2022/5/5 20:16 Project 3 – Block-based Motion Compensation
https://calstatela.instructure.com/courses/73236/assignments/1083800
程序代写 CS代考 加微信: powcoder QQ: 1823890830 Email: powcoder@163.com