Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
cdd8395
add getFrameCount()
sturkmen72 Jul 3, 2024
da078c4
highgui: Make GThread mandatory with GTK
tintou Jul 13, 2024
d150569
throw() -> noexcept
r-barnes Jul 15, 2024
bcce38c
fix: resolve Swift method name conflicts by adding missing namespace
yeatse Jul 17, 2024
0c2da1d
Merge pull request #25914 from r-barnes:4.x
asmorkalov Jul 17, 2024
0020831
Merge pull request #25927 from yeatse:fix-swift-name
asmorkalov Jul 18, 2024
32d81a8
Fix toolchain.
hanliutong Jul 18, 2024
1125755
Merge pull request #25931 from zihaomu:clean_code
zihaomu Jul 18, 2024
325da2b
Merge pull request #25907 from Andy-SAKN:Andy-SAKN-add_orbbec
Andy-SAKN Jul 18, 2024
d892c7b
Merge pull request #25934 from hanliutong:rvv-clang-toolchain-fix
asmorkalov Jul 18, 2024
a5dacb5
Update IPP integration
eplankin Jul 18, 2024
4dd54bb
Merge pull request #25898 from Octopus136:issue-25853
Burnside999 Jul 19, 2024
b5ea321
Merge pull request #25883 from hanliutong:rvv-intrin-upgrade
hanliutong Jul 19, 2024
26714f9
Merge pull request #25905 from tintou:tintou/glib-cleanup
asmorkalov Jul 19, 2024
23b244d
Merge pull request #25881 from fengyuentau:dnn/cpu/optimize_activatio…
fengyuentau Jul 19, 2024
89dd4ee
Merge pull request #25935 from eplankin:icv_update_2021.12
alalek Jul 22, 2024
c9b5781
Merge pull request #25874 from cudawarped:videoio_ffmpeg_fix_encapsul…
cudawarped Jul 22, 2024
012d853
cuda: prevent CMAKE_CUDA_ARCHITECTURES default from overiding OpenCV …
cudawarped Jul 22, 2024
44c814e
Merge pull request #25936 from savuor:rv/hal_dot
savuor Jul 23, 2024
38cfea9
Report used HAL to test log and xml
asmorkalov Jul 23, 2024
93b607d
Merge pull request #25942 from asmorkalov:as/hal_report
asmorkalov Jul 23, 2024
e1b5705
Avoid future integer overflow in _OutputArray::create
vrabaud Jul 23, 2024
c169276
Merge pull request #25938 from vrabaud:charuco
vrabaud Jul 24, 2024
14f9d71
Merge pull request #25941 from cudawarped:cuda_fix_default_cuda_arch_…
asmorkalov Jul 24, 2024
160879c
Merge pull request #25807 from spdfghi:4.x
spdfghi Jul 24, 2024
c5de090
Merge pull request #25944 from vrabaud:depth_check
asmorkalov Jul 24, 2024
eab21b6
Merge pull request #25814 from sturkmen72:numFrames
asmorkalov Jul 24, 2024
672a662
Merge branch 4.x
asmorkalov Jul 25, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 9 additions & 9 deletions 3rdparty/ippicv/ippicv.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ function(download_ippicv root_var)
set(${root_var} "" PARENT_SCOPE)

