doc cv::imshow supports Linux framebuffer and Windows (#155)

This commit is contained in:
nihui
2024-10-22 19:30:00 +08:00
committed by GitHub
parent d9989ed992
commit 1906a37ff4

View File

@@ -26,6 +26,8 @@
:heavy_check_mark: ***NEW FEATURE*** [`cv::putText` supports full-width CJK characters](#cvputtext-supports-full-width-cjk-characters)
:heavy_check_mark: ***NEW FEATURE*** [`cv::imshow` supports Linux framebuffer and Windows](#cvimshow-supports-linux-framebuffer-and-windows)
|opencv 4.10.0 package size|The official opencv|opencv-mobile|
|:-:|:-:|:-:|
|source zip|95.2 MB|8.25 MB|
@@ -542,6 +544,60 @@ int main()
}
```
## `cv::imshow` supports Linux framebuffer and Windows
In Linux, `cv::imshow` can display images on the screen (`/dev/fb0`) via the [Linux Framebuffer API](https://www.kernel.org/doc/html/latest/fb/api.html). `cv::imshow` can work without desktop environment (gnome, KDE Plasma, xfce, etc.) or window manager (X or wayland), making it suitable for embedded scenarios. The first argument to `cv::imshow` must be **`fb`**.
In Windows, `cv::imshow` will use the Windows API to create a simple window for displaying.
<table>
<tr><td>
display image
```cpp
#include <opencv2/core/core.hpp>
#include <opencv2/highgui/highgui.hpp>
int main()
{
cv::Mat bgr = cv::imread("im.jpg", 1);
cv::imshow("fb", bgr);
return 0;
}
```
</td><td>
realtime camera preview
```cpp
#include <opencv2/core/core.hpp>
#include <opencv2/highgui/highgui.hpp>
int main()
{
cv::VideoCapture cap;
cap.set(cv::CAP_PROP_FRAME_WIDTH, 320);
cap.set(cv::CAP_PROP_FRAME_HEIGHT, 240);
cap.open(0);
cv::Mat bgr;
while (1)
{
cap >> bgr;
cv::imshow("fb", bgr);
}
return 0;
}
```
</td></tr>
</table>
# opencv modules included
|module|comment|