Work / Research / DIP Practical Handbook

No. 47 · Education · Imaging

The lab handbook that actually runs.

CSU2543 · Digital Image Processing · Shoolini University · Solan, H.P. · 2025-2026

Most practical handbooks are PDFs nobody can run. Students copy code that does not compile, hate the subject, and graduate without a portfolio. This handbook ships eight Gonzalez & Woods experiments, each in three independently-runnable forms · Jupyter, Flask on Cloud Run, static Cloudflare Pages · plus a print-ready Chicago-style PDF with cover, certificate, index, QR codes and watermark.

8 × 3Experiments × runtimes
32Pre-baked result figures
Cloud Runasia-south1 · live
AAAWCAG 2.2 from line one
PDFPrint-ready, submission-ready

Act I · The Syllabus

Eight experiments. Gonzalez & Woods, third.

The full prescribed list, end to end. Every entry runs in three places, and every entry prints to a colour-coded section template.

Index · Practical File · CSU2543

  1. 1.Loading and displaying digital imagesG&W Ch 2
  2. 2.Impact of sampling rate on spatial resolutionG&W Ch 2
  3. 3.Image negation, subtraction and inversionG&W Ch 2-3
  4. 4.Gamma correction and power-law transformationsG&W Ch 3
  5. 5.Histogram equalizationG&W Ch 3
  6. 6.Histogram matching and specificationG&W Ch 3
  7. 7.2D correlation and convolutionG&W Ch 3
  8. 8.Spatial filtering · box, median, Laplacian, SobelG&W Ch 3

Act II · The Matrix

Same lab. Three independent runtimes.

A student opens Colab. A teacher demos it on the projector through the Cloud Run app. An evaluator with no internet opens the static folder. All three see the same experiment, with the same colour-coded sections.

#Experiment JupyterFlask · Cloud RunStatic · Cloudflare
1DisplayYYY
2SamplingYYY
3Negation / SubtractYYY
4Gamma / Power lawYYY
5EqualizationYYY
6MatchingYYY
7Conv / CorrYYY
8Spatial filteringYYY

8 experiments · 3 runtimes · 24 independent paths

Act III · The Handbook

Press Ctrl+P. Submit it.

Every page on the live site is print-ready. The PDF is Chicago-style, AAA-accessible, and matches the Shoolini practical-file template exactly.

Cover, Certificate, Acknowledgement, Index

Universal pages prepended when printing from /. Title, programme, Submitted by / to, school, university, location, date · all the fields the practical-file rubric expects.

Per-practical cover identifier

"Practical 7: 2D Correlation & Convolution" appears when printing an individual practical, suppressed on the consolidated home printout. One template, both modes.

Five colour-coded section banners

Aim (blue), Description / Theory (purple), Code (green), Output (orange), Analysis / Conclusion (red). Identical palette across notebooks and the web app.

Literal Python rendered in Code section

The exact Python from the notebooks is embedded in the Code block, not the server processors · so the printed code matches what the student actually ran.

Result figures auto-mirrored under Output

A beforeprint JS hook copies every visible figure into the Output container, so what is on screen ends up on paper.

2"×2" QR + 22% watermark

QR on each cover encodes the canonical page URL (works behind Cloudflare via Werkzeug ProxyFix). Centred dmj.one watermark on every content page, suppressed on the cover.

Per-practical page numbers

1.1, 1.2, …, 8.5 using CSS named-page contexts. Cover unnumbered. Times New Roman 12pt, justified, 1-inch margins. JetBrains Mono code blocks.

32 result figures pre-baked

precompute.py runs at Docker build time. Pages render instantly on first hit, and printed PDFs include the figures even before the user clicks anything.

Auto-downloaded G&W dataset

Chapters 02 and 03 are fetched from imageprocessingplace.com on first run, then cached locally. The Colab notebooks do the same so they run end-to-end with one click.

The Stack

Three runtimes, one source of truth.

  • Flask 3.1 · Gunicorn 25
  • OpenCV 4.13 (headless)
  • Matplotlib 3.10 · Agg
  • NumPy 2.4 · Pillow 12
  • qrcode 8
  • Vanilla JS · Canvas API
  • Chart.js 4 · MathJax 3
  • Cloud Run · asia-south1
  • Cloudflare Pages
  • Jupyter / Colab
  • CSS Paged Media

Act IV · Proof

Live. In production.

dip.dmj.one · Cloud Run, asia-south1

Production deployment behind Cloudflare. Werkzeug ProxyFix honours X-Forwarded-* only from the Cloud Run / Cloudflare hop. Custom domain, HSTS preloaded.

One command to deploy

gcloud run deploy dip-practical --source . --region asia-south1 --memory 2Gi --allow-unauthenticated. The Dockerfile runs precompute.py at build time so the image ships with all 32 cached figures.

Bare-metal Linux VM, idempotent

autoconfig.sh installs Python, Nginx (with microcache), systemd unit, log rotation, UFW rules on a fresh Ubuntu 24.04 host. Deterministic from start to finish.

Static client-side build, free hosting

The pages/ folder re-implements every operation in pure JavaScript via the Canvas API. Deploy to Cloudflare Pages or GitHub Pages with no backend at all.

Coursework that doesn't die in a PDF.

I build teaching artefacts that ship as real systems · runnable in three places, accessible to every reader, ready for submission, ready for production.