Update opencv macros
This commit is contained in:
parent
d6cb89bc04
commit
66ce5c8ad0
|
@ -15,14 +15,25 @@
|
|||
include(${CMAKE_CURRENT_LIST_DIR}/IncludeGuard.cmake)
|
||||
cmake_include_guard()
|
||||
|
||||
find_package(OpenCV REQUIRED)
|
||||
message(STATUS "Found OpenCV: ${OpenCV_VERSION}")
|
||||
if(OpenCV_VERSION VERSION_LESS 3.0)
|
||||
add_definitions(-DUSE_OPENCV2)
|
||||
elseif(OpenCV_VERSION VERSION_LESS 4.0)
|
||||
add_definitions(-DUSE_OPENCV3)
|
||||
if(OpenCV_FIND_QUIET)
|
||||
find_package(OpenCV QUIET)
|
||||
else()
|
||||
add_definitions(-DUSE_OPENCV4)
|
||||
find_package(OpenCV REQUIRED)
|
||||
endif()
|
||||
|
||||
if(OpenCV_FOUND)
|
||||
|
||||
#message(STATUS "Found OpenCV: ${OpenCV_VERSION}")
|
||||
|
||||
set(WITH_OPENCV TRUE)
|
||||
add_definitions(-DWITH_OPENCV)
|
||||
|
||||
if(OpenCV_VERSION VERSION_LESS 3.0)
|
||||
add_definitions(-DWITH_OPENCV2)
|
||||
elseif(OpenCV_VERSION VERSION_LESS 4.0)
|
||||
add_definitions(-DWITH_OPENCV3)
|
||||
else()
|
||||
add_definitions(-DWITH_OPENCV4)
|
||||
endif()
|
||||
|
||||
list(FIND OpenCV_LIBS "opencv_world" __index)
|
||||
|
@ -35,3 +46,9 @@ if(MSVC OR MSYS OR MINGW)
|
|||
else()
|
||||
set(OpenCV_LIB_SEARCH_PATH "${OpenCV_LIB_PATH}")
|
||||
endif()
|
||||
|
||||
else()
|
||||
|
||||
set(WITH_OPENCV FALSE)
|
||||
|
||||
endif()
|
||||
|
|
|
@ -184,7 +184,7 @@ int main(int argc, char *argv[]) {
|
|||
// Show disparity instead of depth, but show depth values in region.
|
||||
auto &&depth_frame = disp_data.frame;
|
||||
|
||||
#ifdef USE_OPENCV3
|
||||
#ifdef WITH_OPENCV3
|
||||
// ColormapTypes
|
||||
// http://docs.opencv.org/master/d3/d50/group__imgproc__colormap.html#ga9a805d8262bcbe273f16be9ea2055a65
|
||||
cv::applyColorMap(depth_frame, depth_frame, cv::COLORMAP_JET);
|
||||
|
|
|
@ -196,7 +196,7 @@ int main(int argc, char *argv[]) {
|
|||
// Show disparity instead of depth, but show depth values in region.
|
||||
auto &&depth_frame = disp_data.frame;
|
||||
|
||||
#ifdef USE_OPENCV3
|
||||
#ifdef WITH_OPENCV3
|
||||
// ColormapTypes
|
||||
// http://docs.opencv.org/master/d3/d50/group__imgproc__colormap.html#ga9a805d8262bcbe273f16be9ea2055a65
|
||||
cv::applyColorMap(depth_frame, depth_frame, cv::COLORMAP_JET);
|
||||
|
|
|
@ -178,7 +178,7 @@ cv::Rect CVPainter::DrawText(
|
|||
y += offset_y;
|
||||
|
||||
cv::Point org(x, y);
|
||||
#ifdef USE_OPENCV2
|
||||
#ifdef WITH_OPENCV2
|
||||
cv::putText(
|
||||
const_cast<cv::Mat &>(img), text, org, FONT_FACE, FONT_SCALE, FONT_COLOR,
|
||||
THICKNESS);
|
||||
|
|
|
@ -29,7 +29,7 @@ DisparityProcessor::DisparityProcessor(std::int32_t proc_period)
|
|||
int sgbmWinSize = 3;
|
||||
int numberOfDisparities = 64;
|
||||
|
||||
#ifdef USE_OPENCV2
|
||||
#ifdef WITH_OPENCV2
|
||||
// StereoSGBM
|
||||
// http://docs.opencv.org/2.4/modules/calib3d/doc/camera_calibration_and_3d_reconstruction.html?#stereosgbm
|
||||
sgbm_ = cv::Ptr<cv::StereoSGBM>(
|
||||
|
@ -79,7 +79,7 @@ bool DisparityProcessor::OnProcess(
|
|||
ObjMat *output = Object::Cast<ObjMat>(out);
|
||||
|
||||
cv::Mat disparity;
|
||||
#ifdef USE_OPENCV2
|
||||
#ifdef WITH_OPENCV2
|
||||
// StereoSGBM::operator()
|
||||
// http://docs.opencv.org/2.4/modules/calib3d/doc/camera_calibration_and_3d_reconstruction.html#stereosgbm-operator
|
||||
// Output disparity map. It is a 16-bit signed single-channel image of the
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
// limitations under the License.
|
||||
#include "dataset/dataset.h"
|
||||
|
||||
#ifdef USE_OPENCV2
|
||||
#ifdef WITH_OPENCV2
|
||||
#include <opencv2/highgui/highgui.hpp>
|
||||
#else
|
||||
#include <opencv2/imgcodecs/imgcodecs.hpp>
|
||||
|
|
|
@ -16,13 +16,18 @@ include(${CMAKE_CURRENT_LIST_DIR}/IncludeGuard.cmake)
|
|||
cmake_include_guard()
|
||||
|
||||
find_package(OpenCV REQUIRED)
|
||||
|
||||
message(STATUS "Found OpenCV: ${OpenCV_VERSION}")
|
||||
|
||||
set(WITH_OPENCV TRUE)
|
||||
add_definitions(-DWITH_OPENCV)
|
||||
|
||||
if(OpenCV_VERSION VERSION_LESS 3.0)
|
||||
add_definitions(-DUSE_OPENCV2)
|
||||
add_definitions(-DWITH_OPENCV2)
|
||||
elseif(OpenCV_VERSION VERSION_LESS 4.0)
|
||||
add_definitions(-DUSE_OPENCV3)
|
||||
add_definitions(-DWITH_OPENCV3)
|
||||
else()
|
||||
add_definitions(-DUSE_OPENCV4)
|
||||
add_definitions(-DWITH_OPENCV4)
|
||||
endif()
|
||||
|
||||
list(FIND OpenCV_LIBS "opencv_world" __index)
|
||||
|
|
Loading…
Reference in New Issue
Block a user