本文介绍了使用scikit-image和RANSAC稳健地估计多项式几何变换的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想用scikit-image skimage.transform和skimage.measure.ransac来强大地估计多项式几何变换

I would like to robustly estimate a polynomial geometric transform with scikit-image skimage.transform and skimage.measure.ransac

ransack文档提供了一个很好的例子如何做到这一点,但使用相似变换。结果如下:

The ransack documentation gives a very nice example of how to do exactly that but with a Similarity Transform. Here is how it goes:

from skimage.transform import SimilarityTransform
from skimage.measure import ransac
model, inliers = ransac((src, dst), SimilarityTransform, 2, 10)

我需要使用而不是SimilarityTransform,以及我需要能够指定多项式顺序。

I need to use skimage.transform.PolynomialTransform instead of SimilarityTransform, and I need to be able to specify the polynomial order.

但是RANSAC调用将PolynomialTransform()作为输入,它不接受任何输入参数。所需的多项式阶数确实在PolynomialTransform()的估计属性中指定...因此RANSAC调用使用多项式阶的默认值,即2,而我需要3阶或4阶多项式。

But the RANSAC call takes as input the PolynomialTransform(), which does not take any input parameters. The desired polynomial order is indeed specified in the estimate attribute of PolynomialTransform()... So the RANSAC call uses the default value for the polynomial order, which is 2, while I would need a 3rd or 4th order polynomial.

我怀疑这是一个基本的python问题?
提前致谢!

I suspect it's a basic python problem?Thanks in advance!

推荐答案

我们可以在RANSAC中提供一种机制,将参数传递给估算器(免费)提交票证)。然而,一个快速的解决方法是:

We could provide a mechanism in RANSAC to pass on arguments to the estimator (feel free to file a ticket). A quick workaround, however, would be:

from skimage.transform import PolynomialTransform

class PolyTF_4(PolynomialTransform):
    def estimate(*data):
        return PolynomialTransform.estimate(*data, order=4)

PolyTF_4 类可以直接传递给RANSAC。

The PolyTF_4 class can then be passed directly to RANSAC.

这篇关于使用scikit-image和RANSAC稳健地估计多项式几何变换的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

05-16 23:46