Ask Your Question
1

TYPE ERROR : expected intiger , got float

asked 2017-01-23 23:56:01 -0600

screen1 gravatar image

updated 2017-01-24 01:04:27 -0600

berak gravatar image

Traceback (most recent call last): File "example.py", line 58, in <module> flow = cv2.calcOpticalFlowFarneback(gray1, gray2,0.5, 3, 15, 2, 5, 1.2, 0) # calculating the flow between gray1 and gray2 using gunner farneback algorithm TypeError: integer argument expected, got float

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted
1

answered 2017-01-24 01:21:57 -0600

berak gravatar image

updated 2017-01-24 08:05:38 -0600

if you do a :

 >>> help(cv2.calcOpticalFlowFarneback)
Help on built-in function calcOpticalFlowFarneback:

calcOpticalFlowFarneback(...)
    calcOpticalFlowFarneback(prev, next, flow, pyr_scale, levels, winsize, iterations, poly_n, poly_sigma, flags) -> flow

in the python repl, you can see the signature.

so, the problem, seems the flow param, you have to use None, like in the tutorial,

flow = cv2.calcOpticalFlowFarneback(gray1, gray2, None, 0.5, 3, 15, 2, 5, 1.2, 0)
edit flag offensive delete link more

Comments

1

Thank you very much for the kind reply. I got the following error after executing the instruction:

File "example.py", line 61, in <module> flow=cv2.calcOpticalFlowFarneback(gray1, gray2, pyr_scale=0.5, levels=3, winsize=15, iterations=2, poly_n=5, poly_sigma=1.2, flags=0) TypeError: Required argument 'flow' (pos 3) not found

screen1 gravatar imagescreen1 ( 2017-01-24 04:52:31 -0600 )edit

yes, you're right, see edit ^^

berak gravatar imageberak ( 2017-01-24 08:06:17 -0600 )edit

I am Sorry , unable to catch you what you are commented, can you please elaborate it. thank you in advance

screen1 gravatar imagescreen1 ( 2017-01-25 03:01:19 -0600 )edit

finally I got Solution sir thank you but I want to know the instruction for read image which we generated images in the same directory Please help me Thank you in advance

screen1 gravatar imagescreen1 ( 2017-01-25 03:05:54 -0600 )edit

Question Tools

1 follower

Stats

Asked: 2017-01-23 23:56:01 -0600

Seen: 2,985 times

Last updated: Jan 24 '17