Guest User

Untitled

a guest
Jan 18th, 2018
93
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.92 KB | None | 0 0
  1. from pathlib import Path
  2. import cv2
  3. 以下の関数を呼び出してくると画像が開けない
  4. #from classfy02 import input_data
  5.  
  6. def main():
  7. parent_path = Path(__file__).parent
  8. path = str(
  9. (parent_path / 'cross.png').resolve()
  10. )
  11.  
  12.  
  13. img = cv2.imread(path)
  14. cv2.namedWindow('screen', cv2.WINDOW_NORMAL)
  15. cv2.setWindowProperty('screen', cv2.WND_PROP_FULLSCREEN,
  16. cv2.WINDOW_FULLSCREEN)
  17. cv2.imshow('screen', img)
  18. cv2.waitKey(1000)
  19.  
  20. if __name__ == '__main__':
  21. main()
  22.  
  23. OpenCV Error: Assertion failed (size.width>0 && size.height>0) in imshow, file /Users/travis/build/skvark/opencv-
  24. python/opencv/modules/highgui/src/window.cpp, line 325
  25. Traceback (most recent call last):
  26. File "path.py", line 15, in <module>
  27. cv2.imshow('screen', img)
  28. cv2.error: /Users/travis/build/skvark/opencv-
  29. python/opencv/modules/highgui/src/window.cpp:325: error: (-215) size.width>0 && size.height>0 in function imshow
Add Comment
Please, Sign In to add comment