# Finding displacement for different directions/angles

**URL:** <https://forums.openmv.io/t/finding-displacement-for-different-directions-angles/7613>\
**Category:** OpenMV Boards\
**Created:** [October 24, 2022, 2:46pm UTC](https://forums.openmv.io/t/finding-displacement-for-different-directions-angles/7613 "2022-10-24T14:46:51Z")\
**Posts on this page:** 4\
**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 24, 2022, 2:46pm UTC](https://forums.openmv.io/t/finding-displacement-for-different-directions-angles/7613/1 "2022-10-24T14:46:51Z")

</div>

Hello,

I’d like to be able to use optical flow to control all six degrees of freedom (translational and rotational movements) of a UAV without a GPS. So basically, I want to find the displacement for x and y translation, scale, as well as for yaw, pitch, and roll rotations (I don’t know if it’s clear). When I use the displacement object (from Image library), I feel that I am only able to find x, y translation, scale and yaw rotation.  
So do you know a way to find the displacement for the roll and pitch rotations? Whether it’s with the displacement object or just by creating my own class.

Thank you

---

<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 24, 2022, 5:02pm UTC](https://forums.openmv.io/t/finding-displacement-for-different-directions-angles/7613/2 "2022-10-24T17:02:48Z")

</div>

There’s no direct method to find roll and pitch using geometric methods like our code is based on.

Also, note that our scale/yaw find\_displacement code barely works since our log\_polar reprojection internally needs to be upgraded to use bilinear/bicubic sampling. Right now it’s NN which results in too many rough edges for the Fourier transform used by find\_displacement to match well.

---

<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 25, 2022, 9:03am UTC](https://forums.openmv.io/t/finding-displacement-for-different-directions-angles/7613/3 "2022-10-25T09:03:12Z")

</div>

Thank you for your fast reply.

What method do you suggest I use to do this then? I’m open to any advice…  
Should I create my own function? Or is there a way to update as you said the log\_polar reprojection?

---

<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 25, 2022, 2:15pm UTC](https://forums.openmv.io/t/finding-displacement-for-different-directions-angles/7613/4 "2022-10-25T14:15:57Z")

</div>

You more or less would need to write 1000s of lines of very high performance C code to do this. So, I don’t have a solution.
