{"id":16221525,"url":"https://github.com/simleek/displayarray","last_synced_at":"2025-10-27T13:02:16.322Z","repository":{"id":47809111,"uuid":"115299300","full_name":"SimLeek/displayarray","owner":"SimLeek","description":"A OpenCV interface to display tensors, multiple cameras, and so on.","archived":false,"fork":false,"pushed_at":"2024-08-10T00:55:13.000Z","size":33148,"stargazers_count":12,"open_issues_count":9,"forks_count":3,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-02-27T00:11:42.883Z","etag":null,"topics":["display-tensors","numpy","python","pytorch","tensorflow","video","webcam"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/SimLeek.png","metadata":{"files":{"readme":"README.rst","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2017-12-25T02:24:18.000Z","updated_at":"2024-03-13T00:54:50.000Z","dependencies_parsed_at":"2024-03-04T01:24:49.658Z","dependency_job_id":"66c0f626-f169-4b8e-aaea-282234f6fb0f","html_url":"https://github.com/SimLeek/displayarray","commit_stats":{"total_commits":215,"total_committers":5,"mean_commits":43.0,"dds":"0.051162790697674376","last_synced_commit":"ddc97b92335abbbf831b51eceb015b398ce0ce9f"},"previous_names":["simleek/cv_pubsubs"],"tags_count":14,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SimLeek%2Fdisplayarray","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SimLeek%2Fdisplayarray/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SimLeek%2Fdisplayarray/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SimLeek%2Fdisplayarray/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/SimLeek","download_url":"https://codeload.github.com/SimLeek/displayarray/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243718839,"owners_count":20336590,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["display-tensors","numpy","python","pytorch","tensorflow","video","webcam"],"created_at":"2024-10-10T12:08:27.441Z","updated_at":"2025-10-27T13:02:16.317Z","avatar_url":"https://github.com/SimLeek.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"displayarray\n============\n\nA library for displaying arrays as video in Python.\n\nDisplay arrays while updating them\n----------------------------------\n\n.. figure:: https://i.imgur.com/UEt6iR6.gif\n   :alt: \n\n::\n\n    from displayarray import display\n    import numpy as np\n\n    arr = np.random.normal(0.5, 0.1, (100, 100, 3))\n\n    with display(arr) as d:\n        while d:\n            arr[:] += np.random.normal(0.001, 0.0005, (100, 100, 3))\n            arr %= 1.0\n\nRun functions on 60fps webcam or video input\n--------------------------------------------\n\n|image0|\n\n(Video Source: https://www.youtube.com/watch?v=WgXQ59rg0GM)\n\n::\n\n    from displayarray import display\n    import math as m\n\n    def forest_color(arr):\n        forest_color.i += 1\n        arr[..., 0] = (m.sin(forest_color.i*(2*m.pi)*4/360)*255 + arr[..., 0]) % 255\n        arr[..., 1] = (m.sin((forest_color.i * (2 * m.pi) * 5 + 45) / 360) * 255 + arr[..., 1]) % 255\n        arr[..., 2] = (m.cos(forest_color.i*(2*m.pi)*3/360)*255 + arr[..., 2]) % 255\n\n    forest_color.i = 0\n\n    display(\"fractal test.mp4\", callbacks=forest_color, blocking=True, fps_limit=120)\n\nDisplay tensors as they're running through TensorFlow or PyTorch\n----------------------------------------------------------------\n\n.. figure:: https://i.imgur.com/TejCpIP.png\n   :alt: \n\n::\n\n    # see test_display_tensorflow in test_simple_apy for full code.\n\n    ...\n\n    autoencoder.compile(loss=\"mse\", optimizer=\"adam\")\n\n    while displayer:\n        grab = tf.convert_to_tensor(\n            displayer.FRAME_DICT[\"fractal test.mp4frame\"][np.newaxis, ...].astype(np.float32)\n            / 255.0\n        )\n        grab_noise = tf.convert_to_tensor(\n            (((displayer.FRAME_DICT[\"fractal test.mp4frame\"][np.newaxis, ...].astype(\n                np.float32) + np.random.uniform(0, 255, grab.shape)) / 2) % 255)\n            / 255.0\n        )\n        displayer.update((grab_noise.numpy()[0] * 255.0).astype(np.uint8), \"uid for grab noise\")\n        autoencoder.fit(grab_noise, grab, steps_per_epoch=1, epochs=1)\n        output_image = autoencoder.predict(grab, steps=1)\n        displayer.update((output_image[0] * 255.0).astype(np.uint8), \"uid for autoencoder output\")\n\nHandle input events\n-------------------\n\nMouse events captured whenever the mouse moves over the window:\n\n::\n\n    event:0\n    x,y:133,387\n    flags:0\n    param:None\n\nCode:\n\n::\n\n    from displayarray.input import mouse_loop\n    from displayarray import display\n\n    @mouse_loop\n    def print_mouse_thread(mouse_event):\n        print(mouse_event)\n\n    display(\"fractal test.mp4\", blocking=True)\n\nInstallation\n------------\n\ndisplayarray is distributed on `PyPI \u003chttps://pypi.org\u003e`__ as a\nuniversal wheel in Python 3.6+ and PyPy.\n\n::\n\n    $ pip install displayarray\n\nUsage\n-----\n\nAPI has been generated `here \u003chttps://simleek.github.io/displayarray/index.html\u003e`_.\n\nSee tests and examples for example usage.\n\nLicense\n-------\n\ndisplayarray is distributed under the terms of both\n\n-  `MIT License \u003chttps://choosealicense.com/licenses/mit\u003e`__\n-  `Apache License, Version\n   2.0 \u003chttps://choosealicense.com/licenses/apache-2.0\u003e`__\n\nat your option.\n\n.. |image0| image:: https://thumbs.gfycat.com/AbsoluteEarnestEelelephant-size_restricted.gif\n   :target: https://gfycat.com/absoluteearnesteelelephant\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsimleek%2Fdisplayarray","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsimleek%2Fdisplayarray","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsimleek%2Fdisplayarray/lists"}