Quantcast
Channel: OpenCV Q&A Forum - RSS feed
Viewing all articles
Browse latest Browse all 2088

Sizes of input arguments do not match () in cvCalcOpticalFlowBM

$
0
0
hello i am trying to Implement the opticalflow algorithm with block matching cv.CalcOpticalFlowBM(), but when i run i have error ***OpenCV Error: Sizes of input arguments do not match () in cvCalcOpticalFlowBM, file /home/travis/miniconda/conda-bld/work/opencv-2.4.11/modules/legacy/src/optflowbm.cpp, line 88 Traceback (most recent call last): File "/home/kaos/PycharmProjects/untitled/16*16.py", line 56, in optix = calcOpticalFlow(image,image2 ,'BlockMatching') File "/home/kaos/PycharmProjects/untitled/16*16.py", line 44, in calcOpticalFlow 0, cv.fromarray( opticalFlowArrayX ), cv.fromarray( opticalFlowArrayY ) ) cv2.error*** here is the code i try all day, but didn't find where is the problem thank's ` def calcOpticalFlow( image1, image2, method="BlockMatching" ): storageWidth = image1.shape[0] storageHeight = image1.shape[1] if method == "BlockMatching": opticalFlowArrayX = np.ndarray( ( storageHeight, storageWidth ), dtype=np.float32 ) opticalFlowArrayY = np.ndarray( ( storageHeight, storageWidth ), dtype=np.float32 ) cv.CalcOpticalFlowBM(cv.fromarray(image1),cv.fromarray(image2), (16,16), (5,5), (1,1), 0, cv.fromarray( opticalFlowArrayX ), cv.fromarray( opticalFlowArrayY ) ) return ( opticalFlowArrayX, opticalFlowArrayY ) image = cv2.imread('2.jpg',cv2.CV_LOAD_IMAGE_GRAYSCALE) image2 = cv2.imread('3.jpg',cv2.CV_LOAD_IMAGE_GRAYSCALE) optix,optiy = calcOpticalFlow(image,image2 ,'BlockMatching')`

Viewing all articles
Browse latest Browse all 2088

Trending Articles