opencv: OpenCV's imshow() suddenly stops updating a content inside the named window

Symptoms

A simple program which consists of two threads:

  • a thread to check console input (like an interactive shell) and
  • a thread to constantly update the image inside the specific named window by keep grabbing image from the device and calling imshow() .

It worked for some frames (maybe 10 or so), but stops updating suddenly without any notification, warning or error logs. It seems imshow() and other process seem working.

Environment

  • Ubuntu 18.04LTS
  • OpenCV 4.4

Solution

Put startWindowThread() before starting threads.

Reason

The official documentation does not provide any information about startWindowThread(), though it plays a very important role especially in GTK environment.

コメント

このブログの人気の投稿

gnuplot: グラフの色を変更する

[Linux] rsyncで進捗を確認する

gnuplotで縦線を引きたい