Skip to content

Commit

Permalink
Upgrade to OpenCV 4.8.0
Browse files Browse the repository at this point in the history
  • Loading branch information
sjmgarnier committed Jul 20, 2023
1 parent 92e3179 commit 91ede34
Show file tree
Hide file tree
Showing 24 changed files with 1,537 additions and 51 deletions.
7 changes: 3 additions & 4 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
Package: ROpenCVLite
Type: Package
Title: Helper Package for Installing OpenCV with R
Version: 4.70.0
Date: 2022-12-28
Version: 4.80.0
Date: 2023-07-20
Authors@R: c(
person("Simon", "Garnier", email = "[email protected]", role = c("aut", "cre"),
comment = c(ORCID = "0000-0002-3886-3974")),
Expand All @@ -21,8 +21,7 @@ Imports:
pkgbuild,
parallel
SystemRequirements:
cmake,
C++11
cmake
RoxygenNote: 7.2.3
Biarch: true
Encoding: UTF-8
Expand Down
12 changes: 12 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,15 @@
# ROpenCVLite 4.80.0

## New features

* Upgrade package to OpenCV 4.8.0.

## Minor improvements and fixes

* N/A.

---

# ROpenCVLite 4.70.0

## New features
Expand Down
40 changes: 20 additions & 20 deletions R/opencv.R
Original file line number Diff line number Diff line change
Expand Up @@ -181,21 +181,21 @@ installOpenCV <- function(path = defaultOpenCVPath(), batch = FALSE) {
}
}

Sys.setenv(CXX_STD = "CXX11")
# Sys.setenv(CXX_STD = "CXX11")

