Log-Chromaticity Illumination-Invariant Image
~14 mincode completion
Implement illumination_invariant(image, theta).
imagehas shape(H, W, 3)with strictly positive channels.- Return a 2D array of shape
(H, W).
Examples
theta = 0 keeps only log(R/G): ln 2
- Input
- illumination_invariant([[[2, 1, 4]]], 0)
- Output
- [[0.69315]]
theta = pi/2 keeps only log(B/G): ln 4
- Input
- illumination_invariant([[[2, 1, 4]]], 1.5707963267948966)
- Output
- [[1.38629]]
Scaling a pixel by 2 (sun versus shade) leaves the invariant unchanged
- Input
- illumination_invariant([[[2, 1, 4], [4, 2, 8]]], 0)
- Output
- [[0.69315, 0.69315]]
Hints
Hint 1
is the natural log, which is what this formula wants.
Hint 2
Watch for this: took the log of the ratio after projecting.
Requirements
image: array of shape (H, W, 3), all channels > 0theta: projection angle in radiansReturn array of shape (H, W)
Constraints
Allowed library: NumPy only
Time limit: 200 ms, Memory: 64 MB
Where this shows up
~14 min
••••••••••••••••
8 employers weight this skill
4 autonomy companies, 1 defense company, 1 health and bio company, 1 enterprise vendor, 1 AI product company. Top match scores 81.
Python
import numpy as np
def illumination_invariant(image, theta):
"""
One-channel illumination-invariant image from log-chromaticity.
Args:
image: array of shape (H, W, 3), all channels > 0
theta: projection angle in radians
Returns:
array of shape (H, W)
"""
# YOUR CODE HERE
pass