# Commit SHA in the opencv_3rdparty repo
set(IPPICV_COMMIT "fd27188235d85e552de31425e7ea0f53ba73ba53")
set(IPPICV_COMMIT "7f55c0c26be418d494615afca15218566775c725")
# Define actual ICV versions
if(APPLE)
set(IPPICV_COMMIT "0cc4aa06bf2bef4b05d237c69a5a96b9cd0cb85a")
Expand All @@ -14,21 +14,21 @@ function(download_ippicv root_var)
set(OPENCV_ICV_PLATFORM "linux")
set(OPENCV_ICV_PACKAGE_SUBDIR "ippicv_lnx")
if(X86_64)
set(OPENCV_ICV_NAME "ippicv_2021.11.0_lnx_intel64_20240201_general.tgz")
set(OPENCV_ICV_HASH "0f2745ff705ecae31176dad437608f6f")
set(OPENCV_ICV_NAME "ippicv_2021.12.0_lnx_intel64_20240425_general.tgz")
set(OPENCV_ICV_HASH "d06e6d44ece88f7f17a6cd9216761186")
else()
set(OPENCV_ICV_NAME "ippicv_2021.11.0_lnx_ia32_20240201_general.tgz")
set(OPENCV_ICV_HASH "63e381bf08076ca34fd5264203043a45")
set(OPENCV_ICV_NAME "ippicv_2021.12.0_lnx_ia32_20240425_general.tgz")
set(OPENCV_ICV_HASH "85ffa2b9ed7802b93c23fa27b0097d36")
endif()
elseif(WIN32 AND NOT ARM)
set(OPENCV_ICV_PLATFORM "windows")
set(OPENCV_ICV_PACKAGE_SUBDIR "ippicv_win")
if(X86_64)
set(OPENCV_ICV_NAME "ippicv_2021.11.0_win_intel64_20240201_general.zip")
set(OPENCV_ICV_HASH "59d154bf54a1e3eea20d7248f81a2a8e")
set(OPENCV_ICV_NAME "ippicv_2021.12.0_win_intel64_20240425_general.zip")
set(OPENCV_ICV_HASH "402ff8c6b4986738fed71c44e1ce665d")
else()
set(OPENCV_ICV_NAME "ippicv_2021.11.0_win_ia32_20240201_general.zip")
set(OPENCV_ICV_HASH "7a6d8ac5825c02fea6cbfc1201b521b5")
set(OPENCV_ICV_NAME "ippicv_2021.12.0_win_ia32_20240425_general.zip")
set(OPENCV_ICV_HASH "8b1d2a23957d57624d0de8f2a5cae5f1")
endif()
else()
return()
Expand Down
14 changes: 7 additions & 7 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -724,7 +724,13 @@ if(ENABLE_CUDA_FIRST_CLASS_LANGUAGE)

cmake_policy(SET CMP0092 NEW) # CMake 3.15+: leave warning flags out of default CMAKE_<LANG>_FLAGS flags.
if(CMAKE_CUDA_COMPILER)
if(CMAKE_CUDA_ARCHITECTURES)
set(USER_DEFINED_CMAKE_CUDA_ARCHITECTURES TRUE)
endif()
enable_language(CUDA)
if(NOT USER_DEFINED_CMAKE_CUDA_ARCHITECTURES)
set(CMAKE_CUDA_ARCHITECTURES "")
endif()
elseif(UNIX)
message(WARNING "CUDA: Not detected! If you are not using the default host compiler (g++) then you need to specify both CMAKE_CUDA_HOST_COMPILER and CMAKE_CUDA_COMPILER. e.g. -DCMAKE_CUDA_HOST_COMPILER=/usr/bin/clang++ -DCMAKE_CUDA_COMPILER=/usr/local/cuda/bin/nvcc.")
endif()
Expand Down Expand Up @@ -1447,16 +1453,10 @@ if(WITH_GTK OR HAVE_GTK)
status(" GTK+:" "YES (ver ${GTK3_VERSION})")
elseif(HAVE_GTK)
status(" GTK+:" "YES (ver ${GTK2_VERSION})")
status(" GtkGlExt:" HAVE_GTKGLEXT THEN "YES (ver ${GTKGLEXT_VERSION})" ELSE NO)
else()
status(" GTK+:" "NO")
endif()

if(HAVE_GTK)
status( " GThread :" HAVE_GTHREAD THEN "YES (ver ${GTHREAD_VERSION})" ELSE NO)
if(NOT HAVE_GTK3)
status( " GtkGlExt:" HAVE_GTKGLEXT THEN "YES (ver ${GTKGLEXT_VERSION})" ELSE NO)
endif()
endif()
endif()

if(WITH_FRAMEBUFFER OR HAVE_FRAMEBUFFER)
Expand Down
5 changes: 0 additions & 5 deletions cmake/OpenCVCompilerOptimizations.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -390,14 +390,9 @@ elseif(PPC64LE)
set(CPU_BASELINE "VSX" CACHE STRING "${HELP_CPU_BASELINE}")

elseif(RISCV)
option(RISCV_RVV_SCALABLE "Use scalable RVV API on RISC-V" ON)

ocv_update(CPU_RVV_TEST_FILE "${OpenCV_SOURCE_DIR}/cmake/checks/cpu_rvv.cpp")
ocv_update(CPU_KNOWN_OPTIMIZATIONS "RVV")
ocv_update(CPU_RVV_FLAGS_ON "-march=rv64gcv")
if(RISCV_RVV_SCALABLE)
set(CPU_RVV_FLAGS_ON "${CPU_RVV_FLAGS_ON} -DCV_RVV_SCALABLE")
endif()
ocv_update(CPU_RVV_FLAGS_CONFLICT "-march=[^ ]*")

