English subtitles

← Neighbors - Intro to Java Programming

Get Embed Code
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.