Fixed divide by zero bug by adding a catch for black pixels.