The 365 Data Science team is proud to invite you to our own community forum. A very well built system to support your queries, questions and give the chance to show your knowledge and help others in their path of becoming Data Science specialists.
Ask
Anybody can ask a question
Answer
Anybody can answer
Vote
The best answers are voted up and moderated by our team

CAPSTONE FINAL PYTHON BOOTCAMP PROJECT

CAPSTONE FINAL PYTHON BOOTCAMP PROJECT

0
Votes
1
Answer

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 Answer

365 Team
0
Votes

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