HOW TO SOLVE THIS ERROR IN A CODE

asked 2019-05-29 03:37:35 -0500

seona gravatar image

updated 2019-05-29 08:53:21 -0500

supra56 gravatar image

code:

import numpy as np
import matplotlib.pyplot as plt
import cv2

img = cv2.imread("foot.jpeg")

blur = cv2.blur(img,(5,10))

rows,cols,ch = img.shape

point=[[170,270],[480,220],[240, 710],[540,650]]

pts1 = np.float32(point)
pts2 = np.float32([[0,0],[210,0],[0,297],[210,297]])

M = cv2.getPerspectiveTransform(pts1,pts2)

dst = cv2.warpPerspective(img,M,(210,297))

plt.subplot(121),plt.imshow(img),plt.title('Input')

plt.plot(*zip(*point), marker='.', color='r', ls='')

plt.subplot(122),plt.imshow(dst),plt.title('Output')

plt.show()

THIS IS MY CODE I WANT TO MAKE A PROGRAM CHECKING MY FOOT-SIZE URL: http://cocoding94.blogspot.com/2017/0... I USE RASPBERRY PI

this is a error :

Traceback (most recent call last): File "foot.py",line 7,in blur = cv2. blur (img,(5,10)) cv2.error:OpenCV(3.4.3) /home/pi/opencv/opencv-3.4.3/modules/core/src/matrix.cpp:756: error: (-215:Assertion failed) dims <=2 && step[0] > 0 in function 'locateROI'

Thanks

edit retag flag offensive close merge delete

Comments

your image was never read. you have to check, before you can go on.

berak gravatar imageberak ( 2019-05-29 04:19:45 -0500 )edit