Computer Vision Interview
20 essential Q&A
Updated 2026
thresholding
Image Thresholding: 20 Essential Q&A
Global vs adaptive methods, Otsu, and when simple thresholding fails.
~10 min read
20 questions
Beginner
OtsuadaptivebinaryOpenCV
Quick Navigation
1
What is image thresholding?
⚡ easy
Answer: Classifying pixels as foreground vs background by comparing intensity to one or more thresholds—produces binary or multi-label masks.
2
What is global thresholding?
⚡ easy
Answer: Single threshold T for the whole image: pixel → foreground if I > T (or < depending on type). Fast but fails under uneven lighting or overlapping histograms.
3
When use inverse binary threshold?
⚡ easy
Answer: When objects are darker than background (or you want white objects on black mask). Complement of standard binary THRESH_BINARY.
4
How does Otsu choose T?
📊 medium
Answer: Assumes roughly bimodal histogram; picks T that minimizes intra-class variance (equivalently maximizes between-class variance). Automatic, no manual T.
_, bw = cv2.threshold(gray, 0, 255, cv2.THRESH_BINARY + cv2.THRESH_OTSU)
5
When does Otsu fail?
📊 medium
Answer: Unimodal or flat histograms, uneven illumination, low contrast, or when foreground fraction is tiny—histogram may not have clear valleys.
6
What is adaptive mean threshold?
📊 medium
Answer: For each pixel, threshold = mean of local neighborhood − C. Handles varying illumination; needs block size larger than foreground features.
7
Adaptive threshold with Gaussian weights?
📊 medium
Answer: Local threshold from Gaussian-weighted mean instead of flat mean—smoother local estimates, slightly better on gradual shading.
8
What is block size in adaptive threshold?
⚡ easy
Answer: Odd window size defining local neighborhood. Too small: noisy mask; too large: loses detail near object boundaries.
9
What is Sauvola / Niblack?
🔥 hard
Answer: Local methods using mean and standard deviation to set threshold—good for document and degraded scans with uneven background.
10
Fix uneven lighting before threshold?
⚡ easy
Answer: Homomorphic filtering, background normalization, CLAHE on luminance, or large-kernel low-pass estimate of illumination to flatten.
11
Threshold colored objects?
📊 medium
Answer: Often convert to HSV and threshold H/S/V ranges (e.g. colored ball)—more robust than RGB for hue-based objects under some lighting.
12
What is multi-level thresholding?
📊 medium
Answer: Several thresholds to get multiple classes (e.g. tissue types). Extension of Otsu exists (multi-Otsu) but cost grows with levels.
13
How pick T without Otsu?
📊 medium
Answer: Manual inspection, ROC on validation set, entropy methods, or trial with domain constraints (known object brightness).
14
Common approach for scanned documents?
⚡ easy
Answer: Adaptive threshold or Sauvola-class; deskew/denoise first; morphology to clean speckles—DL methods also used for hard cases.
15
Why binary masks have holes / noise?
⚡ easy
Answer: Sensor noise, shadows, partial overlap of histograms—use morphology, median blur pre-threshold, or adaptive methods.
16
Apply morphology after thresholding?
📊 medium
Answer: Yes—opening removes pepper noise, closing fills small holes in foreground; preserves label if structuring element smaller than features.
17
Do deep nets replace thresholding?
📊 medium
Answer: For complex scenes, semantic segmentation wins; classical thresholding remains fast for controlled lighting, industrial vision, and documents.
18
What is soft thresholding (wavelets)?
🔥 hard
Answer: Shrinks coefficients toward zero—used in denoising, not classical image binarization. Mention only if interviewer asks denoising context.
19
Threshold on float vs uint8?
⚡ easy
Answer: Same logic but ensure consistent range ([0,1] vs 0–255). Always know your image dtype before comparing to T.
20
Typical order: blur → threshold → morph?
📊 medium
Answer: Often denoise/blur lightly → threshold → morphological cleanup—order depends on whether blur destroys thin structures.
Thresholding Cheat Sheet
Global
- Single T
- Otsu if bimodal
Adaptive
- Local mean/Gauss
- Block size + C
Docs
- Sauvola family
- Illumination first
💡 Pro tip: Say when global fails (lighting) and name one adaptive fix.
Full tutorial track
Go deeper with the matching tutorial chapter and code examples.