So i setup OpenCV and python3 on my mac using the guide here: http://www.pyimagesearch.com/2016/12/05/macos-install-opencv-3-and-python-3-5/#comment-427533
In one of his guide, he has an example code:
from __future__ import print_function
import argparse
import cv2
ap = argparse.ArgumentParser()
ap.add_argument("-i", "--image", required = True, help = "From Terminal")
args = vars(ap.parse_args())
image = cv2.imread(args["image"])
cv2.imwrite("./Output/image1.jpg", image)
cv2.imshow("Test_imShow", image)
cv2.waitKey(0)
After i execute it in terminal with
python read_n_write.py --image ./Resource/Me.jpg
while the imwrite function successfully creates a duplicate of the read image, imshow failed to display it in the window. There's no background, just a floating top window bar.
I'm really confused here, after a bit of google, i've tried the suggested solution
cv2.startWindowThread()
cv2.namedWindow("test")
Both won't work, any suggestions would be appreciated, thank you.
Edit 1: Big thanks to api55. I used matplotlib
plt.imshow(canvas, interpolation='nearest')
plt.show()
And it totally worked, still have no idea why cv2.imshow isn't working. So i will leave this question open.