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/05/blog-post_7.html
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
↧