mirror of
https://github.com/nihui/opencv-mobile.git
synced 2025-10-04 08:16:25 +08:00
doc cv::imshow
supports Linux framebuffer and Windows (#155)
This commit is contained in:
56
README.md
56
README.md
@@ -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::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|
|
|opencv 4.10.0 package size|The official opencv|opencv-mobile|
|
||||||
|:-:|:-:|:-:|
|
|:-:|:-:|:-:|
|
||||||
|source zip|95.2 MB|8.25 MB|
|
|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
|
# opencv modules included
|
||||||
|
|
||||||
|module|comment|
|
|module|comment|
|
||||||
|
Reference in New Issue
Block a user