Commit Graph

41 Commits (ec32a08e2b2a297372dd3bdbb966507272a243d2)

Author SHA1 Message Date
hithereai 1b9301d82f p 2023-05-21 17:20:47 +03:00
kabachuha 47f7140c4d Revert "add license notices"
This reverts commit 37504733b4.
2023-05-20 11:46:21 +03:00
kabachuha 4b07029029 Revert "change contact notices the discord server"
This reverts commit dc0031e1ac.
2023-05-20 11:46:16 +03:00
kabachuha dc0031e1ac change contact notices the discord server 2023-05-20 01:26:40 +03:00
kabachuha 37504733b4 add license notices 2023-05-20 01:21:16 +03:00
hithereai 8884842589 CLEAN 2023-05-19 20:45:31 +03:00
hithereai 11adf08a04 add critical comments 2023-05-19 20:30:07 +03:00
hithereai 489193a2e9 is instead of == none 2023-05-19 20:28:24 +03:00
reallybigname f39acbf486 fixed frames for 0-based counting in inputframes
also removed the stupid switching behavior for max frames when using a mask??? wtf
2023-05-08 13:41:13 -07:00
hithereai f4bc6cd176 remove unused import 2023-05-08 00:21:21 +03:00
reallybigname 03f54a3768 FIXED optical flow cadence
Properly normalized the optical flow field before warping and after warping based on width and height.  Now, because the range of the values are between -1 and 1 (usually much smaller), the flow doesn't get corrupted by the grid_sample for 3D or the warpPerspective for 2D anymore. So, I was able to remove all workarounds and just fix the abs to rel and rel to abs functions.
2023-05-04 12:37:34 -07:00
hithereai f976c8d2fd reorder imports at hybrid_video.py 2023-04-30 21:26:56 +03:00
reallybigname 352a8fdb07 Consistency flow masks & fixed Frames to Video
added consistency flow masks
- there is now an option to use flow consistency masks and an attached option for consistency mask blur, defaulted to 2.
- if you save extra frames, it also save consistency masks now
- you can see the effect on the flow in the flow outputs as well
- it doesn't work as great with cadence because you see afterimages, but if you up the blur it can be a little better.

