蟒蛇图像识别蟒蛇、图像

由网友(你的婚礼,我的葬礼)分享简介:我想要做的是一个图像识别为一个简单的应用程序:what I want to do is a image recognition for a simple app:在给定的图像(500×500)PXS(1彩色背景)图像将只有1个几何图形(三角形或正方形或smaleyface :))的(50×50)PXS。在Pyth...

我想要做的是一个图像识别为一个简单的应用程序:

what I want to do is a image recognition for a simple app:

在给定的图像(500×500)PXS(1彩色背景) 图像将只有1个几何图形(三角形或正方形或smaleyface :))的(50×50)PXS。 在Python会做识别的身影,并显示哪些几何图形的。

任何联系?任何提示?任何API? thxs:)

any links? any hints? any API? thxs :)

推荐答案

一个典型的蟒蛇工具链是:

与 PIL 看了你的照片 将其转换成 numpy的阵列 使用 SciPy的的图像过滤器(linear而排名,morphological)实现您的解决方案 read your images with with PIL transform them into Numpy arrays use Scipy's image filters (linear and rank, morphological) to implement your solution

据区分形状,我会通过看背景的形状获得其轮廓。然后,我会发现的角落使用角点检测算法(如哈里斯)的数量。一个三角形有3角,方形4,和一个笑脸没有。 下面是一个python 实施Harris角点检测与SciPy的。

As far differentiating the shapes, I would obtain its silhouette by looking at the shape of the background. I would then detect the number of corners using a corner detection algorithm (e.g. Harris). A triangle has 3 corners, a square 4, and a smiley none. Here's a python implementation of the Harris corner detection with Scipy.

编辑:

正如你提到的评论,博客文章没有present产生所需的算法中的高斯核的功能。下面是来自 SciPy的食谱了这样的功能(巨大的资源BTW)的例子:

As you mention in the comments, the blog post didn't present the function that produces a gaussian kernel needed in the algorithm. Here's an example of a such a function from the Scipy Cookbook (great resource btw):

def gauss_kern(size, sizey=None):
    """ Returns a normalized 2D gauss kernel array for convolutions """
        size = int(size)
        if not sizey:
            sizey = size
        else:
            sizey = int(sizey)
        x, y = mgrid[-size:size+1, -sizey:sizey+1]
        g = exp(-(x**2/float(size)+y**2/float(sizey)))
        return g / g.sum()
阅读全文

相关推荐

最新文章