• Managing your videos in Amara teams just got easier! Read about it in our latest blog post. Hide

## ← Neighbors - Intro to Java Programming

• 2 Followers
• 24 Lines

### Get Embed Code x Embed video Use the following code to embed this video. See our usage guide for more details on embedding. Paste this in your document somewhere (closest to the closing body tag is preferable): <script type="text/javascript" src='https://amara.org/embedder-iframe'></script> Paste this inside your HTML body, where you want to include the widget: <div class="amara-embed" data-url="http://www.youtube.com/watch?v=HwXc2VA6xuc" data-team="udacity"></div> 5 Languages

Showing Revision 4 created 05/25/2016 by Udacity Robot.

1. Let me show you how I did this. We have the loop for the rows, and the loop for
2. the columns. Notice that the rows jump in steps of two. We'll do the same thing
3. for the columns. Now I need to compute the average of these four pixels. Let me
4. draw my little picture again. So here's position I J. And I want to compute the
5. average of this one. This one. This one, and this one. I already have the one
6. in I J. This one here has row I, column J plus 1. The one over here has row I
7. plus 1 and column J. And finally the one over here has row I plus 1, column J
8. plus 1. I add those four, divide by 4, and that's my average. And I need to
9. stick it back into. Each of those four pixels. I already have the coordinates,
10. so I can just copy them. I'm almost done, but I still have to put in the bounds
11. here. When we talked about the gas prices, we were told, what the general rule
12. is, so let's just do that. The length of a two dimensional array, is the number
13. of rows, and the length of a row is the number of columns. Let's see what it
14. looks like when we run it. Here was the original picture. Here are the process
15. gray levels. Now, you won't be able to see this on the video, but if you run
16. this at home, if you carefully look at this arc for example, you will see that
17. it is more pixelated. Now, the point of all this was, to work with neighbors.
18. To figure out if you have a pixel position, what other neighboring positions.
19. That many, many image manipulation algorithms where you have to do just that.
20. For example, to blur a photo, to sharpen it or to process it in other ways. Now
21. you will work with Sarah with an entirely different problem. She will show you
22. how to use two dimensional arrays for a grade book with a kind instructor who
23. wants to know which students are doing very well and also which exams are too
24. hard.