diff --git a/ports/cctag/0001-fix-osx.patch b/ports/cctag/0001-fix-osx.patch new file mode 100644 index 0000000000..8d3f76acfd --- /dev/null +++ b/ports/cctag/0001-fix-osx.patch @@ -0,0 +1,11 @@ +--- a/src/cctag/utils/Exceptions.hpp ++++ b/src/cctag/utils/Exceptions.hpp +@@ -7,7 +7,7 @@ + */ + #ifndef _CCTAG_EXCEPTIONS_HPP_ + #define _CCTAG_EXCEPTIONS_HPP_ +- ++#define _GNU_SOURCE + #include + #include + #include diff --git a/ports/cctag/portfile.cmake b/ports/cctag/portfile.cmake index bce2870c08..6b4a4d3aed 100644 --- a/ports/cctag/portfile.cmake +++ b/ports/cctag/portfile.cmake @@ -4,6 +4,8 @@ vcpkg_from_github( REF v1.0.2 SHA512 ccd62f6b1ca55035a08660052f38e73866260d5295490864fa9c86af779a42ce2ec727d6c88f0ea38f205903cf8f4107069b690849e432219c74d3b9666e3ae2 HEAD_REF develop + PATCHES + 0001-fix-osx.patch ) vcpkg_check_features(OUT_FEATURE_OPTIONS FEATURE_OPTIONS @@ -15,7 +17,6 @@ vcpkg_check_features(OUT_FEATURE_OPTIONS FEATURE_OPTIONS if("cuda" IN_LIST FEATURES) include(${CURRENT_INSTALLED_DIR}/share/cuda/vcpkg_find_cuda.cmake) vcpkg_find_cuda(OUT_CUDA_TOOLKIT_ROOT CUDA_TOOLKIT_ROOT) - message(STATUS "CUDA_TOOLKIT_ROOT ${CUDA_TOOLKIT_ROOT}") endif() @@ -30,7 +31,7 @@ vcpkg_cmake_config_fixup(CONFIG_PATH lib/cmake/CCTag) vcpkg_copy_pdbs() -file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include ${CURRENT_PACKAGES_DIR}/debug/share) +file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/include" "${CURRENT_PACKAGES_DIR}/debug/share") # remove test files file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/include/cctag/geometry/test" "${CURRENT_PACKAGES_DIR}/include/cctag/test") @@ -45,4 +46,4 @@ if ("apps" IN_LIST FEATURES) vcpkg_copy_tools(TOOL_NAMES ${CCTAG_TOOLS} AUTO_CLEAN) endif() -file(INSTALL ${SOURCE_PATH}/COPYING.md DESTINATION ${CURRENT_PACKAGES_DIR}/share/cctag RENAME copyright) \ No newline at end of file +file(INSTALL "${SOURCE_PATH}/COPYING.md" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}" RENAME copyright) diff --git a/ports/cctag/vcpkg.json b/ports/cctag/vcpkg.json index 7661452d03..1844000430 100644 --- a/ports/cctag/vcpkg.json +++ b/ports/cctag/vcpkg.json @@ -1,6 +1,7 @@ { "name": "cctag", "version-semver": "1.0.2", + "port-version": 1, "maintainers": "alicevision-team@googlegroups.com", "description": "Computer vision library for detecting CCTag markers made up of concentric circles", "homepage": "https://github.com/alicevision/CCTag", @@ -32,7 +33,7 @@ "boost-type-traits", "boost-unordered", "eigen3", - "opencv3", + "opencv", "tbb", { "name": "vcpkg-cmake", diff --git a/ports/dbow3/fix_cmake.patch b/ports/dbow3/fix_cmake.patch index 0b802425e3..81b6a7e200 100644 --- a/ports/dbow3/fix_cmake.patch +++ b/ports/dbow3/fix_cmake.patch @@ -1,632 +1,293 @@ -From d72cb42f5147f7648c462ee1b211070c1691a887 Mon Sep 17 00:00:00 2001 -From: Ramadan -Date: Thu, 15 Aug 2019 12:27:19 +0200 -Subject: [PATCH 1/2] Fix CMakeLists.txt and installation - ---- - .gitignore | 249 ++++++++++ - CMakeLists.txt | 275 +---------- - Lib/CMakeLists.txt | 99 ++++ - Lib/DBow3Config.cmake | 4 + - {src => Lib/include/DBow3}/BowVector.h | 1 + - {src => Lib/include/DBow3}/DBoW3.h | 0 - {src => Lib/include/DBow3}/Database.h | 0 - {src => Lib/include/DBow3}/DescManip.h | 0 - {src => Lib/include/DBow3}/FeatureVector.h | 0 - {src => Lib/include/DBow3}/QueryResults.h | 0 - {src => Lib/include/DBow3}/ScoringObject.h | 0 - {src => Lib/include/DBow3}/Vocabulary.h | 0 - {src => Lib/include/DBow3}/exports.h | 16 +- - {src => Lib/include/DBow3}/quicklz.h | 0 - {src => Lib/include/DBow3}/timers.h | 0 - {src => Lib/src}/BowVector.cpp | 2 +- - {src => Lib/src}/Database.cpp | 2 +- - {src => Lib/src}/DescManip.cpp | 546 ++++++++++----------- - {src => Lib/src}/FeatureVector.cpp | 2 +- - {src => Lib/src}/QueryResults.cpp | 2 +- - {src => Lib/src}/ScoringObject.cpp | 4 +- - {src => Lib/src}/Vocabulary.cpp | 8 +- - {src => Lib/src}/quicklz.c | 2 +- - cmake/instructionSet.cmake | 13 + - cmake_uninstall.cmake.in | 28 -- - config.cmake.in | 36 -- - {utils => examples}/CMakeLists.txt | 0 - {utils => examples}/create_voc_step0.cpp | 252 +++++----- - {utils => examples}/create_voc_step1.cpp | 142 +++--- - {utils => examples}/demo_general.cpp | 404 +++++++-------- - {utils => examples}/images/image0.png | Bin - {utils => examples}/images/image1.png | Bin - {utils => examples}/images/image2.png | Bin - {utils => examples}/images/image3.png | Bin - src/CMakeLists.txt | 35 -- - orbvoc.dbow3 => voc/orbvoc.dbow3 | Bin - 36 files changed, 1072 insertions(+), 1050 deletions(-) - create mode 100644 .gitignore - create mode 100644 Lib/CMakeLists.txt - create mode 100644 Lib/DBow3Config.cmake - rename {src => Lib/include/DBow3}/BowVector.h (99%) - rename {src => Lib/include/DBow3}/DBoW3.h (100%) - rename {src => Lib/include/DBow3}/Database.h (100%) - rename {src => Lib/include/DBow3}/DescManip.h (100%) - rename {src => Lib/include/DBow3}/FeatureVector.h (100%) - rename {src => Lib/include/DBow3}/QueryResults.h (100%) - rename {src => Lib/include/DBow3}/ScoringObject.h (100%) - rename {src => Lib/include/DBow3}/Vocabulary.h (100%) - rename {src => Lib/include/DBow3}/exports.h (78%) - rename {src => Lib/include/DBow3}/quicklz.h (100%) - rename {src => Lib/include/DBow3}/timers.h (100%) - rename {src => Lib/src}/BowVector.cpp (99%) - rename {src => Lib/src}/Database.cpp (99%) - rename {src => Lib/src}/DescManip.cpp (96%) - rename {src => Lib/src}/FeatureVector.cpp (98%) - rename {src => Lib/src}/QueryResults.cpp (97%) - rename {src => Lib/src}/ScoringObject.cpp (99%) - rename {src => Lib/src}/Vocabulary.cpp (99%) - rename {src => Lib/src}/quicklz.c (99%) - create mode 100644 cmake/instructionSet.cmake - delete mode 100644 cmake_uninstall.cmake.in - delete mode 100644 config.cmake.in - rename {utils => examples}/CMakeLists.txt (100%) - rename {utils => examples}/create_voc_step0.cpp (97%) - rename {utils => examples}/create_voc_step1.cpp (97%) - rename {utils => examples}/demo_general.cpp (96%) - rename {utils => examples}/images/image0.png (100%) - rename {utils => examples}/images/image1.png (100%) - rename {utils => examples}/images/image2.png (100%) - rename {utils => examples}/images/image3.png (100%) - delete mode 100644 src/CMakeLists.txt - rename orbvoc.dbow3 => voc/orbvoc.dbow3 (100%) - -diff --git a/.gitignore b/.gitignore -new file mode 100644 -index 0000000..8c4285e ---- /dev/null -+++ b/.gitignore -@@ -0,0 +1,249 @@ -+## Ignore Visual Studio temporary files, build results, and -+## files generated by popular Visual Studio add-ons. -+ -+# User-specific files -+*.suo -+*.user -+*.userosscache -+*.sln.docstates -+ -+# User-specific files (MonoDevelop/Xamarin Studio) -+*.userprefs -+ -+# Build results -+[Dd]ebug/ -+[Dd]ebugPublic/ -+[Rr]elease/ -+[Rr]eleases/ -+[Xx]64/ -+[Xx]86/ -+[Bb]uild/ -+bld/ -+[Bb]in/ -+[Oo]bj/ -+ -+# Visual Studio 2015 cache/options directory -+.vs/ -+out/ -+# Uncomment if you have tasks that create the project's static files in wwwroot -+#wwwroot/ -+ -+# MSTest test Results -+[Tt]est[Rr]esult*/ -+[Bb]uild[Ll]og.* -+ -+# NUNIT -+*.VisualState.xml -+TestResult.xml -+ -+# Build Results of an ATL Project -+[Dd]ebugPS/ -+[Rr]eleasePS/ -+dlldata.c -+ -+# DNX -+project.lock.json -+artifacts/ -+ -+*_i.c -+*_p.c -+*_i.h -+*.ilk -+*.meta -+*.obj -+*.pch -+*.pdb -+*.pgc -+*.pgd -+*.rsp -+*.sbr -+*.tlb -+*.tli -+*.tlh -+*.tmp -+*.tmp_proj -+*.log -+*.vspscc -+*.vssscc -+.builds -+*.pidb -+*.svclog -+*.scc -+*.tlog -+*.idb -+# Chutzpah Test files -+_Chutzpah* -+ -+# Visual C++ cache files -+ipch/ -+*.aps -+*.ncb -+*.opendb -+*.opensdf -+*.sdf -+*.cachefile -+*.VC.db -+ -+# Visual Studio profiler -+*.psess -+*.vsp -+*.vspx -+*.sap -+ -+# TFS 2012 Local Workspace -+$tf/ -+ -+# Guidance Automation Toolkit -+*.gpState -+ -+# ReSharper is a .NET coding add-in -+_ReSharper*/ -+*.[Rr]e[Ss]harper -+*.DotSettings.user -+ -+# JustCode is a .NET coding add-in -+.JustCode -+ -+# TeamCity is a build add-in -+_TeamCity* -+ -+# DotCover is a Code Coverage Tool -+*.dotCover -+ -+# NCrunch -+_NCrunch_* -+.*crunch*.local.xml -+nCrunchTemp_* -+ -+# MightyMoose -+*.mm.* -+AutoTest.Net/ -+ -+# Web workbench (sass) -+.sass-cache/ -+ -+# Installshield output folder -+[Ee]xpress/ -+ -+# DocProject is a documentation generator add-in -+DocProject/buildhelp/ -+DocProject/Help/*.HxT -+DocProject/Help/*.HxC -+DocProject/Help/*.hhc -+DocProject/Help/*.hhk -+DocProject/Help/*.hhp -+DocProject/Help/Html2 -+DocProject/Help/html -+ -+# Click-Once directory -+publish/ -+ -+# Publish Web Output -+*.[Pp]ublish.xml -+*.azurePubxml -+ -+# TODO: Un-comment the next line if you do not want to checkin -+# your web deploy settings because they may include unencrypted -+# passwords -+#*.pubxml -+*.publishproj -+ -+# NuGet Packages -+*.nupkg -+# The packages folder can be ignored because of Package Restore -+**/packages/* -+# except build/, which is used as an MSBuild target. -+!**/packages/build/ -+# Uncomment if necessary however generally it will be regenerated when needed -+#!**/packages/repositories.config -+# NuGet v3's project.json files produces more ignoreable files -+*.nuget.props -+*.nuget.targets -+ -+# Microsoft Azure Build Output -+csx/ -+*.build.csdef -+ -+# Microsoft Azure Emulator -+ecf/ -+rcf/ -+ -+# Microsoft Azure ApplicationInsights config file -+ApplicationInsights.config -+ -+# Windows Store app package directory -+AppPackages/ -+BundleArtifacts/ -+ -+# Visual Studio cache files -+# files ending in .cache can be ignored -+*.[Cc]ache -+# but keep track of directories ending in .cache -+!*.[Cc]ache/ -+ -+# Others -+ClientBin/ -+[Ss]tyle[Cc]op.* -+~$* -+*~ -+*.dbmdl -+*.dbproj.schemaview -+*.pfx -+*.publishsettings -+node_modules/ -+orleans.codegen.cs -+ -+# RIA/Silverlight projects -+Generated_Code/ -+ -+# Backup & report files from converting an old project file -+# to a newer Visual Studio version. Backup files are not needed, -+# because we have git ;-) -+_UpgradeReport_Files/ -+Backup*/ -+UpgradeLog*.XML -+UpgradeLog*.htm -+ -+# SQL Server files -+*.mdf -+*.ldf -+ -+# Business Intelligence projects -+*.rdl.data -+*.bim.layout -+*.bim_*.settings -+ -+# Microsoft Fakes -+FakesAssemblies/ -+ -+# GhostDoc plugin setting file -+*.GhostDoc.xml -+ -+# Node.js Tools for Visual Studio -+.ntvs_analysis.dat -+ -+# Visual Studio 6 build log -+*.plg -+ -+# Visual Studio 6 workspace options file -+*.opt -+ -+# Visual Studio LightSwitch build output -+**/*.HTMLClient/GeneratedArtifacts -+**/*.DesktopClient/GeneratedArtifacts -+**/*.DesktopClient/ModelManifest.xml -+**/*.Server/GeneratedArtifacts -+**/*.Server/ModelManifest.xml -+_Pvt_Extensions -+ -+# LightSwitch generated files -+GeneratedArtifacts/ -+ModelManifest.xml -+ -+# Paket dependency manager -+.paket/paket.exe -+ -+# FAKE - F# Make -+.fake/ -+html -+xml -diff --git a/CMakeLists.txt b/CMakeLists.txt -index 9541cd7..a2a563a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,268 +1,25 @@ --# ---------------------------------------------------------------------------- --# Basic Configuration --# ---------------------------------------------------------------------------- --CMAKE_MINIMUM_REQUIRED(VERSION 2.8) -+cmake_minimum_required(VERSION 3.10) - --set(CMAKE_CXX_STANDARD 11) -+project(DBow3 VERSION 1.0.0) - --PROJECT(DBoW3) --set(PROJECT_VERSION "0.0.1") --string(REGEX MATCHALL "[0-9]" PROJECT_VERSION_PARTS "${PROJECT_VERSION}") --list(GET PROJECT_VERSION_PARTS 0 PROJECT_VERSION_MAJOR) --list(GET PROJECT_VERSION_PARTS 1 PROJECT_VERSION_MINOR) --list(GET PROJECT_VERSION_PARTS 2 PROJECT_VERSION_PATCH) --set(PROJECT_SOVERSION "${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}") -+option(BUILD_EXAMPLES "Set to ON to build examples" OFF) -+option(BUILD_TESTS "Set to ON to build tests" OFF) -+option(BUILD_SHARED_LIBS "Set to OFF to build static libraries" ON) - --message("LIB_INSTALL_DIR: ${LIB_INSTALL_DIR}") -+# OpenCV -+option(USE_OPENCV_CONTRIB "Set on to use opencv-contrib" ON) - --#------------------------------------------------------ --# Build type --#------------------------------------------------------ -+# Optimization -+option(USE_SIMD "Set on to enabel avx optimization" ON) - --IF(NOT CMAKE_BUILD_TYPE ) -- SET( CMAKE_BUILD_TYPE "Release" ) --ENDIF() - --#------------------------------------------------------ --# Lib Names and Dirs --#------------------------------------------------------ -+add_subdirectory(Lib) - --if(WIN32) -- # Postfix of DLLs: -- SET(PROJECT_DLLVERSION "${PROJECT_VERSION_MAJOR}${PROJECT_VERSION_MINOR}${PROJECT_VERSION_PATCH}") -- SET(RUNTIME_OUTPUT_PATH ${PROJECT_BINARY_DIR}/bin CACHE PATH "Directory for dlls and binaries") -- SET(EXECUTABLE_OUTPUT_PATH ${PROJECT_BINARY_DIR}/bin CACHE PATH "Directory for binaries") -- SET(LIBRARY_OUTPUT_PATH ${PROJECT_BINARY_DIR}/bin CACHE PATH "Directory for dlls") --else() -- # Postfix of so's: -- set(PROJECT_DLLVERSION) -- set(LIB_INSTALL_DIR lib CACHE STRING "Install location of libraries (e.g. lib32 or lib64 for multilib installations)") -- SET(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_INSTALL_PREFIX}/${LIB_INSTALL_DIR}/cmake/ /usr/${LIB_INSTALL_DIR}/cmake ) --endif() -+if(BUILD_EXAMPLES) -+ add_subdirectory(examples) -+endif(BUILD_EXAMPLES) - -+if(BUILD_TESTS) -+ add_subdirectory(tests) -+endif(BUILD_TESTS) - -- --# --OPTION(BUILD_UTILS "Set to OFF to not build utils" ON) --OPTION(USE_CONTRIB "Set to ON if contrib are installed" OFF) --OPTION(BUILD_SHARED_LIBS "Set to OFF to build static libraries" ON) -- --# ---------------------------------------------------------------------------- --# Find Dependencies --# ---------------------------------------------------------------------------- --find_package(OpenCV REQUIRED) --IF(USE_CONTRIB) --add_definitions(-DUSE_CONTRIB) --ENDIF() --if(NOT OpenCV_VERSION VERSION_LESS "3.0") -- ADD_DEFINITIONS(-DOPENCV_VERSION_3) -- SET(OPENCV_VERSION_3 ON) --ELSE() -- SET(OPENCV_VERSION_3 OFF) --ENDIF() -- --include_directories(${OpenCV_INCLUDE_DIRS}) -- --SET(REQUIRED_LIBRARIES ${REQUIRED_LIBRARIES} ${OpenCV_LIBS}) -- --# ---------------------------------------------------------------------------- --# PROJECT CONFIGURATION --# force some variables that could be defined in the command line to be written to cache --# ---------------------------------------------------------------------------- --OPTION(INSTALL_DOC "Set to ON to build/install Documentation" OFF) --IF (INSTALL_DOC) -- FIND_PACKAGE(Doxygen REQUIRED) -- MESSAGE( STATUS "INSTALL_DOC: ${INSTALL_DOC} ") -- INCLUDE("${PROJECT_SOURCE_DIR}/generateDoc.cmake") -- GENERATE_DOCUMENTATION(${PROJECT_SOURCE_DIR}/dox.in) --ENDIF() -- --# ---------------------------------------------------------------------------- --# Uninstall target, for "make uninstall" --# ---------------------------------------------------------------------------- --CONFIGURE_FILE( "${CMAKE_CURRENT_SOURCE_DIR}/cmake_uninstall.cmake.in" "${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake" IMMEDIATE @ONLY) --ADD_CUSTOM_TARGET(uninstall "${CMAKE_COMMAND}" -P "${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake") -- --# ---------------------------------------------------------------------------- --# create configuration file from .in file (If you use windows take care with paths) --# ---------------------------------------------------------------------------- -- --CONFIGURE_FILE("${PROJECT_SOURCE_DIR}/config.cmake.in" "${PROJECT_BINARY_DIR}/Find${PROJECT_NAME}.cmake") --CONFIGURE_FILE("${PROJECT_SOURCE_DIR}/config.cmake.in" "${PROJECT_BINARY_DIR}/${PROJECT_NAME}Config.cmake") --INSTALL(FILES "${PROJECT_BINARY_DIR}/Find${PROJECT_NAME}.cmake" DESTINATION ${LIB_INSTALL_DIR}/cmake/ ) --INSTALL(FILES "${PROJECT_BINARY_DIR}/${PROJECT_NAME}Config.cmake" DESTINATION ${LIB_INSTALL_DIR}/cmake/${PROJECT_NAME} ) -- -- -- -- --# ---------------------------------------------------------------------------- --# Program Optimization and debug (Extracted from OpenCV) --# ---------------------------------------------------------------------------- --set(WARNINGS_ARE_ERRORS OFF CACHE BOOL "Treat warnings as errors") --set(WHOLE_PROGRAM_OPTIMIZATION OFF CACHE BOOL "Flags for whole program optimization.") -- --set(EXTRA_C_FLAGS "") --set(EXTRA_C_FLAGS_RELEASE "") --set(EXTRA_C_FLAGS_DEBUG "") --set(EXTRA_EXE_LINKER_FLAGS "") --set(EXTRA_EXE_LINKER_FLAGS_RELEASE "") --set(EXTRA_EXE_LINKER_FLAGS_DEBUG "") -- --IF(CMAKE_COMPILER_IS_GNUCXX OR MINGW) -- set(ENABLE_PROFILING OFF CACHE BOOL "Enable profiling in the GCC compiler (Add flags: -g -pg)") -- set(USE_OMIT_FRAME_POINTER ON CACHE BOOL "Enable -fomit-frame-pointer for GCC") -- if(${CMAKE_SYSTEM_PROCESSOR} MATCHES arm*) # We can use only -O2 because the -O3 causes gcc crash -- set(USE_O2 ON CACHE BOOL "Enable -O2 for GCC") -- set(USE_FAST_MATH OFF CACHE BOOL "Enable -ffast-math for GCC") -- endif() -- if(${CMAKE_SYSTEM_PROCESSOR} MATCHES powerpc*) -- set(USE_O3 ON CACHE BOOL "Enable -O3 for GCC") -- set(USE_POWERPC ON CACHE BOOL "Enable PowerPC for GCC") -- endif () -- if(${CMAKE_SYSTEM_PROCESSOR} MATCHES amd64* OR ${CMAKE_SYSTEM_PROCESSOR} MATCHES x86_64*) -- set(USE_O3 ON CACHE BOOL "Enable -O3 for GCC") -- set(USE_FAST_MATH OFF CACHE BOOL "Enable -ffast-math for GCC") -- set(USE_MMX ON CACHE BOOL "Enable MMX for GCC") -- set(USE_SSE ON CACHE BOOL "Enable SSE for GCC") -- set(USE_SSE2 ON CACHE BOOL "Enable SSE2 for GCC") -- set(USE_SSE3 ON CACHE BOOL "Enable SSE3 for GCC") -- endif() -- if(${CMAKE_SYSTEM_PROCESSOR} MATCHES i686* OR ${CMAKE_SYSTEM_PROCESSOR} MATCHES x86) -- set(USE_O3 ON CACHE BOOL "Enable -O3 for GCC") -- set(USE_FAST_MATH OFF CACHE BOOL "Enable -ffast-math for GCC") -- set(USE_MMX ON CACHE BOOL "Enable MMX for GCC") -- set(USE_SSE OFF CACHE BOOL "Enable SSE for GCC") -- set(USE_SSE2 OFF CACHE BOOL "Enable SSE2 for GCC") -- set(USE_SSE3 OFF CACHE BOOL "Enable SSE3 for GCC") -- endif () -- -- set(EXTRA_C_FLAGS "${EXTRA_C_FLAGS} -Wall") -- -- if(WARNINGS_ARE_ERRORS) -- set(EXTRA_C_FLAGS "${EXTRA_C_FLAGS} -Werror") -- endif() -- -- # The -Wno-long-long is required in 64bit systems when including sytem headers. -- if(${CMAKE_SYSTEM_PROCESSOR} MATCHES x86_64* OR ${CMAKE_SYSTEM_PROCESSOR} MATCHES amd64*) -- set(EXTRA_C_FLAGS "${EXTRA_C_FLAGS} -Wno-long-long") -- endif() -- -- # Whole program optimization -- if(WHOLE_PROGRAM_OPTIMIZATION) -- set(EXTRA_C_FLAGS_RELEASE "${EXTRA_C_FLAGS_RELEASE} -fwhole-program --combine") -- endif() -- -- # Other optimizations -- if(USE_OMIT_FRAME_POINTER) -- set(EXTRA_C_FLAGS_RELEASE "${EXTRA_C_FLAGS_RELEASE} -fomit-frame-pointer") -- endif() -- if(USE_O2) -- set(EXTRA_C_FLAGS_RELEASE "${EXTRA_C_FLAGS_RELEASE} -O2") -- endif() -- if(USE_O3) -- set(EXTRA_C_FLAGS_RELEASE "${EXTRA_C_FLAGS_RELEASE} -O3") -- endif() -- if(USE_FAST_MATH) -- set(EXTRA_C_FLAGS_RELEASE "${EXTRA_C_FLAGS_RELEASE} -ffast-math") -- endif() -- if(USE_POWERPC) -- set(EXTRA_C_FLAGS_RELEASE "${EXTRA_C_FLAGS_RELEASE} -mcpu=G3 -mtune=G5") -- endif() -- if(USE_MMX) -- set(EXTRA_C_FLAGS_RELEASE "${EXTRA_C_FLAGS_RELEASE} -mmmx") -- endif() -- if(USE_SSE) -- set(EXTRA_C_FLAGS_RELEASE "${EXTRA_C_FLAGS_RELEASE} -msse") -- endif() -- if(USE_SSE2) -- set(EXTRA_C_FLAGS_RELEASE "${EXTRA_C_FLAGS_RELEASE} -msse2") -- endif() -- if(USE_SSE3 AND NOT MINGW) # SSE3 should be disabled under MingW because it generates compiler errors -- set(EXTRA_C_FLAGS_RELEASE "${EXTRA_C_FLAGS_RELEASE} -msse3") -- endif() -- -- if(ENABLE_PROFILING) -- set(EXTRA_C_FLAGS_RELEASE "${EXTRA_C_FLAGS_RELEASE} -pg -g") -- else() -- if(NOT APPLE) -- set(EXTRA_C_FLAGS "${EXTRA_C_FLAGS} -ffunction-sections") -- endif() -- endif() -- -- -- set(EXTRA_C_FLAGS_RELEASE "${EXTRA_C_FLAGS_RELEASE} -DNDEBUG ") -- set(EXTRA_C_FLAGS_DEBUG "-g3 -O0 -DDEBUG -D_DEBUG -W -Wextra -Wno-return-type ") -- -- MESSAGE( STATUS "-------------------------------------------------------------------------------" ) -- message( STATUS "GNU COMPILER") -- MESSAGE( STATUS "-------------------------------------------------------------------------------" ) -- -- -- -- --ELSE() # MSVC -- -- --ENDIF()#END OF COMPILER SPECIFIC OPTIONS --SET(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS} ${EXTRA_C_FLAGS_RELEASE}") --SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS} ${EXTRA_C_FLAGS_DEBUG}") --SET(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -std=c++11") --SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -std=c++11") --set(CMAKE_C_FLAGS_RELWITHDEBINFO "${CMAKE_C_FLAGS_RELEASE} ${CMAKE_C_FLAGS_DEBUG}") --set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELEASE} ${CMAKE_CXX_FLAGS_DEBUG}") --SET(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${EXTRA_EXE_LINKER_FLAGS}") --SET(CMAKE_EXE_LINKER_FLAGS_RELEASE "${CMAKE_EXE_LINKER_FLAGS_RELEASE} ${EXTRA_EXE_LINKER_FLAGS_RELEASE}") --SET(CMAKE_EXE_LINKER_FLAGS_DEBUG "${CMAKE_EXE_LINKER_FLAGS_DEBUG} ${EXTRA_EXE_LINKER_FLAGS_DEBUG}") -- -- -- --#------------------------------------------------ --# DIRS --#------------------------------------------------ --ADD_SUBDIRECTORY(src) --IF (BUILD_UTILS) --ADD_SUBDIRECTORY(utils) --ENDIF() -- --IF (BUILD_TESTS) --ADD_SUBDIRECTORY(tests) --ENDIF() -- -- --# ---------------------------------------------------------------------------- --# display status message for important variables --# ---------------------------------------------------------------------------- --message( STATUS ) --MESSAGE( STATUS "-------------------------------------------------------------------------------" ) --message( STATUS "General configuration for ${PROJECT_NAME} ${PROJECT_VERSION}") --MESSAGE( STATUS "-------------------------------------------------------------------------------" ) --message(" Built as dynamic libs?:" ${BUILD_SHARED_LIBS}) --message(" Compiler:" "${CMAKE_COMPILER}" "${CMAKE_CXX_COMPILER}") -- --message( STATUS "Build Type: ${CMAKE_BUILD_TYPE}") --message( STATUS "C++ flags (Release): ${CMAKE_CXX_FLAGS} ${CMAKE_CXX_FLAGS_RELEASE}") --message( STATUS "C++ flags (Debug): ${CMAKE_CXX_FLAGS} ${CMAKE_CXX_FLAGS_DEBUG}") --message( STATUS "C++ flags (Relase+Debug): ${CMAKE_CXX_FLAGS_RELWITHDEBINFO}") -- --message( STATUS "CMAKE_CXX_FLAGS: ${CMAKE_CXX_FLAGS}") --message( STATUS "CMAKE_BINARY_DIR: ${CMAKE_BINARY_DIR}") -- --MESSAGE( STATUS ) --MESSAGE( STATUS "CMAKE_SYSTEM_PROCESSOR = ${CMAKE_SYSTEM_PROCESSOR}" ) --MESSAGE( STATUS "CMAKE_INSTALL_PREFIX = ${CMAKE_INSTALL_PREFIX}" ) --MESSAGE( STATUS "CMAKE_BUILD_TYPE = ${CMAKE_BUILD_TYPE}" ) --MESSAGE( STATUS "CMAKE_MODULE_PATH = ${CMAKE_MODULE_PATH}" ) --MESSAGE( STATUS "BUILD_UTILS= ${BUILD_UTILS}" ) --MESSAGE( STATUS "BUILD_TESTS= ${BUILD_TESTS}" ) --MESSAGE( STATUS "OPENCV_DIR= ${OpenCV_DIR} VERSION=${OpenCV_VERSION}" ) -- --MESSAGE( STATUS "USE_CONTRIB= ${USE_CONTRIB}" ) -- --MESSAGE( STATUS ) --MESSAGE( STATUS "OpenCV_LIB_DIR=${OpenCV_LIB_DIR}") --MESSAGE( STATUS "CMAKE_INSTALL_PREFIX=${CMAKE_BINARY_DIR}") -- --MESSAGE( STATUS ) --MESSAGE( STATUS ) --MESSAGE( STATUS "Change a value with: cmake -D=" ) --MESSAGE( STATUS ) -diff --git a/Lib/CMakeLists.txt b/Lib/CMakeLists.txt -new file mode 100644 -index 0000000..e56077b +-# ---------------------------------------------------------------------------- +-# Basic Configuration +-# ---------------------------------------------------------------------------- +-CMAKE_MINIMUM_REQUIRED(VERSION 2.8) ++cmake_minimum_required(VERSION 3.10) + +-set(CMAKE_CXX_STANDARD 11) ++project(DBow3 VERSION 1.0.0) + +-PROJECT(DBoW3) +-set(PROJECT_VERSION "0.0.1") +-string(REGEX MATCHALL "[0-9]" PROJECT_VERSION_PARTS "${PROJECT_VERSION}") +-list(GET PROJECT_VERSION_PARTS 0 PROJECT_VERSION_MAJOR) +-list(GET PROJECT_VERSION_PARTS 1 PROJECT_VERSION_MINOR) +-list(GET PROJECT_VERSION_PARTS 2 PROJECT_VERSION_PATCH) +-set(PROJECT_SOVERSION "${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}") ++option(BUILD_EXAMPLES "Set to ON to build examples" OFF) ++option(BUILD_TESTS "Set to ON to build tests" OFF) ++option(BUILD_SHARED_LIBS "Set to OFF to build static libraries" ON) + +-message("LIB_INSTALL_DIR: ${LIB_INSTALL_DIR}") ++# OpenCV ++option(USE_OPENCV_CONTRIB "Set on to use opencv-contrib" ON) + +-#------------------------------------------------------ +-# Build type +-#------------------------------------------------------ ++# Optimization ++option(USE_SIMD "Set on to enabel avx optimization" ON) + +-IF(NOT CMAKE_BUILD_TYPE ) +- SET( CMAKE_BUILD_TYPE "Release" ) +-ENDIF() + +-#------------------------------------------------------ +-# Lib Names and Dirs +-#------------------------------------------------------ ++add_subdirectory(Lib) + +-if(WIN32) +- # Postfix of DLLs: +- SET(PROJECT_DLLVERSION "${PROJECT_VERSION_MAJOR}${PROJECT_VERSION_MINOR}${PROJECT_VERSION_PATCH}") +- SET(RUNTIME_OUTPUT_PATH ${PROJECT_BINARY_DIR}/bin CACHE PATH "Directory for dlls and binaries") +- SET(EXECUTABLE_OUTPUT_PATH ${PROJECT_BINARY_DIR}/bin CACHE PATH "Directory for binaries") +- SET(LIBRARY_OUTPUT_PATH ${PROJECT_BINARY_DIR}/bin CACHE PATH "Directory for dlls") +-else() +- # Postfix of so's: +- set(PROJECT_DLLVERSION) +- set(LIB_INSTALL_DIR lib CACHE STRING "Install location of libraries (e.g. lib32 or lib64 for multilib installations)") +- SET(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_INSTALL_PREFIX}/${LIB_INSTALL_DIR}/cmake/ /usr/${LIB_INSTALL_DIR}/cmake ) +-endif() ++if(BUILD_EXAMPLES) ++ add_subdirectory(examples) ++endif(BUILD_EXAMPLES) + ++if(BUILD_TESTS) ++ add_subdirectory(tests) ++endif(BUILD_TESTS) + +- +-# +-OPTION(BUILD_UTILS "Set to OFF to not build utils" ON) +-OPTION(USE_CONTRIB "Set to ON if contrib are installed" OFF) +-OPTION(BUILD_SHARED_LIBS "Set to OFF to build static libraries" ON) +- +-# ---------------------------------------------------------------------------- +-# Find Dependencies +-# ---------------------------------------------------------------------------- +-find_package(OpenCV REQUIRED) +-IF(USE_CONTRIB) +-add_definitions(-DUSE_CONTRIB) +-ENDIF() +-if(NOT OpenCV_VERSION VERSION_LESS "3.0") +- ADD_DEFINITIONS(-DOPENCV_VERSION_3) +- SET(OPENCV_VERSION_3 ON) +-ELSE() +- SET(OPENCV_VERSION_3 OFF) +-ENDIF() +- +-include_directories(${OpenCV_INCLUDE_DIRS}) +- +-SET(REQUIRED_LIBRARIES ${REQUIRED_LIBRARIES} ${OpenCV_LIBS}) +- +-# ---------------------------------------------------------------------------- +-# PROJECT CONFIGURATION +-# force some variables that could be defined in the command line to be written to cache +-# ---------------------------------------------------------------------------- +-OPTION(INSTALL_DOC "Set to ON to build/install Documentation" OFF) +-IF (INSTALL_DOC) +- FIND_PACKAGE(Doxygen REQUIRED) +- MESSAGE( STATUS "INSTALL_DOC: ${INSTALL_DOC} ") +- INCLUDE("${PROJECT_SOURCE_DIR}/generateDoc.cmake") +- GENERATE_DOCUMENTATION(${PROJECT_SOURCE_DIR}/dox.in) +-ENDIF() +- +-# ---------------------------------------------------------------------------- +-# Uninstall target, for "make uninstall" +-# ---------------------------------------------------------------------------- +-CONFIGURE_FILE( "${CMAKE_CURRENT_SOURCE_DIR}/cmake_uninstall.cmake.in" "${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake" IMMEDIATE @ONLY) +-ADD_CUSTOM_TARGET(uninstall "${CMAKE_COMMAND}" -P "${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake") +- +-# ---------------------------------------------------------------------------- +-# create configuration file from .in file (If you use windows take care with paths) +-# ---------------------------------------------------------------------------- +- +-CONFIGURE_FILE("${PROJECT_SOURCE_DIR}/config.cmake.in" "${PROJECT_BINARY_DIR}/Find${PROJECT_NAME}.cmake") +-CONFIGURE_FILE("${PROJECT_SOURCE_DIR}/config.cmake.in" "${PROJECT_BINARY_DIR}/${PROJECT_NAME}Config.cmake") +-INSTALL(FILES "${PROJECT_BINARY_DIR}/Find${PROJECT_NAME}.cmake" DESTINATION ${LIB_INSTALL_DIR}/cmake/ ) +-INSTALL(FILES "${PROJECT_BINARY_DIR}/${PROJECT_NAME}Config.cmake" DESTINATION ${LIB_INSTALL_DIR}/cmake/${PROJECT_NAME} ) +- +- +- +- +-# ---------------------------------------------------------------------------- +-# Program Optimization and debug (Extracted from OpenCV) +-# ---------------------------------------------------------------------------- +-set(WARNINGS_ARE_ERRORS OFF CACHE BOOL "Treat warnings as errors") +-set(WHOLE_PROGRAM_OPTIMIZATION OFF CACHE BOOL "Flags for whole program optimization.") +- +-set(EXTRA_C_FLAGS "") +-set(EXTRA_C_FLAGS_RELEASE "") +-set(EXTRA_C_FLAGS_DEBUG "") +-set(EXTRA_EXE_LINKER_FLAGS "") +-set(EXTRA_EXE_LINKER_FLAGS_RELEASE "") +-set(EXTRA_EXE_LINKER_FLAGS_DEBUG "") +- +-IF(CMAKE_COMPILER_IS_GNUCXX OR MINGW) +- set(ENABLE_PROFILING OFF CACHE BOOL "Enable profiling in the GCC compiler (Add flags: -g -pg)") +- set(USE_OMIT_FRAME_POINTER ON CACHE BOOL "Enable -fomit-frame-pointer for GCC") +- if(${CMAKE_SYSTEM_PROCESSOR} MATCHES arm*) # We can use only -O2 because the -O3 causes gcc crash +- set(USE_O2 ON CACHE BOOL "Enable -O2 for GCC") +- set(USE_FAST_MATH OFF CACHE BOOL "Enable -ffast-math for GCC") +- endif() +- if(${CMAKE_SYSTEM_PROCESSOR} MATCHES powerpc*) +- set(USE_O3 ON CACHE BOOL "Enable -O3 for GCC") +- set(USE_POWERPC ON CACHE BOOL "Enable PowerPC for GCC") +- endif () +- if(${CMAKE_SYSTEM_PROCESSOR} MATCHES amd64* OR ${CMAKE_SYSTEM_PROCESSOR} MATCHES x86_64*) +- set(USE_O3 ON CACHE BOOL "Enable -O3 for GCC") +- set(USE_FAST_MATH OFF CACHE BOOL "Enable -ffast-math for GCC") +- set(USE_MMX ON CACHE BOOL "Enable MMX for GCC") +- set(USE_SSE ON CACHE BOOL "Enable SSE for GCC") +- set(USE_SSE2 ON CACHE BOOL "Enable SSE2 for GCC") +- set(USE_SSE3 ON CACHE BOOL "Enable SSE3 for GCC") +- endif() +- if(${CMAKE_SYSTEM_PROCESSOR} MATCHES i686* OR ${CMAKE_SYSTEM_PROCESSOR} MATCHES x86) +- set(USE_O3 ON CACHE BOOL "Enable -O3 for GCC") +- set(USE_FAST_MATH OFF CACHE BOOL "Enable -ffast-math for GCC") +- set(USE_MMX ON CACHE BOOL "Enable MMX for GCC") +- set(USE_SSE OFF CACHE BOOL "Enable SSE for GCC") +- set(USE_SSE2 OFF CACHE BOOL "Enable SSE2 for GCC") +- set(USE_SSE3 OFF CACHE BOOL "Enable SSE3 for GCC") +- endif () +- +- set(EXTRA_C_FLAGS "${EXTRA_C_FLAGS} -Wall") +- +- if(WARNINGS_ARE_ERRORS) +- set(EXTRA_C_FLAGS "${EXTRA_C_FLAGS} -Werror") +- endif() +- +- # The -Wno-long-long is required in 64bit systems when including sytem headers. +- if(${CMAKE_SYSTEM_PROCESSOR} MATCHES x86_64* OR ${CMAKE_SYSTEM_PROCESSOR} MATCHES amd64*) +- set(EXTRA_C_FLAGS "${EXTRA_C_FLAGS} -Wno-long-long") +- endif() +- +- # Whole program optimization +- if(WHOLE_PROGRAM_OPTIMIZATION) +- set(EXTRA_C_FLAGS_RELEASE "${EXTRA_C_FLAGS_RELEASE} -fwhole-program --combine") +- endif() +- +- # Other optimizations +- if(USE_OMIT_FRAME_POINTER) +- set(EXTRA_C_FLAGS_RELEASE "${EXTRA_C_FLAGS_RELEASE} -fomit-frame-pointer") +- endif() +- if(USE_O2) +- set(EXTRA_C_FLAGS_RELEASE "${EXTRA_C_FLAGS_RELEASE} -O2") +- endif() +- if(USE_O3) +- set(EXTRA_C_FLAGS_RELEASE "${EXTRA_C_FLAGS_RELEASE} -O3") +- endif() +- if(USE_FAST_MATH) +- set(EXTRA_C_FLAGS_RELEASE "${EXTRA_C_FLAGS_RELEASE} -ffast-math") +- endif() +- if(USE_POWERPC) +- set(EXTRA_C_FLAGS_RELEASE "${EXTRA_C_FLAGS_RELEASE} -mcpu=G3 -mtune=G5") +- endif() +- if(USE_MMX) +- set(EXTRA_C_FLAGS_RELEASE "${EXTRA_C_FLAGS_RELEASE} -mmmx") +- endif() +- if(USE_SSE) +- set(EXTRA_C_FLAGS_RELEASE "${EXTRA_C_FLAGS_RELEASE} -msse") +- endif() +- if(USE_SSE2) +- set(EXTRA_C_FLAGS_RELEASE "${EXTRA_C_FLAGS_RELEASE} -msse2") +- endif() +- if(USE_SSE3 AND NOT MINGW) # SSE3 should be disabled under MingW because it generates compiler errors +- set(EXTRA_C_FLAGS_RELEASE "${EXTRA_C_FLAGS_RELEASE} -msse3") +- endif() +- +- if(ENABLE_PROFILING) +- set(EXTRA_C_FLAGS_RELEASE "${EXTRA_C_FLAGS_RELEASE} -pg -g") +- else() +- if(NOT APPLE) +- set(EXTRA_C_FLAGS "${EXTRA_C_FLAGS} -ffunction-sections") +- endif() +- endif() +- +- +- set(EXTRA_C_FLAGS_RELEASE "${EXTRA_C_FLAGS_RELEASE} -DNDEBUG ") +- set(EXTRA_C_FLAGS_DEBUG "-g3 -O0 -DDEBUG -D_DEBUG -W -Wextra -Wno-return-type ") +- +- MESSAGE( STATUS "-------------------------------------------------------------------------------" ) +- message( STATUS "GNU COMPILER") +- MESSAGE( STATUS "-------------------------------------------------------------------------------" ) +- +- +- +- +-ELSE() # MSVC +- +- +-ENDIF()#END OF COMPILER SPECIFIC OPTIONS +-SET(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS} ${EXTRA_C_FLAGS_RELEASE}") +-SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS} ${EXTRA_C_FLAGS_DEBUG}") +-SET(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -std=c++11") +-SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -std=c++11") +-set(CMAKE_C_FLAGS_RELWITHDEBINFO "${CMAKE_C_FLAGS_RELEASE} ${CMAKE_C_FLAGS_DEBUG}") +-set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELEASE} ${CMAKE_CXX_FLAGS_DEBUG}") +-SET(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${EXTRA_EXE_LINKER_FLAGS}") +-SET(CMAKE_EXE_LINKER_FLAGS_RELEASE "${CMAKE_EXE_LINKER_FLAGS_RELEASE} ${EXTRA_EXE_LINKER_FLAGS_RELEASE}") +-SET(CMAKE_EXE_LINKER_FLAGS_DEBUG "${CMAKE_EXE_LINKER_FLAGS_DEBUG} ${EXTRA_EXE_LINKER_FLAGS_DEBUG}") +- +- +- +-#------------------------------------------------ +-# DIRS +-#------------------------------------------------ +-ADD_SUBDIRECTORY(src) +-IF (BUILD_UTILS) +-ADD_SUBDIRECTORY(utils) +-ENDIF() +- +-IF (BUILD_TESTS) +-ADD_SUBDIRECTORY(tests) +-ENDIF() +- +- +-# ---------------------------------------------------------------------------- +-# display status message for important variables +-# ---------------------------------------------------------------------------- +-message( STATUS ) +-MESSAGE( STATUS "-------------------------------------------------------------------------------" ) +-message( STATUS "General configuration for ${PROJECT_NAME} ${PROJECT_VERSION}") +-MESSAGE( STATUS "-------------------------------------------------------------------------------" ) +-message(" Built as dynamic libs?:" ${BUILD_SHARED_LIBS}) +-message(" Compiler:" "${CMAKE_COMPILER}" "${CMAKE_CXX_COMPILER}") +- +-message( STATUS "Build Type: ${CMAKE_BUILD_TYPE}") +-message( STATUS "C++ flags (Release): ${CMAKE_CXX_FLAGS} ${CMAKE_CXX_FLAGS_RELEASE}") +-message( STATUS "C++ flags (Debug): ${CMAKE_CXX_FLAGS} ${CMAKE_CXX_FLAGS_DEBUG}") +-message( STATUS "C++ flags (Relase+Debug): ${CMAKE_CXX_FLAGS_RELWITHDEBINFO}") +- +-message( STATUS "CMAKE_CXX_FLAGS: ${CMAKE_CXX_FLAGS}") +-message( STATUS "CMAKE_BINARY_DIR: ${CMAKE_BINARY_DIR}") +- +-MESSAGE( STATUS ) +-MESSAGE( STATUS "CMAKE_SYSTEM_PROCESSOR = ${CMAKE_SYSTEM_PROCESSOR}" ) +-MESSAGE( STATUS "CMAKE_INSTALL_PREFIX = ${CMAKE_INSTALL_PREFIX}" ) +-MESSAGE( STATUS "CMAKE_BUILD_TYPE = ${CMAKE_BUILD_TYPE}" ) +-MESSAGE( STATUS "CMAKE_MODULE_PATH = ${CMAKE_MODULE_PATH}" ) +-MESSAGE( STATUS "BUILD_UTILS= ${BUILD_UTILS}" ) +-MESSAGE( STATUS "BUILD_TESTS= ${BUILD_TESTS}" ) +-MESSAGE( STATUS "OPENCV_DIR= ${OpenCV_DIR} VERSION=${OpenCV_VERSION}" ) +- +-MESSAGE( STATUS "USE_CONTRIB= ${USE_CONTRIB}" ) +- +-MESSAGE( STATUS ) +-MESSAGE( STATUS "OpenCV_LIB_DIR=${OpenCV_LIB_DIR}") +-MESSAGE( STATUS "CMAKE_INSTALL_PREFIX=${CMAKE_BINARY_DIR}") +- +-MESSAGE( STATUS ) +-MESSAGE( STATUS ) +-MESSAGE( STATUS "Change a value with: cmake -D=" ) +-MESSAGE( STATUS ) --- /dev/null +++ b/Lib/CMakeLists.txt -@@ -0,0 +1,99 @@ +@@ -0,0 +1,92 @@ +cmake_minimum_required(VERSION 3.10) + +find_package(OpenCV REQUIRED) @@ -684,13 +345,6 @@ index 0000000..e56077b +) +endif() + -+if(USE_SIMD) -+ target_link_libraries(DBow3 -+ PRIVATE -+ SIMD::SSE4.1 -+ ) -+endif() -+ +target_compile_definitions(DBow3 + PUBLIC + NOMINMAX @@ -727,9 +381,6 @@ index 0000000..e56077b +install(FILES DBow3Config.cmake ${CMAKE_CURRENT_BINARY_DIR}/DBow3ConfigVersion.cmake + DESTINATION cmake/DBow3) \ No newline at end of file -diff --git a/Lib/DBow3Config.cmake b/Lib/DBow3Config.cmake -new file mode 100644 -index 0000000..9720a14 --- /dev/null +++ b/Lib/DBow3Config.cmake @@ -0,0 +1,4 @@ @@ -858,279 +509,279 @@ index d6331af..430ce2b 100644 --- a/src/DescManip.cpp +++ b/Lib/src/DescManip.cpp @@ -1,273 +1,273 @@ --/** -- * File: DescManip.cpp -- * Date: June 2012 -- * Author: Dorian Galvez-Lopez -- * Description: functions for ORB descriptors -- * License: see the LICENSE.txt file -- * -- */ -- --#include --#include --#include --#include --#include --#include -- --#include "DescManip.h" -- --using namespace std; -- --namespace DBoW3 { -- --// -------------------------------------------------------------------------- -- --void DescManip::meanValue(const std::vector &descriptors, -- cv::Mat &mean) --{ -- -- if(descriptors.empty()) return; -- -- if(descriptors.size() == 1) -- { -- mean = descriptors[0].clone(); -- return; -- } -- //binary descriptor -- if (descriptors[0].type()==CV_8U ){ -- //determine number of bytes of the binary descriptor -- int L= getDescSizeBytes( descriptors[0]); -- vector sum( L * 8, 0); -- -- for(size_t i = 0; i < descriptors.size(); ++i) -- { -- const cv::Mat &d = descriptors[i]; -- const unsigned char *p = d.ptr(); -- -- for(int j = 0; j < d.cols; ++j, ++p) -- { -- if(*p & (1 << 7)) ++sum[ j*8 ]; -- if(*p & (1 << 6)) ++sum[ j*8 + 1 ]; -- if(*p & (1 << 5)) ++sum[ j*8 + 2 ]; -- if(*p & (1 << 4)) ++sum[ j*8 + 3 ]; -- if(*p & (1 << 3)) ++sum[ j*8 + 4 ]; -- if(*p & (1 << 2)) ++sum[ j*8 + 5 ]; -- if(*p & (1 << 1)) ++sum[ j*8 + 6 ]; -- if(*p & (1)) ++sum[ j*8 + 7 ]; -- } -- } -- -- mean = cv::Mat::zeros(1, L, CV_8U); -- unsigned char *p = mean.ptr(); -- -- const int N2 = (int)descriptors.size() / 2 + descriptors.size() % 2; -- for(size_t i = 0; i < sum.size(); ++i) -- { -- if(sum[i] >= N2) -- { -- // set bit -- *p |= 1 << (7 - (i % 8)); -- } -- -- if(i % 8 == 7) ++p; -- } -- } -- //non binary descriptor -- else{ -- assert(descriptors[0].type()==CV_32F );//ensure it is float -- -- mean.create(1, descriptors[0].cols,descriptors[0].type()); -- mean.setTo(cv::Scalar::all(0)); -- float inv_s =1./double( descriptors.size()); -- for(size_t i=0;i(); // a & b are actually CV_8U -- pb = b.ptr(); -- -- uint64_t v, ret = 0; -- for(size_t i = 0; i < a.cols / sizeof(uint64_t); ++i, ++pa, ++pb) -- { -- v = *pa ^ *pb; -- v = v - ((v >> 1) & (uint64_t)~(uint64_t)0/3); -- v = (v & (uint64_t)~(uint64_t)0/15*3) + ((v >> 2) & -- (uint64_t)~(uint64_t)0/15*3); -- v = (v + (v >> 4)) & (uint64_t)~(uint64_t)0/255*15; -- ret += (uint64_t)(v * ((uint64_t)~(uint64_t)0/255)) >> -- (sizeof(uint64_t) - 1) * CHAR_BIT; -- } -- -- return ret; -- } -- else{ -- double sqd = 0.; -- assert(a.type()==CV_32F); -- assert(a.rows==1); -- const float *a_ptr=a.ptr(0); -- const float *b_ptr=b.ptr(0); -- for(int i = 0; i < a.cols; i ++) -- sqd += (a_ptr[i ] - b_ptr[i ])*(a_ptr[i ] - b_ptr[i ]); -- return sqd; -- } --} -- -- -- -- --// -------------------------------------------------------------------------- -- --std::string DescManip::toString(const cv::Mat &a) --{ -- stringstream ss; -- //introduce a magic value to distinguish from DBOw2 -- ss<<"dbw3 "; -- //save size and type -- -- -- ss <(); -- for(int i = 0; i < a.cols; ++i, ++p) -- ss << (int)*p << " "; -- }else{ -- -- const float *p = a.ptr(); -- for(int i = 0; i < a.cols; ++i, ++p) -- ss << *p << " "; -- -- } -- -- return ss.str(); --} -- --// -------------------------------------------------------------------------- -- --void DescManip::fromString(cv::Mat &a, const std::string &s) --{ -- -- //check if the dbow3 is present -- string ss_aux;ss_aux.reserve(10); -- for(size_t i=0;i<10 && i data;data.reserve(100); -- while( ss>>val) data.push_back(val); -- //copy to a -- a.create(1,data.size(),CV_8UC1); -- memcpy(a.ptr(0),&data[0],data.size()); -- } -- else { -- char szSign[10]; -- int type,cols; -- stringstream ss(s); -- ss >> szSign >> type >> cols; -- a.create(1, cols, type); -- if(type==CV_8UC1){ -- unsigned char *p = a.ptr(); -- int n; -- for(int i = 0; i < a.cols; ++i, ++p) -- if ( ss >> n) *p = (unsigned char)n; -- } -- else{ -- float *p = a.ptr(); -- for(int i = 0; i < a.cols; ++i, ++p) -- if ( !(ss >> *p))cerr<<"Error reading. Unexpected EOF. DescManip::fromString"< &descriptors, -- cv::Mat &mat) --{ -- if(descriptors.empty()) -- { -- mat.release(); -- return; -- } -- -- if(descriptors[0].type()==CV_8UC1){ -- -- const size_t N = descriptors.size(); -- int L=getDescSizeBytes(descriptors[0]); -- mat.create(N, L*8, CV_32F); -- float *p = mat.ptr(); -- -- for(size_t i = 0; i < N; ++i) -- { -- const int C = descriptors[i].cols; -- const unsigned char *desc = descriptors[i].ptr(); -- -- for(int j = 0; j < C; ++j, p += 8) -- { -- p[0] = (desc[j] & (1 << 7) ? 1 : 0); -- p[1] = (desc[j] & (1 << 6) ? 1 : 0); -- p[2] = (desc[j] & (1 << 5) ? 1 : 0); -- p[3] = (desc[j] & (1 << 4) ? 1 : 0); -- p[4] = (desc[j] & (1 << 3) ? 1 : 0); -- p[5] = (desc[j] & (1 << 2) ? 1 : 0); -- p[6] = (desc[j] & (1 << 1) ? 1 : 0); -- p[7] = desc[j] & (1); -- } -- } -- } -- else{ -- assert(descriptors[0].type()==CV_32F); -- const int N = descriptors.size(); -- int L=descriptors[0].cols; -- mat.create(N, L, CV_32F); -- for(int i = 0; i < N; ++i) -- memcpy(mat.ptr(i),descriptors[i].ptr(0),sizeof(float)*L); -- } --} -- --void DescManip::toStream(const cv::Mat &m,std::ostream &str){ -- assert(m.rows==1 || m.isContinuous()); -- int type=m.type(); -- int cols=m.cols; -- int rows=m.rows; -- str.write((char*)&cols,sizeof(cols)); -- str.write((char*)&rows,sizeof(rows)); -- str.write((char*)&type,sizeof(type)); -- str.write((char*)m.ptr(0),m.elemSize()*m.cols); --} -- --void DescManip::fromStream(cv::Mat &m,std::istream &str){ -- int type,cols,rows; -- str.read((char*)&cols,sizeof(cols)); -- str.read((char*)&rows,sizeof(rows)); -- str.read((char*)&type,sizeof(type)); -- m.create(rows,cols,type); -- str.read((char*)m.ptr(0),m.elemSize()*m.cols); --} -- -- --// -------------------------------------------------------------------------- -- --} // namespace DBoW3 -- +-/** +- * File: DescManip.cpp +- * Date: June 2012 +- * Author: Dorian Galvez-Lopez +- * Description: functions for ORB descriptors +- * License: see the LICENSE.txt file +- * +- */ +- +-#include +-#include +-#include +-#include +-#include +-#include +- +-#include "DescManip.h" +- +-using namespace std; +- +-namespace DBoW3 { +- +-// -------------------------------------------------------------------------- +- +-void DescManip::meanValue(const std::vector &descriptors, +- cv::Mat &mean) +-{ +- +- if(descriptors.empty()) return; +- +- if(descriptors.size() == 1) +- { +- mean = descriptors[0].clone(); +- return; +- } +- //binary descriptor +- if (descriptors[0].type()==CV_8U ){ +- //determine number of bytes of the binary descriptor +- int L= getDescSizeBytes( descriptors[0]); +- vector sum( L * 8, 0); +- +- for(size_t i = 0; i < descriptors.size(); ++i) +- { +- const cv::Mat &d = descriptors[i]; +- const unsigned char *p = d.ptr(); +- +- for(int j = 0; j < d.cols; ++j, ++p) +- { +- if(*p & (1 << 7)) ++sum[ j*8 ]; +- if(*p & (1 << 6)) ++sum[ j*8 + 1 ]; +- if(*p & (1 << 5)) ++sum[ j*8 + 2 ]; +- if(*p & (1 << 4)) ++sum[ j*8 + 3 ]; +- if(*p & (1 << 3)) ++sum[ j*8 + 4 ]; +- if(*p & (1 << 2)) ++sum[ j*8 + 5 ]; +- if(*p & (1 << 1)) ++sum[ j*8 + 6 ]; +- if(*p & (1)) ++sum[ j*8 + 7 ]; +- } +- } +- +- mean = cv::Mat::zeros(1, L, CV_8U); +- unsigned char *p = mean.ptr(); +- +- const int N2 = (int)descriptors.size() / 2 + descriptors.size() % 2; +- for(size_t i = 0; i < sum.size(); ++i) +- { +- if(sum[i] >= N2) +- { +- // set bit +- *p |= 1 << (7 - (i % 8)); +- } +- +- if(i % 8 == 7) ++p; +- } +- } +- //non binary descriptor +- else{ +- assert(descriptors[0].type()==CV_32F );//ensure it is float +- +- mean.create(1, descriptors[0].cols,descriptors[0].type()); +- mean.setTo(cv::Scalar::all(0)); +- float inv_s =1./double( descriptors.size()); +- for(size_t i=0;i(); // a & b are actually CV_8U +- pb = b.ptr(); +- +- uint64_t v, ret = 0; +- for(size_t i = 0; i < a.cols / sizeof(uint64_t); ++i, ++pa, ++pb) +- { +- v = *pa ^ *pb; +- v = v - ((v >> 1) & (uint64_t)~(uint64_t)0/3); +- v = (v & (uint64_t)~(uint64_t)0/15*3) + ((v >> 2) & +- (uint64_t)~(uint64_t)0/15*3); +- v = (v + (v >> 4)) & (uint64_t)~(uint64_t)0/255*15; +- ret += (uint64_t)(v * ((uint64_t)~(uint64_t)0/255)) >> +- (sizeof(uint64_t) - 1) * CHAR_BIT; +- } +- +- return ret; +- } +- else{ +- double sqd = 0.; +- assert(a.type()==CV_32F); +- assert(a.rows==1); +- const float *a_ptr=a.ptr(0); +- const float *b_ptr=b.ptr(0); +- for(int i = 0; i < a.cols; i ++) +- sqd += (a_ptr[i ] - b_ptr[i ])*(a_ptr[i ] - b_ptr[i ]); +- return sqd; +- } +-} +- +- +- +- +-// -------------------------------------------------------------------------- +- +-std::string DescManip::toString(const cv::Mat &a) +-{ +- stringstream ss; +- //introduce a magic value to distinguish from DBOw2 +- ss<<"dbw3 "; +- //save size and type +- +- +- ss <(); +- for(int i = 0; i < a.cols; ++i, ++p) +- ss << (int)*p << " "; +- }else{ +- +- const float *p = a.ptr(); +- for(int i = 0; i < a.cols; ++i, ++p) +- ss << *p << " "; +- +- } +- +- return ss.str(); +-} +- +-// -------------------------------------------------------------------------- +- +-void DescManip::fromString(cv::Mat &a, const std::string &s) +-{ +- +- //check if the dbow3 is present +- string ss_aux;ss_aux.reserve(10); +- for(size_t i=0;i<10 && i data;data.reserve(100); +- while( ss>>val) data.push_back(val); +- //copy to a +- a.create(1,data.size(),CV_8UC1); +- memcpy(a.ptr(0),&data[0],data.size()); +- } +- else { +- char szSign[10]; +- int type,cols; +- stringstream ss(s); +- ss >> szSign >> type >> cols; +- a.create(1, cols, type); +- if(type==CV_8UC1){ +- unsigned char *p = a.ptr(); +- int n; +- for(int i = 0; i < a.cols; ++i, ++p) +- if ( ss >> n) *p = (unsigned char)n; +- } +- else{ +- float *p = a.ptr(); +- for(int i = 0; i < a.cols; ++i, ++p) +- if ( !(ss >> *p))cerr<<"Error reading. Unexpected EOF. DescManip::fromString"< &descriptors, +- cv::Mat &mat) +-{ +- if(descriptors.empty()) +- { +- mat.release(); +- return; +- } +- +- if(descriptors[0].type()==CV_8UC1){ +- +- const size_t N = descriptors.size(); +- int L=getDescSizeBytes(descriptors[0]); +- mat.create(N, L*8, CV_32F); +- float *p = mat.ptr(); +- +- for(size_t i = 0; i < N; ++i) +- { +- const int C = descriptors[i].cols; +- const unsigned char *desc = descriptors[i].ptr(); +- +- for(int j = 0; j < C; ++j, p += 8) +- { +- p[0] = (desc[j] & (1 << 7) ? 1 : 0); +- p[1] = (desc[j] & (1 << 6) ? 1 : 0); +- p[2] = (desc[j] & (1 << 5) ? 1 : 0); +- p[3] = (desc[j] & (1 << 4) ? 1 : 0); +- p[4] = (desc[j] & (1 << 3) ? 1 : 0); +- p[5] = (desc[j] & (1 << 2) ? 1 : 0); +- p[6] = (desc[j] & (1 << 1) ? 1 : 0); +- p[7] = desc[j] & (1); +- } +- } +- } +- else{ +- assert(descriptors[0].type()==CV_32F); +- const int N = descriptors.size(); +- int L=descriptors[0].cols; +- mat.create(N, L, CV_32F); +- for(int i = 0; i < N; ++i) +- memcpy(mat.ptr(i),descriptors[i].ptr(0),sizeof(float)*L); +- } +-} +- +-void DescManip::toStream(const cv::Mat &m,std::ostream &str){ +- assert(m.rows==1 || m.isContinuous()); +- int type=m.type(); +- int cols=m.cols; +- int rows=m.rows; +- str.write((char*)&cols,sizeof(cols)); +- str.write((char*)&rows,sizeof(rows)); +- str.write((char*)&type,sizeof(type)); +- str.write((char*)m.ptr(0),m.elemSize()*m.cols); +-} +- +-void DescManip::fromStream(cv::Mat &m,std::istream &str){ +- int type,cols,rows; +- str.read((char*)&cols,sizeof(cols)); +- str.read((char*)&rows,sizeof(rows)); +- str.read((char*)&type,sizeof(type)); +- m.create(rows,cols,type); +- str.read((char*)m.ptr(0),m.elemSize()*m.cols); +-} +- +- +-// -------------------------------------------------------------------------- +- +-} // namespace DBoW3 +- +/** + * File: DescManip.cpp + * Date: June 2012 @@ -1549,42 +1200,42 @@ index 9d15feb..0000000 --- a/config.cmake.in +++ /dev/null @@ -1,36 +0,0 @@ --# =================================================================================== --# @PROJECT_NAME@ CMake configuration file --# --# ** File generated automatically, do not modify ** --# --# Usage from an external project: --# In your CMakeLists.txt, add these lines: --# --# FIND_PACKAGE(@PROJECT_NAME@ REQUIRED ) --# TARGET_LINK_LIBRARIES(MY_TARGET_NAME ${@PROJECT_NAME@_LIBS}) --# --# This file will define the following variables: --# - @PROJECT_NAME@_LIBS : The list of libraries to links against. --# - @PROJECT_NAME@_LIB_DIR : The directory where lib files are. Calling LINK_DIRECTORIES --# with this path is NOT needed. --# - @PROJECT_NAME@_VERSION : The version of this PROJECT_NAME build. Example: "1.2.0" --# - @PROJECT_NAME@_VERSION_MAJOR : Major version part of VERSION. Example: "1" --# - @PROJECT_NAME@_VERSION_MINOR : Minor version part of VERSION. Example: "2" --# - @PROJECT_NAME@_VERSION_PATCH : Patch version part of VERSION. Example: "0" --# --# =================================================================================== --INCLUDE_DIRECTORIES("@CMAKE_INSTALL_PREFIX@/include") --SET(@PROJECT_NAME@_INCLUDE_DIRS "@CMAKE_INSTALL_PREFIX@/include") -- --LINK_DIRECTORIES("@CMAKE_INSTALL_PREFIX@/@LIB_INSTALL_DIR@") --SET(@PROJECT_NAME@_LIB_DIR "@CMAKE_INSTALL_PREFIX@/@LIB_INSTALL_DIR@") -- --SET(@PROJECT_NAME@_LIBS @REQUIRED_LIBRARIES@ @PROJECT_NAME@@PROJECT_DLLVERSION@) --SET(@PROJECT_NAME@_LIBRARIES @REQUIRED_LIBRARIES@ @PROJECT_NAME@@PROJECT_DLLVERSION@) -- --SET(@PROJECT_NAME@_FOUND YES) --SET(@PROJECT_NAME@_FOUND "YES") --SET(@PROJECT_NAME@_VERSION @PROJECT_VERSION@) --SET(@PROJECT_NAME@_VERSION_MAJOR @PROJECT_VERSION_MAJOR@) --SET(@PROJECT_NAME@_VERSION_MINOR @PROJECT_VERSION_MINOR@) --SET(@PROJECT_NAME@_VERSION_PATCH @PROJECT_VERSION_PATCH@) +-# =================================================================================== +-# @PROJECT_NAME@ CMake configuration file +-# +-# ** File generated automatically, do not modify ** +-# +-# Usage from an external project: +-# In your CMakeLists.txt, add these lines: +-# +-# FIND_PACKAGE(@PROJECT_NAME@ REQUIRED ) +-# TARGET_LINK_LIBRARIES(MY_TARGET_NAME ${@PROJECT_NAME@_LIBS}) +-# +-# This file will define the following variables: +-# - @PROJECT_NAME@_LIBS : The list of libraries to links against. +-# - @PROJECT_NAME@_LIB_DIR : The directory where lib files are. Calling LINK_DIRECTORIES +-# with this path is NOT needed. +-# - @PROJECT_NAME@_VERSION : The version of this PROJECT_NAME build. Example: "1.2.0" +-# - @PROJECT_NAME@_VERSION_MAJOR : Major version part of VERSION. Example: "1" +-# - @PROJECT_NAME@_VERSION_MINOR : Minor version part of VERSION. Example: "2" +-# - @PROJECT_NAME@_VERSION_PATCH : Patch version part of VERSION. Example: "0" +-# +-# =================================================================================== +-INCLUDE_DIRECTORIES("@CMAKE_INSTALL_PREFIX@/include") +-SET(@PROJECT_NAME@_INCLUDE_DIRS "@CMAKE_INSTALL_PREFIX@/include") +- +-LINK_DIRECTORIES("@CMAKE_INSTALL_PREFIX@/@LIB_INSTALL_DIR@") +-SET(@PROJECT_NAME@_LIB_DIR "@CMAKE_INSTALL_PREFIX@/@LIB_INSTALL_DIR@") +- +-SET(@PROJECT_NAME@_LIBS @REQUIRED_LIBRARIES@ @PROJECT_NAME@@PROJECT_DLLVERSION@) +-SET(@PROJECT_NAME@_LIBRARIES @REQUIRED_LIBRARIES@ @PROJECT_NAME@@PROJECT_DLLVERSION@) +- +-SET(@PROJECT_NAME@_FOUND YES) +-SET(@PROJECT_NAME@_FOUND "YES") +-SET(@PROJECT_NAME@_VERSION @PROJECT_VERSION@) +-SET(@PROJECT_NAME@_VERSION_MAJOR @PROJECT_VERSION_MAJOR@) +-SET(@PROJECT_NAME@_VERSION_MINOR @PROJECT_VERSION_MINOR@) +-SET(@PROJECT_NAME@_VERSION_PATCH @PROJECT_VERSION_PATCH@) diff --git a/utils/CMakeLists.txt b/examples/CMakeLists.txt similarity index 100% rename from utils/CMakeLists.txt @@ -1597,132 +1248,132 @@ index 4fd78f6..c48a3c4 100644 --- a/utils/create_voc_step0.cpp +++ b/examples/create_voc_step0.cpp @@ -1,126 +1,126 @@ -- --//First step of creating a vocabulary is extracting features from a set of images. We save them to a file for next step --#include --#include -- --// DBoW3 --#include "DBoW3.h" -- --// OpenCV --#include --#include --#include --#ifdef USE_CONTRIB --#include --#include --#endif --#include "DescManip.h" -- --using namespace DBoW3; --using namespace std; -- -- --//command line parser --class CmdLineParser{int argc; char **argv; public: CmdLineParser(int _argc,char **_argv):argc(_argc),argv(_argv){} bool operator[] ( string param ) {int idx=-1; for ( int i=0; i readImagePaths(int argc,char **argv,int start){ -- vector paths; -- for(int i=start;i loadFeatures( std::vector path_to_images,string descriptor="") throw (std::exception){ -- //select detector -- cv::Ptr fdetector; -- if (descriptor=="orb") fdetector=cv::ORB::create(); -- else if (descriptor=="brisk") fdetector=cv::BRISK::create(); --#ifdef OPENCV_VERSION_3 -- else if (descriptor=="akaze") fdetector=cv::AKAZE::create(); --#endif --#ifdef USE_CONTRIB -- else if(descriptor=="surf" ) fdetector=cv::xfeatures2d::SURF::create(400, 4, 2, EXTENDED_SURF); --#endif -- -- else throw std::runtime_error("Invalid descriptor"); -- assert(!descriptor.empty()); -- vector features; -- -- -- cout << "Extracting features..." << endl; -- for(size_t i = 0; i < path_to_images.size(); ++i) -- { -- vector keypoints; -- cv::Mat descriptors; -- cout<<"reading image: "<detectAndCompute(image, cv::Mat(), keypoints, descriptors); -- features.push_back(descriptors); -- cout<<"done detecting features"< &features){ -- -- //test it is not created -- std::ifstream ifile(filename); -- if (ifile.is_open()){cerr<<"ERROR::: Output File "<(0),f.total()*f.elemSize()); -- } --} -- --// ---------------------------------------------------------------------------- -- --int main(int argc,char **argv) --{ -- -- try{ -- CmdLineParser cml(argc,argv); -- if (cml["-h"] || argc==1){ -- cerr<<"Usage: descriptor_name output image0 image1 ... \n\t descriptors:brisk,surf,orb(default),akaze(only if using opencv 3)"< features= loadFeatures(images,descriptor); -- -- //save features to file -- saveToFile(argv[2],features); -- -- }catch(std::exception &ex){ -- cerr< +-#include +- +-// DBoW3 +-#include "DBoW3.h" +- +-// OpenCV +-#include +-#include +-#include +-#ifdef USE_CONTRIB +-#include +-#include +-#endif +-#include "DescManip.h" +- +-using namespace DBoW3; +-using namespace std; +- +- +-//command line parser +-class CmdLineParser{int argc; char **argv; public: CmdLineParser(int _argc,char **_argv):argc(_argc),argv(_argv){} bool operator[] ( string param ) {int idx=-1; for ( int i=0; i readImagePaths(int argc,char **argv,int start){ +- vector paths; +- for(int i=start;i loadFeatures( std::vector path_to_images,string descriptor="") throw (std::exception){ +- //select detector +- cv::Ptr fdetector; +- if (descriptor=="orb") fdetector=cv::ORB::create(); +- else if (descriptor=="brisk") fdetector=cv::BRISK::create(); +-#ifdef OPENCV_VERSION_3 +- else if (descriptor=="akaze") fdetector=cv::AKAZE::create(); +-#endif +-#ifdef USE_CONTRIB +- else if(descriptor=="surf" ) fdetector=cv::xfeatures2d::SURF::create(400, 4, 2, EXTENDED_SURF); +-#endif +- +- else throw std::runtime_error("Invalid descriptor"); +- assert(!descriptor.empty()); +- vector features; +- +- +- cout << "Extracting features..." << endl; +- for(size_t i = 0; i < path_to_images.size(); ++i) +- { +- vector keypoints; +- cv::Mat descriptors; +- cout<<"reading image: "<detectAndCompute(image, cv::Mat(), keypoints, descriptors); +- features.push_back(descriptors); +- cout<<"done detecting features"< &features){ +- +- //test it is not created +- std::ifstream ifile(filename); +- if (ifile.is_open()){cerr<<"ERROR::: Output File "<(0),f.total()*f.elemSize()); +- } +-} +- +-// ---------------------------------------------------------------------------- +- +-int main(int argc,char **argv) +-{ +- +- try{ +- CmdLineParser cml(argc,argv); +- if (cml["-h"] || argc==1){ +- cerr<<"Usage: descriptor_name output image0 image1 ... \n\t descriptors:brisk,surf,orb(default),akaze(only if using opencv 3)"< features= loadFeatures(images,descriptor); +- +- //save features to file +- saveToFile(argv[2],features); +- +- }catch(std::exception &ex){ +- cerr< @@ -1857,77 +1508,77 @@ index 8d9de7d..1f82c66 100644 --- a/utils/create_voc_step1.cpp +++ b/examples/create_voc_step1.cpp @@ -1,71 +1,71 @@ --//Second step,creates the vocabulary from the set of features. It can be slow --#include --#include -- --// DBoW3 --#include "DBoW3.h" -- --// OpenCV --#include --using namespace DBoW3; --using namespace std; -- --//command line parser --class CmdLineParser{int argc; char **argv; public: CmdLineParser(int _argc,char **_argv):argc(_argc),argv(_argv){} bool operator[] ( string param ) {int idx=-1; for ( int i=0; i readFeaturesFromFile(string filename){ --vector features; -- //test it is not created -- std::ifstream ifile(filename); -- if (!ifile.is_open()){cerr<<"could not open input file"<(0),features[i].total()*features[i].elemSize()); -- } -- return features; --} -- --// ---------------------------------------------------------------------------- -- --int main(int argc,char **argv) --{ -- -- try{ -- CmdLineParser cml(argc,argv); -- if (cml["-h"] || argc!=3){ -- cerr<<"Usage: features output_voc.yml[.gz]"< +-#include +- +-// DBoW3 +-#include "DBoW3.h" +- +-// OpenCV +-#include +-using namespace DBoW3; +-using namespace std; +- +-//command line parser +-class CmdLineParser{int argc; char **argv; public: CmdLineParser(int _argc,char **_argv):argc(_argc),argv(_argv){} bool operator[] ( string param ) {int idx=-1; for ( int i=0; i readFeaturesFromFile(string filename){ +-vector features; +- //test it is not created +- std::ifstream ifile(filename); +- if (!ifile.is_open()){cerr<<"could not open input file"<(0),features[i].total()*features[i].elemSize()); +- } +- return features; +-} +- +-// ---------------------------------------------------------------------------- +- +-int main(int argc,char **argv) +-{ +- +- try{ +- CmdLineParser cml(argc,argv); +- if (cml["-h"] || argc!=3){ +- cerr<<"Usage: features output_voc.yml[.gz]"< +#include @@ -2007,208 +1658,208 @@ index 63db40b..b4bc391 100644 --- a/utils/demo_general.cpp +++ b/examples/demo_general.cpp @@ -1,202 +1,202 @@ --/** -- * Date: 2016 -- * Author: Rafael Muñoz Salinas -- * Description: demo application of DBoW3 -- * License: see the LICENSE.txt file -- */ -- --#include --#include -- --// DBoW3 --#include "DBoW3.h" -- --// OpenCV --#include --#include --#include --#ifdef USE_CONTRIB --#include --#include --#endif --#include "DescManip.h" -- --using namespace DBoW3; --using namespace std; -- -- --//command line parser --class CmdLineParser{int argc; char **argv; public: CmdLineParser(int _argc,char **_argv):argc(_argc),argv(_argv){} bool operator[] ( string param ) {int idx=-1; for ( int i=0; i readImagePaths(int argc,char **argv,int start){ -- vector paths; -- for(int i=start;i loadFeatures( std::vector path_to_images,string descriptor="") throw (std::exception){ -- //select detector -- cv::Ptr fdetector; -- if (descriptor=="orb") fdetector=cv::ORB::create(); -- else if (descriptor=="brisk") fdetector=cv::BRISK::create(); --#ifdef OPENCV_VERSION_3 -- else if (descriptor=="akaze") fdetector=cv::AKAZE::create(); --#endif --#ifdef USE_CONTRIB -- else if(descriptor=="surf" ) fdetector=cv::xfeatures2d::SURF::create(400, 4, 2, EXTENDED_SURF); --#endif -- -- else throw std::runtime_error("Invalid descriptor"); -- assert(!descriptor.empty()); -- vector features; -- -- -- cout << "Extracting features..." << endl; -- for(size_t i = 0; i < path_to_images.size(); ++i) -- { -- vector keypoints; -- cv::Mat descriptors; -- cout<<"reading image: "<detectAndCompute(image, cv::Mat(), keypoints, descriptors); -- features.push_back(descriptors); -- cout<<"done detecting features"< &features) --{ -- // branching factor and depth levels -- const int k = 9; -- const int L = 3; -- const WeightingType weight = TF_IDF; -- const ScoringType score = L1_NORM; -- -- DBoW3::Vocabulary voc(k, L, weight, score); -- -- cout << "Creating a small " << k << "^" << L << " vocabulary..." << endl; -- voc.create(features); -- cout << "... done!" << endl; -- -- cout << "Vocabulary information: " << endl -- << voc << endl << endl; -- -- // lets do something with this vocabulary -- cout << "Matching images against themselves (0 low, 1 high): " << endl; -- BowVector v1, v2; -- for(size_t i = 0; i < features.size(); i++) -- { -- voc.transform(features[i], v1); -- for(size_t j = 0; j < features.size(); j++) -- { -- voc.transform(features[j], v2); -- -- double score = voc.score(v1, v2); -- cout << "Image " << i << " vs Image " << j << ": " << score << endl; -- } -- } -- -- // save the vocabulary to disk -- cout << endl << "Saving vocabulary..." << endl; -- voc.save("small_voc.yml.gz"); -- cout << "Done" << endl; --} -- --////// ---------------------------------------------------------------------------- -- --void testDatabase(const vector &features) --{ -- cout << "Creating a small database..." << endl; -- -- // load the vocabulary from disk -- Vocabulary voc("small_voc.yml.gz"); -- -- Database db(voc, false, 0); // false = do not use direct index -- // (so ignore the last param) -- // The direct index is useful if we want to retrieve the features that -- // belong to some vocabulary node. -- // db creates a copy of the vocabulary, we may get rid of "voc" now -- -- // add images to the database -- for(size_t i = 0; i < features.size(); i++) -- db.add(features[i]); -- -- cout << "... done!" << endl; -- -- cout << "Database information: " << endl << db << endl; -- -- // and query the database -- cout << "Querying the database: " << endl; -- -- QueryResults ret; -- for(size_t i = 0; i < features.size(); i++) -- { -- db.query(features[i], ret, 4); -- -- // ret[0] is always the same image in this case, because we added it to the -- // database. ret[1] is the second best match. -- -- cout << "Searching for Image " << i << ". " << ret << endl; -- } -- -- cout << endl; -- -- // we can save the database. The created file includes the vocabulary -- // and the entries added -- cout << "Saving database..." << endl; -- db.save("small_db.yml.gz"); -- cout << "... done!" << endl; -- -- // once saved, we can load it again -- cout << "Retrieving database once again..." << endl; -- Database db2("small_db.yml.gz"); -- cout << "... done! This is: " << endl << db2 << endl; --} -- -- --// ---------------------------------------------------------------------------- -- --int main(int argc,char **argv) --{ -- -- try{ -- CmdLineParser cml(argc,argv); -- if (cml["-h"] || argc<=2){ -- cerr<<"Usage: descriptor_name image0 image1 ... \n\t descriptors:brisk,surf,orb ,akaze(only if using opencv 3)"< features= loadFeatures(images,descriptor); -- testVocCreation(features); -- -- -- testDatabase(features); -- -- }catch(std::exception &ex){ -- cerr< +-#include +- +-// DBoW3 +-#include "DBoW3.h" +- +-// OpenCV +-#include +-#include +-#include +-#ifdef USE_CONTRIB +-#include +-#include +-#endif +-#include "DescManip.h" +- +-using namespace DBoW3; +-using namespace std; +- +- +-//command line parser +-class CmdLineParser{int argc; char **argv; public: CmdLineParser(int _argc,char **_argv):argc(_argc),argv(_argv){} bool operator[] ( string param ) {int idx=-1; for ( int i=0; i readImagePaths(int argc,char **argv,int start){ +- vector paths; +- for(int i=start;i loadFeatures( std::vector path_to_images,string descriptor="") throw (std::exception){ +- //select detector +- cv::Ptr fdetector; +- if (descriptor=="orb") fdetector=cv::ORB::create(); +- else if (descriptor=="brisk") fdetector=cv::BRISK::create(); +-#ifdef OPENCV_VERSION_3 +- else if (descriptor=="akaze") fdetector=cv::AKAZE::create(); +-#endif +-#ifdef USE_CONTRIB +- else if(descriptor=="surf" ) fdetector=cv::xfeatures2d::SURF::create(400, 4, 2, EXTENDED_SURF); +-#endif +- +- else throw std::runtime_error("Invalid descriptor"); +- assert(!descriptor.empty()); +- vector features; +- +- +- cout << "Extracting features..." << endl; +- for(size_t i = 0; i < path_to_images.size(); ++i) +- { +- vector keypoints; +- cv::Mat descriptors; +- cout<<"reading image: "<detectAndCompute(image, cv::Mat(), keypoints, descriptors); +- features.push_back(descriptors); +- cout<<"done detecting features"< &features) +-{ +- // branching factor and depth levels +- const int k = 9; +- const int L = 3; +- const WeightingType weight = TF_IDF; +- const ScoringType score = L1_NORM; +- +- DBoW3::Vocabulary voc(k, L, weight, score); +- +- cout << "Creating a small " << k << "^" << L << " vocabulary..." << endl; +- voc.create(features); +- cout << "... done!" << endl; +- +- cout << "Vocabulary information: " << endl +- << voc << endl << endl; +- +- // lets do something with this vocabulary +- cout << "Matching images against themselves (0 low, 1 high): " << endl; +- BowVector v1, v2; +- for(size_t i = 0; i < features.size(); i++) +- { +- voc.transform(features[i], v1); +- for(size_t j = 0; j < features.size(); j++) +- { +- voc.transform(features[j], v2); +- +- double score = voc.score(v1, v2); +- cout << "Image " << i << " vs Image " << j << ": " << score << endl; +- } +- } +- +- // save the vocabulary to disk +- cout << endl << "Saving vocabulary..." << endl; +- voc.save("small_voc.yml.gz"); +- cout << "Done" << endl; +-} +- +-////// ---------------------------------------------------------------------------- +- +-void testDatabase(const vector &features) +-{ +- cout << "Creating a small database..." << endl; +- +- // load the vocabulary from disk +- Vocabulary voc("small_voc.yml.gz"); +- +- Database db(voc, false, 0); // false = do not use direct index +- // (so ignore the last param) +- // The direct index is useful if we want to retrieve the features that +- // belong to some vocabulary node. +- // db creates a copy of the vocabulary, we may get rid of "voc" now +- +- // add images to the database +- for(size_t i = 0; i < features.size(); i++) +- db.add(features[i]); +- +- cout << "... done!" << endl; +- +- cout << "Database information: " << endl << db << endl; +- +- // and query the database +- cout << "Querying the database: " << endl; +- +- QueryResults ret; +- for(size_t i = 0; i < features.size(); i++) +- { +- db.query(features[i], ret, 4); +- +- // ret[0] is always the same image in this case, because we added it to the +- // database. ret[1] is the second best match. +- +- cout << "Searching for Image " << i << ". " << ret << endl; +- } +- +- cout << endl; +- +- // we can save the database. The created file includes the vocabulary +- // and the entries added +- cout << "Saving database..." << endl; +- db.save("small_db.yml.gz"); +- cout << "... done!" << endl; +- +- // once saved, we can load it again +- cout << "Retrieving database once again..." << endl; +- Database db2("small_db.yml.gz"); +- cout << "... done! This is: " << endl << db2 << endl; +-} +- +- +-// ---------------------------------------------------------------------------- +- +-int main(int argc,char **argv) +-{ +- +- try{ +- CmdLineParser cml(argc,argv); +- if (cml["-h"] || argc<=2){ +- cerr<<"Usage: descriptor_name image0 image1 ... \n\t descriptors:brisk,surf,orb ,akaze(only if using opencv 3)"< features= loadFeatures(images,descriptor); +- testVocCreation(features); +- +- +- testDatabase(features); +- +- }catch(std::exception &ex){ +- cerr<= 3 || (CERES_VERSION_MAJOR >= 2 && CERES_VERSION_MINOR >= 1) +- problem.SetParameterization(current_camera_R_t, ++ problem.SetManifold(current_camera_R_t, + constant_translation_manifold); + #else + problem.SetParameterization(current_camera_R_t, diff --git a/ports/opencv3/0016-fix-freetype-contrib.patch b/ports/opencv3/0016-fix-freetype-contrib.patch new file mode 100644 index 0000000000..930a1d65a3 --- /dev/null +++ b/ports/opencv3/0016-fix-freetype-contrib.patch @@ -0,0 +1,15 @@ +--- a/modules/freetype/CMakeLists.txt ++++ b/modules/freetype/CMakeLists.txt +@@ -3,8 +5,10 @@ if(APPLE_FRAMEWORK) + ocv_module_disable(freetype) + endif() + +-ocv_check_modules(FREETYPE freetype2) +-ocv_check_modules(HARFBUZZ harfbuzz) ++if(WITH_FREETYPE) ++find_package(freetype CONFIG REQUIRED) ++find_package(harfbuzz CONFIG REQUIRED) ++endif() + + if(OPENCV_INITIAL_PASS) + if(NOT FREETYPE_FOUND) diff --git a/ports/opencv3/portfile.cmake b/ports/opencv3/portfile.cmake index 1cf7c930cb..2567a072bf 100644 --- a/ports/opencv3/portfile.cmake +++ b/ports/opencv3/portfile.cmake @@ -1,11 +1,3 @@ -if (EXISTS "${CURRENT_INSTALLED_DIR}/share/opencv2") - message(FATAL_ERROR "OpenCV 2 is installed, please uninstall and try again:\n vcpkg remove opencv2") -endif() - -if (EXISTS "${CURRENT_INSTALLED_DIR}/share/opencv4") - message(FATAL_ERROR "OpenCV 4 is installed, please uninstall and try again:\n vcpkg remove opencv4") -endif() - file(READ "${CMAKE_CURRENT_LIST_DIR}/vcpkg.json" _contents) string(JSON OPENCV_VERSION GET "${_contents}" version) @@ -15,7 +7,7 @@ vcpkg_from_github( OUT_SOURCE_PATH SOURCE_PATH REPO opencv/opencv REF ${OPENCV_VERSION} - SHA512 2fa9243625309a1c12c916737c94f0e2f9566f0828469b148cc1683dd1b8db8d1d58f90a36cfcaa72052964a718929451f04cda5361d8b546a63da69217d040a + SHA512 96bbeb9525325f17ba635a0b75126aae0a7b0daef211af45057a97abd5d31a57fc50f0e889a6dab614df9b7621a145e06c0d240f0a218f33df1217d9a19c510d HEAD_REF master PATCHES 0001-disable-downloading.patch @@ -54,6 +46,7 @@ vcpkg_check_features(OUT_FEATURE_OPTIONS FEATURE_OPTIONS "eigen" WITH_EIGEN "ffmpeg" WITH_FFMPEG "flann" BUILD_opencv_flann + "freetype" WITH_FREETYPE "gdcm" WITH_GDCM "gstreamer" WITH_GSTREAMER "halide" WITH_HALIDE @@ -73,7 +66,7 @@ vcpkg_check_features(OUT_FEATURE_OPTIONS FEATURE_OPTIONS "dc1394" WITH_1394 ) -# Cannot use vcpkg_check_features() for "dnn", "gtk", "ipp", ovis", "python", "qt", "tbb" +# Cannot use vcpkg_check_features() for "dnn", "gtk", ipp", "openmp", "ovis", "python", "qt", "tbb" set(BUILD_opencv_dnn OFF) if("dnn" IN_LIST FEATURES) if(NOT VCPKG_TARGET_IS_ANDROID) @@ -102,6 +95,15 @@ if("ipp" IN_LIST FEATURES) set(WITH_IPP ON) endif() +set(WITH_OPENMP OFF) +if("openmp" IN_LIST FEATURES) + if(NOT VCPKG_TARGET_IS_OSX) + set(WITH_OPENMP ON) + else() + message(WARNING "The OpenMP feature is not supported on macOS") + endif() +endif() + set(BUILD_opencv_ovis OFF) if("ovis" IN_LIST FEATURES) set(BUILD_opencv_ovis ON) @@ -113,10 +115,16 @@ if("tbb" IN_LIST FEATURES) endif() set(WITH_PYTHON OFF) +set(BUILD_opencv_python3 OFF) if("python" IN_LIST FEATURES) - x_vcpkg_get_python_packages(PYTHON_VERSION "3" PACKAGES numpy OUT_PYTHON_VAR "PYTHON3") - set(ENV{PYTHON} "${PYTHON3}") - set(WITH_PYTHON ON) + if (VCPKG_LIBRARY_LINKAGE STREQUAL static AND VCPKG_TARGET_IS_WINDOWS) + message(WARNING "The python module is currently unsupported on Windows when building static OpenCV libraries") + else() + x_vcpkg_get_python_packages(PYTHON_VERSION "3" PACKAGES numpy OUT_PYTHON_VAR "PYTHON3") + set(ENV{PYTHON} "${PYTHON3}") + set(BUILD_opencv_python3 ON) + set(WITH_PYTHON ON) + endif() endif() if("dnn" IN_LIST FEATURES) @@ -140,13 +148,15 @@ if("contrib" IN_LIST FEATURES) endif() vcpkg_from_github( - OUT_SOURCE_PATH CONTRIB_SOURCE_PATH - REPO opencv/opencv_contrib - REF ${OPENCV_VERSION} - SHA512 31bd55617d3a54fa020d4255e463c90caf41e10136c82a05c24ee19890f0cdc4fc049136874841dc84037dedb0562471ea0345ab1dcd5ad8a5b0218f24ae9a35 - HEAD_REF master - PATCHES - 0007-fix-hdf5.patch + OUT_SOURCE_PATH CONTRIB_SOURCE_PATH + REPO opencv/opencv_contrib + REF ${OPENCV_VERSION} + SHA512 a051497e61ae55f86c224044487fc2247a3bba1aa27031c4997c981ddf8402edf82f1dd0d307f562c638bc021cfd8bd42a723973f00ab25131495f84d33c5383 + HEAD_REF master + PATCHES + 0007-fix-hdf5.patch + 0013-fix-ceres.patch + 0016-fix-freetype-contrib.patch ) set(BUILD_WITH_CONTRIB_FLAG "-DOPENCV_EXTRA_MODULES_PATH=${CONTRIB_SOURCE_PATH}/modules") @@ -244,7 +254,7 @@ if(WITH_IPP) endif() set(WITH_MSMF ON) -if(NOT VCPKG_TARGET_IS_WINDOWS OR VCPKG_TARGET_IS_UWP) +if(NOT VCPKG_TARGET_IS_WINDOWS OR VCPKG_TARGET_IS_UWP OR VCPKG_TARGET_IS_MINGW) set(WITH_MSMF OFF) endif() @@ -267,6 +277,16 @@ if("ffmpeg" IN_LIST FEATURES) endif() endif() +if("halide" IN_LIST FEATURES) + list(APPEND ADDITIONAL_BUILD_FLAGS + # Halide 13 requires C++17 + "-DCMAKE_CXX_STANDARD=17" + "-DCMAKE_CXX_STANDARD_REQUIRED=ON" + "-DCMAKE_DISABLE_FIND_PACKAGE_Halide=ON" + "-DHALIDE_ROOT_DIR=${CURRENT_INSTALLED_DIR}" + ) +endif() + if("qt" IN_LIST FEATURES) list(APPEND ADDITIONAL_BUILD_FLAGS "-DCMAKE_AUTOMOC=ON") endif() @@ -290,19 +310,20 @@ vcpkg_cmake_configure( -DX86=${TARGET_IS_X86} -DARM=${TARGET_IS_ARM} ###### ocv_options + -DINSTALL_TO_MANGLED_PATHS=OFF -DOpenCV_INSTALL_BINARIES_PREFIX= -DOPENCV_BIN_INSTALL_PATH=bin - -DOPENCV_INCLUDE_INSTALL_PATH=include + -DOPENCV_INCLUDE_INSTALL_PATH=include/opencv3 -DOPENCV_LIB_INSTALL_PATH=lib - -DOPENCV_3P_LIB_INSTALL_PATH=lib - -DOPENCV_CONFIG_INSTALL_PATH=share/opencv - -DINSTALL_TO_MANGLED_PATHS=OFF + -DOPENCV_3P_LIB_INSTALL_PATH=lib/manual-link/opencv3_thirdparty + -DOPENCV_CONFIG_INSTALL_PATH=share/opencv3 -DOPENCV_FFMPEG_USE_FIND_PACKAGE=FFMPEG -DOPENCV_FFMPEG_SKIP_BUILD_CHECK=TRUE -DCMAKE_DEBUG_POSTFIX=d - -DOPENCV_DLLVERSION= + -DOPENCV_DLLVERSION=3 -DOPENCV_DEBUG_POSTFIX=d -DOPENCV_GENERATE_SETUPVARS=OFF + -DOPENCV_GENERATE_PKGCONFIG=ON # Do not build docs/examples -DBUILD_DOCS=OFF -DBUILD_EXAMPLES=OFF @@ -321,6 +342,8 @@ vcpkg_cmake_configure( -DBUILD_PROTOBUF=OFF ###### OpenCV Build components -DBUILD_opencv_apps=OFF + -DBUILD_opencv_java=OFF + -DBUILD_opencv_js=OFF -DBUILD_opencv_bgsegm=${BUILD_opencv_bgsegm} -DBUILD_opencv_line_descriptor=${BUILD_opencv_line_descriptor} -DBUILD_opencv_saliency=${BUILD_opencv_saliency} @@ -351,14 +374,12 @@ vcpkg_cmake_configure( ###### customized properties ## Options from vcpkg_check_features() ${FEATURE_OPTIONS} - -DCMAKE_DISABLE_FIND_PACKAGE_Halide=ON - -DHALIDE_ROOT_DIR=${CURRENT_INSTALLED_DIR} -DWITH_GTK=${WITH_GTK} -DWITH_QT=${WITH_QT} -DWITH_IPP=${WITH_IPP} -DWITH_MATLAB=OFF -DWITH_MSMF=${WITH_MSMF} - -DWITH_OPENMP=OFF + -DWITH_OPENMP=${WITH_OPENMP} -DWITH_PROTOBUF=${BUILD_opencv_flann} -DWITH_PYTHON=${WITH_PYTHON} -DWITH_OPENCLAMDBLAS=OFF @@ -368,6 +389,7 @@ vcpkg_cmake_configure( ###### BUILD_options (mainly modules which require additional libraries) -DBUILD_opencv_ovis=${BUILD_opencv_ovis} -DBUILD_opencv_dnn=${BUILD_opencv_dnn} + -DBUILD_opencv_python3=${BUILD_opencv_python3} ###### The following modules are disabled for UWP -DBUILD_opencv_quality=${BUILD_opencv_quality} ###### Additional build flags @@ -375,19 +397,19 @@ vcpkg_cmake_configure( ) vcpkg_cmake_install() -vcpkg_cmake_config_fixup(PACKAGE_NAME opencv CONFIG_PATH "share/opencv") +vcpkg_cmake_config_fixup() vcpkg_copy_pdbs() -if (NOT VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL "debug") +if (NOT VCPKG_BUILD_TYPE) # Update debug paths for libs in Android builds (e.g. sdk/native/staticlibs/armeabi-v7a) - vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/share/opencv/OpenCVModules-debug.cmake" + vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/share/opencv3/OpenCVModules-debug.cmake" "\${_IMPORT_PREFIX}/sdk" "\${_IMPORT_PREFIX}/debug/sdk" ) endif() if(VCPKG_LIBRARY_LINKAGE STREQUAL "static") - file(READ "${CURRENT_PACKAGES_DIR}/share/opencv/OpenCVModules.cmake" OPENCV_MODULES) + file(READ "${CURRENT_PACKAGES_DIR}/share/opencv3/OpenCVModules.cmake" OPENCV_MODULES) set(DEPS_STRING "include(CMakeFindDependencyMacro) if(${BUILD_opencv_flann}) find_dependency(Protobuf CONFIG REQUIRED) @@ -441,7 +463,7 @@ find_dependency(Tesseract)") string(APPEND DEPS_STRING "\nfind_dependency(OpenMP)") endif() if(BUILD_opencv_ovis) - string(APPEND DEPS_STRING "\nfind_dependency(Ogre)\nfind_dependency(Freetype)") + string(APPEND DEPS_STRING "\nfind_dependency(Ogre)\nfind_dependency(freetype)") endif() if("quirc" IN_LIST FEATURES) string(APPEND DEPS_STRING "\nfind_dependency(quirc)") @@ -479,7 +501,7 @@ find_dependency(Qt${USE_QT_VERSION} COMPONENTS OpenGL)") "OgreGLSupport" OPENCV_MODULES "${OPENCV_MODULES}") endif() - file(WRITE "${CURRENT_PACKAGES_DIR}/share/opencv/OpenCVModules.cmake" "${OPENCV_MODULES}") + file(WRITE "${CURRENT_PACKAGES_DIR}/share/opencv3/OpenCVModules.cmake" "${OPENCV_MODULES}") file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/bin" "${CURRENT_PACKAGES_DIR}/debug/bin") @@ -489,6 +511,8 @@ file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/share") file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/include") file(REMOVE "${CURRENT_PACKAGES_DIR}/LICENSE") file(REMOVE "${CURRENT_PACKAGES_DIR}/debug/LICENSE") +file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/share/opencv/licenses") +file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/share/opencv") if(VCPKG_TARGET_IS_ANDROID) file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/README.android") @@ -497,4 +521,6 @@ endif() vcpkg_fixup_pkgconfig() +configure_file("${CURRENT_PORT_DIR}/usage.in" "${CURRENT_PACKAGES_DIR}/share/${PORT}/usage") + file(INSTALL "${SOURCE_PATH}/LICENSE" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}" RENAME copyright) diff --git a/ports/opencv3/usage.in b/ports/opencv3/usage.in new file mode 100644 index 0000000000..1bec7f3049 --- /dev/null +++ b/ports/opencv3/usage.in @@ -0,0 +1,4 @@ +The package ${PORT} is compatible with CMake if you set the OpenCV_DIR *before* the find_package call + + set(OpenCV_DIR "${CURRENT_INSTALLED_DIR}/share/${PORT}") + find_package(OpenCV REQUIRED) diff --git a/ports/opencv3/vcpkg.json b/ports/opencv3/vcpkg.json index ee4b942744..a237deb535 100644 --- a/ports/opencv3/vcpkg.json +++ b/ports/opencv3/vcpkg.json @@ -1,7 +1,6 @@ { "name": "opencv3", - "version": "3.4.16", - "port-version": 9, + "version": "3.4.18", "description": "Open Source Computer Vision Library", "homepage": "https://github.com/opencv/opencv", "license": "BSD-3-Clause", @@ -50,6 +49,7 @@ "cudnn", { "name": "opencv3", + "default-features": false, "features": [ "contrib" ] @@ -125,6 +125,13 @@ "protobuf" ] }, + "freetype": { + "description": "Freetype support for opencv", + "dependencies": [ + "freetype", + "harfbuzz" + ] + }, "gdcm": { "description": "GDCM support for opencv", "dependencies": [ @@ -196,12 +203,16 @@ "opengl" ] }, + "openmp": { + "description": "Enable openmp support for opencv" + }, "ovis": { "description": "opencv_ovis module", "dependencies": [ "ogre", { "name": "opencv3", + "default-features": false, "features": [ "contrib" ] @@ -215,7 +226,10 @@ ] }, "python": { - "description": "Python wrapper support for opencv" + "description": "Python wrapper support for opencv", + "dependencies": [ + "python3" + ] }, "qt": { "description": "Qt GUI support for opencv", @@ -236,14 +250,21 @@ "description": "opencv_sfm module", "dependencies": [ "ceres", - "eigen3", "gflags", "glog", { "name": "opencv3", + "default-features": false, "features": [ "contrib" ] + }, + { + "name": "opencv3", + "default-features": false, + "features": [ + "eigen" + ] } ] }, @@ -262,6 +283,12 @@ "vtk": { "description": "vtk support for opencv", "dependencies": [ + { + "name": "opencv3", + "features": [ + "contrib" + ] + }, "vtk" ] }, diff --git a/ports/opencv4/0005-fix-eigen.patch b/ports/opencv4/0004-fix-eigen.patch similarity index 100% rename from ports/opencv4/0005-fix-eigen.patch rename to ports/opencv4/0004-fix-eigen.patch diff --git a/ports/opencv4/0004-fix-policy-CMP0057.patch b/ports/opencv4/0005-fix-policy-CMP0057.patch similarity index 100% rename from ports/opencv4/0004-fix-policy-CMP0057.patch rename to ports/opencv4/0005-fix-policy-CMP0057.patch diff --git a/ports/opencv4/0008-devendor-quirc.patch b/ports/opencv4/0008-devendor-quirc.patch index 504e42bc55..4333eb0f6b 100644 --- a/ports/opencv4/0008-devendor-quirc.patch +++ b/ports/opencv4/0008-devendor-quirc.patch @@ -11,8 +11,8 @@ --- a/modules/objdetect/CMakeLists.txt +++ b/modules/objdetect/CMakeLists.txt -@@ -2,7 +2,5 @@ set(the_description "Object Detection") - ocv_define_module(objdetect opencv_core opencv_imgproc opencv_calib3d opencv_dnn WRAP java objc python js) +@@ -2,7 +2,5 @@ js + ) if(HAVE_QUIRC) - get_property(QUIRC_INCLUDE GLOBAL PROPERTY QUIRC_INCLUDE_DIR) diff --git a/ports/opencv4/0012-fix-zlib.patch b/ports/opencv4/0012-fix-zlib.patch index 9c38fd8925..b82b9b00eb 100644 --- a/ports/opencv4/0012-fix-zlib.patch +++ b/ports/opencv4/0012-fix-zlib.patch @@ -1,5 +1,3 @@ -diff --git a/cmake/OpenCVFindLibsGrfmt.cmake b/cmake/OpenCVFindLibsGrfmt.cmake -index 8ea5497..7ed3f6b 100644 --- a/cmake/OpenCVFindLibsGrfmt.cmake +++ b/cmake/OpenCVFindLibsGrfmt.cmake @@ -5,6 +5,9 @@ diff --git a/ports/opencv4/0013-fix-ceres.patch b/ports/opencv4/0013-fix-ceres.patch new file mode 100644 index 0000000000..c8acb16101 --- /dev/null +++ b/ports/opencv4/0013-fix-ceres.patch @@ -0,0 +1,11 @@ +--- a/modules/sfm/src/libmv_light/libmv/simple_pipeline/bundle.cc ++++ b/modules/sfm/src/libmv_light/libmv/simple_pipeline/bundle.cc +@@ -549,7 +549,7 @@ void EuclideanBundleCommonIntrinsics( + + if (bundle_constraints & BUNDLE_NO_TRANSLATION) { + #if CERES_VERSION_MAJOR >= 3 || (CERES_VERSION_MAJOR >= 2 && CERES_VERSION_MINOR >= 1) +- problem.SetParameterization(current_camera_R_t, ++ problem.SetManifold(current_camera_R_t, + constant_translation_manifold); + #else + problem.SetParameterization(current_camera_R_t, diff --git a/ports/opencv4/0013-fix-opengl.patch b/ports/opencv4/0013-fix-opengl.patch deleted file mode 100644 index 8cd38c9bb6..0000000000 --- a/ports/opencv4/0013-fix-opengl.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- a/modules/highgui/CMakeLists.txt -+++ b/modules/highgui/CMakeLists.txt -@@ -271,7 +271,7 @@ if(APPLE) - add_apple_compiler_options(${the_module}) - endif() - --if(OPENCV_HIGHGUI_BUILTIN_BACKEND STREQUAL "WIN32UI" AND HAVE_OPENGL AND OPENGL_LIBRARIES) -+if(HAVE_OPENGL AND OPENGL_LIBRARIES) - ocv_target_link_libraries(${the_module} PRIVATE "${OPENGL_LIBRARIES}") - endif() - diff --git a/ports/opencv4/0014-fix-gstreamer.patch b/ports/opencv4/0014-fix-gstreamer.patch deleted file mode 100644 index d75c5ec2ec..0000000000 --- a/ports/opencv4/0014-fix-gstreamer.patch +++ /dev/null @@ -1,29 +0,0 @@ ---- a/modules/videoio/cmake/detect_gstreamer.cmake -+++ b/modules/videoio/cmake/detect_gstreamer.cmake -@@ -44,6 +44,10 @@ if(NOT HAVE_GSTREAMER AND WIN32) - NAMES gstvideo gstvideo-1.0 - PATHS ${env_paths} - PATH_SUFFIXES "lib") -+ find_library(GSTREAMER_audio_LIBRARY -+ NAMES gstvideo gstaudio-1.0 -+ PATHS ${env_paths} -+ PATH_SUFFIXES "lib") - - find_library(GSTREAMER_glib_LIBRARY - NAMES glib-2.0 -@@ -63,6 +67,7 @@ if(NOT HAVE_GSTREAMER AND WIN32) - AND GSTREAMER_pbutils_LIBRARY - AND GSTREAMER_riff_LIBRARY - AND GSTREAMER_video_LIBRARY -+ AND GSTREAMER_audio_LIBRARY - AND GSTREAMER_glib_LIBRARY - AND GSTREAMER_gobject_LIBRARY) - file(STRINGS "${GSTREAMER_gst_INCLUDE_DIR}/gst/gstversion.h" ver_strings REGEX "#define +GST_VERSION_(MAJOR|MINOR|MICRO|NANO).*") -@@ -77,6 +82,7 @@ if(NOT HAVE_GSTREAMER AND WIN32) - ${GSTREAMER_app_LIBRARY} - ${GSTREAMER_riff_LIBRARY} - ${GSTREAMER_video_LIBRARY} -+ ${GSTREAMER_audio_LIBRARY} - ${GSTREAMER_pbutils_LIBRARY} - ${GSTREAMER_glib_LIBRARY} - ${GSTREAMER_gobject_LIBRARY}) diff --git a/ports/opencv4/0014-fix-ogre.patch b/ports/opencv4/0014-fix-ogre.patch new file mode 100644 index 0000000000..8f2da1508a --- /dev/null +++ b/ports/opencv4/0014-fix-ogre.patch @@ -0,0 +1,12 @@ +--- a/modules/ovis/src/ovis.cpp ++++ b/modules/ovis/src/ovis.cpp +@@ -453,7 +453,8 @@ class WindowSceneImpl : public WindowScene + if(tus->getTextureName() != name) + { + RTShader::ShaderGenerator::getSingleton().invalidateMaterial( +- RTShader::ShaderGenerator::DEFAULT_SCHEME_NAME, *bgplane->getMaterial()); ++ RTShader::ShaderGenerator::DEFAULT_SCHEME_NAME, bgplane->getMaterial()->getName(), ++ RESOURCEGROUP_NAME); + + tus->setTextureName(name); + tus->setTextureAddressingMode(TAM_CLAMP); diff --git a/ports/opencv4/0015-fix-freetype.patch b/ports/opencv4/0015-fix-freetype.patch index 62c41f2f4f..93bcfafcf5 100644 --- a/ports/opencv4/0015-fix-freetype.patch +++ b/ports/opencv4/0015-fix-freetype.patch @@ -1,5 +1,3 @@ -diff --git a/modules/gapi/cmake/init.cmake b/modules/gapi/cmake/init.cmake -index 1c46432..43fb8ad 100644 --- a/modules/gapi/cmake/init.cmake +++ b/modules/gapi/cmake/init.cmake @@ -20,10 +20,8 @@ if(NOT TARGET ade) diff --git a/ports/opencv4/0016-fix-freetype-contrib.patch b/ports/opencv4/0016-fix-freetype-contrib.patch index 4d0637fd1b..930a1d65a3 100644 --- a/ports/opencv4/0016-fix-freetype-contrib.patch +++ b/ports/opencv4/0016-fix-freetype-contrib.patch @@ -1,5 +1,3 @@ -diff --git a/modules/freetype/CMakeLists.txt b/modules/freetype/CMakeLists.txt -index 6dd4aaf..e734e97 100644 --- a/modules/freetype/CMakeLists.txt +++ b/modules/freetype/CMakeLists.txt @@ -3,8 +5,10 @@ if(APPLE_FRAMEWORK) diff --git a/ports/opencv4/0017-mingw-strsafe-no-deprecate.patch b/ports/opencv4/0017-mingw-strsafe-no-deprecate.patch new file mode 100644 index 0000000000..6e56fee24c --- /dev/null +++ b/ports/opencv4/0017-mingw-strsafe-no-deprecate.patch @@ -0,0 +1,15 @@ +--- a/modules/videoio/src/cap_dshow.cpp ++++ b/modules/videoio/src/cap_dshow.cpp +@@ -90,8 +90,11 @@ Thanks to: + + #if defined(__clang__) // clang or MSVC clang + #pragma clang diagnostic ignored "-Wnon-virtual-dtor" +-#elif defined(__GNUC__) // MinGW ++#elif defined(__GNUC__) // gcc + #pragma GCC diagnostic ignored "-Wnon-virtual-dtor" ++#endif ++ ++#ifdef __MINGW32__ + #define STRSAFE_NO_DEPRECATE + #endif + diff --git a/ports/opencv4/portfile.cmake b/ports/opencv4/portfile.cmake index be4e0ecb78..310f1aecd2 100644 --- a/ports/opencv4/portfile.cmake +++ b/ports/opencv4/portfile.cmake @@ -1,11 +1,3 @@ -if (EXISTS "${CURRENT_INSTALLED_DIR}/share/opencv2") - message(FATAL_ERROR "OpenCV 2 is installed, please uninstall and try again:\n vcpkg remove opencv2") -endif() - -if (EXISTS "${CURRENT_INSTALLED_DIR}/share/opencv3") - message(FATAL_ERROR "OpenCV 3 is installed, please uninstall and try again:\n vcpkg remove opencv3") -endif() - file(READ "${CMAKE_CURRENT_LIST_DIR}/vcpkg.json" _contents) string(JSON OPENCV_VERSION GET "${_contents}" version) @@ -15,24 +7,23 @@ vcpkg_from_github( OUT_SOURCE_PATH SOURCE_PATH REPO opencv/opencv REF ${OPENCV_VERSION} - SHA512 4d1783fd78425cc43bb2153446dd634cedd366a49592bccc0c538a40aa161fcf67db8f1b6b68f1ce0b4a93504b3f06f65931709277afb1a1ee9fe963094bca02 + SHA512 93d7807794682990b6a1d1de1851986ae3c5d1afe6605f3f8cace03ba5e3390bee2568bc0f335af34d3fc974df64cbce0ce685261ec2abd693d259b97b15bc46 FILE_DISAMBIGUATOR 1 HEAD_REF master PATCHES 0001-disable-downloading.patch 0002-install-options.patch 0003-force-package-requirements.patch - 0004-fix-policy-CMP0057.patch - 0005-fix-eigen.patch + 0004-fix-eigen.patch + 0005-fix-policy-CMP0057.patch 0006-fix-uwp.patch 0008-devendor-quirc.patch 0009-fix-protobuf.patch 0010-fix-uwp-tiff-imgcodecs.patch 0011-remove-python2.patch 0012-fix-zlib.patch - 0013-fix-opengl.patch - 0014-fix-gstreamer.patch 0015-fix-freetype.patch + 0017-mingw-strsafe-no-deprecate.patch ) if(VCPKG_TARGET_ARCHITECTURE STREQUAL "arm64") @@ -80,7 +71,7 @@ vcpkg_check_features(OUT_FEATURE_OPTIONS FEATURE_OPTIONS "dc1394" WITH_1394 ) -# Cannot use vcpkg_check_features() for "dnn", "gtk", ipp", "openmp", "ovis", "python", "qt, "tbb" +# Cannot use vcpkg_check_features() for "dnn", "gtk", ipp", "openmp", "ovis", "python", "qt", "tbb" set(BUILD_opencv_dnn OFF) if("dnn" IN_LIST FEATURES) if(NOT VCPKG_TARGET_IS_ANDROID) @@ -179,10 +170,12 @@ if("contrib" IN_LIST FEATURES) OUT_SOURCE_PATH CONTRIB_SOURCE_PATH REPO opencv/opencv_contrib REF ${OPENCV_VERSION} - SHA512 8469de524e8e6f4c50a74b8cbec5e4cfc48a63a6dfc787609696099eca40dc02b9dc7a347a014d4416fd4efd66955d3af5f4847f44612312a8362f453e6c2e35 + SHA512 2e9cc9632774babf59cd186cd7b7edbd35a816bdda2acb51339c514a33fc6d8c3f1687eb3b0f6827304e3fcb0f9f3e81d47e8ab08239175750ac1240cc99dc5d HEAD_REF master PATCHES 0007-fix-hdf5.patch + 0013-fix-ceres.patch + 0014-fix-ogre.patch 0016-fix-freetype-contrib.patch ) set(BUILD_WITH_CONTRIB_FLAG "-DOPENCV_EXTRA_MODULES_PATH=${CONTRIB_SOURCE_PATH}/modules") @@ -322,7 +315,7 @@ if(WITH_IPP) endif() set(WITH_MSMF ON) -if(NOT VCPKG_TARGET_IS_WINDOWS OR VCPKG_TARGET_IS_UWP) +if(NOT VCPKG_TARGET_IS_WINDOWS OR VCPKG_TARGET_IS_UWP OR VCPKG_TARGET_IS_MINGW) set(WITH_MSMF OFF) endif() @@ -369,17 +362,17 @@ vcpkg_cmake_configure( -DX86=${TARGET_IS_X86} -DARM=${TARGET_IS_ARM} ###### ocv_options + -DINSTALL_TO_MANGLED_PATHS=OFF -DOpenCV_INSTALL_BINARIES_PREFIX= -DOPENCV_BIN_INSTALL_PATH=bin -DOPENCV_INCLUDE_INSTALL_PATH=include -DOPENCV_LIB_INSTALL_PATH=lib - -DOPENCV_3P_LIB_INSTALL_PATH=lib - -DOPENCV_CONFIG_INSTALL_PATH=share/opencv - -DINSTALL_TO_MANGLED_PATHS=OFF + -DOPENCV_3P_LIB_INSTALL_PATH=lib/manual-link/opencv4_thirdparty + -DOPENCV_CONFIG_INSTALL_PATH=share/opencv4 -DOPENCV_FFMPEG_USE_FIND_PACKAGE=FFMPEG -DOPENCV_FFMPEG_SKIP_BUILD_CHECK=TRUE -DCMAKE_DEBUG_POSTFIX=d - -DOPENCV_DLLVERSION= + -DOPENCV_DLLVERSION=4 -DOPENCV_DEBUG_POSTFIX=d -DOPENCV_GENERATE_SETUPVARS=OFF -DOPENCV_GENERATE_PKGCONFIG=ON @@ -436,9 +429,9 @@ vcpkg_cmake_configure( -DWITH_IPP=${WITH_IPP} -DWITH_MATLAB=OFF -DWITH_MSMF=${WITH_MSMF} - -DWITH_PYTHON=${WITH_PYTHON} -DWITH_OPENMP=${WITH_OPENMP} -DWITH_PROTOBUF=${BUILD_opencv_dnn} + -DWITH_PYTHON=${WITH_PYTHON} -DWITH_OPENCLAMDBLAS=OFF -DWITH_TBB=${WITH_TBB} -DWITH_OPENJPEG=OFF @@ -457,19 +450,19 @@ vcpkg_cmake_configure( ) vcpkg_cmake_install() -vcpkg_cmake_config_fixup(PACKAGE_NAME opencv CONFIG_PATH "share/opencv") +vcpkg_cmake_config_fixup() vcpkg_copy_pdbs() -if (NOT VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL "debug") +if (NOT VCPKG_BUILD_TYPE) # Update debug paths for libs in Android builds (e.g. sdk/native/staticlibs/armeabi-v7a) - vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/share/opencv/OpenCVModules-debug.cmake" + vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/share/opencv4/OpenCVModules-debug.cmake" "\${_IMPORT_PREFIX}/sdk" "\${_IMPORT_PREFIX}/debug/sdk" ) endif() if(VCPKG_LIBRARY_LINKAGE STREQUAL "static") - file(READ "${CURRENT_PACKAGES_DIR}/share/opencv/OpenCVModules.cmake" OPENCV_MODULES) + file(READ "${CURRENT_PACKAGES_DIR}/share/opencv4/OpenCVModules.cmake" OPENCV_MODULES) set(DEPS_STRING "include(CMakeFindDependencyMacro) if(${BUILD_opencv_dnn}) find_dependency(Protobuf CONFIG REQUIRED) @@ -561,7 +554,7 @@ find_dependency(Qt${USE_QT_VERSION} COMPONENTS OpenGL)") "OgreGLSupport" OPENCV_MODULES "${OPENCV_MODULES}") endif() - file(WRITE "${CURRENT_PACKAGES_DIR}/share/opencv/OpenCVModules.cmake" "${OPENCV_MODULES}") + file(WRITE "${CURRENT_PACKAGES_DIR}/share/opencv4/OpenCVModules.cmake" "${OPENCV_MODULES}") file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/bin" "${CURRENT_PACKAGES_DIR}/debug/bin") @@ -571,6 +564,8 @@ file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/share") file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/include") file(REMOVE "${CURRENT_PACKAGES_DIR}/LICENSE") file(REMOVE "${CURRENT_PACKAGES_DIR}/debug/LICENSE") +file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/share/opencv4/licenses") +file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/share/opencv") if(VCPKG_TARGET_IS_ANDROID) file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/README.android") @@ -579,4 +574,6 @@ endif() vcpkg_fixup_pkgconfig() +configure_file("${CURRENT_PORT_DIR}/usage.in" "${CURRENT_PACKAGES_DIR}/share/${PORT}/usage") + file(INSTALL "${SOURCE_PATH}/LICENSE" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}" RENAME copyright) diff --git a/ports/opencv4/usage.in b/ports/opencv4/usage.in new file mode 100644 index 0000000000..cb9c47dc75 --- /dev/null +++ b/ports/opencv4/usage.in @@ -0,0 +1,5 @@ +If you do not install the meta-port *opencv*, the package ${PORT} is compatible with CMake +if you set the OpenCV_DIR *before* the find_package call + + set(OpenCV_DIR "${CURRENT_INSTALLED_DIR}/share/${PORT}") + find_package(OpenCV REQUIRED) diff --git a/ports/opencv4/vcpkg.json b/ports/opencv4/vcpkg.json index 90a10987d5..c40b7e4a57 100644 --- a/ports/opencv4/vcpkg.json +++ b/ports/opencv4/vcpkg.json @@ -1,7 +1,6 @@ { "name": "opencv4", - "version": "4.5.5", - "port-version": 7, + "version": "4.6.0", "description": "computer vision library", "homepage": "https://github.com/opencv/opencv", "license": "Apache-2.0", diff --git a/ports/rtabmap/0001-add-bigobj-for-msvc.patch b/ports/rtabmap/0001-add-bigobj-for-msvc.patch index ea6c73b844..cc5786b5fa 100644 --- a/ports/rtabmap/0001-add-bigobj-for-msvc.patch +++ b/ports/rtabmap/0001-add-bigobj-for-msvc.patch @@ -1,14 +1,3 @@ -From 37a2b1fe682bcea48cb944762853bec404c9e937 Mon Sep 17 00:00:00 2001 -From: Amin Yahyaabadi -Date: Sun, 6 Feb 2022 12:29:02 -0800 -Subject: [PATCH] add bigobj for msvc - ---- - CMakeLists.txt | 1 + - 1 file changed, 1 insertion(+) - -diff --git a/CMakeLists.txt b/CMakeLists.txt -index 5cdae617..ed829a46 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -106,6 +106,7 @@ if(MSVC) @@ -19,6 +8,3 @@ index 5cdae617..ed829a46 100644 endif() # [Eclipse] Automatic Discovery of Include directories (Optional, but handy) --- -2.35.1.windows.2 - diff --git a/ports/rtabmap/0002-fix-opencv46.patch b/ports/rtabmap/0002-fix-opencv46.patch new file mode 100644 index 0000000000..37e13dca17 --- /dev/null +++ b/ports/rtabmap/0002-fix-opencv46.patch @@ -0,0 +1,11 @@ +--- a/corelib/src/MarkerDetector.cpp ++++ b/corelib/src/MarkerDetector.cpp +@@ -304,7 +304,7 @@ std::map MarkerDetector::detect(const cv::Mat & image, + std::map::iterator iter = detections.find(ids[i]); + if(iter!=detections.end()) + { +- cv::aruco::drawAxis(*imageWithDetections, model.K(), model.D(), rvecs[i], tvecs[i], iter->second.length() * 0.5f); ++ cv::drawFrameAxes(*imageWithDetections, model.K(), model.D(), rvecs[i], tvecs[i], iter->second.length() * 0.5f); + } + } + } diff --git a/ports/rtabmap/fix-qt.patch b/ports/rtabmap/0003-fix-qt.patch similarity index 65% rename from ports/rtabmap/fix-qt.patch rename to ports/rtabmap/0003-fix-qt.patch index e7baa15dfb..facc1ffe8f 100644 --- a/ports/rtabmap/fix-qt.patch +++ b/ports/rtabmap/0003-fix-qt.patch @@ -1,13 +1,3 @@ -From a9f8c032bb7915c075f0fb32a0bbfa633ca3b388 Mon Sep 17 00:00:00 2001 -Date: Wed, 7 Jul 2021 15:13:43 -0400 -Subject: [PATCH] Fix Qt - ---- - CMakeLists.txt | 4 ++-- - 1 file changed, 2 insertions(+), 2 deletions(-) - -diff --git a/CMakeLists.txt b/CMakeLists.txt -index 5cdae617..fe98199b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -966,13 +966,13 @@ IF(ANDROID) @@ -26,6 +16,3 @@ index 5cdae617..fe98199b 100644 ENDIF() IF(BUILD_TOOLS) --- -2.32.0.windows.1 - diff --git a/ports/rtabmap/portfile.cmake b/ports/rtabmap/portfile.cmake index 1cd6d123fa..24ec6fb336 100644 --- a/ports/rtabmap/portfile.cmake +++ b/ports/rtabmap/portfile.cmake @@ -7,8 +7,9 @@ vcpkg_from_github( SHA512 7787d5f927f53554cec3044221011cbc78b654c504d96af29947266e25058194923c5463aefde73b93dcfb3930eedf731f6af4d0c311d8f2f0d7be2114393e05 HEAD_REF master PATCHES - fix-qt.patch 0001-add-bigobj-for-msvc.patch + 0002-fix-opencv46.patch + 0003-fix-qt.patch ) vcpkg_check_features(OUT_FEATURE_OPTIONS FEATURE_OPTIONS @@ -90,7 +91,7 @@ if("tools" IN_LIST FEATURES) ) endif() -file(REMOVE_RECURSE +file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/include" "${CURRENT_PACKAGES_DIR}/debug/share" ) diff --git a/ports/rtabmap/vcpkg.json b/ports/rtabmap/vcpkg.json index f92769710b..ee33395648 100644 --- a/ports/rtabmap/vcpkg.json +++ b/ports/rtabmap/vcpkg.json @@ -1,12 +1,16 @@ { "name": "rtabmap", "version": "0.20.13", - "port-version": 3, + "port-version": 4, "description": "Real-Time Appearance-Based Mapping", "homepage": "https://introlab.github.io/rtabmap/", + "license": "BSD-3-Clause", "supports": "windows & !static", "dependencies": [ - "opencv", + { + "name": "opencv", + "default-features": false + }, { "name": "pcl", "default-features": false, @@ -24,7 +28,22 @@ }, "zlib" ], + "default-features": [ + "opencv-contrib" + ], "features": { + "opencv-contrib": { + "description": "Use OpenCV with contrib modules", + "dependencies": [ + { + "name": "opencv", + "default-features": false, + "features": [ + "contrib" + ] + } + ] + }, "tools": { "description": "Build tools", "dependencies": [ diff --git a/ports/vcpkg-get-python-packages/vcpkg.json b/ports/vcpkg-get-python-packages/vcpkg.json index 227e4557b1..f2e187d0d3 100644 --- a/ports/vcpkg-get-python-packages/vcpkg.json +++ b/ports/vcpkg-get-python-packages/vcpkg.json @@ -1,7 +1,6 @@ { "name": "vcpkg-get-python-packages", - "version-date": "2022-04-11", - "port-version": 1, + "version-date": "2022-06-30", "documentation": "https://vcpkg.io/en/docs/README.html", "license": "MIT", "supports": "native" diff --git a/ports/vcpkg-get-python-packages/x_vcpkg_get_python_packages.cmake b/ports/vcpkg-get-python-packages/x_vcpkg_get_python_packages.cmake index 189017cd2b..8b0a016462 100644 --- a/ports/vcpkg-get-python-packages/x_vcpkg_get_python_packages.cmake +++ b/ports/vcpkg-get-python-packages/x_vcpkg_get_python_packages.cmake @@ -31,21 +31,32 @@ function(x_vcpkg_get_python_packages) get_filename_component(python_dir "${arg_PYTHON_EXECUTABLE}" DIRECTORY) set(ENV{PYTHONNOUSERSITE} "1") - if("${python_dir}" MATCHES "(${DOWNLOADS}|${CURRENT_HOST_INSTALLED_DIR})" AND CMAKE_HOST_WIN32) # inside vcpkg and windows host. + if("${python_dir}" MATCHES "(${DOWNLOADS}|${CURRENT_HOST_INSTALLED_DIR})" AND CMAKE_HOST_WIN32) # inside vcpkg and windows host. #if(NOT EXISTS "${python_dir}/python310._pth" AND PYTHON_EXECUTABLE MATCHES "python3") # file(COPY "${CURRENT_HOST_INSTALLED_DIR}/share/vcpkg-get-python-packages/python310._pth" DESTINATION "${python_dir}") #endif() if(NOT EXISTS "${python_dir}/easy_install${VCPKG_HOST_EXECUTABLE_SUFFIX}") if(NOT EXISTS "${python_dir}/Scripts/pip${VCPKG_HOST_EXECUTABLE_SUFFIX}") - vcpkg_from_github( - OUT_SOURCE_PATH PYFILE_PATH - REPO pypa/get-pip - REF 38e54e5de07c66e875c11a1ebbdb938854625dd8 #2022-03-07 - SHA512 431a9f66618a2f251db3a8c3311e7fc3af3ff7364ec1d14a99f1b9c237646b6146cef8b9471d83e1086dba2ed448bccc48d99b2bb375e4235d78e76d9970d3e5 - ) - vcpkg_execute_required_process(COMMAND "${arg_PYTHON_EXECUTABLE}" "${PYFILE_PATH}/public/get-pip.py" --no-warn-script-location - WORKING_DIRECTORY "${CURRENT_BUILDTREES_DIR}" - LOGNAME "get-pip-${TARGET_TRIPLET}") + if(arg_PYTHON_VERSION STREQUAL 3) + vcpkg_from_github( + OUT_SOURCE_PATH PYFILE_PATH + REPO pypa/get-pip + REF 38e54e5de07c66e875c11a1ebbdb938854625dd8 #2022-03-07 + SHA512 431a9f66618a2f251db3a8c3311e7fc3af3ff7364ec1d14a99f1b9c237646b6146cef8b9471d83e1086dba2ed448bccc48d99b2bb375e4235d78e76d9970d3e5 + ) + vcpkg_execute_required_process(COMMAND "${arg_PYTHON_EXECUTABLE}" "${PYFILE_PATH}/public/get-pip.py" --no-warn-script-location + WORKING_DIRECTORY "${CURRENT_BUILDTREES_DIR}" + LOGNAME "get-pip-${TARGET_TRIPLET}") + elseif(arg_PYTHON_VERSION STREQUAL 2) + vcpkg_download_distfile(PYFILE + URLS "https://bootstrap.pypa.io/pip/2.7/get-pip.py" + FILENAME "get-pip.py" + SHA512 8c74bdaff57a2dcf2aa69c4c218b7d5f3bf4a470dbda2d7c8d1b53862c84e2a83cd04c3cd20cf80dc0e4076b113a734413e31d6a9853f41e894398e7f88f848e + ) + vcpkg_execute_required_process(COMMAND "${arg_PYTHON_EXECUTABLE}" "${PYFILE}" --no-warn-script-location + WORKING_DIRECTORY "${CURRENT_BUILDTREES_DIR}" + LOGNAME "get-pip-${TARGET_TRIPLET}") + endif() endif() vcpkg_execute_required_process(COMMAND "${python_dir}/Scripts/pip${VCPKG_HOST_EXECUTABLE_SUFFIX}" install virtualenv --no-warn-script-location WORKING_DIRECTORY "${CURRENT_BUILDTREES_DIR}" @@ -58,23 +69,29 @@ function(x_vcpkg_get_python_packages) endif() set(venv_path "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-venv") file(REMOVE_RECURSE "${venv_path}") # Remove old venv - file(MAKE_DIRECTORY "${venv_path}") + file(MAKE_DIRECTORY "${venv_path}") if(CMAKE_HOST_WIN32) - file(MAKE_DIRECTORY "${python_dir}/DLLs") + file(MAKE_DIRECTORY "${python_dir}/DLLs") set(python_sub_path /Scripts) set(python_venv virtualenv) - file(COPY "${python_dir}/python310.zip" DESTINATION "${venv_path}/Scripts") + if(arg_PYTHON_VERSION STREQUAL 3) + file(COPY "${python_dir}/python310.zip" DESTINATION "${venv_path}/Scripts") + endif() set(python_venv_options "--app-data" "${venv_path}/data") else() set(python_sub_path /bin) - set(python_venv venv) + if(arg_PYTHON_VERSION STREQUAL 3) + set(python_venv venv) + elseif(arg_PYTHON_VERSION STREQUAL 2) + set(python_venv virtualenv) + endif() set(python_venv_options --symlinks) endif() set(ENV{PYTHONNOUSERSITE} "1") message(STATUS "Setting up python virtual environmnent...") - vcpkg_execute_required_process(COMMAND "${arg_PYTHON_EXECUTABLE}" -m "${python_venv}" ${python_venv_options} "${venv_path}" - WORKING_DIRECTORY "${CURRENT_BUILDTREES_DIR}" + vcpkg_execute_required_process(COMMAND "${arg_PYTHON_EXECUTABLE}" -m "${python_venv}" ${python_venv_options} "${venv_path}" + WORKING_DIRECTORY "${CURRENT_BUILDTREES_DIR}" LOGNAME "venv-setup-${TARGET_TRIPLET}") vcpkg_add_to_path(PREPEND "${venv_path}${python_sub_path}") set(${arg_OUT_PYTHON_VAR} "${venv_path}${python_sub_path}/python${VCPKG_HOST_EXECUTABLE_SUFFIX}") @@ -83,14 +100,14 @@ function(x_vcpkg_get_python_packages) unset(ENV{PYTHONPATH}) if(DEFINED arg_REQUIREMENTS_FILE) message(STATUS "Installing requirements from: ${arg_REQUIREMENTS_FILE}") - vcpkg_execute_required_process(COMMAND "${${arg_OUT_PYTHON_VAR}}" -m pip install -r ${arg_REQUIREMENTS_FILE} - WORKING_DIRECTORY "${CURRENT_BUILDTREES_DIR}" + vcpkg_execute_required_process(COMMAND "${${arg_OUT_PYTHON_VAR}}" -m pip install -r ${arg_REQUIREMENTS_FILE} + WORKING_DIRECTORY "${CURRENT_BUILDTREES_DIR}" LOGNAME "pip-install-requirements-file-${TARGET_TRIPLET}") endif() if(DEFINED arg_PACKAGES) message(STATUS "Installing python packages: ${arg_PACKAGES}") - vcpkg_execute_required_process(COMMAND "${${arg_OUT_PYTHON_VAR}}" -m pip install ${arg_PACKAGES} - WORKING_DIRECTORY "${CURRENT_BUILDTREES_DIR}" + vcpkg_execute_required_process(COMMAND "${${arg_OUT_PYTHON_VAR}}" -m pip install ${arg_PACKAGES} + WORKING_DIRECTORY "${CURRENT_BUILDTREES_DIR}" LOGNAME "pip-install-packages-${TARGET_TRIPLET}") endif() message(STATUS "Setting up python virtual environmnent...finished.") diff --git a/scripts/ci.baseline.txt b/scripts/ci.baseline.txt index 3d8c57f65e..22569ef9d7 100644 --- a/scripts/ci.baseline.txt +++ b/scripts/ci.baseline.txt @@ -770,24 +770,24 @@ opencl:arm-uwp=fail opencl:x64-uwp=fail opencsg:arm-uwp=fail opencsg:x64-uwp=fail -opencv2:arm64-windows = skip -opencv2:arm-uwp = skip -opencv2:x64-linux = skip -opencv2:x64-osx = skip -opencv2:x64-uwp = skip -opencv2:x64-windows = skip -opencv2:x64-windows-static = skip -opencv2:x64-windows-static-md=skip -opencv2:x86-windows = skip -opencv3:arm64-windows = skip -opencv3:arm-uwp = skip -opencv3:x64-linux = skip -opencv3:x64-osx = skip -opencv3:x64-uwp = skip -opencv3:x64-windows = skip -opencv3:x64-windows-static = skip -opencv3:x64-windows-static-md=skip -opencv3:x86-windows = skip +opencv2:arm64-windows = skip +opencv2:arm-uwp = skip +opencv2:x64-linux = skip +opencv2:x64-osx = skip +opencv2:x64-uwp = skip +opencv2:x64-windows = skip +opencv2:x64-windows-static = skip +opencv2:x64-windows-static-md = skip +opencv2:x86-windows = skip +opencv3:arm64-windows = skip +opencv3:arm-uwp = skip +opencv3:x64-linux = skip +opencv3:x64-osx = skip +opencv3:x64-uwp = skip +opencv3:x64-windows = skip +opencv3:x64-windows-static = skip +opencv3:x64-windows-static-md = skip +opencv3:x86-windows = skip opendnp3:x64-uwp=fail opendnp3:arm-uwp=fail openexr:arm64-windows=fail diff --git a/versions/baseline.json b/versions/baseline.json index a1383c8d19..a7e9670130 100644 --- a/versions/baseline.json +++ b/versions/baseline.json @@ -1310,7 +1310,7 @@ }, "cctag": { "baseline": "1.0.2", - "port-version": 0 + "port-version": 1 }, "cctz": { "baseline": "2.3", @@ -1854,7 +1854,7 @@ }, "dbow3": { "baseline": "1.0.0", - "port-version": 1 + "port-version": 2 }, "dcmtk": { "baseline": "3.6.7", @@ -5189,20 +5189,20 @@ "port-version": 0 }, "opencv": { - "baseline": "4.5.5", - "port-version": 1 + "baseline": "4.6.0", + "port-version": 0 }, "opencv2": { "baseline": "2.4.13.7", - "port-version": 13 + "port-version": 14 }, "opencv3": { - "baseline": "3.4.16", - "port-version": 9 + "baseline": "3.4.18", + "port-version": 0 }, "opencv4": { - "baseline": "4.5.5", - "port-version": 7 + "baseline": "4.6.0", + "port-version": 0 }, "opendnp3": { "baseline": "3.1.1", @@ -6374,7 +6374,7 @@ }, "rtabmap": { "baseline": "0.20.13", - "port-version": 3 + "port-version": 4 }, "rtaudio": { "baseline": "2021-11-16", @@ -7449,8 +7449,8 @@ "port-version": 1 }, "vcpkg-get-python-packages": { - "baseline": "2022-04-11", - "port-version": 1 + "baseline": "2022-06-30", + "port-version": 0 }, "vcpkg-gfortran": { "baseline": "3", diff --git a/versions/c-/cctag.json b/versions/c-/cctag.json index 59c461ac0e..25d459e2b6 100644 --- a/versions/c-/cctag.json +++ b/versions/c-/cctag.json @@ -1,5 +1,10 @@ { "versions": [ + { + "git-tree": "979f28c0cc646b1a4c057ee810772a6b8964b65a", + "version-semver": "1.0.2", + "port-version": 1 + }, { "git-tree": "41cef2a0749658a793585a55c57cb701e0845427", "version-semver": "1.0.2", diff --git a/versions/d-/dbow3.json b/versions/d-/dbow3.json index 12758d201c..9747e1f563 100644 --- a/versions/d-/dbow3.json +++ b/versions/d-/dbow3.json @@ -1,5 +1,10 @@ { "versions": [ + { + "git-tree": "0942151a7555bcac51e84d94474111ca96ff5974", + "version": "1.0.0", + "port-version": 2 + }, { "git-tree": "d0cbeaf64e4827fa69b0c07f21c6d0d689305559", "version-string": "1.0.0", diff --git a/versions/o-/opencv.json b/versions/o-/opencv.json index 80915b47c1..0916046027 100644 --- a/versions/o-/opencv.json +++ b/versions/o-/opencv.json @@ -1,5 +1,10 @@ { "versions": [ + { + "git-tree": "135db832c720c800e2ac222994aa216df7575d17", + "version": "4.6.0", + "port-version": 0 + }, { "git-tree": "1ed18903421ae513e731348b2e5afb13c8c38d24", "version": "4.5.5", diff --git a/versions/o-/opencv2.json b/versions/o-/opencv2.json index 87764af3d7..b052f97f41 100644 --- a/versions/o-/opencv2.json +++ b/versions/o-/opencv2.json @@ -1,5 +1,10 @@ { "versions": [ + { + "git-tree": "5161f9b494cb04f39503980cdca10bdac6e7ee53", + "version": "2.4.13.7", + "port-version": 14 + }, { "git-tree": "5dad4c606f120b7d208ec193036596bd82074e81", "version": "2.4.13.7", diff --git a/versions/o-/opencv3.json b/versions/o-/opencv3.json index 803ad15108..b40aebe00a 100644 --- a/versions/o-/opencv3.json +++ b/versions/o-/opencv3.json @@ -1,5 +1,10 @@ { "versions": [ + { + "git-tree": "15c9083efa4c00674bef4fbca443a662fe6dd5cd", + "version": "3.4.18", + "port-version": 0 + }, { "git-tree": "8d02d89d9531e2243b81f37f97a9be943fd6b0a0", "version": "3.4.16", diff --git a/versions/o-/opencv4.json b/versions/o-/opencv4.json index 3c14a9620c..ee86692054 100644 --- a/versions/o-/opencv4.json +++ b/versions/o-/opencv4.json @@ -1,5 +1,10 @@ { "versions": [ + { + "git-tree": "1ff543272c91a32d242ad5320e9ca63b29b34ed2", + "version": "4.6.0", + "port-version": 0 + }, { "git-tree": "8e165720af85f0da853cf0a4ac9eb5cb20804d13", "version": "4.5.5", diff --git a/versions/r-/rtabmap.json b/versions/r-/rtabmap.json index 1ef4831fd0..aeaf4087c7 100644 --- a/versions/r-/rtabmap.json +++ b/versions/r-/rtabmap.json @@ -1,5 +1,10 @@ { "versions": [ + { + "git-tree": "b51506f789882022d1af0556521079694ce5cf62", + "version": "0.20.13", + "port-version": 4 + }, { "git-tree": "cf41f524585ec0c2dd5b8c7d8b455a79265b62ea", "version": "0.20.13", diff --git a/versions/v-/vcpkg-get-python-packages.json b/versions/v-/vcpkg-get-python-packages.json index 31285bc57d..e9eced18e6 100644 --- a/versions/v-/vcpkg-get-python-packages.json +++ b/versions/v-/vcpkg-get-python-packages.json @@ -1,5 +1,10 @@ { "versions": [ + { + "git-tree": "e65762bfef05a4d380bb171409c48a694fb35435", + "version-date": "2022-06-30", + "port-version": 0 + }, { "git-tree": "ffe13ab59e3e2f4f003498035bc1fbc06b64e164", "version-date": "2022-04-11",