Skip to content

Commit

Permalink
Merge branch 'master' into update_tuto_brightness_cycle_gamma_methods
Browse files Browse the repository at this point in the history
  • Loading branch information
fspindle committed Nov 3, 2024
2 parents d1f9401 + d8ae587 commit ebca3c5
Show file tree
Hide file tree
Showing 44 changed files with 226 additions and 78 deletions.
1 change: 1 addition & 0 deletions .github/workflows/conda/environment_linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ dependencies:
- xorg-libx11
- xorg-libxfixes
- mesa-libegl-cos7-x86_64
- icu
- libxml2
- libdc1394 >=2.2.6
- librealsense
Expand Down
26 changes: 15 additions & 11 deletions .github/workflows/other-arch-isolated.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,23 +28,23 @@ jobs:
# - arch: armv6
# distro: bullseye
# target: ARMV6
- arch: armv7
distro: ubuntu_latest
target: ARMV7
endianness: (Little Endian)
#- arch: armv7
# distro: ubuntu:latest
# target: ARMV7
# endianness: (Little Endian)
- arch: aarch64
distro: ubuntu_latest
distro: ubuntu:latest
endianness: (Little Endian)
- arch: riscv64
distro: ubuntu_latest
distro: ubuntu:latest
target: RISC-V
endianness: (Little Endian)
- arch: ppc64le
distro: ubuntu_latest
distro: ubuntu:latest
target: POWER8
endianness: (Little Endian)
- arch: s390x
distro: ubuntu_latest
distro: ubuntu:latest
target: Z13
endianness: (Big Endian)

Expand All @@ -53,11 +53,15 @@ jobs:
uses: actions/checkout@v4

- name: Run on arch
uses: uraimo/[email protected]
uses: uraimo/run-on-arch-action@v2
# See issue https://github.com/uraimo/run-on-arch-action/issues/155 for the explanation on the weird use of the arch and distro
# that resulted in error
# ERROR: failed to solve: ${arch}/ubuntu:latest: failed to resolve source metadata for docker.io/${arch}/ubuntu:latest: no match for platform in manifest: not found
with:
githubToken: ${{ github.token }}
arch: ${{ matrix.arch }}
distro: ${{ matrix.distro }}
arch: none
distro: none
base_image: "--platform=linux/${{ matrix.arch }} ${{ matrix.distro }}"

run: |
lscpu
Expand Down
14 changes: 9 additions & 5 deletions .github/workflows/other-arch.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,14 +32,14 @@ jobs:
# distro: ubuntu20.04
# target: ARMV7
- arch: aarch64
distro: ubuntu_latest
distro: ubuntu:latest
target: ARMV8
endianness: (Little Endian)
# - arch: ppc64le
# distro: ubuntu20.04
# target: POWER8
- arch: s390x
distro: ubuntu_latest
distro: ubuntu:latest
target: Z13
endianness: (Big Endian)

Expand All @@ -48,11 +48,15 @@ jobs:
uses: actions/checkout@v4

- name: Run on arch
uses: uraimo/[email protected]
uses: uraimo/run-on-arch-action@v2
# See issue https://github.com/uraimo/run-on-arch-action/issues/155 for the explanation on the weird use of the arch and distro
# that resulted in error
# ERROR: failed to solve: ${arch}/ubuntu:latest: failed to resolve source metadata for docker.io/${arch}/ubuntu:latest: no match for platform in manifest: not found
with:
githubToken: ${{ github.token }}
arch: ${{ matrix.arch }}
distro: ${{ matrix.distro }}
arch: none
distro: none
base_image: "--platform=linux/${{ matrix.arch }} ${{ matrix.distro }}"

run: |
lscpu
Expand Down
20 changes: 18 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -687,6 +687,17 @@ if(USE_PCL)
set(PCL_REQUIRED_COMPONENTS "common;filters;io;visualization;segmentation")
# Create cmake vars corresponding to pcl components used by ViSP like VISP_HAVE_PCL_COMMON...
vp_detect_required_pcl_components(PCL_REQUIRED_COMPONENTS)

