Caffe: C++ classification fails with OpenCV 3

Created on 4 Nov 2015  路  5Comments  路  Source: BVLC/caffe

Hi,

The compilation fails when it tries to build the cpp classification example with OpenCV 3

Some functions are deprecated in OpenCV 3 for example : CV_BGR2GRAY it should be cv::COLOR_BGRA2GRAY

https://groups.google.com/d/msg/caffe-users/mZDi02lgcj0/71W9rNWs5KwJ

CXX examples/cpp_classification/classification.cpp
examples/cpp_classification/classification.cpp:194:31: error: use of undeclared identifier 'CV_BGR2GRAY'
    cv::cvtColor(img, sample, CV_BGR2GRAY);
                              ^
examples/cpp_classification/classification.cpp:196:31: error: use of undeclared identifier 'CV_BGRA2GRAY'
    cv::cvtColor(img, sample, CV_BGRA2GRAY);
                              ^
examples/cpp_classification/classification.cpp:198:31: error: use of undeclared identifier 'CV_BGRA2BGR'
    cv::cvtColor(img, sample, CV_BGRA2BGR);
                              ^
examples/cpp_classification/classification.cpp:200:31: error: use of undeclared identifier 'CV_GRAY2BGR'
    cv::cvtColor(img, sample, CV_GRAY2BGR);
                              ^
4 errors generated.
make: *** [.build_release/examples/cpp_classification/classification.o] Error 1

Most helpful comment

I think maybe you can "#define CV_BGR2GRAY cv::COLOR_BGRA2GRAY "

All 5 comments

See #2693
But I'm puzzled by the fact that it compiles fine for me.

I think maybe you can "#define CV_BGR2GRAY cv::COLOR_BGRA2GRAY "

Closing as a duplicate of #2693.

Thanks .. that one work,
so what about
cv::namedWindow("imgOriginal", cv::WINDOW_AUTOSIZE);
cv::namedWindow("imgCanny", WINDOW_AUTOSIZE); // error
or
cv::namedWindow("imgOriginal", WINDOW_AUTOSIZE); //error
cv::namedWindow("imgCanny", WINDOW_AUTOSIZE);

what actually that means, I have limited info about C++

No it's not working
i have tried BGRA2GRAY and RGB2GRAY is already wrong

Was this page helpful?
0 / 5 - 0 ratings