1
0
mirror of https://github.com/opencv/opencv.git synced 2026-07-30 07:43:03 +04:00

Merge branch '4.x' into '5.x'

This commit is contained in:
Maksim Shabunin
2024-06-11 19:38:59 +03:00
573 changed files with 72922 additions and 7355 deletions
@@ -0,0 +1,106 @@
Using Wayland highgui-backend in Ubuntu {#tutorial_wayland_ubuntu}
=======================================
@tableofcontents
@prev_tutorial{tutorial_intelperc}
| | |
| -: | :- |
| Original author | Kumataro |
| Compatibility | OpenCV >= 4.10 |
| ^ | Ubuntu 24.04 |
Goal
-----
This tutorial is to use Wayland highgui-backend in Ubuntu 24.04.
Wayland highgui-backend is experimental implementation.
Setup
-----
- Setup Ubuntu 24.04.
- `sudo apt install build-essential git cmake` to build OpenCV.
- `sudo apt install libwayland-dev wayland-protocols libxkbcommon-dev` to enable Wayland highgui-backend.
- (Option) `sudo apt install ninja-build` (or remove `-GNinja` option for cmake command).
- (Option) `sudo apt install libwayland-egl1` to enable Wayland EGL library.
Get OpenCV from GitHub
----------------------
```bash
mkdir work
cd work
git clone --depth=1 https://github.com/opencv/opencv.git
```
@note
`--depth=1` option is to limit downloading commits. If you want to see more commit history, please remove this option.
Build/Install OpenCV with Wayland highgui-backend
-------------------------------------------------
Run `cmake` with `-DWITH_WAYLAND=ON` option to configure OpenCV.
```bash
cmake -S opencv -B build4-main -DWITH_WAYLAND=ON -GNinja
```
If succeeded, Wayland Client/Cursor/Protocols and Xkbcommon versions are shown. Wayland EGL is option.
```plaintext
--
-- GUI: Wayland
-- Wayland: (Experimental) YES
-- Wayland Client: YES (ver 1.22.0)
-- Wayland Cursor: YES (ver 1.22.0)
-- Wayland Protocols: YES (ver 1.34)
-- Xkbcommon: YES (ver 1.6.0)
-- Wayland EGL(Option): YES (ver 18.1.0)
-- GTK+: NO
-- VTK support: NO
```
Run `cmake --build` to build, and `sudo cmake --install` to install into your system.
```bash
cmake --build build4-main
sudo cmake --install build4-main
sudo ldconfig
```
Simple Application to try Wayland highgui-backend
-------------------------------------------------
Try this code, so you can see name of currentUIFrramework() and OpenCV logo window with Wayland highgui-backend.
```bash
// g++ main.cpp -o a.out -I /usr/local/include/opencv4 -lopencv_core -lopencv_highgui -lopencv_imgcodecs
#include <opencv2/core.hpp>
#include <opencv2/highgui.hpp>
#include <opencv2/imgcodecs.hpp>
#include <iostream>
#include <string>
int main(void)
{
std::cout << "cv::currentUIFramework() returns " << cv::currentUIFramework() << std::endl;
cv::Mat src;
src = cv::imread("opencv-logo.png");
cv::namedWindow("src");
int key = 0;
do
{
cv::imshow("src", src );
key = cv::waitKey(50);
} while( key != 'q' );
return 0;
}
```
Limitation/Known problem
------------------------
- cv::moveWindow() is not implementated. ( See. https://github.com/opencv/opencv/issues/25478 )
+1
View File
@@ -4,6 +4,7 @@ Using Creative Senz3D and other Intel RealSense SDK compatible depth sensors {#t
@tableofcontents
@prev_tutorial{tutorial_orbbec_astra}
@next_tutorial{tutorial_wayland_ubuntu}
![hardwares](images/realsense.jpg)
@@ -8,3 +8,4 @@ Application utils (highgui, imgcodecs, videoio modules) {#tutorial_table_of_cont
- @subpage tutorial_kinect_openni
- @subpage tutorial_orbbec_astra
- @subpage tutorial_intelperc
- @subpage tutorial_wayland_ubuntu
@@ -621,6 +621,7 @@ Following build options are utilized in `opencv_contrib` modules, as stated [pre
`CMAKE_TOOLCHAIN_FILE`
`WITH_CAROTENE`
`WITH_KLEIDICV`
`WITH_CPUFEATURES`
`WITH_EIGEN`
`WITH_DIRECTX`
@@ -46,10 +46,16 @@ MY_ENV_VARIABLE=true ./my_app
```.py
import os
os.environ["MY_ENV_VARIABLE"] = True
os.environ["MY_ENV_VARIABLE"] = "True" # value must be a string
import cv2 # variables set after this may not have effect
```
@note This method may not work on all operating systems and/or Python distributions. For example, it works on Ubuntu Linux with system Python interpreter, but doesn't work on Windows 10 with the official Python package. It depends on the ability of a process to change its own environment (OpenCV uses `getenv` from C++ runtime to read variables).
@note See also:
- https://docs.python.org/3.12/library/os.html#os.environ
- https://stackoverflow.com/questions/69199708/setenvironmentvariable-does-not-seem-to-set-values-that-can-be-retrieved-by-ge
## Types