In radiology, X-ray images are traditionally viewed as negatives: bones appear in black on a white background. The photographic negative operation is routinely applied in PACS (Picture Archiving and Communication Systems) to facilitate the detection of fractures and bone densities.
Dimensions: Read the integers \(L\) (rows) and \(C\) (columns).
Data: Read the integer values of the original matrix.
Mapping: For each pixel \(p\), compute the negative:
\[p' = 255 - p\]
Output: Display the resulting matrix \(L \times C\).
3.12.3.2 📌 Computational Constraints
No clipping required: The result of \(255 - p\) with \(p \in [0, 255]\) is always \(\in [0, 255]\).
Integer type: The output must consist of integer values.
Logical equivalence: The operation is identical to the bitwise NOT (mm::bnot) on 8-bit images.
3.12.3.3 🧠 Theoretical Foundation
Original Pixel \(p\)
Negative Pixel \(p'\)
Observation
0 (black)
255 (white)
Total inversion
128 (medium gray)
127 (medium gray)
Central value
255 (white)
0 (black)
Total inversion
3.12.3.4 📦 Input and Output Specification (VPL)
Input:
Line 1: Integer \(L\).
Line 2: Integer \(C\).
Following lines: Integer elements of the original matrix.
Output:
Negative matrix with \(L\) rows and \(C\) columns.
3.12.3.5 📌 Examples
Input
Output
Observation
1
4
0 128 200 255
255 127 55 0
Inversion of each pixel
2
2
10 20
30 40
245 235
225 215
Inverted 2x2 matrix
🎭 Simulator EP03_03: Photographic Negative (Inversion)p' = 255 − p
Observe the complementary intensity inversion: dark tones become light and light tones become dark by subtracting each pixel from the maximum value of 255.