OpenCV Intro to Character Recognition and Machine Learning with KNN

This video uses OpenCV 2.x and is therefore now out of date, here are some updated OpenCV 3 options depending on language preference:

OpenCV 3 KNN Character Recognition C++

OpenCV 3 KNN Character Recognition Python

OpenCV 3 KNN Character Recognition Emgu CV 3 Visual Basic

If you found this video helpful please consider supporting me on Patreon:

22 comments

  1. irshad ahamed says:

    Please make more videos on PIC18F, you made those videos enjoyable for
    micro controller newbies like me. 

  2. Swati Matta says:

    Please make more videos for SVM, cascades and others. Your tutorials are
    really helpful.

  3. Yassine Yassine says:

    hi man i love your videos please keep making them, specially about opencv’s
    ML , SVM …. etc thanks

  4. kingame69 says:

    cannot create classifications.txt and flattened_images.txt in python script
    ubuntu 14.04 any solution…?

  5. Benjamin Laschkar says:

    Awesome, but too bad it doesn’t work on VS2012 cause of this line :

    std::vector intValidChars = { ‘0’, ‘1’, ‘2’, ‘3’, ‘4’, ‘5’, ‘6’, ‘7’,
    ‘8’, ‘9’; }

    I see on some forum that you can use this syntaxe only in VS2013.

    But nice tutorial ! thank you !

  6. saman namik says:

    Hi, Thanks for the videos they were very useful.

    Can i just share a useful tip with you and with everyone else here.

    I’ve found using templates in VS very useful, since i noticed in your
    videos you had re-enter all the configuration required (per project).

    The way I’ve overcome this, is by creating a standard project template in
    VS. This Project Template includes all of the configuration required to run
    an OpenCV 3.0.0 or 2.4.11 project.

    To do this:

    – Create a standard opencv 3.0.0 or 2.4.11 project as per your cheat sheets.

    – In VS go to: File -> Export Template and from there you can give the
    template a description and save it.

    – Next time when you create a new opencv project, you can seletect the
    template you just created, give it a name, and you you dont have to enter
    all of the configuration in the installation cheat sheet again.

    – When your new project opens up, add your source file as per usual, build
    and run.

    I hope this was helpful to all.

  7. Frank Lopez says:

    hey there im new to all this opencv stuff but i must learn and looking
    forward to it , now at the moment i have visual studio 2013 & 2015 which of
    this can i use to follow along ? also i been trying to instal and run
    opencv 3 for use in visual studio ummm no luck with thatshit , so do you
    think by me following this video i can setup your version of opencv? i see
    is not 3 but 2.4? let me know ill be impatiently waiting lol

  8. Jumaan Rimzy says:

    @18F4550videos Thank you for the code.. Its working perfectly . Can you do
    one for character classification using SVM as well

  9. Sarp Aykent says:

    Hey I wanna ask you something I’m using same code but I cant figure out how
    to make detect “i” character. It just selecting “ı” part of it

  10. Lucky Guest says:

    You are brilliant Chris, very clear and detailed presentation!!I use openCV
    on a decaptcha .net project, but I did not train it with a set of reference
    char as u did, nor do I use KNN. I am using instead the inbuilt OPENCV
    Tesseract class along with its set of reference Tessdata files where the
    letter vectors are predefined. The code in vb is much more condensed and
    quite effective – I have around 50% success rate on 8 letters captcha after
    character isolation, rotation and formatting for which I developed code
    myself.The vb code is a such.”Dim myOcr as Tesseract = New
    Tesseract(“”,”eng”,OcrEngineMode.TesseractOnly,”0123456789″)myOcr.Recognize(New
    Image(Of Bgr, Byte)(bitmap))Dim ocredChar as string = myOct.GetText”Have
    you been able to compare the merits of the 2 different approaches?All the
    best.

  11. Sys.stem says:

    hello there as you can see i been having a good run so far with your
    tutorials with no issues till now, as you can see i have this window pop up
    on when i finished setting up the properties from the cheat sheet, i got no
    errors but then again i did not got to the outcome i was looking for,

    Generate-Data.cpp
    what does this 4 pop ups mean ?

    Unhandled exception at 0x7722D4F2 (ntdll.dll) in ConsoleApplication1.exe:
    0xC000007B: %hs is either not designed to run on Windows or it contains an
    error. Try installing the program again using the original installation
    media or contact your system administrator or the software vendor for
    support. Error status 0x.

    Unhandled exception at 0x771D9610 (ntdll.dll) in ConsoleApplication1.exe:
    VTGuard instrumentation code detected an attempt to use an illegal virtual
    function table.

    Unhandled exception at 0x00000030 in ConsoleApplication1.exe: 0xC0000005:
    Access violation executing location 0x00000030.

    Unhandled exception at 0x770D0309 in ConsoleApplication1.exe: 0xC00001A5:
    An invalid exception handler routine has been detected (parameters:
    0x00000003).

  12. MegaAbrox says:

    Thanks for the lesson. I notice that You have publish also other videos
    consider this same topic, need to check out also those. :-)

  13. Govinda Adithya Rajagopalan says:

    Hey,
    The tutorial was amazing. I got this problem, i finish the generate data
    but the txt files that are created is always empty why is it so and what
    can i do rectify it?

    OpenCV: 2.x
    OS: Ubuntu 14.0.4

    (Same error occurs in Windows as well)

  14. Pham Quoc Hoan says:

    Hi, can you make a video about recognition character using SVM? My teacher
    ask me about it but i have no ideal!!!

  15. Jose Silva- Rodriguez says:

    This was awesome dude I really like this. I’m going to attempt to implement
    it myself and perhaps tweak it a bit. I had a question for you. You
    mentioned that you wanted to use an odd number in order for KNN to
    determine which number it is… could this perhaps work to the benefit of
    the machine? What I mean to say is that if you had an even amount of 0’s
    and 8’s could you throw out an exception that would prompt a user to
    determine what that number is so it learns more and more if it’s a 0 or
    8?… idk if that made sense…

  16. João Vitor Alves da Cruz says:

    How do I improve de classifier?? I need train several cases with forms
    different.

Comments are closed.