# Optical Flow Question

**URL:** <https://forums.openmv.io/t/optical-flow-question/7584>\
**Category:** OpenMV Boards\
**Created:** [October 13, 2022, 1:21pm UTC](https://forums.openmv.io/t/optical-flow-question/7584 "2022-10-13T13:21:15Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![ccrom21](https://avatars.discourse-cdn.com/v4/letter/c/ecccb3/32.png) [@ccrom21](https://forums.openmv.io/u/ccrom21)\
**Post date:** [October 13, 2022, 1:21pm UTC](https://forums.openmv.io/t/optical-flow-question/7584/1 "2022-10-13T13:21:15Z")

</div>

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 :

```auto
# 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 🙂

---

<div class="post-metadata">

**Author:** ![kwagyeman](https://yyz1.discourse-cdn.com/flex029/user_avatar/forums.openmv.io/kwagyeman/32/4_2.png) [@kwagyeman](https://forums.openmv.io/u/kwagyeman)\
**Post date:** [October 13, 2022, 1:39pm UTC](https://forums.openmv.io/t/optical-flow-question/7584/2 "2022-10-13T13:39:08Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![longwuhen](https://avatars.discourse-cdn.com/v4/letter/l/dec6dc/32.png) [@longwuhen](https://forums.openmv.io/u/longwuhen)\
**Post date:** [October 12, 2023, 7:57am UTC](https://forums.openmv.io/t/optical-flow-question/7584/3 "2023-10-12T07:57:34Z")

</div>

hi,Are you still working on this problem？
