Closed vadixidav closed 1 year ago
@stephanemagnenat I have incorporated your changes along with my own. Could you please compare the Rust CV akaze
against the OpenCV implementation again to see if the behavior is now the same.
On my unpublished branch, I had the following code for half_size
:
Self(ImageBuffer::from_fn(width, height, |x, y| {
let x = x * 2;
let y = y * 2;
let mut sum = self.0.get_pixel(x, y).0[0];
let mut count = 1.0;
let horiz_ok = x + 1 < self.0.width();
let vert_ok = y + 1 < self.0.height();
if horiz_ok {
sum += self.0.get_pixel(x + 1, y).0[0];
count += 1.0;
}
if vert_ok {
sum += self.0.get_pixel(x, y + 1).0[0];
count += 1.0;
}
if vert_ok && horiz_ok {
sum += self.0.get_pixel(x + 1, y + 1).0[0];
count += 1.0;
}
Luma([sum / count])
}))
It would be interesting to see which one is faster, compared to the one in this PR, that uses iterators and save tests in the inner loop, but touches the right pixels out of order.
Further corrections in #66, with the debug dumps.
Ok, now the push works, thanks!
This is the same branch as #64 but added to the upstream repository as the original branch was not modifiable by maintainers.