File size: 1,195 Bytes
ef987bb | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 | # Deterministic image transformation pipeline
Write `solve.py` to transform the local RGB image in `input.ppm`, run as `python3 solve.py` in the project root. Work offline using the supplied Python, NumPy and Pillow as needed; do not require installing Albumentations.
## Pipeline
For any valid RGB input at least 4×4, apply these operations in order:
1. Crop a centered 4×4 region starting at `((width-4)//2, (height-4)//2)`.
2. Flip the crop horizontally.
3. Blur each channel with a 3×3 mean kernel, replicating edge pixels for padding. Round each channel to an integer.
4. Compute grayscale as `0.299R + 0.587G + 0.114B` and round to the nearest integer. Equivalent rounding may differ by at most three gray levels.
Save `transformed_image.png` as a 4×4 grayscale PNG or RGB PNG with equal channels. In `transform_report.txt`, describe all four operations in Chinese or English.
## Acceptance Checklist
- Running the script produces a valid 4×4 grayscale transformation and a report describing the actual sequence.
- Pixel values follow the specified crop, flip, edge-replicated blur and grayscale, including for inputs with different dimensions, colors and asymmetric patterns.
|