# USE_NLOHMANN_JSON is set to ON if nlohmann_json is installed and found thanks to nlohmann_jsonConfig.cmake.
# VTK that is a PCL 3rd party embbed also a built in version of nlohmann_json.
# Here we add a specific case to consider the nlohmann version coming from VTK when the system version is not found
if(NOT USE_NLOHMANN_JSON)
if(VISP_HAVE_NLOHMANN_JSON_FROM_VTK)
message(WARNING "json 3rd party is detected and used as a VTK 3rd party which is itself a PCL 3rd party. Thus we enable nlohmann json usage turning USE_NLOHMANN_JSON=ON.")
unset(USE_NLOHMANN_JSON)
set(USE_NLOHMANN_JSON ON CACHE BOOL "Include nlohmann json support thanks to VTK" FORCE)
endif()
endif()
endif()

# ----------------------------------------------------------------------------
Expand Down Expand Up @@ -1090,7 +1101,8 @@ VP_SET(VISP_HAVE_THREADS TRUE IF (BUILD_MODULE_visp_core AND USE_THREADS))
VP_SET(VISP_HAVE_XML2 TRUE IF (BUILD_MODULE_visp_core AND USE_XML2))
VP_SET(VISP_HAVE_PCL TRUE IF (BUILD_MODULE_visp_core AND USE_PCL))
VP_SET(VISP_HAVE_TENSORRT TRUE IF (BUILD_MODULE_visp_core AND USE_TENSORRT))
VP_SET(VISP_HAVE_NLOHMANN_JSON TRUE IF (BUILD_MODULE_visp_core AND USE_NLOHMANN_JSON))
VP_SET(VISP_HAVE_NLOHMANN_JSON TRUE IF (BUILD_MODULE_visp_core AND USE_NLOHMANN_JSON))
VP_SET(VISP_HAVE_NLOHMANN_JSON_FROM_VTK TRUE IF (BUILD_MODULE_visp_core AND VISP_HAVE_NLOHMANN_JSON_FROM_VTK))

