15-Inspect Image Values
Let's look at some values from our dolphin image. As before, we load the image with imread and let's also display the image with imshow. How about we print out the size as well? And let's run this to make sure everything's okay. All right. Dolphin's still there, and the size is still 320 by 500. Let's say we want to find out the image value at a particular location. We specify this location with a row and column number. We learned earlier that an image is a function over the two dimensions. Octave uses a notation similar to a function to access values at a particular location. Let's say we want to find out the value at row 50, column 100. We write img, that's our image variable. Followed by the row column coordinates in parenthesis. And let's display this value. All right, let's see what we have. So the value at 50, 100 is 208. Similarly we can find out the values for an entire row. We'll use a similar notation as before, but we'll do something different for the column. Putting a colon tells Octave to return values for all columns. Let's see what the output is. As you can see, Octave dumps values from the entire row, all 500 columns. Obviously, this isn't a useful way to look at values from an entire row. What else can we do? We can plot these values. This makes more sense, doesn't it? You can clearly see the relatively higher values where the white wave is, and then the other values are comparatively lower. Can you find out the values from this three by three slice of the image? Rows 101 to 103. Columns 201 through 203.Â