Count Lines of Code (CLOC) is a useful utility to keep at hand when working with code. It is straightforward to use and count the LOC of a project. It supports almost all types of programming languages and you will get a splitup of each language and a total sum of LOC and comments in the summary.
$ sudo apt install cloc
$ cloc opencv
Tried with: CLOC 1.6 and Ubuntu 14.04