v9.1.1
Menu

Photo Consistency Check

mediumFREEMulti-view StereoMVSCV: Depth Estimation

Check if a 3D point is photo-consistent across multiple views.

In multi-view stereo (MVS), we reconstruct 3D points by finding locations that project to similar colors in all images. A point is photo-consistent if the variance of its projected colors does not exceed a threshold:

σ2=1N∑i(ci−cˉ)2≤τ2\sigma^2 = \frac{1}{N}\sum_i (c_i - \bar{c})^2 \le \tau^2

where:

  • cic_i is the color in view ii
  • cˉ\bar{c} is the mean color across views
  • τ\tau is the consistency threshold

Photo consistency is checked for each color channel independently. If any channel has high variance, the point is not consistent.

Example

Input
is_photo_consistent([(100, 100, 100), (102, 98, 101), (99, 101, 100)], 10)
Output
True
Reasoning
  • Inputs: colors holds one RGB triple per camera view, here N=3N = 3 views of the same 3D point; threshold τ=10\tau = 10 is the largest allowed standard deviation, so each channel's variance may be at most τ2=100\tau^2 = 100.
  • Red values across views are 100,102,99100, 102, 99: mean cˉ=301/3≈100.33\bar{c} = 301/3 \approx 100.33, squared deviations ≈0.11,2.78,1.78\approx 0.11, 2.78, 1.78, so σ2=4.67/3≈1.56\sigma^2 = 4.67/3 \approx 1.56.
  • Green values 100,98,101100, 98, 101: mean ≈99.67\approx 99.67, deviations mirror the red ones, giving the same σ2≈1.56\sigma^2 \approx 1.56.
  • Blue values 100,101,100100, 101, 100: mean ≈100.33\approx 100.33, squared deviations ≈0.11,0.44,0.11\approx 0.11, 0.44, 0.11, so σ2≈0.22\sigma^2 \approx 0.22.
  • Every channel satisfies σ2≤100\sigma^2 \le 100, so the output is True: the three views agree to within a couple of intensity levels.
  • Notice that a single bad channel is enough to fail. Two views (100,100,100)(100,100,100) and (200,200,200)(200,200,200) give σ2=2500>100\sigma^2 = 2500 > 100 in every channel. A lone view has σ2=0\sigma^2 = 0 and always passes.

Constraints

  • colors: list of RGB tuples from different views
  • threshold: maximum standard deviation for consistency
  • Return True if all channels have variance ≤ threshold²

Learn this in

More from CV: Depth Estimation

solution.py

Test results

Sign in to run your code against the test cases.