PIXELBANKv9.1.0
Menu

Photo Consistency Check

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 is below a threshold:

σ2=1N∑i(ci−cˉ)2<τ2\sigma^2 = \frac{1}{N}\sum_i (c_i - \bar{c})^2 < \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:
  • Checking photo consistency across 3 views:
  • Red channel: [100, 102, 99] → mean=100.33, variance=1.56 < 100 ✓
  • Green channel: [100, 98, 101] → mean=99.67, variance=1.56 < 100 ✓
  • Blue channel: [100, 101, 100] → mean=100.33, variance=0.22 < 100 ✓ All channels have variance < 10² = 100, so point is consistent.

Constraints:

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

Test Results

0/0
Run code to see test results.