A javascript Error:cv2.error:OpenCv(4.2.0)

asked 2020-06-29 16:21:21 -0500

glrktn gravatar image

updated 2020-06-30 01:22:57 -0500

berak gravatar image

image description

The part of the code that gives error:

import ezdxf
import numpy
import cv2
import argparse #Daha sonra kodu geliştirebilmek için
from flask import request
import sys

fpath = sys.argv[1]
path = r'fpath'



def converter(masked_jpg):
    a= (0,0,0)
    b= (200,200,200)
    doc = ezdxf.new('R2010')
    msp = doc.modelspace() 
    opened_jpg = cv2.imread(fpath)
    masked_jpg = cv2.inRange(opened_jpg, a, b) #Renk aralığı belirlenir
    for i in range(0,masked_jpg.shape[0]):
        for j in range(0,masked_jpg.shape[1]):
            if masked_jpg[i][j] == 255: #Renk siyah olunca
                msp.add_line((j,masked_jpg.shape[0] - i), 
                (j,masked_jpg.shape[0] - i))            
                doc.saveas('output_dxf.dxf')


converter(fpath)
print("oldu")
sys.stdout.flush()

Pls help me!

edit retag flag offensive close merge delete

Comments

python noobs -- they never understand, that loading an image might fail

berak gravatar imageberak ( 2020-06-30 01:03:10 -0500 )edit

try to find out what fpath is, when in doubt, use an absolute path to your image

berak gravatar imageberak ( 2020-06-30 01:21:10 -0500 )edit