Next time, it will help a lot to also copy and paste the error that you're getting. Otherwise, we have to copy your code to our computers and try running it ourselves, which we shouldn't have to deal with.
- You're using cout, which are members of the iostream library. You'll need to add iostream
to the top.
- The opencv C++ headers are located under opencv2/. Remove cv.h, highgui.h and add opencv2/core/core.hpp instead. Your example doesn't use anything from highgui, but if you need it in the future, you can replace highgui.h with opencv2/highgui.hpp
- Make sure you link against opencv when compiling. Adding "-lopencv_core" will compile your code.