簡単なジェスチャ検出を作成するためにオブジェクト トラッキングに関するいくつかのチュートリアルを使用していますが、新しいAPIで関数または同等の機能GetSpatialMoment
を見つけるのに苦労しています。GetCentralMoment
cv2
チュートリアル コードは常に次のようになりますが、常に古い cv1 になっています。
moments = cv.Moments(thresholded_img, 0)
area = cv.GetCentralMoment(moments, 0, 0)
#there can be noise in the video so ignore objects with small areas
if(area > 100000):
#determine the x and y coordinates of the center of the object
#we are tracking by dividing the 1, 0 and 0, 1 moments by the area
x = cv.GetSpatialMoment(moments, 1, 0)/area
y = cv.GetSpatialMoment(moments, 0, 1)/area
これにはどのような新しいcv2
機能を使用する必要がありますか?