set(CPU_DISPATCH "" CACHE STRING "${HELP_CPU_DISPATCH}")
Expand Down
26 changes: 16 additions & 10 deletions cmake/checks/cpu_rvv.cpp
Original file line number Diff line number Diff line change
@@ -1,17 +1,16 @@
#include <stdio.h>

#if defined(__riscv)
# include <riscv_vector.h>
# define CV_RVV 1
#if !defined(__riscv) || !defined(__riscv_v)
#error "RISC-V or vector extension(RVV) is not supported by the compiler"
#endif

#if defined CV_RVV
#if defined(__riscv_v_intrinsic) && __riscv_v_intrinsic>10999
#define vreinterpret_v_u64m1_u8m1 __riscv_vreinterpret_v_u64m1_u8m1
#define vle64_v_u64m1 __riscv_vle64_v_u64m1
#define vle32_v_f32m1 __riscv_vle32_v_f32m1
#define vfmv_f_s_f32m1_f32 __riscv_vfmv_f_s_f32m1_f32
#if !defined(__THEAD_VERSION__) && defined(__riscv_v_intrinsic) && __riscv_v_intrinsic < 12000
#error "Wrong intrinsics version, v0.12 or higher is required for gcc or clang"
#endif

#include <riscv_vector.h>

#ifdef __THEAD_VERSION__
int test()
{
const float src[] = { 0.0f, 0.0f, 0.0f, 0.0f };
Expand All @@ -21,7 +20,14 @@ int test()
return (int)vfmv_f_s_f32m1_f32(val);
}
#else
#error "RISC-V vector extension(RVV) is not supported"
int test()
{
const float src[] = { 0.0f, 0.0f, 0.0f, 0.0f };
uint64_t ptr[2] = {0x0908060504020100, 0xFFFFFFFF0E0D0C0A};
vuint8m1_t a = __riscv_vreinterpret_v_u64m1_u8m1(__riscv_vle64_v_u64m1(ptr, 2));
vfloat32m1_t val = __riscv_vle32_v_f32m1((const float*)(src), 4);
return (int)__riscv_vfmv_f_s_f32m1_f32(val);
}
#endif

