我是新来的,我需要你的帮助!!!! 我正在制作一个项目(我的学校的手势识别),所以未读的图像就是我的手。我想在点之间找到角度(链码)
提前谢谢你:)
import cv2
import cv2.cv as cv
import numpy as np
# Create display windows
cv2.namedWindow("input", cv.CV_WINDOW_AUTOSIZE)
cv2.namedWindow("output", cv.CV_WINDOW_AUTOSIZE)
# Parameters
blur_ksize = 5
thresh_Tlower = 100
kernel = np.ones((5,5),np.uint8)
# Imread the image
img = cv2.imread ("0_dani_mask.png",0)
# Funding the contours of the hand
contours, hierarchy = cv2.findContours(img.copy(), cv2.RETR_TREE, cv.CV_CHAIN_APPROX_NONE)
# contour = the biggest (area)
big_contour = contours[0]
num_points_cnt = len( big_contour )
print "num_points_cnt = ", num_points_cnt
theta = np.zeros( num_points_cnt, np.uint8 )
P0 = big_contour[0]
x0 = P0[0,0]
y0 = P0[0,1]
for n in range( 1, num_points_cnt ):
P = big_contour[n]
x = P[0,0]
y = P[0,1]
dX = x - x0
dY = y - y0
angulo = np.arctan( dY/dX )
theta[n] = angulo
x0 = x
y0 = y
P = big_contour[0]
x = P[0,0]
y = P[0,1]
dX = x - x0
dY = y - y0
angulo = np.arctan(dY/dX)
theta[0] = angulo
print theta
该计划告诉我:
num_points_cnt = 2031 [0 0 0 ...,0 0 0] /Users/dani/Desktop/myproject/src/kasksasa.py:47:运行时警告:在int_scalars中遇到零除 angulo = np.tanh(dY / dX)
答案 0 :(得分:0)
要查找给定RewriteEngine on
RewriteRule ^about/$ about.php [NC,L]
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\\ /about\\.php [NC]
RewriteRule ^about.php$ /about-us/ [L,R=301]
和dY
的角度,请使用numpy.arctan2(dY, dX)
。它正确处理dX
。