Skip to content

Tutorials

Knn handwritten digits recognition – OpenCV 3.4 with python 3 Tutorial 36

Access community, courses and source codes
Logo

AI Vision Academy

Access the code of this tutorial, computer vision courses and an exclusive community on AI Vision Academy

  • Access to over 50+ source codes from Pysource.com/blog
  • Dedicated video courses about computer vision
  • Access to an exclusive community of professionals
  • Real-World AI Projects – Get hands-on experience building practical AI Computer Vision solutions with a structured path.
  • Monthly Coaching Calls – get support and any of your questions answered

Subscribe to our newsletter to learn more

In this video you will find an easy explanation of how the KNN algorythm works for handwritten digits recognition.

We use a sample of 2500 digits (250 of each type 0 to 9) to train the algorythm and we have another small sample to test it and see if the Knn algorithm can accurately read handwritten digits.

7 comments

  1. Hi,
    When I execute the code I get the following cv2.error:
    error: (-215:Assertion failed) test_samples.type() == CV_32F && test_samples.cols == samples.cols in function ‘cv::ml::BruteForceImpl::findNearest’
    What can be the reason?

Join the discussion