Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Dynamic Programming: Question 1 (10pt) You are given a color picture consisting of an m x n array A of pixels, where each pixel specifies
Dynamic Programming:
Question 1 (10pt) You are given a color picture consisting of an m x n array A of pixels, where each pixel specifies a triple of red, green, and blue (RGB) ntensities. Suppose that we wish to compress this picture slightly. Specifically, we wish to remove one pixel from each of the m rows, so that the whole picture become one pixel narrower. To avoid disturbing visual effects, however, we require that the pixels removed in two adjacent rows be in the same or adjacent columns; the pixels removed from a "seam" from the top row to the bottom row where successive pixels in the seam are adjacent vertically or diagonally. [8pt] Suppose now that along with each pixel Ali, j], we have calculated a real valued disruption measure d ,j, indicating how disruptive it would be to remove pixel A ' Intuitively, the lower a pixel's disruption measure, the more similar the pixel is to its neighbors. Suppose further that we define the disruption measure of a seam to be the sum of the disruption measures of its pixels. Give a dynamic programming algorithm to find a seam with the lowest disruption measure. The space used by your algorithm must be O(mn). (For space requirement, assuming that the total disruption measure of any seam requires a constant amount of space.) The running time of your algorithm must be a polynomial in mn; calculate itStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started