Color recognition using openCV

This is the one part of object recognition module exploring of openCV. Until now, i have successfully detected and recognized circle, rectangle and color which is presented here today. And next step is hand gesture recognition.

In color recognition, it can detect any color, but there’s still a little bug that,  the detectation color should be preset before recognizing the objects in the destination image. I am not sure whether there’s any color filter in openCV like Actionscript3 which can just directly filter the necessary color objects.

colorrecognition

Source code colorrecg.pdf

Author: Andol Li

A HCI researcher, a digital media lecturer, an information product designer, and a python/php/java coder.

26 Comments On “ Color recognition using openCV”

  1. Actually, there are 3 methods to recognize the colour objects which are:
    1) using histgram to match the destination image;
    2) using cvSetImageCOI to get specific color channel;
    3) using cvSplit & cvMerge to manipulate channel to get the target colours.
    there i put on another post about color recognition using openCV here as well as some parts of codes, hope it will be useful: http://www.iandol.com/research/882.htm

  2. Am doing project in olor detection and mouse controls in visual c++. can i just get the code for that.i have been trying it in open cv.

  3. sir its showing the error 1>c:\opencv2.1\projects\large\large\new.cpp(174) : error C2040: ‘==’ : ‘int’ differs in levels of indirection from ‘const char [2]’

  4. i got stuck with some errors…

    1>—— Build started: Project: large, Configuration: Debug Win32 ——
    1>Compiling…
    1>new.cpp
    1>c:\opencv2.1\projects\large\large\new.cpp(19) : error C2146: syntax error : missing ‘;’ before identifier ‘–’
    1>c:\opencv2.1\projects\large\large\new.cpp(19) : error C2065: ‘–’ : undeclared identifier
    1>c:\opencv2.1\projects\large\large\new.cpp(19) : error C2146: syntax error : missing ‘;’ before identifier ‘rect’
    1>c:\opencv2.1\projects\large\large\new.cpp(26) : error C2146: syntax error : missing ‘;’ before identifier ‘–’
    1>c:\opencv2.1\projects\large\large\new.cpp(26) : error C2065: ‘–’ : undeclared identifier
    1>c:\opencv2.1\projects\large\large\new.cpp(26) : error C2146: syntax error : missing ‘;’ before identifier ‘rect’
    1>c:\opencv2.1\projects\large\large\new.cpp(150) : error C2065: ‘“mainWin”’ : undeclared identifier
    1>c:\opencv2.1\projects\large\large\new.cpp(151) : error C2065: ‘“mainWin”’ : undeclared identifier
    1>c:\opencv2.1\projects\large\large\new.cpp(167) : error C2065: ‘“mainWin”’ : undeclared identifier
    1>c:\opencv2.1\projects\large\large\new.cpp(170) : error C2065: ‘‘q’’ : undeclared identifier
    1>c:\opencv2.1\projects\large\large\new.cpp(174) : error C2446: ‘==’ : no conversion from ‘const char *’ to ‘int’
    1> There is no context in which this conversion is possible
    1>c:\opencv2.1\projects\large\large\new.cpp(174) : error C2040: ‘==’ : ‘int’ differs in levels of indirection from ‘const char [2]’
    1>c:\opencv2.1\projects\large\large\new.cpp(193) : error C2065: ‘‘q’’ : undeclared identifier
    1>Build log was saved at “file://c:\OpenCV2.1\projects\large\large\Debug\BuildLog.htm”
    1>large – 13 error(s), 0 warning(s)
    ========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

  5. Hello Sir,
    I am newbie in opencv, i m trying to use image recognition to recognise an apple and haar training seems to be only way of doing it…Can u explain the haar training method in detail may be in different post for those who are doing it for the first time…documentation doesnt seems to be of great help….M sure it’l be extremely useful for all who are aspiring to do the haar training:)
    Thank you Sir.

  6. Hello sir,
    I have been working on analysing time for color detection from video or real time.For this i am detecting colors from the motion of a person in video and synchronising the movements of graphical robot in opengl with this.
    Problem i am getting is when i call color detection and than making of robot in main(), than it stops after taking one frame because of glutMainloop();
    I am not able to find out the solution so that I could run the designing of robot in opengl and detecting the moments from a video in opencv IN A LOOP simultaneously.

Leave a comment
Due to technical adjustments, the comment function is shortly closed and will be re-openning soon. Thanks.


Copyrights 2006-2017 © All rights reserved
Theme Tree2, re-designed by Andol Li, powered by WordPress and Bootsrap
WWW.ANDOL.ME | 浙ICP备15040508号-1
公安备案图标 浙公网安备33010602004018号
Back to top