Need help with this algorithm assignment

User Generated

tbivaqonwnw4h

Computer Science

Description

Need help with this algo assignment.

Part 1 in 12 hours.

Part 2 by May 21st.

Part 3 by May 30th.


I've attached the files.

Unformatted Attachment Preview

CS627 Project 2 – multiple due dates (200 points) Design an algorithm that compares one picture with another using dynamic programming. You have been tasked with creating an app that performs special operations on images. Specifically, your app will compare one black-and-white image to another black-and-white image. There are a number of methods that can be used to perform this task, but have been told that dynamic programming is a fast and elegant scheme to solve this problem. Design an algorithm (using pseudocode) that takes in as an input, two 2-D integer arrays that are assumed to be 2 black-and-white images: initiallmage x, whose dimensions are IxJ (I rows by J columns), and finallmage y, whose dimensions are IxK. The algorithm will compare x to y, row- by-row, as defined below. Your algorithm will employ a dynamic programming scheme to compare X to Y identifying the minimal difference between each row. Because you are working with black-and-white images only, you should assume that each image is a 2-D integer array consisting of 2 possible values: 0 or 1, where 0 represents black and 1 represents white. Thus, this 2-D grid of 0 and 1 values comprise a 2-D black-and-white image. Each row of this image is then simply a 1-D integer array filled with either Os or 1s. Therefore, you must define how you will measure the difference between the strings of Os and 1s in each row. Remember that you will do the comparison one row in the images at a time. First, compare X1,* to Y1* (Here X1,* is the first row in image X and Y1,* is the first row in image Y). Next, compare X2 to Y2... Each one of these comparisons will require the construction of a D (distance) matrix. Use the following recurrence relation to develop your pseudocode: pli - 1.6 - 1]. if Xij = YA OR DJ – 1.) – 1] + 1. if Xij = Yin Dj - 1.k] + 1, account for Xij is not in Yic Dj.k - 1] +1, account for Yix is not in XL. Dj,k] = min line 1 line 2 line 3 After the D matrix is completed (for each row), the minimum number in the bottom row is the minimal mismatch for this row. You will assign this value to the variable minVali. This number tells how different row X1,* is from row Y1* . You will then repeat this comparison for all rows i and aggregate the difference when complete into variable totalDifference = Ei minVali. As a result, the algorithm will compare the total difference to a threshold value called thresh. If total value is above the threshold, the images are declared different, otherwise they are declared to be similar images. You can assume that the thresh variable is supplied as an input to your algorithm. Hint: you might want to make thresh a percent versus an actual value since your images can be small or large. Part 3 4. AI Section 12.5 in your book might help guide you on the basic understanding as it similar in the row by row comparison with fewer options. Here is a simple example: ice Similar initial image final image 1 1 1 1 1 1 1 1 1 1 1 0 0 1 0 1 1 0 1 0 1 0 0 1 10 1 0 1 0 1 1 0 1 0 0 0 0 0 0 00 00 'p of O Different initial image final image 0 1 1 1 | 1 0 0 0 1 000 1 0 1 00 1 0 0 1 1 1 1 1 1 1 1 1 0 0 1 0 0 0 0 000 0 1 1 1 1 O O O O All parts must be submitted electronically to the portal for full credit. Your algorithm has the following pieces: O Part 1 (due 15 May): 1. Describe the problem (10 points) this might be what a boss gives you (or what I have given you) 2. Formulate the problem (10 points) A lot of this I have given to you but you should: restate to make sure you understand in your own words state preferences or restrictions state assumptions (minimum size, maximum size, etc) is there any prerequisite knowledge needed to follow the algorithm? o this might often be the hardest part . 1 Part 2 (Due 22 May): 3. Design the algorithm (75 points) o Design pseudocode for the image comparison algorithm discussed above, given input Images X, Y, and thresh. The output is a declaration: The images are similar, or the images are different. Include the input thresh value and the calculated difference o Make sure all cases accounted for o You should use words and/or flowcharts to help enhance your pseudocode O Part 3 (Due 31 May): 4. Analyze the algorithm (50 points) o Discuss the optimality of the dynamic programming solution. Discuss the time complexity of this algorithm in terms of the size of the inputs X and Y. 5. Add possible extensions (15 points) Cases not accounted for? Other possibilities? 6. Test the algorithm (at least 2 cases, 20 points for each case) Actually trace your algorithm with two cases - one that should be a match and one that should not be a match Should be a step by step trace (building matrices for the number of rows in your pictures) O This is an individual project but I encourage you to talk to classmates and discuss ideas. Course Objectives: Construct measurement objects to measure the performance of developed algorithms. Design and develop solutions to problems that require algorithms. Analyze the complexity of algorithms assigned.
Purchase answer to see full attachment
User generated content is uploaded by users for the purposes of learning and should be used following Studypool's honor code & terms of service.

Explanation & Answer

Attached.

PSEUDOCODE

STUDENT NAME:

INSTITUTION NAME:

Describing the problem
We are trying to find a program that will make us avoid calculating the same thing twice. This we aim to
achieve by creating a table that will keep the known results and also will keep the minimum values
which in the end will help us find the maximum or larger ...


Anonymous
This is great! Exactly what I wanted.

Studypool
4.7
Trustpilot
4.5
Sitejabber
4.4

Related Tags