Computer Vision Interview
20 essential Q&A
Updated 2026
edges
Edge Detection: 20 Essential Q&A
Gradients, second derivatives, and Canny—what interviewers expect you to explain clearly.
~11 min read
20 questions
Intermediate
SobelCannyLaplaciangradients
Quick Navigation
1. What is edge detection?
2. Image gradient
3. Sobel operator
4. Prewitt / Roberts
5. Laplacian & 2nd derivative
6. Zero-crossings
7. Gaussian then derivative
2. Image gradient
3. Sobel operator
4. Prewitt / Roberts
5. Laplacian & 2nd derivative
6. Zero-crossings
7. Gaussian then derivative
1
What is edge detection?
⚡ easy
Answer: Finding boundaries where intensity changes rapidly—object outlines, surface markings, shadows. Edges are local; full segmentation groups pixels into regions.
2
What is the image gradient ∇I?
⚡ easy
Answer: Vector of partial derivatives (Ix, Iy). Magnitude ‖∇I‖ shows edge strength; direction is perpendicular to the edge (along max rate of change).
3
How does the Sobel operator work?
📊 medium
Answer: Discrete 3×3 separable approximation of derivatives with slight smoothing (center weight). Gx and Gy kernels estimate Ix, Iy; combine for magnitude and angle.
4
How does Prewitt differ from Sobel?
⚡ easy
Answer: Similar 3×3 derivative masks; weights differ slightly (Sobel emphasizes center more). Both approximate first derivatives; results are often close for interviews.
5
What does the Laplacian ∇²I detect?
📊 medium
Answer: Second derivative—zero-crossings align with edges. Sensitive to noise; often applied to Gaussian-smoothed image (LoG) for stability.
6
What are zero-crossings of ∇²(G*I)?
📊 medium
Answer: Locations where Laplacian of Gaussian changes sign—candidate edges. Need additional filtering to reduce spurious responses from noise.
7
Why blur with Gaussian before taking derivatives?
📊 medium
Answer: Differentiation amplifies noise. Gaussian low-pass reduces noise while keeping meaningful discontinuities; leads to LoG or smooth gradients for Canny.
8
List the Canny edge detector steps.
🔥 hard
Answer: 1) Gaussian smooth 2) gradient magnitude/direction 3) non-max suppression 4) hysteresis with high/low thresholds to link strong edges and reject weak noise.
9
What is non-maximum suppression (NMS)?
📊 medium
Answer: Thins edges: at each pixel keep magnitude only if it is a local max along the gradient direction—produces one-pixel-wide ridges.
10
What is hysteresis thresholding?
📊 medium
Answer: Use high T_hi to accept strong edges, low T_lo to continue chains from strong pixels—reduces broken edges while suppressing isolated weak noise.
11
Why are “thick” edges undesirable?
⚡ easy
Answer: Thick edges blur object boundaries, hurt subpixel localization, and complicate linking. NMS aims for single-pixel thickness.
12
Detect edges in RGB how?
📊 medium
Answer: Options: max/mean gradient across channels, convert to luminance first, or vector gradient methods. Channel-wise max is simple; luminance can discard chromatic edges.
13
Why is salt-and-pepper noise bad for edges?
⚡ easy
Answer: Creates spurious large gradients. Median filter first can help; Gaussian blur before derivatives is standard for Gaussian noise.
14
How does scale (σ) affect edges?
📊 medium
Answer: Large σ: fewer, smoother edges (coarse structure). Small σ: more detail and noise. Multi-scale edge detection combines responses at several σ.
15
What is the Laplacian of Gaussian (LoG) idea?
🔥 hard
Answer: Smooth with Gaussian, apply Laplacian, find zero-crossings—Marr-Hildreth approach. Approximated by Difference of Gaussians (DoG) in some pipelines.
16
What is edge linking?
📊 medium
Answer: Connecting broken edge pixels into curves using proximity, direction continuity, or global optimization—step after local edge detection for contours.
17
Typical
cv2.Canny parameters?
⚡ easy
Answer: threshold1, threshold2 for hysteresis (low/high), apertureSize for Sobel, L2gradient flag for magnitude formula. Tune for your noise and scale.
import cv2
e = cv2.Canny(img, 50, 150)
18
Gradient direction vs edge normal?
📊 medium
Answer: Gradient points in direction of steepest ascent; edge normal is often aligned with gradient; edge tangent is perpendicular.
19
How get sub-pixel edge location?
🔥 hard
Answer: Fit parabola to gradient magnitudes along normal, moment-based refinement, or optimization—used in metrology and calibration.
20
Edges vs segmentation?
⚡ easy
Answer: Edges are local discontinuities; segmentation assigns each pixel to a region/object. Edges can guide segmentation (watershed, active contours, graphs).
Edge Detection Cheat Sheet
1st deriv
- Gradient ∇I
- Sobel / Prewitt
- Magnitude + angle
2nd deriv
- Laplacian
- LoG zero-cross
- Noise sensitive
Canny
- Smooth → grad
- NMS
- Hysteresis
💡 Pro tip: Explain Canny as “thin, linked, thresholded” edges.
Full tutorial track
Go deeper with the matching tutorial chapter and code examples.