I am using python 3.5.2 from my Blender Python
directory using PyCharm as IDE.
When I call the Matplotlib
module:
import cv2
from matplotlib import pyplot as plt
import numpy as np
The code exits when I try to import the matplotlib
module with no errors in the console other than:
Process finished with exit code -1073740791 (0xC0000409)
So far as I can tell the modules are up to date:
cycler (0.10.0)
matplotlib (2.1.0)
numpy (1.13.3)
opencv-python (3.3.0)
pip (9.0.1)
pyparsing (2.2.0)
python-dateutil (2.6.1)
pytz (2017.3)
setuptools (36.2.7)
six (1.11.0)
wheel (0.29.0)
With little information from the debugger I am struggling to figure out what is going wrong.
EDIT: I have just ran the same code on a separate Python 3.6.1 installation and it works fine so the problem is definitely with the blender python installation...
Further EDIT: This is the code that runs in my Python 3.6.1 installation which is not working within my Blender Python 3.5.2 installation. Nothing executes after the matplotlib import. I am certainly not a professional programmer and am new to PyCharm. It would be useful for feedback on how to trace the error in the PyCharm debugger.
import cv2
from matplotlib import pyplot as plt
import numpy as np
cap1 = cv2.VideoCapture(1)
cap2 = cv2.VideoCapture(2)
stereo = cv2.StereoBM_create(numDisparities=16, blockSize=15)
while(True):
ret, frame1 = cap1.read()
ret2, frame2 = cap2.read()
cv2.imshow('cam1', frame1)
cv2.imshow('cam2', frame2)
if cv2.waitKey(1) & 0xFF == ord('q'):
left = cv2.cvtColor(frame1, cv2.CV_8UC1)
right = cv2.cvtColor(frame2, cv2.CV_8UC1)
disparity = stereo.compute(left, right)
plt.imshow(disparity, 'Disparity')
plt.show()
break
cap1.release()
cv2.destroyAllWindows()