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

- given image (500 x 500) pxs ( 1 color background )
- the image will have only 1 geometric figure (triangle or square or smaleyface :) ) of (50x50) pxs.
- python will do the recognition of the figure and display what geometric figure is.

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

A typical **python tool chain** would be:

- read your images with with PIL
- transform them into Numpy arrays
- use Scipy's image filters (linear and rank, morphological) to implement your solution

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.

**Edit:**

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()
```

Licensed under: CC-BY-SA with attribution

Not affiliated with: Stack Overflow