Previous | Next --- Slide 91 of 114
Back to Lecture Thumbnails
qryy

I have a question about how the derivative filter works to amplify edges. What if the intensity on the rightside of our current pixel is very large (say like a value of 200) and on the left side it is only 5. Then would the new pixel value after applying this derivative filter be in the negatives, because we have -200 + 5? Like I get that this amplifies and shows an edge, but I don't get how negative values are handled

mpotoole

Yes! The result will be a negative value---and that's ok. In fact, the sign is important here, as it tell us the "orientation" of the edge. But for visualization purposes, you may want to either set all negative values to 0, or take its absolute value.

qryy

How does it tell us the orientation of the edge? I thought negative values would not work because if example our colors were represented by 8-bit, the value has to be between 0 and 255. So I'm a bit confused how negative values are allowed.

mpotoole

So the original image is often quantized with a range 0 to 255 (8-bit). Image formats usually encode 8-bit values because our displays are 8-bit---it would be a waste of space otherwise. But when processing images, we typically want to convert the 8-bit image into a different format (e.g., floats). This is because our vision algorithms will introduce both values outside the range [0, 255], and even non-integer values as well. So while the input images are 8-bit and our displays (outputs) are 8-bit, we typically do not use an 8-bit representation of our images during processing.

As for the orientation of the edge, the sign basically tells us whether we're going from dark to bright, or bright to dark. In short, it determines the gradient direction (and this is discussed a bit more on this slide).