Hi everyone,
I would like to pose a problem regarding the function calcGlobalOrientation when used with the Motion Template technique.
It seems that once the MHI's gradient is computed, calcGlobalOrientation fails to detect the correct direction of motion when an object has an aspect ratio far from 1. For instance, if you move a rod up and down, its global orientation tends to be normal to the longest edge.
Consider, for instance, this poster box:
In the following screenshot, the MHI and the computed orientation of the box moving downwards are shown. As you can see, calcGlobalOrientation determines an angle close to 0, probably also due to the fact that there is a slight horizontal motion.
When used with objects having an aspect ratio close to 1, calcGlobalOrientation works very well.
I believe that we should take into account this and re-design the computation of the global orientation otherwise the estimated motion orientation is not reliable. I experienced the same problems with other objects (e.g. violin bows).
Thanks in advance Alessio