For Beginners

If you are a beginner in OpenCV programming, then this post may be helpful in providing a insight towards the basic image processing algorithms and its functions available in OpenCV.

OpenCV 2.4.3  (for other versions visit HERE )
Microsoft Visual Studio 10 (or higher version)
OpenCV Linking Guide

First, install OpenCV library and link it with C compiler ( I am using Microsoft Visual studio in Windows platform). Learn the basic image processing functions available in OpenCV through the examples provided in the blog. Here is a list of algorithms you can experiment on to make OpenCV handy.

  1. Load, Display and Save an image
  2. Capture Video from Webcam
  3. Basic drawing examples
  4. Convert RGB to gray / other color spaces
  5. Threshold operation
  6. Bilateral Filter / Gaussian Filter / Median Filter
  7. 2D Convolution / Creating new filter
  8. Sobel Edge Detection / Laplacian operator
  9. Hough Circle Detection
  10. Histogram Calculation
  11. Erosion or dilation
  12. Bitwise AND, OR, XOR and NOT
  13. Face Detection using Haar-Cascade Classifier


  1. It should be really usefull to do a complete Topic about creating haarcascade clasifier ;)
    But your website really nice ! continue

  2. This comment has been removed by the author.

  3. Refer:

  4. This comment has been removed by the author.

  5. can you post for face recognition tutorial??

    1. import numpy as np
      import cv2
      import as cv
      from video import create_capture
      from common import clock, draw_str

      help_message = '''
      USAGE: [--cascade ] [--nested-cascade ] []

      def detect(img, cascade):
      rects = cascade.detectMultiScale(img, scaleFactor=1.3, minNeighbors=4, minSize=(30, 30), flags = cv.CV_HAAR_SCALE_IMAGE)
      if len(rects) == 0:
      return []
      rects[:,2:] += rects[:,:2]
      return rects

      def draw_rects(img, rects, color):
      for x1, y1, x2, y2 in rects:
      cv2.rectangle(img, (x1, y1), (x2, y2), color, 2)

      if __name__ == '__main__':
      import sys, getopt
      print help_message

      args, video_src = getopt.getopt(sys.argv[1:], '', ['cascade=', 'nested-cascade='])
      try: video_src = video_src[0]
      except: video_src = 0
      args = dict(args)
      cascade_fn = args.get('--cascade', "../../data/haarcascades/haarcascade_frontalface_alt.xml")
      nested_fn = args.get('--nested-cascade', "../../data/haarcascades/haarcascade_eye.xml")

      cascade = cv2.CascadeClassifier(cascade_fn)
      nested = cv2.CascadeClassifier(nested_fn)

      cam = create_capture(video_src, fallback='synth:bg=../cpp/lena.jpg:noise=0.05')

      while True:
      ret, img =
      gray = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY)
      gray = cv2.equalizeHist(gray)

      t = clock()
      rects = detect(gray, cascade)
      vis = img.copy()
      draw_rects(vis, rects, (0, 255, 0))
      for x1, y1, x2, y2 in rects:
      roi = gray[y1:y2, x1:x2]
      vis_roi = vis[y1:y2, x1:x2]
      subrects = detect(roi.copy(), nested)
      draw_rects(vis_roi, subrects, (255, 0, 0))
      dt = clock() - t

      draw_str(vis, (20, 20), 'time: %.1f ms' % (dt*1000))
      cv2.imshow('facedetect', vis)

      if 0xFF & cv2.waitKey(5) == 27:

      save this code in your python idle as run in ur terminal $python

  6. Hi! It is really helpful! All the important things in one article! Lately, I was building an app in Android Studio, I needed to integrate it with OpenCv and I found a great article about it. Check it out:

  7. Those are good examples of Open CV. For more information and resources about retail software solutions, please visit the TradeMeters point of sale software page. They also offer a reasonable Windows PC based optometry software for opticians.

  8. I found most of the tutorials a waste of time and garbage as it says only how to use the existing junks (functions already written by someone). What should be taught is to load an image and play with the pixels rather than wasting readers time giving superfluous information about calling some functions.

    1. may be you can do it instead of broaching

  9. Hii..Welcome to this blog...Your posting is really much more informative and helpful to all people...Thanks for your informative update..

  10. Hi..I'm a second year student in University Of Westminster,UK. I'm working on smart glass for blind and visually impaired people project.I'm using OpenCV and Raspbian as an OS. I already did Face detection and Object detection using OpenCV. Now I want to get REAL TIME Emotional expressions from the faces..but I couldn't find any tutorials about OpenCV REAL TIME Emotional expressions..
    Please help me..Thankz...

  11. Your content is very informative
    Please see video below
    Expression skills and speech training
    فن بیان

  12. I read that Post and got it fine and informative.

    HTML basics for SEO

  13. Given so much info in it, These type of articles keeps the users interest in the website, and keep on sharing more ... good luck.
    Android training in chennai with placement | Android Training in chennai

  14. This information is impressive; I am inspired with your post writing style & how continuously you describe this topic. After reading your post, thanks for taking the time to discuss this, I feel happy about it and I love learning more about this topic.
    Android Training in chennai | Android Training

  15. It's really interesting I'll be read that many of the bloggers relevant android development that's time I read that's your tips helped me and clarify the new thing. pretty explicit helpful content.
    Java Training in Chennai | Selenium Training Institute in Chennai | Android Training in Chennai | Android Training in Chennai with Placement

  16. Nice info. Thanks for sharing info about about c language training. I want to learn c training this tutorial is really helpful. Thanks a lot. Keep updating tutorials……

  17. I read a lot of stuff and I found that the way of writing to training that explicitly wants to say was very good so I am affected and like to come again in immortality.
    Python Online Training | Learn Python Online

  18. Nice post, check it to learn android development Android Online Training

  19. Nice information presented in this post, I like the quality of content and the conclusion is good. Thanks for sharing such a nice post!! Keep sharing!!
    online java course for beginners.

  20. Great blog great information. It's actually most entertaining live casino site each game is very interesting especially slot casino games and it's extremely fascinated with different spins. Have a look again the experience you too and take the pleasure of with Android Casino Malaysia today.

  21. Thanks for sharing the Knowledge!
    I was looking for above mentioned Information.

    Premium Ad Network

  22. This comment has been removed by the author.

  23. I read your Blog Your explanation is really good just check it once onceAndroid Online Training Hyderabad to Know more.

  24. I read your blog it has good informative content, Thanks for sharing with us. Check this information once at Android Online Training

  25. Nice blog..! I really loved reading through this article... Thanks for sharing such an amazing post with us and keep blogging...
    ios app development course

  26. This is an awesome post. Really very informative and creative contents. This concept is a good way to enhance the knowledge.

    Like it and help me to development very well Thank you for this brief explanation and very nice information. Well got good

    Android Training in Gurgaon

  27. Nice blog Content. It is very informative and helpful. Please share more content. Thanks.
    Python Training in Noida
    Python Course in Noida
    Python Institute in Noida

  28. I believe there are many more pleasurable opportunities ahead for individuals that looked at your site.

    Hadoop Training in chennai

  29. I believe there are many more pleasurable opportunities ahead for individuals that looked at your site.

    Hadoop Training in chennai

  30. More Resources Here (Curated) -

  31. Thank you a lot for providing individuals with a very spectacular possibility to read critical reviews from this site.
    Python Training in Bangalore

  32. This comment has been removed by the author.


  33. I simply wanted to thank you so much again. I am not sure the things that I might have gone through without the type of hints revealed by you regarding that situation.
    Best selenium training Institute in chennai