why the image is not showing even after coded correctly without any error???

asked 2019-02-08 09:16:36 -0600

vivekz gravatar image

updated 2019-02-12 12:35:42 -0600

LBerger gravatar image

import cv2

def main():

imgpath="C:\\Users\\vivekz\\Desktop\\ip\\database\\standard_test_images\\lena_gray_512.tif"

img=cv2.imread(imgpath,cv2.IMREAD_GRAYSCALE)
cv2.namedWindow('lena',cv2.WINDOW_NORMAL)
cv2.imshow('lena',img)
cv2.waitKey(0)
cv2.destroyAllWindows

if __name__=="__main__":


    main()
edit retag flag offensive close merge delete

Comments

I removed your image. Pease post your code as text

LBerger gravatar imageLBerger ( 2019-02-08 09:22:11 -0600 )edit

please add this in your code

img=cv2.imread(imgpath,cv2.IMREAD_GRAYSCALE)
if img is None:
    print("Le fichier image ne peut etre lu. Verifier le chemin du fichier")
    print("File cannot be read. Check file path")
    print("Datei kann nicht gelesen werden. Dateipfad überprüfen")
    print("ບໍ່ສາມາດອ່ານໄຟລ໌ໄດ້. ກວດເບິ່ງເສັ້ນທາງໄຟລ໌")
    print("Dosja nuk mund të lexohet. Kontrollo rrugën e skedarit")
    print("Il file non può essere letto. Controlla il percorso del file")
    print("ファイルを読み込めません。 ファイルパスを確認する")
    print("文件无法读取。 检查文件路径")
    print("No se puede leer el archivo. Verifique la ruta del archivo")
LBerger gravatar imageLBerger ( 2019-02-08 10:54:31 -0600 )edit