0

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()
Jeru Luke
  • 20,118
  • 13
  • 80
  • 87
Xavi
  • 127
  • 1
  • 1
  • 9
  • What makes you think this is from matplotlib? It's a common error with opencv, e.g. https://stackoverflow.com/q/40273663/4799172 – roganjosh Nov 12 '17 at 22:00
  • On further investigation, there could also be some issues with your python installation. Without further details to help you, you should Google that specific error code and try and narrow down your issue from there. But I imagine removing the matplotlib import will not make the error go away, I'm not sure why you singled that module out from the 3 that you import; please provide details. – roganjosh Nov 12 '17 at 22:03
  • Thanks for response @roganjosh (who was a great character from a favourite 1990's comic series Revolver :-). I think openCV is fine as I have it working in the same Python distribution with different code. Calls to videocapture work etc). Also, code will fire before import to the matplotlib module but not after Print() statements etc. – Xavi Nov 12 '17 at 22:22
  • Without showing us 'the code', you're leaving us to guess. Try trimming this down to the shortest possible snipped that demonstrate the problem, then post that. – Dave W. Smith Nov 13 '17 at 04:28

0 Answers0