pub fn localize(&self, image: &GrayImage, roi: &Point3<f32>) -> Point2<f32> {
        let mut transform = create_leaf_transform(&roi);

        for stage in self.stages.iter() {
            let mut translation = Translation2::identity();

            for (codes, preds) in stage.iter() {
                let idx = (0..self.depth).fold(0, |idx, _| {
                    2 * idx
                        + 1
                        + unsafe { codes.get_unchecked(idx) }.bintest(image, &transform) as usize
                });
                let lutidx = idx.saturating_sub(self.dsize) + 1;

                translation.vector += preds[lutidx];
            }

            translation.vector.scale_mut(roi.z);
            transform.append_translation_mut(&translation);

            transform.prepend_scaling_mut(self.scale);
        }

        Point2::from(transform.isometry.translation.vector)
    }
/// Estimate object location on the image
///
/// ### Arguments
///
/// * `image` - Target image.
/// * `roi` - Initial location to start:
///   - `roi.x` position on image x-axis,
///   - `roi.y` position on image y-axis,
///   - `roi.z` initial window size to search.
Estimate object location on the image
Estimate object location on the image
pub fn localize(&self, image: &GrayImage, roi: &Point3<f32>) -> Point2<f32> {
        let mut transform = create_leaf_transform(&roi);
        for stage in self.stages.iter() {
            let mut translation = Translation2::identity();
            for (codes, preds) in stage.iter() {
                let idx = (0..self.depth).fold(0, |idx, _| {
                    2 * idx
                        + 1
                        + unsafe { codes.get_unchecked(idx) }.bintest(image, &transform) as usize
                });
                let lutidx = idx.saturating_sub(self.dsize) + 1;
                translation.vector += preds[lutidx];
            }
            translation.vector.scale_mut(roi.z);
            transform.append_translation_mut(&translation);
            transform.prepend_scaling_mut(self.scale);
        }
        Point2::from(transform.isometry.translation.vector)
    }
pub fn localize ( & self , image : & GrayImage , roi : & Point3 < f32 > ) -> Point2 < f32 > { let mut transform = create_leaf_transform ( & roi ) ; for stage in self . stages . iter ( ) { let mut translation = Translation2 :: identity ( ) ; for ( codes , preds ) in stage . iter ( ) { let idx = ( 0 .. self . depth ) . fold ( 0 , | idx , _ | { 2 * idx + 1 + unsafe { codes . get_unchecked ( idx ) } . bintest ( image , & transform ) as usize } ) ; let lutidx = idx . saturating_sub ( self . dsize ) + 1 ; translation . vector += preds [ lutidx ] ; } translation . vector . scale_mut ( roi . z ) ; transform . append_translation_mut ( & translation ) ; transform . prepend_scaling_mut ( self . scale ) ; } Point2 :: from ( transform . isometry . translation . vector ) }
Estimate object location on the image
Estimate object location on the image
&self
image
&GrayImage
roi
&Point3<f32>
&self
image
&GrayImage
roi
&Point3<f32>