Compatibility with opencv 2.4
This commit is contained in:
parent
ecf206b563
commit
3c1981a8d6
2 changed files with 21 additions and 5 deletions
|
@ -14,10 +14,8 @@ set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -Wall -Wextra -pedantic -D_D
|
|||
# Eigen library
|
||||
include_directories( "/usr/include/eigen3/" )
|
||||
|
||||
# OpenCV
|
||||
find_package( OpenCV 3.1 REQUIRED )
|
||||
|
||||
# CUDA
|
||||
# CUDA (optional)
|
||||
find_package( CUDA )
|
||||
if (CUDA_FOUND)
|
||||
include( FindCUDA )
|
||||
|
@ -27,5 +25,18 @@ else()
|
|||
message(STATUS "CUDA not found; will skip bs_dsp")
|
||||
endif (CUDA_FOUND)
|
||||
|
||||
# OpenCV
|
||||
find_package( OpenCV REQUIRED )
|
||||
if(OpenCV_VERSION VERSION_LESS "2.4.8")
|
||||
message(FATAL_ERROR "ERROR: Can't find OpenCV 2.4.8+")
|
||||
endif()
|
||||
if(OpenCV_VERSION VERSION_LESS "3.0")
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DHAS_OPENCV2")
|
||||
else()
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DHAS_OPENCV3")
|
||||
endif (OpenCV_VERSION VERSION_LESS "3.0")
|
||||
|
||||
add_executable( lines lines.cpp )
|
||||
target_link_libraries( lines ${OpenCV_LIBS} )
|
||||
|
||||
# vim: set et ts=4 sw=4:
|
||||
|
|
|
@ -1,6 +1,11 @@
|
|||
#include<cmath>
|
||||
#include<algorithm>
|
||||
#include<opencv2/opencv.hpp>
|
||||
|
||||
#ifdef HAS_OPENCV3
|
||||
#include <opencv2/core.hpp> //Any OPENCV3 code
|
||||
#else
|
||||
#include <opencv2/core/core.hpp> //Any Opencv2 code
|
||||
#endif
|
||||
#include"lines.h"
|
||||
|
||||
// all those colors are still visible on b/w (the first component is not so low)
|
||||
|
@ -185,7 +190,7 @@ int main(int argc, char *argv[])
|
|||
color = (color==BLUE) ? MAGENTA : BLUE; //flip color at every group
|
||||
cv::Point p1 = group[0];
|
||||
cv::Point p2 = group[group.size()-1];
|
||||
cv::arrowedLine(img, p1, p2, color, dotwidth>>2);
|
||||
cv::line(img, p1, p2, color, dotwidth>>2);
|
||||
std::cout << "simplified line: ";
|
||||
for(cv::Point p: group)
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue