Practical 3: Negation, Subtraction & Inversion

Open In Colab Run this practical in Google Colab

1. Aim

Objective

To implement and analyze fundamental intensity transformation operations: image negation, image subtraction, and intensity inversion.

2. Description / Theory
Theory: Intensity transformations are point operations that modify pixel values individually. Negation reverses the intensity scale: \(s = (L-1) - r\), useful for enhancing detail in dark regions. Image subtraction \(g = |f_1 - f_2|\) reveals differences between two images, widely used in medical imaging (Digital Subtraction Angiography).
3. Code

Part 1: Image Negation (s = 255 - r)

Compute the negative of an image by inverting all pixel intensities.

Part 2: Image Subtraction |Img1 - Img2|

Compute the absolute difference between two images to reveal hidden structures.

Pairs

Part 3: Complete Pipeline (Subtraction → Negation → Enhancement)

Run the full pipeline on the selected image pair: subtraction, then negation of result, then contrast enhancement.

4. Output 5. Analysis / Conclusion

Analysis Questions

  1. In the angiography example, what structures become visible after subtraction that were not visible in either original image?
  2. Why is absolute difference used instead of simple subtraction? What would happen with signed vs unsigned arithmetic?
  3. Compare the histogram of the original image with its negative. What mathematical relationship exists between them?