This is probably one of the strangest errors that I have ever ran into when using OpenCV. There is a lot going on, so let me try to explain this to the best of my ability.>
Wrong
imagePath = os.path.dirname(__file__) + "/1.jpg"
Right
from os.path import abspath, join, dirname imagePath = abspath( join(dirname(__file__), "1.jpg") )