Last answered:

14 Apr 2020

Posted on:

04 Apr 2020

0

CAPSTONE FINAL PYTHON BOOTCAMP PROJECT

THIS IS MY CODE:   import numpy as np import cv2   img = cv2.imread('C:\\Users\\patir\\OneDrive\\Documentos\\-- 365 Data Science\\PYTHON PROGRAMMER BOOTCAMP\\capstone_coins.png',cv2.IMREAD_GRAYSCALE) original_image = cv2.imread('capstone_coins.png',1) img = cv2.GaussianBlur(img, (5,5), 0) cv2.imshow('DetectedCoins',original_image) cv2.waitKey(0) cv2.destroyAllWindows()   THIS IS THE ERROR I AM GETTING:   Windows PowerShell
Copyright (C) Microsoft Corporation. Todos los derechos reservados. Prueba la nueva tecnología PowerShell multiplataforma https://aka.ms/pscore6 PS C:\Users\patir> conda activate opencv
PS C:\Users\patir> & C:/Users/patir/anaconda3/envs/opencv/python.exe "c:/Users/patir/OneDrive/Documentos/-- 365 Data Science/PYTHON PROGRAMMER BOOTCAMP/opencv.py"
Traceback (most recent call last):
File "c:/Users/patir/OneDrive/Documentos/-- 365 Data Science/PYTHON PROGRAMMER BOOTCAMP/opencv.py", line 7, in <module>
cv2.imshow('DetectedCoins',original_image)
cv2.error: OpenCV(4.0.1) C:\ci\opencv-suite_1573470242804\work\modules\highgui\src\window.cpp:352: error: (-215:Assertion failed) size.width>0 && size.height>0 in function 'cv::imshow'
1 answers ( 0 marked as helpful)
Instructor
Posted on:

14 Apr 2020

0
Hi Patricia,  are you sure you've specified the correct path to your image? Could you try having the image in the same folder as your Jupyter Notebook, to remove the need to add a folder path.  If not, make sure you use '/' instead of '\', when you type in the directory path.   Best,  Eli

Submit an answer