sudheerachary / Mesh-Flow-Video-Stabilization

Online video stabilization using a novel MeshFlow motion model
310 stars 64 forks source link

How I fixed some bugs and ran the code successfully #21

Open Alireza89 opened 3 years ago

Alireza89 commented 3 years ago

I faced some issues when running the code with newer versions of python and OpenCV. This is how I fixed them and managed to run the code successfully: Make the following adjustment in Stabilization.py:

line  23: print(method.__name__+' has taken: '+str(end_time-start_time)+' sec')
line 265: print('Time elapsed: ', str(time.time()-start_time))
line  60: VERTICAL_BORDER = int((HORIZONTAL_BORDER*old_gray.shape[1])/old_gray.shape[0])
line  66: x_paths = np.zeros((int(old_frame.shape[0]/PIXELS), int(old_frame.shape[1]/PIXELS), 1))
line  67: y_paths = np.zeros((int(old_frame.shape[0]/PIXELS), int(old_frame.shape[1]/PIXELS), 1))

Make the following adjustment in MeshFlow.py:

line  43: cols, rows = int(old_frame.shape[1]/PIXELS), int(old_frame.shape[0]/PIXELS)
line  80: x_motion_mesh[key] = x_motion[key]+temp_x_motion[key][int(len(temp_x_motion[key])/2)]
line  85: y_motion_mesh[key] = y_motion[key]+temp_y_motion[key][int(len(temp_y_motion[key])/2)]
LS11111 commented 3 years ago

thank you very much

evertvorster commented 3 years ago

Line 68, is that inserted, or overwriting the old line 68?

LS11111 commented 3 years ago

overwriting

evertvorster commented 3 years ago

So, frame_num = 1 just goes away?

evertvorster commented 3 years ago

Just in case you are wondering, I am writing a PR to apply these changes If you are updating the source now, then the PR won't be necessary

LS11111 commented 2 years ago

I was wrong. I thought you were talking about line 67

evertvorster commented 2 years ago

OK, now I will do the PR, and see if Sudheerarchy wants to merge it. :)

evertvorster commented 2 years ago

The changes are applied in PR #22