how can i use opencv to compare charaters in a picture and characters in a database [closed]

asked 2016-03-25 04:28:10 -0600

nadia gravatar image

My project aims to extract letters from a picture taken with the mobile camera and compare them with letters in the database(pictures of letters ) and it should know each letter .For example if i tell the program to color the letter N with red it should know all the letters N present in the picture and color them (In french we call that "système d'apprentissage"

edit retag flag offensive reopen merge delete

Closed for the following reason the question is answered, right answer was accepted by sturkmen
close date 2020-09-20 03:29:51.836816

Comments

"système d'apprentissage" == "machine learning" ;)

berak gravatar imageberak ( 2016-03-25 06:32:29 -0600 )edit

Is there examples that i can try to understand how to use machine learning in my case ?

nadia gravatar imagenadia ( 2016-03-25 06:37:32 -0600 )edit
  • which opencv version are you using ?
  • do you already have a training database ? if not, start collecting, you will need like 100-500 examples per character .
  • are you already able to seperate your characters in your image ?
berak gravatar imageberak ( 2016-03-25 06:44:40 -0600 )edit

here is one in c++

(we'll have to adapt that somehow to your android situation, and probably, you should use an SVM instead KNearest)

berak gravatar imageberak ( 2016-03-25 06:48:01 -0600 )edit

I use opencv 3.1.0 for android

I create a database that contains for each letter its equivalents in latin language

I seperate my characters in my image by puting each letter in a rectangle (I use theses instructions:

Rect rect = Imgproc.boundingRect(points);

Imgproc.rectangle(gray, new Point(rect.x,rect.y), new Point(rect.x+rect.width,rect.y+rect.height), new Scalar(255,0,0),2);
}

My project aims to capture an image (contains latin text) with the android camera ,treat the image (extract letters) and then compare this letters with letters in database to translate the text from latin to english

nadia gravatar imagenadia ( 2016-03-25 06:55:30 -0600 )edit
berak gravatar imageberak ( 2016-03-25 08:28:08 -0600 )edit

how can i implement this example .i just copied the code into my activity (error in this instruction " Mat num = digits.submat(new Rect(c20,r20,20,20));" submat isn't known ).What are the steps that i should follow to try this example

nadia gravatar imagenadia ( 2016-03-28 05:00:24 -0600 )edit

it does not find submat ?

berak gravatar imageberak ( 2016-03-28 05:05:01 -0600 )edit

yes ,i use opencv 3.1.0 !!

nadia gravatar imagenadia ( 2016-03-28 05:08:04 -0600 )edit

i am sorry i resolve it because i import android.graphics.Rect; instead of org.opencv.core.Rect;

nadia gravatar imagenadia ( 2016-03-28 05:12:53 -0600 )edit