Permalink
Browse files

stereo_tri: Make the prerasterize window bigger to avoid segfaults, n…

…eeded for interpolation
  • Loading branch information...
1 parent eeaca1b commit da86e0fc0e0fe477340ddb7238aad07464a3f0a8 @oleg-alexandrov oleg-alexandrov committed Sep 27, 2012
Showing with 6 additions and 3 deletions.
  1. +6 −3 src/asp/Tools/stereo_tri.cc
@@ -217,14 +217,17 @@ class StereoLUTAndErrorView : public ImageViewBase<StereoLUTAndErrorView<Dispari
typedef typename UnmaskedPixelType<DPixelT>::type accum_t;
PixelAccumulator<EWMinMaxAccumulator<accum_t> > accumulator;
for_each_pixel( disparity_preraster.child(), accumulator );
+
BBox2i preraster(0,0,0,0);
if ( accumulator.is_valid() ){
accum_t input_min = accumulator.minimum();
accum_t input_max = accumulator.maximum();
- preraster = BBox2i(bbox.min() + floor(Vector2f(input_min[0],input_min[1])),
- bbox.max() + ceil(Vector2(input_max[0],input_max[1])) );
+ // Bugfix: expand the preraster window by 1 pixel to avoid segfaults.
+ // This is needed for interpolation.
+ preraster = BBox2i(bbox.min() + floor(Vector2f(input_min[0]-1,input_min[1]-1)),
+ bbox.max() + ceil(Vector2(input_max[0]+1,input_max[1]+1)) );
}
-
+
return prerasterize_type( disparity_preraster,
m_lut_image1.prerasterize(bbox),
m_lut_image2_org.prerasterize(preraster),

0 comments on commit da86e0f

Please sign in to comment.