Python TypeError:src不是numpy数组

Python TypeError:src不是numpy数组,python,opencv,numpy,Python,Opencv,Numpy,显示错误 回溯(最近一次呼叫最后一次): 你应该做: morphOps(np.array(list(threshold))) 为什么在as列表中传递阈值?您可能应该这样做:morphOps(np.array(list(threshold))@user3804674您检查了下面的答案了吗? import cv2 import numpy as np H_MIN = 0; H_MAX = 256; S_MIN = 0; S_MAX = 256; V_MIN = 0; V_MAX =

显示错误

回溯(最近一次呼叫最后一次):

你应该做:

morphOps(np.array(list(threshold)))

为什么在as列表中传递阈值?您可能应该这样做:
morphOps(np.array(list(threshold))
@user3804674您检查了下面的答案了吗?
import cv2 

import numpy as np

H_MIN = 0;
H_MAX = 256; 
S_MIN = 0;
S_MAX = 256;  
V_MIN = 0;  
V_MAX = 256;

def morphOps(thresh):     
    #create structuring element that will be used to "dilate" and "erode" image.
    #the element chosen here is a 3px by 3px rectangle

    erodeElement = cv2.getStructuringElement( cv2.MORPH_RECT, (3,3));
    #dilate with larger element so make sure object is nicely visible
    dilateElement = cv2.getStructuringElement( cv2.MORPH_RECT,(8,8));

    cv2.erode(thresh,thresh,erodeElement);
    cv2.erode(thresh,thresh,erodeElement);

    cv2.dilate(thresh,thresh,dilateElement);
    cv2.dilate(thresh,thresh,dilateElement);

videoCapture = cv2.VideoCapture('E:/Intern MNIT(gait motions)/Sample video.mp4')
fps = videoCapture.get(cv2.cv.CV_CAP_PROP_FPS)
print 'Frame per seconds :'; print fps
while 1 :
     _,cameraFeed = videoCapture.read()    
     HSV = cv2.cvtColor(cameraFeed,cv2.COLOR_BGR2HSV);  

     # define range of color in HSV 
     lower = np.array([0,0,0])
     upper = np.array([256,256,256])

     #thresholding image
     threshold = cv2.inRange(HSV,lower,upper)

     morphOps([threshold])
morphOps(np.array(list(threshold)))