Scikitimage Regionprops方向值

2024-05-01 22:08:29 发布

您现在位置:Python中文网/ 问答频道 /正文

我的问题很简单,但我还没有找到答案。可以使用scikit image的regionprops方法测量图像中的对象。其中一个可用属性是对象的方向。我的问题是,如果在文档中链接的源代码中,值应该在-pi/4到pi/4的范围内,那么值怎么可能在-pi/2到pi/2(https://scikit-image.org/docs/dev/api/skimage.measure.html#skimage.measure.regionprops)之间

def orientation(self):
    a, b, b, c = self.inertia_tensor.flat
    if a - c == 0:
        if b < 0:
            return -PI / 4.
        else:
            return PI / 4.
    else:
        return 0.5 * atan2(-2 * b, c - a)

我很乐意澄清


Tags: 对象方法答案图像imageselfreturnif