skip to content

OpenCV

OpenCV is the classical computer-vision toolbox: image and video I/O, filtering, geometric transforms, feature detection, contour analysis, and a DNN module for running trained networks. Vision interviews still expect the classical side, not only deep learning.

on this pageshow

explore

questions

page 2 of 2

Why chain resize, warpAffine and warpPerspective into one warp per frame?

level: seniorimportance: should knowfreq 35%

basics

~20 s

Each warp resamples the previous warp's output, so interpolation blur compounds and you pay three passes over the image. Compose the matrices into a single 3x3 and warp once, or precompute cv2.remap maps when the transform is fixed.

open as a page

When would you convert to LAB rather than HSV in an OpenCV pipeline?

level: seniorimportance: should knowfreq 32%

basics

~20 s

Use LAB when the task is about perceived difference or about changing brightness without shifting colour: its L axis is lightness and a/b are colour-opponent axes, and distances approximate perceived difference. HSV is better for carving out a band of the colour wheel with cheap thresholds.

open as a page

An OpenCV loop on a live RTSP camera keeps showing frames seconds old — why, and how do you fix it?

level: seniorimportance: should knowfreq 48%

basics

~20 s

Processing is slower than the camera's frame rate, so decoded frames queue up behind the loop and VideoCapture.read() keeps handing back the oldest one. Latency grows without bound. Fix it by decoupling capture from processing — read in a thread that keeps only the newest frame, or drop frames with grab().

open as a page

When is OpenCV's DNN module the right inference runtime, and when is it not?

level: principalimportance: should knowfreq 36%

basics

~20 s

Choose the DNN module when OpenCV is already in the build, the model is a small vision network, and one dependency matters more than peak throughput. Choose a dedicated runtime when you need broad operator coverage, vendor accelerators, or models it cannot import.

open as a page

How would you choose between SIFT, ORB and AKAZE for a production vision pipeline?

level: principalimportance: should knowfreq 38%

basics

~20 s

Trade matching robustness against compute and memory. SIFT gives the best repeatability under scale and viewpoint change but is slowest with 512-byte float descriptors; ORB is fastest with 32-byte binary descriptors; AKAZE sits between. Decide on measured inlier ratio over your own imagery, not reputation.

open as a page

How do you split a real-time video pipeline's frame budget between detection and tracking?

level: principalimportance: should knowfreq 36%

basics

~20 s

Run the expensive detector every N frames and carry boxes between detections with cheap trackers, sizing N so the average per-frame cost fits the frame interval. The cost of a larger N is tracker drift and delayed discovery of new objects, so N is measured, not guessed.

open as a page

showing 31–36 of 36