As this question highly overlaps with a similar question I have already answered, I would include that answer here (linked in the comments underneath the question):
In images, some frequently used techniques for feature extraction are binarizing and blurring
Binarizing: converts the image array into 1s and 0s. This is done while converting the image to a 2D image. Even gray-scaling can also be used. It gives you a numerical matrix of the image. Grayscale takes much lesser space when stored on Disc.
This is how you do it in Python:
from PIL import Image
#Import an image
image = Image.open("xyz.jpg")
Now, convert into gray-scale:
im = image.convert('L')
will return you this image:
And the matrix can be seen by running this:
The array would look something like this:
array([[213, 213, 213, ..., 176, 176, 176],
[213, 213, 213, ..., 176, 176, 176],
[213, 213, 213, ..., 175, 175, 175],
[173, 173, 173, ..., 204, 204, 204],
[173, 173, 173, ..., 205, 205, 204],
[173, 173, 173, ..., 205, 205, 205]], dtype=uint8)
Now, use a histogram plot and/or a contour plot to have a look at the image features:
from pylab import *
# create a new figure
# show contours with origin upper left corner
This would return you a plot, which looks something like this:
Blurring: Blurring algorithm takes weighted average of neighbouring pixels to incorporate surroundings color into every pixel. It enhances the contours better and helps in understanding the features and their importance better.
And this is how you do it in Python:
from PIL import *
p = image.convert("L").filter(ImageFilter.GaussianBlur(radius = 2))
And the blurred image is:
So, these are some ways in which you can do feature engineering. And for advanced methods, you have to understand the basics of Computer Vision and neural networks, and also the different types of filters and their significance and the math behind them.
The entire analytics is done with the PIL package. I wouldn't claim that it's a one-stop shop for Image analytics, but for a starter to novice level, it is pretty much it.