if (.Platform$OS.type == "windows") {
dir.create(path, showWarnings = FALSE)
tmpDir <- gsub("\\\\", "/", base::tempdir())
dir.create(tmpDir, showWarnings = FALSE)

utils::download.file("https://github.com/opencv/opencv/archive/4.7.0.tar.gz",
paste0(tmpDir, "/opencv-4.7.0.tar.gz"))
utils::untar(paste0(tmpDir, "/opencv-4.7.0.tar.gz"),
utils::download.file("https://github.com/opencv/opencv/archive/4.8.0.tar.gz",
paste0(tmpDir, "/opencv-4.8.0.tar.gz"))
utils::untar(paste0(tmpDir, "/opencv-4.8.0.tar.gz"),
exdir = tmpDir)

utils::download.file("https://github.com/opencv/opencv_contrib/archive/4.7.0.tar.gz",
paste0(tmpDir, "/opencv_contrib-4.7.0.tar.gz"))
utils::untar(paste0(tmpDir, "/opencv_contrib-4.7.0.tar.gz"),
utils::download.file("https://github.com/opencv/opencv_contrib/archive/4.8.0.tar.gz",
paste0(tmpDir, "/opencv_contrib-4.8.0.tar.gz"))
utils::untar(paste0(tmpDir, "/opencv_contrib-4.8.0.tar.gz"),
exdir = tmpDir)

arch <- c("64", "32")
Expand Down Expand Up @@ -227,7 +227,7 @@ installOpenCV <- function(path = defaultOpenCVPath(), batch = FALSE) {
gpp_path <- paste0(rtools4Path, "/x86_64-w64-mingw32.static.posix", "/bin/g++.exe")
windres_path <- paste0(rtools4Path, "/x86_64-w64-mingw32.static.posix", "/bin/windres.exe")
make_path <- paste0(rtools4Path, "/usr/bin/make.exe")
system(paste0('cmake -G "Unix Makefiles" -DCMAKE_C_COMPILER=', gcc_path, ' -DCMAKE_CXX_COMPILER=', gpp_path, ' -DCMAKE_RC_COMPILER=', windres_path, ' -DCMAKE_MAKE_PROGRAM=', make_path, ' -DENABLE_PRECOMPILED_HEADERS=OFF -DOpenCV_ARCH=', openCVArch, ' -DOpenCV_RUNTIME=mingw -DENABLE_CXX11=ON -DBUILD_ZLIB=ON -DOPENCV_EXTRA_MODULES_PATH=', contribDir, ' -DBUILD_LIST=calib3d,core,dnn,features2d,flann,gapi,highgui,imgcodecs,imgproc,ml,objdetect,photo,stitching,video,videoio,ximgproc -DBUILD_opencv_world=OFF -DBUILD_opencv_contrib_world=OFF -DWITH_OPENMP=ON -DWITH_TBB=ON -DWITH_FFMPEG=ON -DWITH_OPENCL=ON -DWITH_EIGEN=ON -DWITH_OPENCLAMDFFT=ON -DWITH_OPENCLAMDBLAS=ON -DBUILD_PERF_TESTS=OFF -DBUILD_TESTS=OFF -DWITH_DSHOW=ON -DBUILD_PROTOBUF=ON -DOPENCV_ENABLE_ALLOCATOR_STATS=OFF -DBUILD_SHARED_LIBS=ON -DCMAKE_BUILD_TYPE=RELEASE -DCMAKE_INSTALL_PREFIX=', path, ' -B', buildDir, ' -H', sourceDir))
system(paste0('cmake -G "Unix Makefiles" -DCMAKE_C_COMPILER=', gcc_path, ' -DCMAKE_CXX_COMPILER=', gpp_path, ' -DCMAKE_RC_COMPILER=', windres_path, ' -DCMAKE_MAKE_PROGRAM=', make_path, ' -DENABLE_PRECOMPILED_HEADERS=OFF -DOpenCV_ARCH=', openCVArch, ' -DOpenCV_RUNTIME=mingw -DBUILD_ZLIB=ON -DOPENCV_EXTRA_MODULES_PATH=', contribDir, ' -DBUILD_LIST=calib3d,core,dnn,features2d,flann,gapi,highgui,imgcodecs,imgproc,ml,objdetect,photo,stitching,video,videoio,ximgproc -DBUILD_opencv_world=OFF -DBUILD_opencv_contrib_world=OFF -DWITH_OPENMP=ON -DWITH_TBB=ON -DWITH_FFMPEG=ON -DWITH_OPENCL=ON -DWITH_EIGEN=ON -DWITH_OPENCLAMDFFT=ON -DWITH_OPENCLAMDBLAS=ON -DBUILD_PERF_TESTS=OFF -DBUILD_TESTS=OFF -DWITH_DSHOW=ON -DBUILD_PROTOBUF=ON -DOPENCV_ENABLE_ALLOCATOR_STATS=OFF -DBUILD_SHARED_LIBS=ON -DCMAKE_BUILD_TYPE=RELEASE -DCMAKE_INSTALL_PREFIX=', path, ' -B', buildDir, ' -H', sourceDir))
system(paste0(make_path, " -j", parallel::detectCores(), " -C ", buildDir))
system(paste0(make_path, " -C", buildDir, " install"))
} else {
Expand All @@ -238,7 +238,7 @@ installOpenCV <- function(path = defaultOpenCVPath(), batch = FALSE) {
gpp_path <- paste0(rtools4Path, "/mingw", arch[i], "/bin/g++.exe")
windres_path <- paste0(rtools4Path, "/mingw", arch[i], "/bin/windres.exe")
make_path <- paste0(rtools4Path, "/usr/bin/make.exe")
system(paste0('cmake -G "Unix Makefiles" -DCMAKE_C_COMPILER=', gcc_path, ' -DCMAKE_CXX_COMPILER=', gpp_path, ' -DCMAKE_RC_COMPILER=', windres_path, ' -DCMAKE_MAKE_PROGRAM=', make_path, ' -DENABLE_PRECOMPILED_HEADERS=OFF -DOpenCV_ARCH=', openCVArch, ' -DOpenCV_RUNTIME=mingw -DENABLE_CXX11=ON -DBUILD_ZLIB=ON -DOPENCV_EXTRA_MODULES_PATH=', contribDir, ' -DBUILD_LIST=calib3d,core,dnn,features2d,flann,gapi,highgui,imgcodecs,imgproc,ml,objdetect,photo,stitching,video,videoio,ximgproc -DBUILD_opencv_world=OFF -DBUILD_opencv_contrib_world=OFF -DWITH_OPENMP=ON -DWITH_TBB=ON -DWITH_FFMPEG=ON -DWITH_OPENCL=ON -DWITH_EIGEN=ON -DWITH_OPENCLAMDFFT=ON -DWITH_OPENCLAMDBLAS=ON -DBUILD_PERF_TESTS=OFF -DBUILD_TESTS=OFF -DWITH_DSHOW=ON -DBUILD_PROTOBUF=OFF -DOPENCV_ENABLE_ALLOCATOR_STATS=OFF -DBUILD_SHARED_LIBS=ON -DCMAKE_BUILD_TYPE=RELEASE -DCMAKE_INSTALL_PREFIX=', path, ' -B', buildDir, ' -H', sourceDir))
system(paste0('cmake -G "Unix Makefiles" -DCMAKE_C_COMPILER=', gcc_path, ' -DCMAKE_CXX_COMPILER=', gpp_path, ' -DCMAKE_RC_COMPILER=', windres_path, ' -DCMAKE_MAKE_PROGRAM=', make_path, ' -DENABLE_PRECOMPILED_HEADERS=OFF -DOpenCV_ARCH=', openCVArch, ' -DOpenCV_RUNTIME=mingw -DBUILD_ZLIB=ON -DOPENCV_EXTRA_MODULES_PATH=', contribDir, ' -DBUILD_LIST=calib3d,core,dnn,features2d,flann,gapi,highgui,imgcodecs,imgproc,ml,objdetect,photo,stitching,video,videoio,ximgproc -DBUILD_opencv_world=OFF -DBUILD_opencv_contrib_world=OFF -DWITH_OPENMP=ON -DWITH_TBB=ON -DWITH_FFMPEG=ON -DWITH_OPENCL=ON -DWITH_EIGEN=ON -DWITH_OPENCLAMDFFT=ON -DWITH_OPENCLAMDBLAS=ON -DBUILD_PERF_TESTS=OFF -DBUILD_TESTS=OFF -DWITH_DSHOW=ON -DBUILD_PROTOBUF=OFF -DOPENCV_ENABLE_ALLOCATOR_STATS=OFF -DBUILD_SHARED_LIBS=ON -DCMAKE_BUILD_TYPE=RELEASE -DCMAKE_INSTALL_PREFIX=', path, ' -B', buildDir, ' -H', sourceDir))
system(paste0(make_path, " -j", parallel::detectCores(), " -C ", buildDir))
system(paste0(make_path, " -C", buildDir, " install"))
}
Expand All @@ -247,7 +247,7 @@ installOpenCV <- function(path = defaultOpenCVPath(), batch = FALSE) {
gpp_path <- paste0(rtoolsPath, "/mingw_", arch[i], "/bin/g++.exe")
windres_path <- paste0(rtoolsPath, "/mingw_", arch[i], "/bin/windres.exe")
make_path <- paste0(rtoolsPath, "/mingw_", arch[i], "/bin/mingw32-make.exe")
system(paste0('cmake -G "Unix Makefiles" -DCMAKE_C_COMPILER=', gcc_path, ' -DCMAKE_CXX_COMPILER=', gpp_path, ' -DCMAKE_RC_COMPILER=', windres_path, ' -DCMAKE_MAKE_PROGRAM=', make_path, ' -DENABLE_PRECOMPILED_HEADERS=OFF -DOpenCV_ARCH=', openCVArch, ' -DOpenCV_RUNTIME=mingw -DENABLE_CXX11=ON -DBUILD_ZLIB=ON -DOPENCV_EXTRA_MODULES_PATH=', contribDir, ' -DBUILD_LIST=calib3d,core,dnn,features2d,flann,highgui,imgcodecs,imgproc,ml,objdetect,photo,stitching,video,videoio,ximgproc -DBUILD_opencv_world=OFF -DBUILD_opencv_contrib_world=OFF -DWITH_OPENMP=ON -DWITH_TBB=ON -DWITH_FFMPEG=ON -DWITH_OPENCL=ON -DWITH_EIGEN=ON -DWITH_OPENCLAMDFFT=ON -DWITH_OPENCLAMDBLAS=ON -DBUILD_PERF_TESTS=OFF -DBUILD_TESTS=OFF -DWITH_DSHOW=ON -DBUILD_PROTOBUF=OFF -DOPENCV_ENABLE_ALLOCATOR_STATS=OFF -DBUILD_SHARED_LIBS=ON -DCMAKE_BUILD_TYPE=RELEASE -DCMAKE_INSTALL_PREFIX=', path, ' -B', buildDir, ' -H', sourceDir))
system(paste0('cmake -G "Unix Makefiles" -DCMAKE_C_COMPILER=', gcc_path, ' -DCMAKE_CXX_COMPILER=', gpp_path, ' -DCMAKE_RC_COMPILER=', windres_path, ' -DCMAKE_MAKE_PROGRAM=', make_path, ' -DENABLE_PRECOMPILED_HEADERS=OFF -DOpenCV_ARCH=', openCVArch, ' -DOpenCV_RUNTIME=mingw -DBUILD_ZLIB=ON -DOPENCV_EXTRA_MODULES_PATH=', contribDir, ' -DBUILD_LIST=calib3d,core,dnn,features2d,flann,highgui,imgcodecs,imgproc,ml,objdetect,photo,stitching,video,videoio,ximgproc -DBUILD_opencv_world=OFF -DBUILD_opencv_contrib_world=OFF -DWITH_OPENMP=ON -DWITH_TBB=ON -DWITH_FFMPEG=ON -DWITH_OPENCL=ON -DWITH_EIGEN=ON -DWITH_OPENCLAMDFFT=ON -DWITH_OPENCLAMDBLAS=ON -DBUILD_PERF_TESTS=OFF -DBUILD_TESTS=OFF -DWITH_DSHOW=ON -DBUILD_PROTOBUF=OFF -DOPENCV_ENABLE_ALLOCATOR_STATS=OFF -DBUILD_SHARED_LIBS=ON -DCMAKE_BUILD_TYPE=RELEASE -DCMAKE_INSTALL_PREFIX=', path, ' -B', buildDir, ' -H', sourceDir))
system(paste0(make_path, " -j", parallel::detectCores(), " -C ", buildDir))
system(paste0(make_path, " -C", buildDir, " install"))
}
Expand All @@ -259,22 +259,22 @@ installOpenCV <- function(path = defaultOpenCVPath(), batch = FALSE) {
tmpDir <- base::tempdir()
dir.create(tmpDir, showWarnings = FALSE)

utils::download.file("https://github.com/opencv/opencv/archive/4.7.0.zip",
paste0(tmpDir, "/opencv-4.7.0.zip"))
utils::unzip(paste0(tmpDir, "/opencv-4.7.0.zip"),
utils::download.file("https://github.com/opencv/opencv/archive/4.8.0.zip",
paste0(tmpDir, "/opencv-4.8.0.zip"))
utils::unzip(paste0(tmpDir, "/opencv-4.8.0.zip"),
exdir = tmpDir)

utils::download.file("https://github.com/opencv/opencv_contrib/archive/4.7.0.zip",
paste0(tmpDir, "/opencv_contrib-4.7.0.zip"))
utils::unzip(paste0(tmpDir, "/opencv_contrib-4.7.0.zip"),
utils::download.file("https://github.com/opencv/opencv_contrib/archive/4.8.0.zip",
paste0(tmpDir, "/opencv_contrib-4.8.0.zip"))
utils::unzip(paste0(tmpDir, "/opencv_contrib-4.8.0.zip"),
exdir = tmpDir)

file.copy(paste0(pkgPath, "/OpenCVModule.4.7.0.cmake"),
paste0(tmpDir, "/opencv-4.7.0/cmake/OpenCVModule.cmake"),
file.copy(paste0(pkgPath, "/OpenCVModule.4.8.0.cmake"),
paste0(tmpDir, "/opencv-4.8.0/cmake/OpenCVModule.cmake"),
overwrite = TRUE)

sourceDir <- paste0(tmpDir, "/opencv-4.7.0/")
contribDir <- paste0(tmpDir, "/opencv_contrib-4.7.0/modules")
sourceDir <- paste0(tmpDir, "/opencv-4.8.0/")
contribDir <- paste0(tmpDir, "/opencv_contrib-4.8.0/modules")
buildDir <- paste0(sourceDir, "build")
dir.create(buildDir, showWarnings = FALSE)

Expand Down
2 changes: 1 addition & 1 deletion cran-comments.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
## Test environments

* local M1 OS X 13.1, R 4.2.2
* local M1 OS X 13.4.1, R 4.3.1
* local Windows 10, R 4.2.2
* local Ubuntu 22.04, R 4.2.2
* Github Actions "windows-latest (release)"
Expand Down
2 changes: 1 addition & 1 deletion docs/404.html

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion docs/LICENSE-text.html

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion docs/articles/index.html

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion docs/articles/install.html

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion docs/articles/usage.html

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 4 additions & 4 deletions docs/authors.html

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion docs/index.html

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

13 changes: 12 additions & 1 deletion docs/news/index.html

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions docs/pkgdown.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
pandoc: 3.0.1
pandoc: 3.1.5
pkgdown: 2.0.7
pkgdown_sha: ~
articles:
install: install.html
usage: usage.html
last_built: 2023-01-28T14:28Z
last_built: 2023-07-20T07:15Z
urls:
reference: https://swarm-lab.github.io/ROpenCVLite/reference
article: https://swarm-lab.github.io/ROpenCVLite/articles
Expand Down
2 changes: 1 addition & 1 deletion docs/reference/OpenCVPath.html

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion docs/reference/ROpenCVLite-package.html

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions docs/reference/defaultOpenCVPath.html

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 91ede34

Please sign in to comment.