sudheerachary / Mesh-Flow-Video-Stabilization

Online video stabilization using a novel MeshFlow motion model
315 stars 65 forks source link

list index out of range #1

Closed darkratio closed 6 years ago

darkratio commented 6 years ago

hi there, when I am trying to run the code after installing all the prerequisites, it shows me this error. please help me out.!!

/home/darkratio/.virtualenvs/cv/lib/python3.5/importlib/_bootstrap.py:222: RuntimeWarning: numpy.dtype size changed, may indicate binary incompatibility. Expected 96, got 88 return f(*args, *kwds) /home/darkratio/.virtualenvs/cv/lib/python3.5/importlib/_bootstrap.py:222: RuntimeWarning: numpy.dtype size changed, may indicate binary incompatibility. Expected 96, got 88 return f(args, **kwds) Traceback (most recent call last): File "Stabilization.py", line 248, in file_name = sys.argv[1]

sudheerachary commented 6 years ago

How did you run the stabilizer ? Did you pass video_file_path as a command line argument ?

darkratio commented 6 years ago

sorry for so late reply, yes i pass the video file path later and it worked but again encountered with another error.

OpenCV Error: Assertion failed (scn == 3 || scn == 4) in cvtColor, file /io/opencv/modules/imgproc/src/color.cpp, line 11111 Traceback (most recent call last): File "Stabilization.py", line 254, in x_motion_meshes, y_motion_meshes, x_paths, y_paths = read_video(cap) File "Stabilization.py", line 21, in timed result = method(*args, **kwargs) File "Stabilization.py", line 78, in read_video frame_gray = cv2.cvtColor(frame, cv2.COLOR_BGR2GRAY) cv2.error: /io/opencv/modules/imgproc/src/color.cpp:11111: error: (-215) scn == 3 || scn == 4 in function cvtColor

sudheerachary commented 6 years ago

Is that an RGB or Grayscale video ?

darkratio commented 6 years ago

its RGB video

darkratio commented 6 years ago

it runs for 254 frames and then stops every time at 99% just for 2 frames it turns false.

sudheerachary commented 6 years ago

Is it storing the video till 254 frames or no ?

darkratio commented 6 years ago

no, it truncates and shows the above error.

sudheerachary commented 6 years ago

I couldn't exactly figure out what the problem, but is this happening with every video ? Did you try multiple videos ?

darkratio commented 6 years ago

yeah, it's happening with every video I tried, it's showing the same error every time I run, please help me out in this.

cv2.error: /io/opencv/modules/imgproc/src/color.cpp:11111: error: (-215) scn == 3 || scn == 4 in function cvtColor

darkratio commented 6 years ago

this is the exact error which it shows now:

/home/darkratio/.virtualenvs/cv/lib/python3.5/importlib/_bootstrap.py:222: RuntimeWarning: numpy.dtype size changed, may indicate binary incompatibility. Expected 96, got 88 return f(*args, kwds) /home/darkratio/.virtualenvs/cv/lib/python3.5/importlib/_bootstrap.py:222: RuntimeWarning: numpy.dtype size changed, may indicate binary incompatibility. Expected 96, got 88 return f(*args, *kwds) OpenCV Error: Assertion failed (scn == 3 || scn == 4) in cvtColor, file /io/opencv/modules/imgproc/src/color.cpp, line 11111 Traceback (most recent call last): File "Stabilization.py", line 257, in x_motion_meshes, y_motion_meshes, x_paths, y_paths = read_video(cap) File "Stabilization.py", line 21, in timed result = method(args, kwargs) File "Stabilization.py", line 52, in read_video old_gray = cv2.cvtColor(old_frame, cv2.COLOR_BGR2GRAY) cv2.error: /io/opencv/modules/imgproc/src/color.cpp:11111: error: (-215) scn == 3 || scn == 4 in function cvtColor

sudheerachary commented 6 years ago

Sorry for late reply, I never tested this on python3.x environment, Can you try this in python2.x environment. Not sure if it works. Will check code if even that doesn't workout.

darkratio commented 6 years ago

can you please tell me which OpenCV version you used?

darkratio commented 6 years ago

I tried with python2.7 also but the error is still the same

LeoSeinThanKyaw commented 6 years ago

when I am trying to run the Stabilization.py , I get the following error

Traceback (most recent call last): File "D:\@My Thesis\Python\Video Stabilization\Own\Mesh-Flow-Video-Stabilization-master\Mesh-Flow-Video-Stabilization-master\src\Stabilization.py", line 258, in x_motion_meshes, y_motion_meshes, x_paths, y_paths = read_video(cap) File "D:\@My Thesis\Python\Video Stabilization\Own\Mesh-Flow-Video-Stabilization-master\Mesh-Flow-Video-Stabilization-master\src\Stabilization.py", line 21, in timed result = method( *args,**kwargs) File "D:\@My Thesis\Python\Video Stabilization\Own\Mesh-Flow-Video-Stabilization-master\Mesh-Flow-Video-Stabilization-master\src\Stabilization.py", line 67, in read_video x_paths = np.zeros((old_frame.shape[0]/PIXELS, old_frame.shape[1]/PIXELS, 1)) TypeError: 'float' object cannot be interpreted as an integer

"I trying to solve but I can't. Please help me

darkratio commented 6 years ago

x_paths = np.zeros(old_frame.shape[0]//PIXELS, old_frame.shape[1]//PIXELS, 1) or x_paths = np.zeros(int(old_frame.shape[0]/PIXELS), int(old_frame.shape[1]/PIXELS, 1))

this should solve your problem

when I am trying to run the Stabilization.py , I get the following error

Traceback (most recent call last): File "D:@my Thesis\Python\Video Stabilization\Own\Mesh-Flow-Video-Stabilization-master\Mesh-Flow-Video-Stabilization-master\src\Stabilization.py", line 258, in x_motion_meshes, y_motion_meshes, x_paths, y_paths = read_video(cap) File "D:@my Thesis\Python\Video Stabilization\Own\Mesh-Flow-Video-Stabilization-master\Mesh-Flow-Video-Stabilization-master\src\Stabilization.py", line 21, in timed result = method( *args,**kwargs) File "D:@my Thesis\Python\Video Stabilization\Own\Mesh-Flow-Video-Stabilization-master\Mesh-Flow-Video-Stabilization-master\src\Stabilization.py", line 67, in read_video x_paths = np.zeros((old_frame.shape[0]/PIXELS, old_frame.shape[1]/PIXELS, 1)) TypeError: 'float' object cannot be interpreted as an integer

"I trying to solve but I can't. Please help me

ahmedAlmasri commented 4 years ago

Sorry for late reply, I never tested this on python3.x environment, Can you try this in python2.x environment. Not sure if it works. Will check code if even that doesn't workout.

I'm trying it on python 2.x but this issue still exists I'm using the example video in the data folder shaky-5.avi