Skip to content

kswain1/OpenCV

Repository files navigation

OpenCV

Currently going through tutorials to use opencv with c++, in the near future will publish a project for a robotics competition All the files are implemented come this website examples: http://opencv-srf.blogspot.com/2010/09/object-detection-using-color-seperation.html

The opencv functions I implemented are :

  • Inverting/eroding images
  • Video Capture Contrast
  • Histogram Equilization
  • Object Color Tracking

I made a class for each of the listed functions, if you would like to erode and image follow these steps:

  • #include "ErodingFilter.h" in main.cpp header
  • call ErodingFilter(); in main.cpp
  • change the the cvLoadImage("/Users/kehlinswain/Pictures/FaceShot.png") funciton inside of ErodingFilter.cpp
    • to your specific file name
    • e.g Mat myImage = cvLoadImage("/Users/MyName/Desktop/Favorite.jpg")
  • Run the program

screen shot 2015-01-12 at 2 00 11 pm

screen shot 2015-01-12 at 2 00 23 pm

If you would like to use the VideoContrast Function follow these steps:

  • #include "VideoCaptureContrastChange.h" in main.cpp header
  • call VideoCaptureContrastChange(); in main.cpp
  • Run the program

screen shot 2015-01-09 at 10 16 30 am

screen shot 2015-01-09 at 10 16 49 am

If you would like to use the Histogram Equilization Function follow these steps:

  • #include "HistogramEquilizationColorImage.h" in main.cpp header
  • call HistogramEquilizationColorImage(); in main.cpp
  • change to your image location image1 = imread("/Users/kehlinswain/Pictures/FaceShot.png", CV_LOAD_IMAGE_COLOR); inside of the HistogramEquilizationColorImage.cpp file
    • e.g Mat myImage = imread("/Users/MyName/Desktop/Favorite.jpg")
  • Run the program

screen shot 2015-01-12 at 2 12 30 pm screen shot 2015-01-12 at 2 12 22 pm

If you would like to use the Histogram Equilization Function follow these steps:

  • #include "RedObjectTracking.h" in main.cpp header
  • call RedObjectTracking(); in main.cpp
  • Currently I have the program set to filter out the black colors, but if you know the HSV values of your color feel free to change it.
  • Change the inRange() to the upper and lower bound of your color you want to filter inside of the RedObjectTracking.cpp
  • e.g // for black inRange(imgHSV, Scalar(0, 0, 0, 0), Scalar(180, 255, 30, 0), imgThreshold);
  • If you use color picker with gimp you can get the exact value of your colors
    • The conversion of GIMP to OpenCv HSV value are:
      • HUE: OpenCV = GIMP/2
      • SATURAION: OpenCV = GIMP/.392
      • VALUE: OpenCV = GIMP/.392
      • LUMA just leave it as zero
  • I made a youtube Video to show my results: https://www.youtube.com/watch?v=AJ3ozBzUThk

screen shot 2015-01-12 at 12 42 09 pm

  • The red line tracks whatever color that is thresholded

  • Run the program

About

OpenCV Color Detection :D

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published