Skip to main content

Haar Cascade Classifier and Lucas–Kanade Optical Flow Based Realtime Object Tracker with Custom Masking Technique

  • 843 Accesses

Part of the Advances in Intelligent Systems and Computing book series (AISC,volume 887)


Computer vision has been proven a remarkable entity in modern computer science. Different applications of this field have been used on a regular basis. In this paper, we propose a new model for tracking real time object (i.e., car, human face, interior objects, arms, etc.) from video feed by providing training with HAAR features and also with the implementation of Lucas Kanade Optical Flow including Custom Masking technique. Object tracking has been considered to be very much useful in augmented reality, security, virtual reality, training with simulation, etc. In this research, we have trained our classifier of a specific object for detection purpose. Upon successful training of the classifier, a video footage has been passed into the classifier. Firstly, it detects region of interest (ROI) consisting of the object(s). Secondly, with necessary preprocessing techniques we have detected the contour area enclosing the object. Finding out the contour within the detected object(s) enabled us to create green color within the contour enclosing area. We only kept green contours and subtracted everything from the frames of the scene by Custom Masking technique. Finally, we tracked the object by trailing the green contours of the detected object(s) by Lucas Kanade Optical Flow. Our developed system is able to detect and track different object(s) from a video feed with the settings of less than or equal to 30 frames per second (FPS).


  • HAAR
  • Object tracking
  • Contour
  • Lucas Kanade Optical Flow
  • Custom masking

This is a preview of subscription content, access via your institution.

Buying options

USD   29.95
Price excludes VAT (USA)
  • DOI: 10.1007/978-3-030-03405-4_27
  • Chapter length: 13 pages
  • Instant PDF download
  • Readable on all devices
  • Own it forever
  • Exclusive offer for individuals only
  • Tax calculation will be finalised during checkout
USD   169.00
Price excludes VAT (USA)
  • ISBN: 978-3-030-03405-4
  • Instant PDF download
  • Readable on all devices
  • Own it forever
  • Exclusive offer for individuals only
  • Tax calculation will be finalised during checkout
Softcover Book
USD   219.99
Price excludes VAT (USA)
Fig. 1.
Fig. 2.
Fig. 3.
Fig. 4.
Fig. 5.
Fig. 6.
Fig. 7.
Fig. 8.
Fig. 9.
Fig. 10.
Fig. 11.


  1. 1.

  2. 2.


  1. Yilmaz, A., Javed, O., Shah, M.: Object tracking: a survey. ACM Comput. Surv. (CSUR) 38(4), 13 (2006)

    CrossRef  Google Scholar 

  2. Chau, D.P., Bremond, F., Thonnat, M.: Object tracking in videos: approaches and issues. arXiv preprint arXiv:1304.5212 (2013)

  3. Krause, J., Stark, M., Deng, J., Fei-Fei, L.: 3D object representations for fine-grained categorization. In: Proceedings of the IEEE International Conference on Computer Vision Workshops, pp. 554–561 (2013)

    Google Scholar 

  4. Tamgade, S.N., Bora, V.R.: Motion vector estimation of video image by Pyramidal implementation of Lucas Kanade Optical flow. In: 2009 2nd International Conference on Emerging Trends in Engineering and Technology (ICETET). IEEE, pp. 914–917 (2009)

    Google Scholar 

  5. Rezaei, M.: Creating a Cascade of Haar-Like Classifiers: Step by Step. Obtenido de University of Auckland (2014).

  6. Soo, S.: Object detection using Haar-cascade Classifier. Institute of Computer Science, University of Tartu (2014)

    Google Scholar 

  7. Viola, P., Jones, M.: Rapid object detection using a boosted cascade of simple features. In: Proceedings of the 2001 IEEE Computer Society Conference on Computer Vision and Pattern Recognition, CVPR 2001, vol. 1, p. I. IEEE (2001)

    Google Scholar 

  8. Ranftl, A., Alonso-Fernandez, F., Karlsson, S.: Face tracking using optical flow. In: 2015 International Conference of the Biometrics Special Interest Group (BIOSIG), pp. 1–5. IEEE (2015)

    Google Scholar 

  9. Abdat, F., Maaoui, C., Pruski, A.: Real time facial feature points tracking with Pyramidal Lucas–Kanade algorithm. In: The 17th IEEE International Symposium on Robot and Human Interactive Communication, 2008. RO-MAN 2008. IEEE. pp. 71–76 (2008)

    Google Scholar 

  10. Abisheva, B.B., Baisakov, B.M., Maratov, M.M.: Real-time facial feature point detection and tracking in a video sequence. Comput. Model. New Technol. 17(2), 48–52 (2013).

  11. Reinius, S.: Object recognition using the OpenCV Haar cascade-classifier on the iOS platform (Dissertation) (2013).

  12. Kanan, C., Cottrell, G.W.: Color-to-grayscale: does the method matter in image recognition? PLoS ONE 7(1), e29740 (2012)

    CrossRef  Google Scholar 

  13. Green, B.: Canny edge detection tutorial (2002).

  14. Patel, D., Upadhyay, S.: Optical flow measurement using Lucas Kanade method. Int. J. Comput. Appl. 61(10), 6–10 (2013)

    Google Scholar 

  15. Lucas, R.R.: Kanade in a Nutshell.–Kanade2.pdf

Download references

Author information

Authors and Affiliations


Corresponding author

Correspondence to Karishma Mohiuddin .

Editor information

Editors and Affiliations

Rights and permissions

Reprints and Permissions

Copyright information

© 2019 Springer Nature Switzerland AG

About this paper

Verify currency and authenticity via CrossMark

Cite this paper

Mohiuddin, K., Alam, M.M., Das, A.K., Munna, M.T.A., Allayear, S.M., Ali, M.H. (2019). Haar Cascade Classifier and Lucas–Kanade Optical Flow Based Realtime Object Tracker with Custom Masking Technique. In: Arai, K., Kapoor, S., Bhatia, R. (eds) Advances in Information and Communication Networks. FICC 2018. Advances in Intelligent Systems and Computing, vol 887. Springer, Cham.

Download citation

  • DOI:

  • Published:

  • Publisher Name: Springer, Cham

  • Print ISBN: 978-3-030-03404-7

  • Online ISBN: 978-3-030-03405-4

  • eBook Packages: EngineeringEngineering (R0)