1
import cv2
img = cv2.imread('316.jpg', 1)
cv2.imshow('img', img)

That's it, the minimal complete program. All the examples I've seen on the net don't do anything before doing the imshow. On running it, I get ...

(py_env_lib) neil@i5 ~/Documents/slides $ python equalise.py
QObject::moveToThread: Current thread (0x17ecab0) is not the object's thread (0x1927630).
Cannot move to target thread (0x17ecab0)

Segmentation fault

If I comment out the cv2.imshow line, openCV works. I can even go on to do complicated processing, and write the image out to a new file.

I'm using Linux Mint 18 MATE 64 bit, with a 4.4.0-146-generic kernel, on a quad core i5, with python 3.5.2 installed in a virtual environment, with openCV 3.3.0.

How do I start trying to debug a seg fault?

It's a fairly 'clean' linux system, because I'm timid, and still don't really know what I'm doing after coming to Mint from XP, everything has been downloaded using the standard package manager. However there are some oddities, like I use KCalc rather than the buggy Gnome version that comes with Mint, and I was surprised how many dependencies came down with that, which could conceivably have messed up something under the hood.

Neil_UK
  • 1,043
  • 12
  • 25
  • Have you looked at [this](https://stackoverflow.com/questions/52337870/python-opencv-error-current-thread-is-not-the-objects-thread) and [this](https://github.com/skvark/opencv-python/issues/46)? – eshirima Apr 30 '19 at 20:01
  • @eshirima I should have searched for the error message contents, like 'thread' would have helped in there. I was fooling around recently with some viewers that pulled in various versions of Qt, which have no doubt complicated things. Your second link has a number of simple things to try before giving up, I'm not going to be building anything from source. I've got good backups going, so I may yet nuke from orbit and start again with a clean system. – Neil_UK May 01 '19 at 07:30

0 Answers0