Fixed bug and added possibility to use file instead of camera