Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

'CV_BGR2RGB' was not declared in this scope #735

Closed
kkjh0723 opened this issue Apr 3, 2019 · 7 comments
Closed

'CV_BGR2RGB' was not declared in this scope #735

kkjh0723 opened this issue Apr 3, 2019 · 7 comments
Assignees
Labels
external contribution welcome A good place to start contributing to the project

Comments

@kkjh0723
Copy link

kkjh0723 commented Apr 3, 2019

Hi, while I build from source, I got the following error.
It seems related to openCV. I installed openCV 4.0 and CV_BGR2RGB seems changed to COLOR_BGR2RGB in opencv4.

/home/dali/dali/aux/optical_flow/turing_of/optical_flow_turing_test.cc: In member function 'virtual void dali::optical_flow::testing::OpticalFlowTuringTest_DISABLED_CalcOpticalFlowTest_Test::TestBody()':
/home/dali/dali/aux/optical_flow/turing_of/optical_flow_turing_test.cc:243:32: error: 'CV_BGR2RGB' was not declared in this scope
   cv::cvtColor(matref, matref, CV_BGR2RGB);
                            ^
/home/dali/dali/aux/optical_flow/turing_of/optical_flow_turing_test.cc: In member function 'virtual void dali::optical_flow::testing::OpticalFlowTuringTest_DISABLED_CalcOpticalFlowExternalHintsTest_Test::TestBody()':
/home/dali/dali/aux/optical_flow/turing_of/optical_flow_turing_test.cc:306:32: error: 'CV_BGR2RGB' was not declared in this scope
   cv::cvtColor(matref, matref, CV_BGR2RGB);
                            ^
dali/CMakeFiles/dali_test.bin.dir/build.make:1142: recipe for target 'dali/CMakeFiles/dali_test.bin.dir/aux/optical_flow/turing_of/optical_flow_turing_test.cc.o' failed
make[2]: *** [dali/CMakeFiles/dali_test.bin.dir/aux/optical_flow/turing_of/optical_flow_turing_test.cc.o] Error 1
make[2]: *** Waiting for unfinished jobs....
CMakeFiles/Makefile2:565: recipe for target 'dali/CMakeFiles/dali_test.bin.dir/all' failed
make[1]: *** [dali/CMakeFiles/dali_test.bin.dir/all] Error 2
Makefile:127: recipe for target 'all' failed
make: *** [all] Error 2
@awolant awolant added the bug Something isn't working label Apr 3, 2019
@awolant
Copy link
Contributor

awolant commented Apr 3, 2019

Hi,
thanks for the info. As openCV 4.0 is quite recent, we did not yet had a chance to check DALIs compatibility. Internally, we use 3.4.3 and this in known to work best.
Sorry for the unfortunate wording of the note on openCV compatibility in the Redme. We are in the process of updating it.

@kkjh0723
Copy link
Author

kkjh0723 commented Apr 3, 2019

Thanks @awolant. So DALI is going to support v3.4.x only or do you have plan to support v4.0 also?

@awolant
Copy link
Contributor

awolant commented Apr 3, 2019

No problem @kkjh0723. For now, there is no plan to support v4.0. We do not see any strong reason to move away from v3.4.3.
Nevertheless, we are open to community contributions in this regard, so if you really need 4.0 support and plan to do it on your own, maybe consider creating a PR with it.

@awolant awolant closed this as completed Apr 3, 2019
@awolant awolant added external contribution welcome A good place to start contributing to the project and removed bug Something isn't working enhancement New feature or request labels Apr 3, 2019
@awolant awolant reopened this Apr 3, 2019
@kkjh0723
Copy link
Author

kkjh0723 commented Apr 4, 2019

I successfully build with openCV4 by changing CV_BGR2RGB to cv::COLOR_BGR2RGB in optical_flow_turing_test.cc (The file moved from the point I forked)

I'm not sure what is the best way to modify for handling both version. Most naive way I can imagine is,

#if (CV_VERSION_MAJOR >= 4)
    cv::cvtColor(matref, matref, cv::COLOR_BGR2RGB);
 #else
    cv::cvtColor(matref, matref, CV_BGR2RGB);
 #endif

But copying above lines 4 times in the code doesn't look nice...

@awolant
Copy link
Contributor

awolant commented Apr 4, 2019

#743 will fix the issue

@awolant
Copy link
Contributor

awolant commented Apr 4, 2019

@kkjh0723 Thanks for pointing this out.

@jantonguirao
Copy link
Contributor

#743 is now merged to master.
This should fix the problem, please reopen this issue otherwise

nofreewill42 added a commit to nofreewill42/CalibAnything that referenced this issue Oct 30, 2023
Build fails, needs cv:: before CV_HSV2BGR after OpenCV version 4.0, at least that's what I suppose based on the following issuecomment: NVIDIA/DALI#735 (comment)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
external contribution welcome A good place to start contributing to the project
Projects
None yet
Development

No branches or pull requests

3 participants