Image classification with opencv
We're currently working on an android ocr app using opencv.pre-processing ,segmentation ,Feature extraction steps are done. Classification is the remaining step and we're stuck ..We're using a DB table which is filled with each letter features ..Firstly we had only 1 feature per letter and we used euclidean distance ,but results wasn't accurate and more features needed to be obtained and so we did.The problem now is we have 7 features per letter and absolutely no idea of how to classify i/p based on them..some have recommended using knn ,but we can't figure out how and the opencv documentation in that part ain't clear ..so if anybody can help it wud be great. Thanks in advance
Briefly and without discussing the details. Vector space comes in handy here. You need to build a feature vector <feature1, feature2, feature3.. featureN> for each of the instances in your training set. From each of these images you extract features that you think or you read in the research articles are important for image classification. For example you can do centroid, Gaussian blur, histograms, etc. Once you have these values linear algebra comes into play with some classification algorithm: knn, svm, naive bayes etc that you run on your training set, that is you build your model. If the model is ready you run it on your test set. Use cross validation for more comprehensive results. For more details check the course notes: http://www.inf.ed.ac.uk/teaching/courses/iaml/slides/knn-2x2.pdf or http://www.inf.ed.ac.uk/teaching/courses/inf2b/lectureSchedule.html
would like to add that OpenCV may not have the sort of classifiers you might prefer. There are several libraries out there, though you may have to see which works best when on a mobile platform. Could you give some details on the features you are using? The simplest KNN (k-nearest neighbors) measure would be to find the Euclidean distance in n dimensions (for an n-dimensional feature vector) between the input sample's features and each of the vectors in your DB table. Also explore Mahalanobis distance (used to measure distance between a point and a dataset/class) if you have multiple classes and the input image is to be classified as one such 'type' or 'class' of image. As #matcheek mentioned, more sophistication can be possible using machine learning techniques such as SVM, Neural Nets, etc. However first you might consider a simpler thing like kNN, considering its a mobile platform which may limit the computational complexity.
Android hide AppBarLayout when i scrolling RecyclerView
Is it possible to automatically connect to Bluetooth LE device when it comes in range after pairing and and connected automatically to device?
Android cirle and rounded background
Create and add object to RealmList in RealmMigration
Create a GridView of images inside a Fragment
Defining size to a custom array type in Android Kotlin
keep previously loaded fragment instance when tab changes instead of creating new one in android
item click for recycler view
How to force Android Studio to build with updated NDK library, without having to clean and build entire project?
Some users not receiving GCM push notification in Android
Sqlite date difference [duplicate]
How do you send a Firebase Notification to all devices via CURL?
Notification: PendingIntent.getActivity how to refresh if activity is already open else open new activity
Can't install Intel HAXM - no error meesage no setup screen
Android: a general scale, translate, rotate animation with long float array values given
Newbie - I cant learn status of my enum or boolen after my activty gone to background?