How many non-boundary pits and peaks are on the map, C/C++ Programming

Assignment Help:

Armed with your function from above, we can do some interesting things. For instance, any pixel where the offsets are both zero is a pit (lower than all surrounding points). Note that every boundary pixel is a pit, so make sure you ignore them in your code. For this second part, write a function:

     function rc = findpits(map)

that will return a matrix containing 2 columns  with the row and column indices of all non-boundary pits in map.  Notice that you can actually then find the non-boundary peaks with the same function, by simply calling it another way: findpits(-map) (think about why this works). Report how many non-boundary pits and peaks are on the map, and plot them as follows:

pits = findpits(map);

peaks = findpits(-map);

imagesc(map); colormap(gray); axis equal

hold on

plot(pits(:,2),pits(:,1),'ro');

plot(peaks(:,2),peaks(:,1),'g+');

hold off

Note: Your findpits() function will probably call findLowNhbr() from Part 1. That is, in your findpits function, you will find lowest neighbours for all points, and then figure out which points are pits.

Note: When plotting, notice that rows are y-coordinates and columns are x-coordinates, which explains their order in the plot command (2nd column, then 1st column). We'll keep talking about rows & columns in the hope it is clearer, but remember that rows indices translate into y-coordinates, and column indices into x-coordinates.

To help you check if your code is working, according to my code, test (the 10x10 test map) has pits at (3,6), (6,3), and (6,6) and peaks at (5,5) and (8,5).

What to submit: Include the m-file for findpits in your zip file. In solutionWatersheds.m, call this function with the provided elevation map ('map'), and generate a figure like the one above, showing all the pits and peaks. Also print out the number of peaks and pits you found.


Related Discussions:- How many non-boundary pits and peaks are on the map

Pro, em Ipsum is that it has a more-or-less normal distribution of letters,...

em Ipsum is that it has a more-or-less normal distribution of letters, as opposed to using ''Content here, content here'', making it look like readable English. Many desktop publis

Draw a picture using line - c program, Draw a picture using line: void...

Draw a picture using line: void main(void) {     int   driver = DETECT,mode;     int   x[10],y[10];     int   x_center = 360, y_center = 180, rad = 100;     int

Pointer, how to use a pointer variable?

how to use a pointer variable?

Program to create triangles on the surface , Using your mountain project so...

Using your mountain project source code as a starting point, you are to write a code that randomly chooses one of the triangles on the surface of your mountain, this will be the en

Iteration problem, my program does not run more than 9 iterations when ever...

my program does not run more than 9 iterations when ever i want to iterate more than 100 iterations. what is the reason and how to tackle?

Declaring Integer variables with an example, How do you declare an integer ...

How do you declare an integer variable? Explain with an example.

Valid segments 1, Consider text comprised of sentences and sentences compri...

Consider text comprised of sentences and sentences comprised of words. Words in a sentence will be space delimited. Given a text and K strings, task is to find out the number valid

Give example of the for loop, The for Loop For loop is the controlled f...

The for Loop For loop is the controlled form of loop. The general format of this : for( initialize ; test ; update)                  {                     statements;

How can i provide printing for whole hierarchy of classes?, A: Provide a fr...

A: Provide a friend operator class Base { public: friend std::ostream& operator ... protected: virtual void printOn(std::ostream& o) const; }; inline std::ostr

#luminous jewel polishing necklace, Ask question # Byteland county is very ...

Ask question # Byteland county is very famous for luminous jewels. Luminous jewels are used in making beautiful necklaces. A necklace consists of various luminous jewels of particu

Write Your Message!

Captcha
Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd