Giter VIP home page Giter VIP logo

vs-masktools's Introduction

vs-masktools

vs-masktools aims to provide tools and functions to manage, create, and manipulate masks in VapourSynth.

For support you can check out the JET Discord server.

Installation

vs-masktools is available on PyPi and can be installed with this simple command:

pip install vsmasktools

Dependencies

The only hard dependencies are vstools and an installation of VapourSynth R59 or higher. However, for full functionality, you should make sure to also install TCanny, TEdgeMask, AWarpSharp2 and AWarpSharp2SF.

vs-masktools's People

Contributors

dependabot[bot] avatar ichunjo avatar justintarthur avatar lightarrowsexe avatar noizuy avatar setsugennoao avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

vs-masktools's Issues

`squaremark` returns wrong resolution clip when using `akarin`

When creating a mask using squaremask, it will not return a clip in the original resolution, but in the target resolution of the square:

VideoNode
        Format: Gray8
        Width: 1342
        Height: 54
        Num Frames: 1
        FPS: 24000/1001

This issue seems to only crop up when using the akarin expression:

Have aka: True
VideoNode
        Format: Gray8
        Width: 1342
        Height: 54
        Num Frames: 1
        FPS: 24000/1001
Have aka: False
VideoNode
        Format: Gray8
        Width: 1920
        Height: 1080
        Num Frames: 1
        FPS: 24000/1001

This naturally has a domino effect on any functions relying on squaremask, such as replace_squaremask.

API improvements

None of the edge detection classes seem to be taking any arguments for constructors or __init__ calls, so the current need to instantiate all of them in a script becomes somewhat unwieldy and doesn't serve much purpose.
I have two suggestions that could improve the user friendliness of the API in this regard, but perhaps there are other solutions as well.

  1. Provide a (sub)module of instantiated objects for importing. This would allow from vsmask import fdog and fdog.edgedetect(*args), has the benefit of not requiring users to instantiate everything. Might come with more initialization overhead that hits star and direct parent imports rather hard, but __pycache__ should lessen that hit considerably. Vardë's old debanding code provided a similar API, which was nice to work with.
  2. Provide the methods intended to be part of the public API as @staticmethods. This would allow vsmask.edge.FDoG.edgedetect(*args). As a staticmethod, this wouldn't break the current API, as the implicit self argument is never passed. This might require some more code and checks in inheriting classes though, possibly in the form of wrapping the call to super.

There is also the option of making them classmethods, but this would be a backwards-incompatible change as all instances of implicit self become an implicit cls. Breaking backwards compatibility can be mitigated by performing checks on the first argument that allows for dynamically choosing the behavior, but this brings extra runtime overhead to every call made and would most probably result in every cls instance having to be instantiated and called again, doubling the overhead on this API.

I'm personally most partial to suggestion 1, with the pre-instantiated objects being made available either as top-level importable name (from vsmask import fdog), or as part of a single submodule (vsmask.masks.FDoG)

`adg_mask` ignore single-colour frames

It's not uncommon for there to be fully black/white frames at the start/end of sparsely scattered throughout videos. It would be neat if the function could take those into account. See for example:

    from vsmasktools import adg_mask

    clip = clip.std.PlaneStats()  # 16bit clip

    adg = clip.text.FrameProps(), adg_mask(clip, luma_scaling=6)

image
image
image

Especially for something like graining functions, it is often a waste of space to grain these kind of areas.
If this isn't added to adg_mask directly, it would be neat if this could at least be implemented in sized_grain.adaptive() (also maybe add a show_mask param to that xd).

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.