My quest for an OpenGL accelerated pre-warping tool similar to TGAWarp finally made me start coding, albeit in copy-paste fashion. This tool is cobbled together using code from:
http://www.codeproject.com/ Articles/8739/Extracting-AVI- Frames - for getting frames from AVI
http://nehe.gamedev.net/tutorial/playing_avi_files_in_opengl/23001/ - for playing AVI with OpenGL
http://paulbourke.net/dataformats/meshwarp/ - for the OpenGL drawing code
http://paulbourke.net/miscellaneous/lenscorrection/#opengl - for the OpenGL initializations
https://github.com/pdbourke/vlc-warp-2.1 - for the ReadMesh code.
Other minor pieces are credited in the comments.
The software can be downloaded from GitHub. The source repository is also available, for all those who would like to help in making improvements.
Usage: Open input fisheye avi file when prompted. Preview of warping is shown on the main window. Choose Menu item Avi Generation - choose output warped avi file when prompted. The render runs at approximately 2 fps on my 1.9 GHz Athlon laptop.
Please note the following points, which could be improved etc. The hard-coded parts are commented as such, // hard coded! hack! and so on.
http://www.codeproject.com/
http://nehe.gamedev.net/tutorial/playing_avi_files_in_opengl/23001/ - for playing AVI with OpenGL
http://paulbourke.net/dataformats/meshwarp/ - for the OpenGL drawing code
http://paulbourke.net/miscellaneous/lenscorrection/#opengl - for the OpenGL initializations
https://github.com/pdbourke/vlc-warp-2.1 - for the ReadMesh code.
Other minor pieces are credited in the comments.
The software can be downloaded from GitHub. The source repository is also available, for all those who would like to help in making improvements.
Usage: Open input fisheye avi file when prompted. Preview of warping is shown on the main window. Choose Menu item Avi Generation - choose output warped avi file when prompted. The render runs at approximately 2 fps on my 1.9 GHz Athlon laptop.
Please note the following points, which could be improved etc. The hard-coded parts are commented as such, // hard coded! hack! and so on.
- The current version expects the map file EP_xyuv_1920.map which should be a valid map file, in the same directory as the executable. This is hard coded at the moment. Other valid map files could be put in its place, but I have not tested this.
- The current version uses only AVI for input and output. This could be improved by using FFMPEG as Asaf of Surreyyasoft suggested.
- The dimensions of the output are currently limited by display size. If display size is larger than 1920x1080, like in my case with a laptop monitor and a secondary monitor at 1920x1200, the initial frame size is set to 1920x1080, and output will be at this resolution. If the program is run on a computer with a smaller display, the frame size reduces correspondingly, and so will the output. This could be improved by using FBO etc.
- The progress bar seems to freeze if the application loses focus (if you click on another window etc). But the rendering still goes on without problems.
- Currently there is no way to pause and resume. Aborting also results in a crash.
- Currently, instead of giving an error message, the program takes defaults for input and output. Default input is a file called Face2.avi in a Data sub-directory of the executable directory. Default output is in the active directory - executable directory or input file directory, with the time-stamp as filename.
Output quality seems to be comparable to TGAWarp. Taking sample frames from the excellent show Cosmic Colors from GLPA, which we're currently exhibiting,
Frame generated by GL_warp2Avi:
Similar frame generated by TGAWarp (actually jpgwarper):
Note: 2 GB file limits for input and output files.
Note 2: Workaround using virtualdub as frameserver - then it can use avisynth avs files, which can source image sequences, mp4, mov etc etc.
Note 2: Workaround using virtualdub as frameserver - then it can use avisynth avs files, which can source image sequences, mp4, mov etc etc.
No comments:
Post a Comment