An elevation map is provided as a gray level image in raw format…
Question Answered step-by-step An elevation map is provided as a gray level image in raw format… An elevation map is provided as a gray level image in raw format (binary, can be download below). The value at a point (pixel) in the map is its height map. From any point (vertex), one can only travel in horizontal or vertical directions (edge) to its adjacent points. The cost of a horizontal or vertical shift between two adjacent points is their slope length, i.e., the squared root of distance between points (considered as 1 unit) and their height difference. For example, cost(a, b) = sqrt(1+(map(a)-map(b))^2) for adjacent points a and b. The cost corresponds to the energy spent for the position shift (climbing or downhill energy considered same here).Requirement: Compute the shortest path starting from top left corner point (x, y)=(0, 0) to all other points in the map by using the greedy algorithm. The cost of a path is the sum of all the edge costs along the path in horizontal and vertical directions. Input Map: a 2D array in row-based-order saved in map1.raw (in FILE page, open in Adobe Photoshop for a glance). It has Width * Height = 250 * 200 dots (so called points, pixels).The value at a position in the map: 1byte character (8bits) for terrain height, i.e., the height value ranges from 0 to 255 within a byte.You can use Adobe Photoshop software downloaded from IUware (not Photoshop Element) to see the input map and your output files.You can define additional matrices (images) as the working space of algorithm to register intermediate results such as1. KNOWN ( or REACHED), or UNKNOWN (defined as char type is enough small and good for visualization) for location status, the accumulated distance from start point (float or double recommended), and2. the direction from previous vertex on the path (char type).3. distance from the starting point.You can also output txt file or do screen print of the shortest path cost to a point. Engineering & Technology Computer Science CS 243 Share QuestionEmailCopy link Comments (0)


