Hu moments comparison

老子叫甜甜 提交于 2019-12-03 13:51:09

I think your numbers are probably ok, the differences between them are moderately small. As the guy says in the video you link to (around 3min):

To get some meaningful answers we take a log transform

so if we do -np.sign(a)*np.log10(np.abs(a)) on the data you post above, we get:

First image:

[[ 0.16584062]
 [ 0.68441437]
 [ 0.96222185]
 [ 2.27570703]
 [-4.23218495]
 [-3.16420051]
 [-3.9462254 ]]

Second image:

[[ 0.17276449]
 [ 0.70438644]
 [ 1.0382848 ]
 [ 2.01764754]
 [-3.61144437]
 [-2.57058511]
 [-3.83686117]]

The fact they are not identical is to be expected. You are starting out with rasterized images which you then process quite a lot to get some of the contours which you pass in.

From the opencv docs:

In case of raster images, the computed Hu invariants for the original and transformed images are a bit different.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!