I would like to start using c++ for pattern recognition projects. There exist some libraries such as CImage and OpenCV but I am not sure which one is better to work with.I also doubt if it's a good idea to use these libraries or I implement the algorithms myself.
"Pattern recognition" is a very ambiguous statement. Regexes are used to recognize patterns of characters, and boost::regex implements such a thing. But you mention CImage and OpenCV which are not regex libraries.