0

This simple piece of code is not working.

output = cv2.namedWindow("Output", cv2.WINDOW_AUTOSIZE)
cv2.imshow(output, saliencyMap)
cv2.waitKey(0)

It should show the saliencyMap inside "Output" window but it is generating two windows(below).

I am using spyder editor and also getting this message.

You might be loading two sets of Qt binaries into the same process. Check that all plugins are compiled against the right Qt binaries. Export DYLD_PRINT_LIBRARIES=1 and check that only one set of binaries are being loaded.
QObject::moveToThread: Current thread (0x7fbf1e53c600) is not the object's thread (0x7fbf1e6f0850).
Cannot move to target thread (0x7fbf1e53c600)`

enter image description here

1 Answers1

2

namedWindow is a function and it is void function so it gives nothing as output value. imshow takes string and Mat as input.

Correct one should be:

import cv2

img = cv2.imread('img.png')
cv2.namedWindow("Output", cv2.WINDOW_AUTOSIZE)
cv2.imshow("Output", img)
cv2.waitKey(0)
Yunus Temurlenk
  • 4,085
  • 4
  • 18
  • 39
  • 1
    Thanks! It does the job of merging both instances. `cv.WINDOW_AUTOSIZE` didn't shrink image within the screen window. Used `cv2.WINDOW_NORMAL` and it's working now. – Muhammad Haseeb Khan Jul 14 '20 at 10:31