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.

Requirments:
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

26 comments:

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

    ReplyDelete
  2. This comment has been removed by the author.

    ReplyDelete
  3. Refer:
    http://opencv-hub.blogspot.in/

    ReplyDelete
  4. This comment has been removed by the author.

    ReplyDelete
  5. can you post for face recognition tutorial??

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

      help_message = '''
      USAGE: facedetect.py [--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 = cam.read()
      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:
      break
      cv2.destroyAllWindows()

      save this code in your python idle as facedetect.py.then run in ur terminal $python facedetect.py

      Delete
  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: http://blog.zaven.co/opencv-in-android-studio-project/

    ReplyDelete
  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.

    ReplyDelete
  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.

    ReplyDelete
    Replies
    1. may be you can do it instead of broaching

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

    ReplyDelete
  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...

    ReplyDelete
  11. Your content is very informative
    Please see video below
    Expression skills and speech training
    فن بیان
    http://mahanteymouri.ir/expression-art/

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


    HTML basics for SEO

    ReplyDelete
  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

    ReplyDelete
  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

    ReplyDelete
  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

    ReplyDelete
  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……

    ReplyDelete
  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

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

    ReplyDelete
  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.

    ReplyDelete
  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.

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

    Regards,
    Premium Ad Network

    ReplyDelete