Permalink
Browse files

stereo_tri: Fix 2f338d0, bounds check incorrect

The prior commit was comparing x axis to y bounds and y axis to x
bounds.
  • Loading branch information...
1 parent 5ae437b commit 5dbd520eb21b0b8ffe64e23f9651dc4cecc30303 Zack Moratto committed Aug 31, 2012
Showing with 6 additions and 9 deletions.
  1. +6 −9 src/asp/Tools/stereo_tri.cc
@@ -147,19 +147,16 @@ class StereoLUTAndErrorView : public ImageViewBase<StereoLUTAndErrorView<Dispari
template <class T>
inline typename boost::enable_if_c<IsCompound<T>::value && (CompoundNumChannels<typename UnmaskedPixelType<T>::type>::value != 1),Vector3>::type
StereoModelHelper( size_t i, size_t j, T const& disparity, double& error ) const {
-
+
float i2 = float(i) + disparity[0];
float j2 = float(j) + disparity[1];
- if ( i2 < 0 || i2 > m_lut_image2.rows()-1 ||
- j2 < 0 || j2 > m_lut_image2.cols()-1 ){
+ if ( i2 < 0 || i2 >= m_lut_image2.cols() ||
+ j2 < 0 || j2 >= m_lut_image2.rows() ||
+ !is_valid( disparity ) ){
return Vector3(); // out of bounds
}
-
- // Avoid returning NaN
- Vector2 lut_image2_pix = m_lut_image2(i2, j2);
- if (lut_image2_pix != lut_image2_pix) return Vector3();
-
- return m_stereo_model( m_lut_image1(i,j), lut_image2_pix, error );
+
+ return m_stereo_model( m_lut_image1(i,j), m_lut_image2(i2, j2), error );
}
public:

0 comments on commit 5dbd520

Please sign in to comment.