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

Feature/ubuntu 20.4 #151

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open

Feature/ubuntu 20.4 #151

wants to merge 4 commits into from

Conversation

PushyamiKaveti
Copy link
Contributor

@mithundiddi @jpsnir Please review and merge. OpenCV update for ubuntu 20.04

@vik748
Copy link
Contributor

vik748 commented Jun 16, 2022

Why is the CI failing, it should continue working with the old versions right?

@PushyamiKaveti
Copy link
Contributor Author

Not sure, Re-running the build.

@PushyamiKaveti
Copy link
Contributor Author

Found the issue, it is failing because travis build is happening for ubuntu < 20.04 with opencv 3.2.0 and this branch is particularly for opencv 4.x and ubuntu 20.04. We have to setup build for this configuration.

Copy link
Contributor

@vik748 vik748 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like the Open CV version check ifdef is flipped. Also there are more opecv calls that need version checks:
Relevant line from travis build log:

 80%] Building CXX object spinnaker_sdk_camera_driver/CMakeFiles/acquilib.dir/src/camera.cpp.o
/ros_ws/src/spinnaker_sdk_camera_driver/src/capture.cpp: In member function ‘void acquisition::Capture::save_mat_frames(int)’:
/ros_ws/src/spinnaker_sdk_camera_driver/src/capture.cpp:835:50: error: ‘imwrite’ was not declared in this scope
             imwrite(dump_img_.c_str(), frames_[i]);
                                                  ^
/ros_ws/src/spinnaker_sdk_camera_driver/src/capture.cpp:850:47: error: ‘imwrite’ was not declared in this scope
             imwrite(filename.str(), frames_[i]);
                                               ^
/ros_ws/src/spinnaker_sdk_camera_driver/src/capture.cpp: In member function ‘void acquisition::Capture::run_soft_trig()’:
/ros_ws/src/spinnaker_sdk_camera_driver/src/capture.cpp:1001:42: error: ‘CV_WINDOW_NORMAL’ was not declared in this scope
     if (LIVE_)namedWindow("Acquisition", CV_WINDOW_NORMAL | CV_WINDOW_KEEPRATIO);
                                          ^
/ros_ws/src/spinnaker_sdk_camera_driver/src/capture.cpp:1001:61: error: ‘CV_WINDOW_KEEPRATIO’ was not declared in this scope
     if (LIVE_)namedWindow("Acquisition", CV_WINDOW_NORMAL | CV_WINDOW_KEEPRATIO);
                                                             ^
/ros_ws/src/spinnaker_sdk_camera_driver/src/capture.cpp:1001:80: error: ‘namedWindow’ was not declared in this scope
     if (LIVE_)namedWindow("Acquisition", CV_WINDOW_NORMAL | CV_WINDOW_KEEPRATIO);
                                                                                ^
/ros_ws/src/spinnaker_sdk_camera_driver/src/capture.cpp:1044:48: error: ‘imshow’ was not declared in this scope
                     imshow("Acquisition", grid_);
                                                ^
/ros_ws/src/spinnaker_sdk_camera_driver/src/capture.cpp:1046:56: error: ‘imshow’ was not declared in this scope
                     imshow("Acquisition", frames_[CAM_]);
                                                        ^
/ros_ws/src/spinnaker_sdk_camera_driver/src/capture.cpp:1049:56: error: ‘displayOverlay’ was not declared in this scope
                     displayOverlay("Acquisition", title);
                                                        ^
/ros_ws/src/spinnaker_sdk_camera_driver/src/capture.cpp:1053:34: error: ‘cvWaitKey’ was not declared in this scope
             int key = cvWaitKey(1);
                                  ^
/ros_ws/src/spinnaker_sdk_camera_driver/src/capture.cpp:1081:41: error: ‘cvDestroyAllWindows’ was not declared in this scope
                     cvDestroyAllWindows();
                                         ^
/ros_ws/src/spinnaker_sdk_camera_driver/src/capture.cpp:1114:41: error: ‘cvDestroyAllWindows’ was not declared in this scope
                     cvDestroyAllWindows();
                                         ^

src/capture.cpp Outdated Show resolved Hide resolved
src/capture.cpp Outdated Show resolved Hide resolved
@vik748
Copy link
Contributor

vik748 commented Jun 18, 2022

One thought, all these ifdefs make it really hard to read the code. How about we reaname all the calls to the new open cv functions. Then in one place do a OpenCV version check and then assign function aliases to the old opencv functions if needed. This way there should only be 1 if def. Aliases: https://www.fluentcpp.com/2017/10/27/function-aliases-cpp/

…r non-void function. (#152)

* Debug error on older versions

* Add aliases

* Add aliases 2

* Add aliases 3

* Add aliases 4

* Add alises 5

* Add aliases 7

* Add aliases 8

* ADD aliases 9
@vik748
Copy link
Contributor

vik748 commented Jun 19, 2022

@PushyamiKaveti @mithundiddi this should fix the issue building. Please try it out once.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants