AdamSpannbauer / python_video_stab

A Python package to stabilize videos using OpenCV
https://adamspannbauer.github.io/python_video_stab/html/index.html
MIT License
682 stars 118 forks source link

Support for Jetson Nano #116

Closed gyillikci closed 2 years ago

gyillikci commented 3 years ago

Hi,

When it comes to Jetson Nano/Xavier pip installation can cause problem. I somehow manage to install required dependencies yet, cant make it run the codes snippets.

AdamSpannbauer commented 3 years ago

Could you provide more detail into how it's not working? Is there an error? If yes, what is the error?

gyillikci commented 3 years ago

I created a virtualenv to isolate and install cython in addition to pip install vidstab (because there wasnt cython package available it needs to installed prior to pip install vidstab)

here is my env pip list

(videoStab) nano@nano-desktop:~$ pip list
Package         Version
--------------- ---------
certifi         2020.6.20
cycler          0.10.0
Cython          0.29.21
imutils         0.5.3
kiwisolver      1.3.0
matplotlib      3.3.2
numpy           1.19.2
Pillow          8.0.1
pip             20.2.4
progress        1.5
pyparsing       2.4.7
python-dateutil 2.8.1
setuptools      50.3.2
six             1.15.0
vidstab         1.7.3
wheel           0.35.1

Here is my copy paste code from the readme named stabilization1.py

from vidstab import VidStab

stabilizer = VidStab()
stabilizer.stabilize(input_path=0,output_path='stable_webcam.avi',max_frames=1000,playback=True)

the error is below ; I tried with python3 and python just incase

(videoStab) nano@nano-desktop:~$ python stabilization1.py 
Traceback (most recent call last):
  File "stabilization1.py", line 1, in <module>
    from vidstab import VidStab
ImportError: bad magic number in 'vidstab': b'\x03\xf3\r\n'
(videoStab) nano@nano-desktop:~$ python3 stabilization1.py 
Traceback (most recent call last):
  File "stabilization1.py", line 1, in <module>
    from vidstab import VidStab
ImportError: bad magic number in 'vidstab': b'\x03\xf3\r\n'
AdamSpannbauer commented 3 years ago

I'll be honest in that I don't have experience with this error. Potentially this resource could be helpful.

gyillikci commented 3 years ago

Thanks for the suggestion Adam

After I delete .pyc files I uninstall the package and reinstall it. Now I encountered another issue regarding to csi camera


nano@nano-desktop:~$ python3 stabilization.py 
[ WARN:0] global /home/nvidia/host/build_opencv/nv_opencv/modules/videoio/src/cap_gstreamer.cpp (1757) handleMessage OpenCV | GStreamer warning: Embedded video playback halted; module v4l2src0 reported: Internal data stream error.
[ WARN:0] global /home/nvidia/host/build_opencv/nv_opencv/modules/videoio/src/cap_gstreamer.cpp (886) open OpenCV | GStreamer warning: unable to start pipeline
[ WARN:0] global /home/nvidia/host/build_opencv/nv_opencv/modules/videoio/src/cap_gstreamer.cpp (480) isPipelinePlaying OpenCV | GStreamer warning: GStreamer: pipeline have not been created
VIDEOIO ERROR: V4L2: property frame_count is not supported
VIDEOIO ERROR: V4L: Unable to get camera FPS
Stabilizing |█                               | 3%Gtk-Message: 00:50:08.983: Failed to load module "canberra-gtk-module"
[ERROR:0] global /home/nvidia/host/build_opencv/nv_opencv/modules/videoio/src/cap.cpp (392) open VIDEOIO(GSTREAMER): raised OpenCV exception:

OpenCV(4.1.1) /home/nvidia/host/build_opencv/nv_opencv/modules/videoio/src/cap_gstreamer.cpp:1392: error: (-215:Assertion failed) fps > 0 in function 'open'

[ERROR:0] global /home/nvidia/host/build_opencv/nv_opencv/modules/videoio/src/cap.cpp (392) open VIDEOIO(CV_IMAGES): raised OpenCV exception:

OpenCV(4.1.1) /home/nvidia/host/build_opencv/nv_opencv/modules/videoio/src/cap_images.cpp:253: error: (-5:Bad argument) CAP_IMAGES: can't find starting number (in the name of file): stable_webcam.avi in function 'icvExtractPattern'

[ERROR:0] global /home/nvidia/host/build_opencv/nv_opencv/modules/videoio/src/cap.cpp (392) open VIDEOIO(CV_MJPEG): raised OpenCV exception:

OpenCV(4.1.1) /home/nvidia/host/build_opencv/nv_opencv/modules/videoio/src/cap_mjpeg_encoder.cpp:436: error: (-215:Assertion failed) fps >= 1 in function 'open'

Any approach to solve this issue?

Tetsujinfr commented 2 years ago

@gyillikci , if you use a CSI camera, I think you should use gstreamer to access it with opencv. just a hint. But I think your error has nothing to do with this repo, I suggest you close this issue. There is nothing in this repo which is hardware specific, and it should definitely work on jetson, provided your opencv install is legit on the jetson.