InterviewDB
Experience
Camera Intensity: Compute Pixel Intensity Statistics Across a Camera Feed
phone
Interview Experience
Problem
Given a grayscale image as a 2D array of pixel intensities (0-255), compute the mean, median, and histogram of intensities. Then implement a function that adjusts contrast by stretching the intensity range to fill [0, 255].
python
import numpy as np
from typing import Tuple
def intensity_stats(image: list[list[int]]) -> dict:
**returns**: {"mean": float, "median": float, "histogram": list[int] of length 256}
pass
def stretch_contrast(image: list[list[int]]) -> list[list[int]]:
# Linearly maps [min_intensity, max_intensity] -> [0, 255]
pass
Example:
image = [[0, 128], [64, 192]]
stretch_contrast([[10, 110], [60, 160]])
# min=10, max=160 -> new = (old-10) * 255/150
-> [[0, 170], [85, 255]]
Follow-ups
- When is linear contrast stretching inadequate, and how does histogram equalization improve it?
- How would you apply this operation in real time to a 30 fps camera stream?
- How do you extend intensity stretching to a 3-channel (RGB) image without distorting colors?
- What happens when min_intensity == max_intensity (uniform image)?
Full Details
Problem
Given a grayscale image as a 2D array of pixel intensities (0-255), compute the mean, median, and histogram of intensities. Then implement a function that adjusts contrast by stretching the intensity range to fill [0, 255].
python
import numpy as np
from typing import Tuple
def intensity_stats(image: list[list[int]]) -> dict:
**returns**: {"mean": float, "median": float, "histogram": list[int] of length 256}
pass
def stretch_contrast(image: list[list[int]]) -> list[list[int]]:
# Linearly maps [min_intensity, max_intensity] -> [0, 255]
pass
Example:
image = [[0, 128], [64, 192]]
stretch_contrast([[10, 110], [60, 160]])
# min=10, max=160 -> new = (old-10) * 255/150
-> [[0, 170], [85, 255]]
Follow-ups
- When is linear contrast stretching inadequate, and how does histogram equalization improve it?
- How would you apply this operation in real time to a 30 fps camera stream?
- How do you extend intensity stretching to a 3-channel (RGB) image without distorting colors?
- What happens when min_intensity == max_intensity (uniform image)?
Free preview. Unlock all Verkada questions →
About This Question
This is a candidate experience report from a verkada interview during the phone round.
It covers the following topics: Arrays, Coding, Phone, Matrix .
More Verkada Interview Questions
1p3a
Verkada Store Front Tech Phone Screen Interview Experience
LeetCode
#986 Interval List Intersections
InterviewDB
Camera API: Design an OOP Camera Control API for a Multi-Camera System
InterviewDB
Verkada SWE Phone - Camera Logs API
1p3a
Verkada Tech Phone Screen: Camera Failure Aggregation Problem