Ask Your Question

Alessio B's profile - activity

2013-07-22 04:35:33 -0600 commented question calcGlobalOrientation: problem with thin objects (e.g. a rod)

Maybe before looking at the source code, I'd better to try with a workaround. I was thinking that given the angle measured by calcGlobalOrientation, I can go back to the y/x gradient ratio and apply a correcting factor using the bounding box aspect ratio. After that, I compute the angle and this might be a better estimation. When the aspect ratio is close to 1, the estimation doesn't change. But I fear that I also have to take into account whether the estimated orientation is normal to the longest edge (which might be tricky). The fact is that calcGlobalOrientation doesn't take into account the length of the trails in the MHIs. I'd like to share some thoughts with the authors of the function, hope that this post will be seen by them.

2013-07-22 03:50:13 -0600 received badge  Editor (source)
2013-07-22 03:49:42 -0600 asked a question calcGlobalOrientation: problem with thin objects (e.g. a rod)

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:

image description

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.

MHI and global orientation

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