How to bring an openCV window to foreground with focus?
http://www.noah.org/wiki/OpenCV_display_window_on_top_with_focus doesn't do anything.
This achieves Topmost, but not Focus:
cv2.imshow('foo', my_2d_numpy_array)
cv2.setWindowProperty('foo', cv2.WND_PROP_TOPMOST, 1)
I'm on macOS.
You can install pyobjc
, import AppKit
and then use the following line before waitKey()
:
AppKit.NSApplication.sharedApplication().activateIgnoringOtherApps_(1)
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.