← Back to Lesson 2

Quiz 2: Image Arithmetic

Score: 0 / 4

. With NumPy's default uint8 arithmetic, what happens when you add 80 to a pixel of value 220?

uint8 wraps around like an odometer: 220 + 80 = 300, which overflows to 300 mod 256 = 44.

. What does "saturating arithmetic" (as used by cv2.add) do differently from plain NumPy uint8 addition?

cv2.add clamps (saturates) at 0 and 255 rather than silently wrapping around.

. Why does difference imaging typically take the absolute value of the subtraction?

Without abs(), a pixel that got darker and one that got brighter by the same amount would look different, even though both changed.

. What does cv2.addWeighted(a, alpha, b, beta, gamma) compute?

It's a saturating weighted sum of the two images plus a constant offset gamma.