Skip to main content

User interface library for visiongraph projects.

Project description

Visiongraph UI

User interface library for visiongraph projects. The idea behind this project is to create a structure for computer vision applications. The idea is to have a configuration, app and graph. And if needed a window.

Example

Configuration

class DemoConfig:
    def __init__(self):
        container = ContainerHelper(self)

        # non-ui bound settings
        with container.section("Test"):
            self.enable_input = DataField(False) | ui.Boolean("Enable") | Argument(help="Enable input.")

Application

class DemoApp(VisiongraphApp[vg.VisionGraph, DemoConfig]):
    def __init__(self, config: DemoConfig):
        super().__init__(config)

    def create_graph(self) -> vg.Visiongraph:
        graph = DemoGraph().create_graph(vg.VideoCaptureInput())
        graph.multi_threaded = True
        return graph

Graph

class DemoGraph:
    def __init__(self):
        self.on_frame_ready: Event[np.ndarray] = Event()
        self.graph: Optional[vg.VisionGraph] = None

    def _on_frame_ready(self, frame: np.ndarray) -> np.ndarray:
        self.on_frame_ready(frame)
        return frame

    def create_graph(self, input_device: vg.BaseInput) -> vg.VisionGraph:
        self.graph = (
            vg.create_graph(name="Demo Graph", input_node=input_device, multi_threaded=True)
            .then(vg.custom(self._on_frame_ready))
            .build()
        )
        return self.graph

Window

class DemoWindow(VisiongraphUserInterface[DemoApp, DemoConfig]):
    def __init__(self, app: DemoApp):
        super().__init__(app)

Usage

def main():
    config = DemoConfig()
    app = DemoApp(config)

    with UIContext():
        window = DemoWindow(app)

About

This is a first draft of the library and the api will change in future release.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

visiongraph_ui-0.2.0-py3-none-any.whl (10.8 kB view details)

Uploaded Python 3

File details

Details for the file visiongraph_ui-0.2.0-py3-none-any.whl.

File metadata

File hashes

Hashes for visiongraph_ui-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 2c1f75cff2599d35a81076215ab0f0c12a7e5f90762740709146fa713b3901be
MD5 8899883c65519271b0ae6e41d1a0140a
BLAKE2b-256 2ce210395a07c84fc1ca35e2e6ad8ff9b4d61a1d449095a46637d334d411c82a

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page