Reputation: 420
I want to train a SVM to perform a classification of Images of Digits (0-9) and then use it to read images with numerical values(a low level OCR).
My idea is to read images one by one and store them in numpy array and then to put all those arrays in an array, so as to make my sample_array.
As from the Scikit-Learn documentation " As other classifiers, SVC, NuSVC and LinearSVC take as input two arrays: an array X of size [n_samples, n_features] holding the training samples, and an array y of class labels (strings or integers), size [n_samples]:"
My question is what should be the features of the Images, and how to define them?
I read the Handwriting Recognition example on the tutorial page of the scikit-learn page, but over there the data is already in a dataset(even after a searching the web quite intensively I still don't know how to get my PICS to convert to a dataset) so you see it's a different situation.
A Secondary question: will scikit-image be helpful to use in this situation? I'm using standard PIL for reading images.
Upvotes: -1
Views: 1784
Reputation: 6361
I would say there are many examples only in SO.
each image is a row in your matrix and each column represents the colour intensity of a pixel.so for example if you have a grayscale image the value in your matrix range from 0 to 255. so your features are pixels intensity. take a look at these pages for examples.
http://matplotlib.org/users/image_tutorial.html
How can I read the RGB value of a given pixel in Python?
I recommend you to read a bit more about the basic of image processing. There are many online courses. I personally like this one:
https://www.youtube.com/playlist?list=PL8NTI-xZ0OWnuPNA8QD1BmFyBYbeKIaLM
Upvotes: 3