VP_SET(VISP_HAVE_OGRE TRUE IF (BUILD_MODULE_visp_ar AND USE_OGRE))
VP_SET(VISP_HAVE_OIS TRUE IF (BUILD_MODULE_visp_ar AND USE_OIS))
Expand Down Expand Up @@ -1844,7 +1856,11 @@ status(" Misc: ")
status(" Use Clipper (built-in):" WITH_CLIPPER THEN "yes (ver ${CLIPPER_VERSION})" ELSE "no")
status(" Use pugixml (built-in):" WITH_PUGIXML THEN "yes (ver ${PUGIXML_VERSION})" ELSE "no")
status(" Use libxml2:" USE_XML2 THEN "yes (ver ${XML2_VERSION_STRING})" ELSE "no")
status(" Use json (nlohmann):" USE_NLOHMANN_JSON THEN "yes (ver ${nlohmann_json_VERSION})" ELSE "no")
if(VISP_HAVE_NLOHMANN_JSON_FROM_VTK)
status(" Use json (nlohmann vtk):" USE_NLOHMANN_JSON THEN "yes (ver ${VTK_NLOHMANN_JSON_VERSION})" ELSE "no")
else()
status(" Use json (nlohmann system):" USE_NLOHMANN_JSON THEN "yes (ver ${nlohmann_json_VERSION})" ELSE "no")
endif()
status("")
status(" Optimization: ")
status(" Use OpenMP:" USE_OPENMP THEN "yes" ELSE "no")
Expand Down
3 changes: 3 additions & 0 deletions ChangeLog.txt
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,9 @@ ViSP 3.x.x (Version in development)
. [#1341] SVD computation fails with Lapack when m < n
. [#1370] encountered compilation errors while building the ViSP library
. [#1424] Unable to detect Yarp 3.9.0
. [#1485] Build issue around nlohmann_json usage with VTK 9.2.0 or more recent version used as an embedded
3rdparty by PCL
. [#1494] Memory management issue in vpArray2D::resize()
----------------------------------------------
ViSP 3.6.0 (released September 22, 2023)
- Contributors:
Expand Down
18 changes: 9 additions & 9 deletions ci/docker/ubuntu-dep-src/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -91,8 +91,8 @@ RUN cd ${HOME}/visp-ws/3rdparty \
&& git clone --depth 1 --branch $LATEST_TAG $GIT_ADDRESS \
&& cd OpenBLAS \
&& mkdir install \
&& make -j$(nproc) \
&& make -j$(nproc) install PREFIX=$(pwd)/install
&& make -j$(($(nproc) / 2)) \
&& make -j$(($(nproc) / 2)) install PREFIX=$(pwd)/install

ENV OpenBLAS_HOME=${HOME}/visp-ws/3rdparty/OpenBLAS/install

Expand All @@ -107,7 +107,7 @@ RUN cd ${HOME}/visp-ws/3rdparty \
&& cmake .. -DVTK_ANDROID_BUILD=OFF -DVTK_BUILD_DOCUMENTATION=OFF -DVTK_BUILD_EXAMPLES=OFF -DVTK_BUILD_EXAMPLES=OFF \
-DCMAKE_BUILD_TYPE=Release -DVTK_GROUP_ENABLE_Imaging=DONT_WANT -DVTK_GROUP_ENABLE_MPI=DONT_WANT \
-DVTK_GROUP_ENABLE_Web=DONT_WANT -DCMAKE_INSTALL_PREFIX=${HOME}/visp-ws/3rdparty/VTK/build/install \
&& make -j$(nproc) install
&& make -j$(($(nproc) / 2)) install

ENV VTK_DIR=${HOME}/visp-ws/3rdparty/VTK/build/install

Expand All @@ -121,7 +121,7 @@ RUN cd ${HOME}/visp-ws/3rdparty \
&& mkdir install \
&& cmake .. -DBUILD_EXAMPLES=OFF -DBUILD_PERF_TESTS=OFF -DBUILD_TESTS=OFF -DCMAKE_BUILD_TYPE=Release \
-DCMAKE_INSTALL_PREFIX=${HOME}/visp-ws/3rdparty/opencv/build/install \
&& make -j$(nproc) install
&& make -j$(($(nproc) / 2)) install

ENV OpenCV_DIR=${HOME}/visp-ws/3rdparty/opencv/build/install

Expand All @@ -135,7 +135,7 @@ RUN cd ${HOME}/visp-ws/3rdparty \
&& mkdir install \
&& cmake .. -DBUILD_EXAMPLES=OFF -DCMAKE_BUILD_TYPE=Release \
-DCMAKE_INSTALL_PREFIX=${HOME}/visp-ws/3rdparty/librealsense/build/install \
&& make -j$(nproc) install
&& make -j$(($(nproc) / 2)) install

ENV REALSENSE2_DIR=${HOME}/visp-ws/3rdparty/librealsense/build/install

Expand All @@ -149,7 +149,7 @@ RUN cd ${HOME}/visp-ws/3rdparty \
&& mkdir install \
&& cmake .. -DBUILD_tools=OFF -DBUILD_global_tests=OFF -DPCL_DISABLE_GPU_TESTS=ON -DCMAKE_BUILD_TYPE=Release \
-DCMAKE_INSTALL_PREFIX=${HOME}/visp-ws/3rdparty/pcl/build/install \
&& make -j10 install
&& make -j$(($(nproc) / 3)) install

ENV PCL_DIR=${HOME}/visp-ws/3rdparty/pcl/build/install

Expand All @@ -160,7 +160,7 @@ RUN mkdir -p ${HOME}/visp-ws \
&& echo "export VISP_WS=${HOME}/visp-ws" >> ${HOME}/.bashrc \
&& echo "export VISP_INPUT_IMAGE_PATH=${HOME}/visp-ws/visp-images" >> ${HOME}/.bashrc

# Download ViSP fork
# Download ViSP
RUN cd ${HOME}/visp-ws \
&& git clone ${GIT_URL} ${GIT_BRANCH_CMD}

Expand All @@ -169,7 +169,7 @@ RUN cd ${HOME}/visp-ws \
&& mkdir visp-build \
&& cd visp-build \
&& cmake ../visp -DCMAKE_INSTALL_PREFIX=${HOME}/visp-ws/visp-build/install \
&& make -j$(nproc) developer_scripts \
&& make -j$(nproc) install
&& make -j$(($(nproc) / 2)) developer_scripts \
&& make -j$(($(nproc) / 2)) install

CMD ["/bin/bash"]
73 changes: 73 additions & 0 deletions ci/docker/ubuntu-dep-src/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
# Docker dedicated to check compatibility with 3rd party last releases

## Build docker image from Dockerfile

- We suppose here that you already installed docker.
If this is not the case, follow instructions provided for [Ubuntu](https://visp-doc.inria.fr/doxygen/visp-daily/tutorial-install-docker.html#install_docker_engine_ubuntu) or [MacOS](https://visp-doc.inria.fr/doxygen/visp-daily/tutorial-install-docker.html#install_docker_engine_mac).

- Get ViSP source code
```
$ cd $VISP_WS/
$ git clone https://github.com/lagadic/visp
```

- Build docker image from Dockerfile running the following:
```
$ cd $VISP_WS/visp/ci/docker/ubuntu-dep-src
$ docker build -t vispci/vispci:ubuntu-dep-src .
```
The version of ViSP that is considered is by default the master branch from github official repo in
https://github.com/lagadic/visp

There is also the possibility to build visp from a specific repo and branch using `GIT_URL` and `GIT_BRANCH_NAME`
args, like
```
$ cd $VISP_WS/visp/ci/docker/ubuntu-dep-src
$ docker build -t vispci/vispci:ubuntu-dep-src --build-arg GIT_URL=https://github.com/lagadic/visp --build-arg GIT_BRANCH_NAME=master .
```

## Start the container

### On Ubuntu host

- On your computer running Ubuntu, allow access to the X11 server
```
$ xhost +local:docker
non-network local connections being added to access control list
```
- Run your Docker container. The following command connects to the ubuntu-dep-src Docker container.
```
$ docker run --rm -it --network=host --privileged \
--env=DISPLAY \
--env=QT_X11_NO_MITSHM=1 \
--volume=/tmp/.X11-unix:/tmp/.X11-unix:rw \
--volume=/dev:/dev \
vispci/vispci:ubuntu-dep-src
vispci@6c8d67579659:~$ pwd
/home/vispci
```

### On MacOS host

- Get your MacOS computer IP address
```
$ IP=$(/usr/sbin/ipconfig getifaddr en0)
$ echo $IP
$ 192.168.1.18
```
- Allow connections from MacOS to XQuartz
```
$ xhost + "$IP"
192.168.1.18 being added to access control list
```
- Run your Docker container. The following command connects to the ubuntu-dep-src Docker container.
```
$ docker run --rm -it --network=host --privileged \
--env=DISPLAY="${IP}:0" \
--env=QT_X11_NO_MITSHM=1 \
--volume=/tmp/.X11-unix:/tmp/.X11-unix:rw \
--volume=/dev:/dev \
vispci/vispci:ubuntu-dep-src
vispci@6c8d67579659:~$ pwd
/home/vispci
```
15 changes: 15 additions & 0 deletions cmake/PCLTools.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -257,6 +257,21 @@ macro(vp_find_pcl pcl_libraries pcl_deps_include_dirs pcl_deps_libraries)
endif()
endforeach()

find_path(VTK_NLOHMANN_JSON_INCLUDE_DIR vtknlohmannjson/include/vtknlohmann/json.hpp
PATHS
${PCL_VTK_IMPORTED_INCS}
)
mark_as_advanced(VTK_NLOHMANN_JSON_INCLUDE_DIR)
if(VTK_NLOHMANN_JSON_INCLUDE_DIR)
vp_parse_header("${VTK_NLOHMANN_JSON_INCLUDE_DIR}/vtknlohmannjson/include/vtknlohmann/json.hpp" NLOHMANN_JSON_VERSION_LINES NLOHMANN_JSON_VERSION_MAJOR NLOHMANN_JSON_VERSION_MINOR NLOHMANN_JSON_VERSION_PATCH)
set(VTK_NLOHMANN_JSON_VERSION "${NLOHMANN_JSON_VERSION_MAJOR}.${NLOHMANN_JSON_VERSION_MINOR}.${NLOHMANN_JSON_VERSION_PATCH}")
list(APPEND ${pcl_deps_include_dirs} "${VTK_NLOHMANN_JSON_INCLUDE_DIR}/vtknlohmannjson/include")
set(VISP_HAVE_NLOHMANN_JSON_FROM_VTK TRUE)
else()
set(VISP_HAVE_NLOHMANN_JSON_FROM_VTK FALSE)
set(VTK_NLOHMANN_JSON_VERSION "n/a")
endif()

# On win10 + msvc 15 2017 with pcl 1.9.1 opengl32.lib needed by vtkRenderingOpenGL-8.1-gd.lib is not found
# Here we explicitly add opengl
if(OPENGL_LIBRARIES)
Expand Down
12 changes: 11 additions & 1 deletion cmake/VISPUtils.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -1248,6 +1248,14 @@ function(status text)
endfunction()

# read set of version defines from the header file
# This macro allows to get defines values from a header file.
# For example if the header.hpp file contains
# #define LIB_VERSION_MAJOR 1
# #define LIB_VERSION_MINOR 2
# #define LIB_VERSION_PATCH 3
# to retrieve the values of these defines and compose a string version you may use
# vp_parse_header("header.hpp" LIB_VERSION_LINES LIB_VERSION_MAJOR LIB_VERSION_MINOR LIB_VERSION_PATCH)
# set(LIB_VERSION "${LIB_VERSION_MAJOR}.${LIB_VERSION_MINOR}.${LIB_VERSION_PATCH}")
macro(vp_parse_header FILENAME FILE_VAR)
set(vars_regex "")
set(__parent_scope OFF)
Expand Down Expand Up @@ -1289,6 +1297,9 @@ macro(vp_parse_header FILENAME FILE_VAR)
endmacro()

# read single version define from the header file
# Example to detect the version in header.hpp file that contains:
# #define MyLIB_VERSION_STR "1.2.3"
# use vp_parse_header2(MyLIB "header.hpp" LIB_VERSION_STR)
macro(vp_parse_header2 LIBNAME HDR_PATH VARNAME)
vp_clear_vars(${LIBNAME}_VERSION_MAJOR
${LIBNAME}_VERSION_MAJOR
Expand All @@ -1300,7 +1311,6 @@ macro(vp_parse_header2 LIBNAME HDR_PATH VARNAME)
if(EXISTS "${HDR_PATH}")
file(STRINGS "${HDR_PATH}" ${LIBNAME}_H REGEX "^#define[ \t]+${VARNAME}[ \t]+\"[^\"]*\".*$" LIMIT_COUNT 1)
endif()

if(${LIBNAME}_H)
string(REGEX REPLACE "^.*[ \t]${VARNAME}[ \t]+\"([0-9]+).*$" "\\1" ${LIBNAME}_VERSION_MAJOR "${${LIBNAME}_H}")
string(REGEX REPLACE "^.*[ \t]${VARNAME}[ \t]+\"[0-9]+\\.([0-9]+).*$" "\\1" ${LIBNAME}_VERSION_MINOR "${${LIBNAME}_H}")
Expand Down
16 changes: 14 additions & 2 deletions cmake/templates/vpConfig.h.in
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
* ViSP, open source Visual Servoing Platform software.
* Copyright (C) 2005 - 2023 by Inria. All rights reserved.
* Copyright (C) 2005 - 2024 by Inria. All rights reserved.
*
* This software is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
Expand Down Expand Up @@ -524,9 +524,21 @@ namespace vp = VISP_NAMESPACE_NAME;
// Defined if we want to use openmp
#cmakedefine VISP_HAVE_OPENMP

// Defined if nlohmann json parser is found
// Defined if nlohmann json parser is found (either system or coming from VTK)
#cmakedefine VISP_HAVE_NLOHMANN_JSON

// Defined if nlohmann json parser is found in PCL thanks to VTK 3rd party
#cmakedefine VISP_HAVE_NLOHMANN_JSON_FROM_VTK

#ifdef VISP_HAVE_NLOHMANN_JSON
# if defined(VISP_HAVE_PCL) && defined(VISP_HAVE_NLOHMANN_JSON_FROM_VTK)
# include <vtk_nlohmannjson.h>
# define VISP_NLOHMANN_JSON(x) <vtknlohmannjson/include/vtknlohmann/x>
# else
# define VISP_NLOHMANN_JSON(x) <nlohmann/x>
# endif
#endif

// Define c++ standard values also available in __cplusplus when gcc is used
#define VISP_CXX_STANDARD_98 ${VISP_CXX_STANDARD_98}
#define VISP_CXX_STANDARD_11 ${VISP_CXX_STANDARD_11}
Expand Down
4 changes: 4 additions & 0 deletions doc/tutorial/detection_dnn/tutorial-detection-dnn.dox
Original file line number Diff line number Diff line change
Expand Up @@ -474,6 +474,10 @@ If you want to train your own YoloV7 model, please refer to the [official docume
If your dataset is rather small (only hundreds of pictures), you may want to consider to base your training on
`yolov7-tiny` network, as it tends to get better results.

\warning If you train your own model, be sure to use the same image size in the `python train.py`,
`python export.py` and `./tutorial-dnn-object-detection-live` commands. Otherwise, it can lead to either an error thrown
by OpenCV or the absence of detection by the ONNX model while the Pytorch model works perfectly using the `python detect.py` command.

\subsubsection dnn_supported_yolov8 Yolo v8

You can find the weights (`yolov8s.onnx`) in ONNX format
Expand Down
Loading

0 comments on commit ebca3c5

Please sign in to comment.