int main()
Expand Down
Binary file added doc/tutorials/app/images/orbbec_uvc_cpp.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added doc/tutorials/app/images/orbbec_uvc_python.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion doc/tutorials/app/intelperc.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ Using Creative Senz3D and other Intel RealSense SDK compatible depth sensors {#t

@tableofcontents

@prev_tutorial{tutorial_orbbec_astra_openni}
@prev_tutorial{tutorial_orbbec_uvc}
@next_tutorial{tutorial_wayland_ubuntu}

![hardwares](images/realsense.jpg)
Expand Down
2 changes: 1 addition & 1 deletion doc/tutorials/app/orbbec_astra_openni.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Using Orbbec Astra 3D cameras {#tutorial_orbbec_astra_openni}
@tableofcontents

@prev_tutorial{tutorial_kinect_openni}
@next_tutorial{tutorial_intelperc}
@next_tutorial{tutorial_orbbec_uvc}


### Introduction
Expand Down
126 changes: 126 additions & 0 deletions doc/tutorials/app/orbbec_uvc.markdown
Original file line number Diff line number Diff line change
@@ -0,0 +1,126 @@
Using Orbbec 3D cameras (UVC) {#tutorial_orbbec_uvc}
====================================================

@tableofcontents

@prev_tutorial{tutorial_orbbec_astra_openni}
@next_tutorial{tutorial_intelperc}

| | |
| -: | :- |
| Original author | Jinyue Chen |
| Compatibility | OpenCV >= 4.10 |

### Introduction
This tutorial is devoted to the Orbbec 3D cameras based on UVC protocol. For the use of the older
Orbbec 3D cameras which depends on OpenNI, please refer to the
[previous tutorial](https://github.com/opencv/opencv/blob/5.x/doc/tutorials/app/orbbec_astra_openni.markdown).

Unlike working with the OpenNI based Astra 3D cameras which requires OpenCV built with OpenNI2 SDK,
Orbbec SDK is not required to be installed for accessing Orbbec UVC 3D cameras via OpenCV. By using
`cv::VideoCapture` class, users get the stream data from 3D cameras, similar to working with USB
cameras. The calibration and alignment of the depth map and color image are done internally.

### Instructions

In order to use the 3D cameras with OpenCV. You can refer to [Get Started](https://opencv.org/get-started/)
to install OpenCV.

Note since 4.11 on, Mac OS users need to compile OpenCV from source with flag
`-DOBSENSOR_USE_ORBBEC_SDK=ON` in order to use the cameras:
```bash
cmake -DOBSENSOR_USE_ORBBEC_SDK=ON ..
make
sudo make install
```

Code
----

@add_toggle_python
This tutorial code's is shown lines below. You can also download it from
[here](https://github.com/opencv/opencv/blob/5.x/samples/python/videocapture_obsensor.py)
@include samples/python/videocapture_obsensor.py
@end_toggle

@add_toggle_cpp
This tutorial code's is shown lines below. You can also download it from
[here](https://github.com/opencv/opencv/blob/5.x/samples/cpp/videocapture_obsensor.cpp)
@include samples/cpp/videocapture_obsensor.cpp
@end_toggle

### Code Explanation

#### Python

- **Open Orbbec Depth Sensor**:
Using `cv.VideoCapture(0, cv.CAP_OBSENSOR)` to attempt to open the first Orbbec depth sensor device.
If the camera fails to open, the program will exit and display an error message.

- **Loop to Grab and Process Data**:
In an infinite loop, the code continuously grabs data from the camera. The `orbbec_cap.grab()`
method attempts to grab a frame.

- **Process BGR Image**:
Using `orbbec_cap.retrieve(None, cv.CAP_OBSENSOR_BGR_IMAGE)` to retrieve the BGR image data.
If successfully retrieved, the BGR image is displayed in a window using `cv.imshow("BGR", bgr_image)`.

- **Process Depth Image**:
Using `orbbec_cap.retrieve(None, cv.CAP_OBSENSOR_DEPTH_MAP)` to retrieve the depth image data.
If successfully retrieved, the depth image is first normalized to a range of 0 to 255, then a
false color image is applied, and the result is displayed in a window using `cv.imshow("DEPTH", color_depth_map)`.

- **Keyboard Interrupt**:
Using `cv.pollKey()` to detect keyboard events. If a key is pressed, the loop breaks and
the program ends.

- **Release Resources**:
After exiting the loop, the camera resources are released using `orbbec_cap.release()`.

#### C++

- **Open Orbbec Depth Sensor**:
Using `VideoCapture obsensorCapture(0, CAP_OBSENSOR)` to attempt to open the first Orbbec depth
sensor device. If the camera fails to open, an error message is displayed, and the program exits.

- **Retrieve Camera Intrinsic Parameters**:
Using `obsensorCapture.get()` to retrieve the intrinsic parameters of the camera, including focal
lengths (`fx`, `fy`) and principal points (`cx`, `cy`).

- **Loop to Grab and Process Data**:
In an infinite loop, the code continuously grabs data from the camera. The `obsensorCapture.grab()`
method attempts to grab a frame.

- **Process BGR Image**:
Using `obsensorCapture.retrieve(image, CAP_OBSENSOR_BGR_IMAGE)` to retrieve the BGR image data.
If successfully retrieved, the BGR image is displayed in a window using `imshow("BGR", image)`.

- **Process Depth Image**:
Using `obsensorCapture.retrieve(depthMap, CAP_OBSENSOR_DEPTH_MAP)` to retrieve the depth image data.
If successfully retrieved, the depth image is normalized and a false color image is applied, then
the result is displayed in a window using `imshow("DEPTH", adjDepthMap)`. The retrieved depth
values are in millimeters and are truncated to a range between 300 and 5000 (millimeter).
This fixed range can be interpreted as a truncation based on the depth camera's depth range,
removing invalid pixels on the depth map.

- **Overlay Depth Map on BGR Image**:
Convert the depth map to an 8-bit image, resize it to match the BGR image size, and overlay it
on the BGR image with a specified transparency (`alpha`). The overlaid image is displayed in
a window using `imshow("DepthToColor", image)`.

- **Keyboard Interrupt**:
Using `pollKey()` to detect keyboard events. If a key is pressed, the loop breaks and the program ends.

- **Release Resources**:
After exiting the loop, the camera resources are released.
### Results
#### Python

![BGR And DEPTH frame](images/orbbec_uvc_python.jpg)

#### C++

![BGR And DEPTH And DepthToColor frame](images/orbbec_uvc_cpp.jpg)

### Note
Mac users need sudo privileges to execute the code.
1 change: 1 addition & 0 deletions doc/tutorials/app/table_of_content_app.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,6 @@ Application utils (highgui, imgcodecs, videoio modules) {#tutorial_table_of_cont
- @subpage tutorial_video_write
- @subpage tutorial_kinect_openni
- @subpage tutorial_orbbec_astra_openni
- @subpage tutorial_orbbec_uvc
- @subpage tutorial_intelperc
- @subpage tutorial_wayland_ubuntu
46 changes: 32 additions & 14 deletions modules/calib/src/calibinit.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1151,22 +1151,40 @@ int ChessBoardDetector::addOuterQuad(ChessBoardQuad& quad, std::vector<ChessBoar
// have to set exact corner
q.corners[j] = quad.corners[i];

// set row and col for next step check
switch (i)
{
case 0:
q.col = quad.col - 1; q.row = quad.row - 1; break;
case 1:
q.col = quad.col + 1; q.row = quad.row - 1; break;
case 2:
q.col = quad.col + 1; q.row = quad.row - 1; break;
case 3:
q.col = quad.col - 1; q.row = quad.row + 1; break;
}

// now find other neighbor and add it, if possible
int next_i = (i + 1) & 3;
int prev_i = (i + 3) & 3; // equal to (j + 1) & 3
ChessBoardQuad* quad_prev = quad.neighbors[prev_i];
if (quad_prev &&
quad_prev->ordered &&
quad_prev->neighbors[i] &&
quad_prev->neighbors[i]->ordered )
for (int k = 1; k <= 3; k += 2)
{
ChessBoardQuad* qn = quad_prev->neighbors[i];
q.count = 2;
q.neighbors[prev_i] = qn;
qn->neighbors[next_i] = &q;
qn->count += 1;
// have to set exact corner
q.corners[prev_i] = qn->corners[next_i];
int next_i = (i + k) % 4;
int prev_i = (i + k + 2) % 4;
ChessBoardQuad* quad_prev = quad.neighbors[prev_i];
if (quad_prev &&
quad_prev->ordered &&
quad_prev->neighbors[i] &&
quad_prev->neighbors[i]->ordered &&
std::abs(quad_prev->neighbors[i]->col - q.col) == 1 &&
std::abs(quad_prev->neighbors[i]->row - q.row) == 1)
{
ChessBoardQuad* qn = quad_prev->neighbors[i];
q.count = 2;
q.neighbors[prev_i] = qn;
qn->neighbors[next_i] = &q;
qn->count += 1;
// have to set exact corner
q.corners[prev_i] = qn->corners[next_i];
}
}
}
}
Expand Down
4 changes: 2 additions & 2 deletions modules/core/include/opencv2/core.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -123,12 +123,12 @@ class CV_EXPORTS Exception : public std::exception
Instead, the macros CV_Error(), CV_Error_() and CV_Assert() are used.
*/
Exception(int _code, const String& _err, const String& _func, const String& _file, int _line);
virtual ~Exception() throw();
virtual ~Exception() CV_NOEXCEPT;

/*!
\return the error description and the context as a text string.
*/
virtual const char *what() const throw() CV_OVERRIDE;
virtual const char *what() const CV_NOEXCEPT CV_OVERRIDE;
void formatMessage();

String msg; ///< the formatted error message
Expand Down
25 changes: 17 additions & 8 deletions modules/core/include/opencv2/core/cv_cpu_dispatch.h
Original file line number Diff line number Diff line change
Expand Up @@ -146,9 +146,23 @@
# define CV_NEON 1
#endif

#if defined(__riscv) && defined(__riscv_vector) && defined(__riscv_vector_071)
# include<riscv_vector.h>
# define CV_RVV071 1
/* RVV-related macro states with different compiler
// +--------------------+----------+----------+
// | Macro | Upstream | XuanTie |
// +--------------------+----------+----------+
// | CV_CPU_COMPILE_RVV | defined | defined |
// | CV_RVV | 1 | 0 |
// | CV_RVV071 | 0 | 1 |
// | CV_TRY_RVV | 1 | 1 |
// +--------------------+----------+----------+
*/
#ifdef CV_CPU_COMPILE_RVV
# ifdef __riscv_vector_071
# define CV_RVV071 1
# else
# define CV_RVV 1
# endif
#include <riscv_vector.h>
#endif

#ifdef CV_CPU_COMPILE_VSX
Expand Down Expand Up @@ -183,11 +197,6 @@
# include <wasm_simd128.h>
#endif

#if defined CV_CPU_COMPILE_RVV
# define CV_RVV 1
# include <riscv_vector.h>
#endif

#endif // CV_ENABLE_INTRINSICS && !CV_DISABLE_OPTIMIZATION && !__CUDACC__

#if defined CV_CPU_COMPILE_AVX && !defined CV_CPU_BASELINE_COMPILE_AVX
Expand Down
Loading