fixed Frames to Video
- made the ffmpeg routine that Frames to Video uses able to take image files other than png.  If png, it includes the -vcodec png as normal. But, if anything else it includes vcodec libx264, which works for jpgs. (jpgs don't work if using vcodec png, so I made it switchable). I haven't tested it with other filetypes, but I bet it works with others too. The png vcodec was specific to png.
- also added two more lines of instruction for how to use the file string.

- I also changed a few ransac functions for future use. They work as normal, but now have a switching behavior if passed depth. But, I'm not passing depth to them for now.
- a few minor code var name edits in hybrid video to align code better (mostly changed matrices to M, as is often convention

- commented a bunch of unused imports in render.py
  - I'll leave it up to someone else to delete them after it's verified that everything works fine with them commented.  I searched and didn't find them in that file. VSCode showed them as gray automatically, but I also verified.
2023-04-29 22:37:49 -07:00
hithereai c51e8e085a Merge remote-tracking branch 'upstream/automatic1111-webui' into pr/600 2023-04-22 19:30:46 +03:00
hithereai 303ed858f9 FIX RAFT THAT NEVER WORKED 2023-04-22 19:27:45 +03:00
reallybigname 96e374844e Updates to Hybrid Video & More + Temporary Removal of RAFT
Discovered that RAFT wasn't actually working due to an issue with the function that got the flows.  There was a missing "elif".  So, the RAFT flow would get calculated and stored in the variable 'r', but then 'r' would always be overwritten by the default Farneback at the end.  We were fooling ourselves into thinking that was RAFT, when in actuality the RAFT flow is invalid and causes an error if actually used.
  - Changed function call for flow methods so that this can never happen. Now, each case returns directly.
  - Added to deprecation utils for now. We can remove the RAFT to Farneback conversion when we get RAFT working

Realignment of the way I handled frame indexes in motion routines to align everything more clearly

Major improvement to motion using prev_img during cadence!
  - added a prev_img during cadence so that there is a prev_img to refer to for the flow

Fixed color matching issue with first frame on Image and Video Init modes
  - first frame color match can't be done beforehand, so it's done afterwards. But, that normally makes for a very bad first frame. So, I added a redo for it to clean up the color matched image on first frame.

Major improvement to RANSAC
  - switched to use SIFT for feature matching instead of Lucas-Kanade
  - changed all border_mode to REFLECT_101, which matched how optical flow handled it, removed all the excess silly border_mode translations. This works much better.
2023-04-22 06:22:15 -07:00
hithereai 13b6acbdaf Add RAFT Optical Flow 2023-04-17 21:57:01 +03:00
reallybigname 65f9c3bf19 Made Optical flow cadence work in 2D mode
I figured out a hack to make optical flow cadence work in 2D.  To do optical flow cadence, I have to warp the flow field.  But, the 2D animation warping function, usually used on images, would mess with the values of the flow (as if they were colors).  So, I scaled them down by 1000 going in and scale them back up doing out, and it eliminates the effect it had which would make the image wobble around.

The same scaling actually messes with 3D optical flow cadence, so I leave that working at the normal scale factor.

I also made one modification to 3D optical flow cadence where it temporarily changes the sampling mehod (used by 3d warping function) to 'nearest' just for the flow warping, then restores it to it's previous value. This should help to minimize any pixel effects from warping.
2023-04-15 17:12:41 -07:00
reallybigname b665c36b36 Made overlay_mask work
Overlay mask working properly with static mask or video mask.
- made new masks.py file that we can use to consolidate other mask functions from main render code
- Overlay mask NOW WORKS WITH CADENCE.  I made the function switchable between PIL rgb and np bgr and inject the function during cadence and for normal saves
- I didn't use old code. I just made this work myself.

Fixed one-off issue with hybrid video where the first frame was duplicated. (it became obvious when doing overlay video masking)

re-commented a few lines, removed some whitespace
2023-04-09 03:49:38 -07:00
hithereai 251ccc6f9f add DEBUG_MODE 2023-04-07 18:57:48 +03:00
reallybigname d9457fc442 Changed hybrid_use_init_image feature to work with online images 2023-04-06 09:31:23 -07:00
hithereai a4e4e7ca22 add comments 2023-04-06 16:04:10 +03:00
reallybigname 69990993fe Hybrid Image, new flow factor schedules, optical flow guidance
new option to use init image as hybrid video
- you can use all normal compositing stuff with that mode.
- you can't use optical flow, because it's not a video - but - if there are already video frames in the directory, well - you should be able to still use flow and ransac modes, although I haven't tested that

changed Optical flow redo to a selection of optical flow type with None as default
- added Redo flow factor schedule
- made optical flow redo look nicer by warping the same image that it is using to compare to prev_img, then it goes in for final generation
changed Optical flow cadence to a selection of optical flow type with None as default
- added cadence flow factor schedule

Added flow guidance from last flow
- no UI change - it just works by default with hybrid motion optical flow types. It just uses the last flow as guidance, so it's a minor difference, but a little better temporal coherence on flow

changed hybrid composite to a selection with None as default
- now can set hybrid compositing to Normal (After Motion), Before Motion, or After Generation!
2023-04-05 11:01:54 -07:00
reallybigname e1ddff8747 Hybrid Video Update
- Adds DIS Fine mode, and sets it as the new default
- Optical flow cadence and optical flow redo generation will now use DIS Fine, for pixel accuracy
- Adds flow guidance to hybrid flow. No setting needed, it just happens automatically, assisting the flow calculation by feeding in the last flow.
- Adds flow_factor_schedule for hybrid flow
- reduced some code for bordermode by setting a variable for the cv2 border mode translated from the user setting
2023-03-16 23:32:15 -07:00
reallybigname 3d008badbd Fixed PIL version conflict
- replaced Image,Resampling.LANCZOS with PIL.Image.LANCZOS
- had to add import PIL
- had heard of people on colab encountering this issue. Should fix both hybrid video and image/video color matching.
- tested, works fine locally, so I see no reason not to change
2023-03-16 04:45:39 -07:00
reallybigname 0c8b8e0aff added optical flow cadence
optional checkbox to include optical flow in normal cadence

-starts by getting flow between turbo_prev_image and turbo_next_image.
- after getting the flow, it warps the turbo_next_image with negative flow to match prev
- then, normal image warping during cadence happens
- then it warps the flow field to match the animation, first converting it to relative for warp, then back to absolute flow
- I calculate the flow division for each tween value and divide that by two.
- it then applies that tweened flow to the prev and next image
2023-03-09 08:25:56 -08:00
hithereai 6e255f97c8 align img filenames to be of length 09.extension 2023-03-05 22:30:22 +02:00
kabachuha 285a98f375 fix missed midas_weight in depth predict calls 2023-02-27 12:11:44 +03:00
kabachuha a36a8e6917 Merge branch 'automatic1111-webui' into pr/289 2023-02-02 18:00:28 +03:00
hithereai 642fdc6c33 set UHD=True if input res is 2K or higher 2023-02-02 06:53:37 +02:00
hithereai ab904025e1 Update hybrid_video.py 2023-02-01 03:32:00 +02:00
hithereai aee500f1ce hybrid_vid tiny improvs 2023-02-01 03:30:38 +02:00
hithereai c2d3ea3ca8 rename vid2frames.py to video_audio_utilities.py
more functions coming soon
2023-01-30 16:27:27 +02:00
reallybigname c6168cf4a7 Hybrid Video Update 2
This update fixes remap's border behavior when applying optical flow.
  - I extended the function so it extends borders and recrops.
  - obeys wrap/replicate setting, except that wrap is replaced with reflect101

Removed optical flow options that don't work unless you run contrib version of opencv (SF and DenseRLOF)
  - functions remain for possible future use if I can figure out how to run both opencv's.

Added 'DIS Medium' optical flow, which a dense flow, similar to the two types that we can't run.

Added checkbox control for hybrid_motion_use_prev_img
  - makes all motion, whether ransac or flow, compare against previous rendered frame rather than previous video frame

Added color_coherence_force_grayscale
  - forces grayscale before and after generation, so that color coherence mode can still be used (like color matching against video), but the image will be forced to grayscale. (NOTE: actual image file is still RGB)
2023-01-29 17:15:15 -08:00
hithereai 446e3430a6 Fixes, -1 as default for unlimited frames and more checks 2023-01-16 18:12:14 +02:00
hithereai 9e0ae9ef26 add extract_from_frame and extract_to_frame to input vid options
The current code will always extract all of the input video frames.

This PR adds two new input parameters for extracting an input video:
extract from frame, and extract to frame.

Now we can only test frames 0 to 50, 50 to 100, etc.
2023-01-16 00:56:16 +02:00
hithereai 898a261f32 Minor improvements +
better handling of wrong file/folder names, added function to delete all imgs from a folder (shorter code); now users can generate only the masks again even without having the 'generate_hybrid_frames' button selected
2023-01-15 22:39:47 +02:00
hithereai 5abe55d1d4 Sync fps according to extract_nth_frame and more 2023-01-14 23:10:08 +02:00
hithereai c9fe53b75f use extracted input imgs instead of input vid 2023-01-14 16:55:01 +02:00
hithereai 5d5287d6cf V01 of human masking 2023-01-14 15:49:52 +02:00
reallybigname cc52c96a61 Hybrid Video Compositing - 3D working 2D broken
First commit. 3D mode works
2023-01-04 06:35:51 -08:00