{ "info": { "author": "SimLeek", "author_email": "josh.miklos@gmail.com", "bugtrack_url": null, "classifiers": [ "Development Status :: 4 - Beta", "Intended Audience :: Developers", "License :: OSI Approved :: Apache Software License", "License :: OSI Approved :: MIT License", "Natural Language :: English", "Operating System :: OS Independent", "Programming Language :: Python :: 2.7", "Programming Language :: Python :: 3.5", "Programming Language :: Python :: 3.6", "Programming Language :: Python :: Implementation :: CPython", "Programming Language :: Python :: Implementation :: PyPy" ], "description": "# displayarray\n\nA threaded PubSub OpenCV interfaceREADME.md. Webcam and video feeds to multiple windows is supported.\n\n## Installation\n\ndisplayarray is distributed on `PyPI `_ as a universal\nwheel and is available on Linux/macOS and Windows and supports\nPython 2.7/3.5+ and PyPy.\n\n $ pip install displayarray\n \n## Usage\n\n### Video Editing and Publishing\n\n#### Display your webcam\n import displayarray.webcam_pub as w\n \n w.VideoHandlerThread().display()\n \n#### Change Display Arguments\n import displayarray.webcam_pub as w\n \n video_thread = w.VideoHandlerThread(video_source=0,\n callbacks = w.display_callbacks,\n request_size=(800, 600),\n high_speed = False,\n fps_limit = 8\n )\n\n#### handle mouse input\n import displayarray.webcam_pub as w\n from displayarray.input import mouse_loop\n \n @mouse_loop\n def print_mouse(mouse_event):\n print(mouse_event)\n\n w.VideoHandlerThread().display()\n\n#### take in key input\n import displayarray.webcam_pub as w\n from displayarray.input import key_loop\n\n @key_loop\n def print_key_thread(key_chr):\n print(\"key pressed: \" + str(key_chr))\n\n w.VideoHandlerThread().display()\n\n#### Run your own functions on the frames\n import displayarray.webcam_pub as w\n \n def redden_frame_print_spam(frame, cam_id):\n frame[:, :, 0] = 0\n frame[:, :, 1] = 0\n print(\"Spam!\")\n\n w.VideoHandlerThread(callbacks=[redden_frame_print_spam] + w.display_callbacks).display()\n\n#### Display a tensor\n\n def tensor_from_image(frame, cam_id):\n ten = tensor_from_pytorch_or_tensorflow(frame)\n return ten\n \n t = wp.VideoHandlerThread(video_source=cam, callbacks=[tensor_from_image] + wp.display_callbacks)\n\n t.display()\n\n#### Display multiple windows from one source\n import displayarray.webcam_pub as w\n from displayarray.window_sub import SubscriberWindows\n\n def cam_handler(frame, cam_id):\n SubscriberWindows.set_global_frame_dict(cam_id, frame, frame)\n\n t = w.VideoHandlerThread(0, [cam_handler],\n request_size=(1280, 720),\n high_speed=True,\n fps_limit=240\n )\n\n t.start()\n\n SubscriberWindows(window_names=['cammy', 'cammy2'],\n video_sources=[str(0)]\n ).loop()\n\n t.join()\n \n#### Display multiple windows from multiple sources\n iport displayarray.webcam_pub as w\n from displayarray.window_sub import SubscriberWindows\n\n t1 = w.VideoHandlerThread(0)\n t2 = w.VideoHandlerThread(1)\n\n t1.start()\n t2.start()\n\n SubscriberWindows(window_names=['cammy', 'cammy2'],\n video_sources=[0,1]\n ).loop()\n\n t1.join()\n t1.join()\n \n#### Run a function on each pixel\n from displayarray.webcam_pub import VideoHandlerThread\n from displayarray.webcam_pub.callbacks import function_display_callback\n img = np.zeros((50, 50, 1))\n img[0:5, 0:5, :] = 1\n\n def conway_game_of_life(array, coords, finished):\n neighbors = np.sum(array[max(coords[0] - 1, 0):min(coords[0] + 2, 50),\n max(coords[1] - 1, 0):min(coords[1] + 2, 50)])\n neighbors = max(neighbors - np.sum(array[coords[0:2]]), 0.0)\n if array[coords] == 1.0:\n if neighbors < 2 or neighbors > 3:\n array[coords] = 0.0\n elif 2 <= neighbors <= 3:\n array[coords] = 1.0\n else:\n if neighbors == 3:\n array[coords] = 1.0\n\n VideoHandlerThread(video_source=img, callbacks=function_display_callback(conway_game_of_life)).display()\n\n## License\n\ndisplayarray is distributed under the terms of both\n\n- `MIT License `_\n- `Apache License, Version 2.0 `_\n\nat your option.", "description_content_type": "text/markdown", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/SimLeek/CV_PubSubs", "keywords": "opencv,camera", "license": "MIT/Apache-2.0", "maintainer": "SimLeek", "maintainer_email": "josh.miklos@gmail.com", "name": "displayarray", "package_url": "https://pypi.org/project/displayarray/", "platform": "", "project_url": "https://pypi.org/project/displayarray/", "project_urls": { "Homepage": "https://github.com/SimLeek/CV_PubSubs" }, "release_url": "https://pypi.org/project/displayarray/0.6.6/", "requires_dist": null, "requires_python": "", "summary": "", "version": "0.6.6" }, "last_serial": 5910599, "releases": { "0.6.6": [ { "comment_text": "", "digests": { "md5": "7ed00aafb792e0d0ca73a4a13c848b75", "sha256": "a1f17f695fe2494e173a5bad307f6deddeb38503e1c066cc8467c4af66741ae3" }, "downloads": -1, "filename": "displayarray-0.6.6.tar.gz", "has_sig": false, "md5_digest": "7ed00aafb792e0d0ca73a4a13c848b75", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 17528, "upload_time": "2019-10-01T06:09:36", "url": "https://files.pythonhosted.org/packages/83/4e/579cefef06fc9cc701a50fbcabb02d1a0098fb91f9609d9fbbb39bde149c/displayarray-0.6.6.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "7ed00aafb792e0d0ca73a4a13c848b75", "sha256": "a1f17f695fe2494e173a5bad307f6deddeb38503e1c066cc8467c4af66741ae3" }, "downloads": -1, "filename": "displayarray-0.6.6.tar.gz", "has_sig": false, "md5_digest": "7ed00aafb792e0d0ca73a4a13c848b75", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 17528, "upload_time": "2019-10-01T06:09:36", "url": "https://files.pythonhosted.org/packages/83/4e/579cefef06fc9cc701a50fbcabb02d1a0098fb91f9609d9fbbb39bde149c/displayarray-0.6.6.tar.gz" } ] }