قبل ما تبدا سمي الله و صلي عالنبي
Welcome 👋
This interactive guide covers CSE 429 Computer Vision and Pattern Recognition so far: how digital images are made, pixels and their neighbours, interpolation, image operations, intensity transformations and histogram equalization. It follows Gonzalez & Woods' Digital Image Processing (3rd ed.), the lecture slides and Sheets 1–3. Where a slide has a mistake, the guide says so and gives the correct version. Navigate through the modes below:
- 📖 Tutorial Mode: each step goes idea → worked example → why → quick check, with tap-to-trace tables and explorers for paths, zooming and equalization.
- 🎴 Flash Cards: definitions, formulas and the worked answers you should know cold.
- 🎯 Professor's Focus: exam-style theory answers and every sheet problem worked in full: Part 1 (image fundamentals) and Part 2 (enhancement).
- ⚡ Practice Quiz: exam-style MCQs from the lectures and all three sheets.
💡 Short on time? Do Tutorials 4, 7 and 8: they hold every numerical problem. Press Ctrl+K to search, and open the 📋 Cheat Sheet (bottom-right) for every formula.
Tutorial Mode
Explanation-first walkthroughs of every lecture with try-it checks
0 / 0
Flash Cards
Quick-recall decks of definitions, formulas & worked answers
0 / 0
Professor's Focus
Exam-style theory answers and every sheet problem worked in full
Practice Quiz
Exam-style MCQs with hints, explanations & mistake tracking
Professor's Focus
Pick a revision part
Each part is a self-contained Q & A + worked-numerical deck built from the lecture slides, problem sheets and Gonzalez & Woods.
P1
Part 1 · Image Fundamentals
Lec 1–3 — what vision is, digital images, storage and transmission, adjacency and paths, distances, interpolation, image operations.
P2
Part 2 · Image Enhancement
Lec 4 — intensity transformations, contrast stretching, slicing, histograms and equalization.
Sheet questions only
Restrict the pool to questions that came directly from the practice sheets
10
15
20
All
of 0
Practice modeShow the correct answer & explanation after each question
Shuffle questionsRandomize the order each attempt
Sheet questions only
Restrict the pool to coding tasks pulled from the practice sheets
5
10
15
All
of 0
Mix question stylesInterleave fill, line builder, and scratch coding questions
Shuffle questionsRandomize the order each attempt
Shuffle cardsRandomize the order each session
📋 Cheat Sheet
Check every formula and recipe anytime!
25:00
Start focus timer
🍅 Focus Timer
Pomodoro / break / stopwatch — keeps counting across pages and refreshes.
🍅 Focus Timer
25:00
Focus Session
Sound chime
Play a gentle tone when the timer ends
📋 Exam Reference Sheet
Digital Images
- Digital image: f(x, y) with x, y and f discrete. Origin top-left, x = row, y = column.
- Sampling digitizes coordinates; quantization digitizes amplitude.
- Levels:
L = 2k(1→2, 4→16, 7→128, 8→256, 9→512, 16→65,536). - Size:
rows × cols × channels × kbits; ÷ 8 = bytes; ÷ 220 = MB. - Transmission: packet = start + data + stop bits; time = total bits ÷ baud.
- Dynamic range = max measurable / min detectable; contrast = highest − lowest.
- PET: positron + electron → two gamma rays (detected). CT: X-rays.
Python
- Shape
(height, width, channels); uint8 0–255 wraps mod 256; float 0–1. img_as_floatfloat64 ·img_as_ubyteuint8 ·img_as_uintuint16 ·img_as_intint16.- 2-D arrays:
plt.imshow(img, 'gray'); histogram:plt.hist(img.ravel(), 256).
Neighbours & Adjacency (values in V)
- N4: (x±1, y), (x, y±1). ND: (x±1, y±1). N8 = N4 ∪ ND.
- 4-adj: q ∈ N4(p). 8-adj: q ∈ N8(p).
- m-adj: q ∈ N4(p), or q ∈ ND(p) and N4(p) ∩ N4(q) has no V pixels (check the two corners).
- Path length = steps = pixels − 1. m and 8 give the same regions.
Distances
De = √((x−s)² + (y−t)²)(disc)D4 = |x−s| + |y−t|(diamond; D4 ≤ 2 = 13 pixels)D8 = max(|x−s|, |y−t|)(square; D8 ≤ 2 = 25 pixels)- D8 ≤ De ≤ D4.
Interpolation
- Nearest: output (i, j) ← input (⌊i·R/R′⌋, ⌊j·C/C′⌋). Shrink = delete rows/cols.
- Bilinear:
v = ax + by + cxy + dfrom 4 neighbours = lerp along edges, then between them. - Bicubic:
Σ aijxiyj, i, j = 0..3: 16 neighbours.
Operations
- Image × image = array (element-wise) product.
- Linear: H[a f₁ + b f₂] = a H[f₁] + b H[f₂]. Σ linear, max not.
- Sum 0–510, difference −255–255: clip, or scale
255·(f − min)/max(f − min). - ROI: multiply by a 1/0 mask. A − B = A ∩ Bᶜ; A ∪ B = A, B or both.
- Point / local / global: one pixel / neighbourhood / whole image.
s = T(r), r in 0 … L − 1
- Negative:
s = L − 1 − r - Log:
s = c·log(1 + r),c = 255/ln(1 + rmax)≈ 45.99. Use float, not uint8. - Gamma:
s = c·rγon 0–1. γ < 1 brighter, γ > 1 darker. - Stretch:
(I − Min)(NewMax − NewMin)/(Max − Min) + NewMin, round to nearest. - Piecewise: r₁ = s₁, r₂ = s₂ identity; r₁ = r₂, s₁ = 0, s₂ = L − 1 threshold.
- Slicing: [A, B] → 255; rest → 0 (binary) or unchanged. Say whether the ends count.
- Bit plane k: ⌊r / 2k−1⌋ mod 2; plane 8 = MSB.
Histogram
h(rk) = nk,p(rk) = nk/MN.- Dark → left, bright → right, low contrast → narrow middle.
Equalization recipe
- nk → pk → running total Σp → × (L − 1) → round = sk → replace each rk by sk.
- Lec 4 4 × 8: s = 1, 3, 4, 5, 7 (slide's "7(0.357) = 2" is wrong).
- Ex 3.5: 0→1, 1→3, 2→5, 3→6, 4→6, 5→7, 6→7, 7→7.
- Matching: s = T(r), G(z) = (L − 1)Σpz, z = closest G to s.
- Stats: m = Σ r p(r), σ² = Σ (r − m)² p(r).
Final answers (worked in Professor's Focus)
- Camera 2680 × 1520, RGB, 256: 97,766,400 bits = 11.655 MB
- Sheet 3 Q1 (512 levels): 109,987,200 bits ≈ 13.11 MB
- Sheet 3 Q2 (1920 × 1080 grey, 128): 14,515,200 bits ≈ 1.73 MB
- Sheet 3 Q3 (56K / 3000K baud): 3.12 min / 3.50 s
- Sheet 3 Q4 (70K / 4000K baud): 4.49 min / 2.36 s (4.72 s if one pixel per packet)
- Sheet 3 Q5 / Q6 (HDTV): 1.1664e+13 / 3.456e+12 bits
- Sheet 2 Q1: not 4-adjacent; 8- and m-adjacent
- Sheet 2 Q2 (a) V = {0, 1}: 4: none · 8: 4 · m: 5
- Sheet 2 Q2 (b) V = {1, 2}: 4: 6 · 8: 4 · m: 6
- Sheet 2 Q3: 4: none · 8: 4 · m: 6
- Sheet 2 Q4 regions: 4-adj: 16 · 8/m-adj: 3
- Lec 3 distances (4, 2)–(1, 4): D4 = 5, D8 = 3, De = √13 ≈ 3.61
- Bilinear 2 × 2 → 3 × 3 centre: 145
- Stretch [60, 150] → [0, 255]: 113 170 184 / 125 142 255 / 0 198 227
- Lec 4 equalization (corrected): s = 1, 3, 4, 5, 7; rows 1 3 3 4 4 5 7 7
- Gonzalez Example 3.5: s = 1, 3, 5, 6, 6, 7, 7, 7