OpenCV error on cvSobel not declared

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

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.