BrokenSource / DepthFlow

🌊 Image to β†’ 2.5D Parallax Effect Video. A Free and Open Source ImmersityAI alternative
https://brokensrc.dev
GNU Affero General Public License v3.0
323 stars 21 forks source link

Can't select input image through comandline or file selection dialog #6

Closed Kukulkano closed 7 months ago

Kukulkano commented 7 months ago

Thanks for this nice project.

Sadly, I always get this mountain rendered but did not manage to set my own input image. If using drag&drop to the preview, I can make it work, but then I get no rendered output file.

I tried using -i or --image, but this gives me error that I should check help. The help page does not tell me how to set the input image.

$ broken depthflow -i DoA_DiamondValley.jpg
...
Usage: main [OPTIONS] COMMAND1 [ARGS]... [COMMAND2 [ARGS]...]...                                                                                     

No help provided
...

I then tried with parallax:

$ broken depthflow parallax -i DoA_DiamondValley.jpg
Exception in thread Thread-2 (__parallax__):
Traceback (most recent call last):
  File "/usr/lib64/python3.11/threading.py", line 1038, in _bootstrap_inner
    self.run()
  File "/usr/lib64/python3.11/threading.py", line 975, in run
    self._target(*self._args, **self._kwargs)
  File "/home/volker/dummy/BrokenSource/Projects/DepthFlow/DepthFlow/DepthFlow.py", line 40, in __parallax__
    self.__load_depth__ = BrokenUtils.load_image(depth or self.mde(image, cache=cache))
                                                          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/volker/dummy/BrokenSource/Projects/DepthFlow/DepthFlow/Modules/DepthFlowMDE.py", line 46, in __call__
    image_hash = hashlib.md5(image.tobytes()).hexdigest()
                             ^^^^^^^^^^^^^
AttributeError: 'NoneType' object has no attribute 'tobytes'

Is there something I missed or doing wrong?

I also do not get any file selection dialog opening up like the github page is saying? It just starts with the mountains.

I'm on OpenSUSE LEAP 15.5 x86_64 with most recent updates.

Tremeschin commented 7 months ago

Try giving it a relative path or an absolute path as in broken depthflow parallax --image ./filename.png main -r ...

The parallax is a sub command of the DepthFlow's ShaderFlow scene, its main command is executed by default that only deals with rendering or exporting options, so depthflow -i doesn't exist. I could try hot patching the main function arguments, just never tried its feasibility, will keep in mind

As why the error, the run project command poetry run main (args) is executed with the working directory on some other project's root folder, so Python probably looked to that file on the wrong path, not on the monorepo where the file is

A workaround is to expand relative paths to absolute paths, which happens on the late initialization of the monorepo package

Thanks for the feedback!

Will improve the help string asking for relative paths or think if it's safe/safer way to expanding anything if the path exists

Kukulkano commented 7 months ago

Thanks. The subcommand structure was not clear to me in the beginning. I made it work like this now:

broken depthflow parallax -i ./input.jpg main -o ./output.mp4 -f 25 -t 30

It successfully renders a movie file output.mp4 with 30 sec duration and 25 frames per second.

Thanks again for this nice project.

BTW, please consider adding uninstall information to your readme.md as I currently don't know where all that stuff, downloaded during installation, went to... If I finished my project I surely want t remove it and then I don't know how and where.

Tremeschin commented 7 months ago

Great! πŸ‘

I thought today about how to fix/make it better the issue you faced, found a nice way to handle relative paths, which I haven't commited yet but tomorrow

Now, every project that imports the main monorepo package changes its directory immediately to the path the shell was when the manager script was run, it doesn't hurt any functionality and using broken depthflow parallax -i image.png main without relative paths works now, as the shell is always where you ran the initial command


BTW, please consider adding uninstall information to your readme.md as I currently don't know where all that stuff, downloaded during installation, went to... If I finished my project I surely want t remove it and then I don't know how and where.

Good idea! I've been wanting to make these optional or remove them for a while, they're mostly left-overs of some earlier ideas which didn't scale well or found better solutions

I'll make the shortcut optional on *nix (I use it every time), and remove the old idea to have the init script symlink under ~/.local/bin/brakeit.py, didn't prove useful to me

The other scripts plus Python's packages are installed on the Poetry's managed virtual environment, under ~/.cache/pypoetry/virtualenvs

So, these are the directories plus ~/.local/share/applications/Broken.desktop to remove if you want to uninstall everything πŸ‘

I'll add a uninstall command to remove any managed known project's venv and the .desktop file on *nix, for completeness as you suggested

Thanks!

Tremeschin commented 7 months ago

Oh, and --, forgot to mention, ~/.local/share/BrokenSource/* for projects workspace directory, will also ask if it should be deleted on the future uninstall command

Tremeschin commented 7 months ago

Life has given me a day mostly without electrical power 🫠

Just commited the fixes and changes I mentioned, broken uninstall now exists to selectively delete venvs; yours original command should work without relative paths now as well !

Kukulkano commented 7 months ago

Thank you! Great quick response and a great project.