Optical Flow Question

Hi,

I’m relatively new to MicroPython and OpenMV but my goal is to implement an optical flow sensor on an UAV. I’m still going through the optical flow example files that you wrote and I have a question concerning the differential-translation.py file:
What do you mean by these two lines :

# Offset results are noisy without filtering so we drop some accuracy.
    sub_pixel_x = int(displacement.x_translation() * 5) / 5.0
    sub_pixel_y = int(displacement.y_translation() * 5) / 5.0

I don’t really understand why you multiply it then divide it by 5? What do you filter exactly?

I want to be able to find the pixel distance (with sub_pixel_x and sub_pixel_y), in order to then find the velocity in pixel/s and then convert this velocity in m/s.
Also, do you know, by any chance, a way to convert from pixel/s to m/s?

Thank you very much for any help you can give me :slight_smile:

I do that literally to just get rid of the LSBs. So, multiply by 5, then floor, then divide by 5.

As for converting pixels to m/s. I’s just a scaling and maybe offset constant. The easiest thing to do is just manually derive these by trying different values.