-
Notifications
You must be signed in to change notification settings - Fork 673
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use lambda as parallel_body in old OpenCV
- Loading branch information
1 parent
091ffce
commit 39d0070
Showing
7 changed files
with
73 additions
and
35 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,15 @@ | ||
FROM ros:noetic-robot | ||
|
||
RUN apt-get update && apt-get install -y libeigen3-dev git cmake ninja-build clang | ||
RUN apt-get update && apt-get install -y libeigen3-dev git cmake ninja-build clang build-essential python3-catkin-tools python3-osrf-pycommon python3-catkin-pkg | ||
|
||
RUN git clone https://github.com/opencv/opencv/ | ||
RUN git clone https://github.com/opencv/opencv_contrib/ | ||
RUN cmake -D OPENCV_EXTRA_MODULES_PATH=opencv_contrib/modules -S opencv -B opencv/build -G Ninja | ||
RUN cmake -D OPENCV_EXTRA_MODULES_PATH=../../opencv_contrib/modules -S opencv -B opencv/build -G Ninja | ||
RUN sudo ninja -C opencv/build install | ||
|
||
RUN sudo apt-get install -y python3-catkin-tools python3-osrf-pycommon python3-catkin-pkg | ||
RUN sh -c 'echo "source /opt/ros/noetic/setup.bash" >> ~/.bashrc' | ||
|
||
ENTRYPOINT /bin/bash | ||
|
||
# docker build . --tag open_vins | ||
# docker run --rm --interactive --tty --volume "${PWD}":/workspace/src/open_vins -w /workspace/ open_vins |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
/* | ||
* OpenVINS: An Open Platform for Visual-Inertial Research | ||
* Copyright (C) 2019 Patrick Geneva | ||
* Copyright (C) 2019 Kevin Eckenhoff | ||
* Copyright (C) 2019 Guoquan Huang | ||
* Copyright (C) 2019 OpenVINS Contributors | ||
* | ||
* This program is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU General Public License as published by | ||
* the Free Software Foundation, either version 3 of the License, or | ||
* (at your option) any later version. | ||
* | ||
* This program is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU General Public License | ||
* along with this program. If not, see <https://www.gnu.org/licenses/>. | ||
*/ | ||
#ifndef LAMBDA_BODY_H | ||
#define LAMBDA_BODY_H | ||
|
||
#include <opencv2/opencv.hpp> | ||
#include <functional> | ||
|
||
namespace ov_core { | ||
|
||
/** | ||
* This is a utility class required to build with older version of opencv | ||
* On newer versions this doesn't seem to be needed, but here we just use it to ensure we can work for more opencv version. | ||
* https://answers.opencv.org/question/65800/how-to-use-lambda-as-a-parameter-to-parallel_for_/?answer=130691#post-id-130691 | ||
*/ | ||
class LambdaBody : public cv::ParallelLoopBody { | ||
public: | ||
explicit LambdaBody(const std::function<void(const cv::Range &)> &body) { | ||
_body = body; | ||
} | ||
void operator() (const cv::Range & range) const override { | ||
_body(range); | ||
} | ||
private: | ||
std::function<void(const cv::Range &)> _body; | ||
}; | ||
|
||
} /* namespace ov_core */ | ||
|
||
#endif /* LAMBDA_BODY_H */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters