what I want to do is a image recognition for a simple app:
any links? any hints? any API? thxs :)
Python is one of the widely used programming languages for this purpose. Its amazing libraries and tools help in achieving the task of image processing very efficiently.
Image recognition refers to the task of inputting an image into a neural network and having it output some kind of label for that image. The label that the network outputs will correspond to a pre-defined class. There can be multiple classes that the image can be labeled as, or just one.
Image classification is a method to classify way images into their respective category classes using some methods like : Training a small network from scratch. Fine-tuning the top layers of the model using VGG16.
A typical python tool chain would be:
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()
OpenCV has blob analysis tools, it will give you metrics about the shape which you can feed for your favourite pattern recognition algorithm :) Eg. rectangle has 1.0 ratio for area / (height * width), when circle's ratio is about 0.78.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With