Code Yarns ‍👨‍💻
Tech BlogPersonal Blog

OpenCV error on cvSobel not declared

📅 2013-Jul-04 ⬩ ✍️ Ashwin Nanjappa ⬩ 🏷️ error, opencv ⬩ 📚 Archive

Problem

I tried to compile some code that used OpenCV and got this error:

foo.cpp:634:21: error: ‘cvPyrDown’ was not declared in this scope
foo.cpp:708:25: error: ‘cvSobel’ was not declared in this scope
foo.cpp:744:31: error: ‘CV_INTER_LINEAR’ was not declared in this scope
foo.cpp:744:49: error: ‘CV_WARP_FILL_OUTLIERS’ was not declared in this scope
foo.cpp:745:17: error: ‘cvRemap’ was not declared in this scope

This code used to compile without errors in older versions of OpenCV.

Solution

It turns out that in newer versions of OpenCV, these declarations are in cv.h and it needs to be explicitly included:

#include <opencv/cv.h>

Tried with: OpenCV 2.4.9 and Ubuntu 12.04 LTS


© 2022 Ashwin Nanjappa • All writing under CC BY-SA license • 🐘 @codeyarns@hachyderm.io📧