diff options
author | CoprDistGit <infra@openeuler.org> | 2023-05-29 11:53:26 +0000 |
---|---|---|
committer | CoprDistGit <infra@openeuler.org> | 2023-05-29 11:53:26 +0000 |
commit | a675e0865225a1a0647e32916cbe5d03fd34d43b (patch) | |
tree | 1ba21a822d19f701b284d1138461e49a508f3283 | |
parent | 0549e6fb14453755bad96b24c549055f60687bb6 (diff) |
automatic import of python-cvpubsubs
-rw-r--r-- | .gitignore | 1 | ||||
-rw-r--r-- | python-cvpubsubs.spec | 483 | ||||
-rw-r--r-- | sources | 1 |
3 files changed, 485 insertions, 0 deletions
@@ -0,0 +1 @@ +/CVPubSubs-0.6.5.tar.gz diff --git a/python-cvpubsubs.spec b/python-cvpubsubs.spec new file mode 100644 index 0000000..b5df580 --- /dev/null +++ b/python-cvpubsubs.spec @@ -0,0 +1,483 @@ +%global _empty_manifest_terminate_build 0 +Name: python-CVPubSubs +Version: 0.6.5 +Release: 1 +Summary: please add a summary manually as the author left a blank one +License: MIT/Apache-2.0 +URL: https://github.com/SimLeek/CV_PubSubs +Source0: https://mirrors.nju.edu.cn/pypi/web/packages/52/78/51f011bd5d3e432991ffad0e412f8c2f5e73d854f352a61a8352fd672105/CVPubSubs-0.6.5.tar.gz +BuildArch: noarch + + +%description +# CVPubSubs + +A threaded PubSub OpenCV interfaceREADME.md. Webcam and video feeds to multiple windows is supported. + +## Installation + +CVPubSubs is distributed on `PyPI <https://pypi.org>`_ as a universal +wheel and is available on Linux/macOS and Windows and supports +Python 2.7/3.5+ and PyPy. + + $ pip install CVPubSubs + +## Usage + +### Video Editing and Publishing + +#### Display your webcam + import cvpubsubs.webcam_pub as w + + w.VideoHandlerThread().display() + +#### Change Display Arguments + import cvpubsubs.webcam_pub as w + + video_thread = w.VideoHandlerThread(video_source=0, + callbacks = w.display_callbacks, + request_size=(800, 600), + high_speed = False, + fps_limit = 8 + ) + +#### handle mouse input + import cvpubsubs.webcam_pub as w + from cvpubsubs.input import mouse_loop + + @mouse_loop + def print_mouse(mouse_event): + print(mouse_event) + + w.VideoHandlerThread().display() + +#### take in key input + import cvpubsubs.webcam_pub as w + from cvpubsubs.input import key_loop + + @key_loop + def print_key_thread(key_chr): + print("key pressed: " + str(key_chr)) + + w.VideoHandlerThread().display() + +#### Run your own functions on the frames + import cvpubsubs.webcam_pub as w + + def redden_frame_print_spam(frame, cam_id): + frame[:, :, 0] = 0 + frame[:, :, 1] = 0 + print("Spam!") + + w.VideoHandlerThread(callbacks=[redden_frame_print_spam] + w.display_callbacks).display() + +#### Display a tensor + + def tensor_from_image(frame, cam_id): + ten = tensor_from_pytorch_or_tensorflow(frame) + return ten + + t = wp.VideoHandlerThread(video_source=cam, callbacks=[tensor_from_image] + wp.display_callbacks) + + t.display() + +#### Display multiple windows from one source + import cvpubsubs.webcam_pub as w + from cvpubsubs.window_sub import SubscriberWindows + + def cam_handler(frame, cam_id): + SubscriberWindows.set_global_frame_dict(cam_id, frame, frame) + + t = w.VideoHandlerThread(0, [cam_handler], + request_size=(1280, 720), + high_speed=True, + fps_limit=240 + ) + + t.start() + + SubscriberWindows(window_names=['cammy', 'cammy2'], + video_sources=[str(0)] + ).loop() + + t.join() + +#### Display multiple windows from multiple sources + iport cvpubsubs.webcam_pub as w + from cvpubsubs.window_sub import SubscriberWindows + + t1 = w.VideoHandlerThread(0) + t2 = w.VideoHandlerThread(1) + + t1.start() + t2.start() + + SubscriberWindows(window_names=['cammy', 'cammy2'], + video_sources=[0,1] + ).loop() + + t1.join() + t1.join() + +#### Run a function on each pixel + from cvpubsubs.webcam_pub import VideoHandlerThread + from cvpubsubs.webcam_pub.callbacks import function_display_callback + img = np.zeros((50, 50, 1)) + img[0:5, 0:5, :] = 1 + + def conway_game_of_life(array, coords, finished): + neighbors = np.sum(array[max(coords[0] - 1, 0):min(coords[0] + 2, 50), + max(coords[1] - 1, 0):min(coords[1] + 2, 50)]) + neighbors = max(neighbors - np.sum(array[coords[0:2]]), 0.0) + if array[coords] == 1.0: + if neighbors < 2 or neighbors > 3: + array[coords] = 0.0 + elif 2 <= neighbors <= 3: + array[coords] = 1.0 + else: + if neighbors == 3: + array[coords] = 1.0 + + VideoHandlerThread(video_source=img, callbacks=function_display_callback(conway_game_of_life)).display() + +## License + +CVPubSubs is distributed under the terms of both + +- `MIT License <https://choosealicense.com/licenses/mit>`_ +- `Apache License, Version 2.0 <https://choosealicense.com/licenses/apache-2.0>`_ + +at your option. + +%package -n python3-CVPubSubs +Summary: please add a summary manually as the author left a blank one +Provides: python-CVPubSubs +BuildRequires: python3-devel +BuildRequires: python3-setuptools +BuildRequires: python3-pip +%description -n python3-CVPubSubs +# CVPubSubs + +A threaded PubSub OpenCV interfaceREADME.md. Webcam and video feeds to multiple windows is supported. + +## Installation + +CVPubSubs is distributed on `PyPI <https://pypi.org>`_ as a universal +wheel and is available on Linux/macOS and Windows and supports +Python 2.7/3.5+ and PyPy. + + $ pip install CVPubSubs + +## Usage + +### Video Editing and Publishing + +#### Display your webcam + import cvpubsubs.webcam_pub as w + + w.VideoHandlerThread().display() + +#### Change Display Arguments + import cvpubsubs.webcam_pub as w + + video_thread = w.VideoHandlerThread(video_source=0, + callbacks = w.display_callbacks, + request_size=(800, 600), + high_speed = False, + fps_limit = 8 + ) + +#### handle mouse input + import cvpubsubs.webcam_pub as w + from cvpubsubs.input import mouse_loop + + @mouse_loop + def print_mouse(mouse_event): + print(mouse_event) + + w.VideoHandlerThread().display() + +#### take in key input + import cvpubsubs.webcam_pub as w + from cvpubsubs.input import key_loop + + @key_loop + def print_key_thread(key_chr): + print("key pressed: " + str(key_chr)) + + w.VideoHandlerThread().display() + +#### Run your own functions on the frames + import cvpubsubs.webcam_pub as w + + def redden_frame_print_spam(frame, cam_id): + frame[:, :, 0] = 0 + frame[:, :, 1] = 0 + print("Spam!") + + w.VideoHandlerThread(callbacks=[redden_frame_print_spam] + w.display_callbacks).display() + +#### Display a tensor + + def tensor_from_image(frame, cam_id): + ten = tensor_from_pytorch_or_tensorflow(frame) + return ten + + t = wp.VideoHandlerThread(video_source=cam, callbacks=[tensor_from_image] + wp.display_callbacks) + + t.display() + +#### Display multiple windows from one source + import cvpubsubs.webcam_pub as w + from cvpubsubs.window_sub import SubscriberWindows + + def cam_handler(frame, cam_id): + SubscriberWindows.set_global_frame_dict(cam_id, frame, frame) + + t = w.VideoHandlerThread(0, [cam_handler], + request_size=(1280, 720), + high_speed=True, + fps_limit=240 + ) + + t.start() + + SubscriberWindows(window_names=['cammy', 'cammy2'], + video_sources=[str(0)] + ).loop() + + t.join() + +#### Display multiple windows from multiple sources + iport cvpubsubs.webcam_pub as w + from cvpubsubs.window_sub import SubscriberWindows + + t1 = w.VideoHandlerThread(0) + t2 = w.VideoHandlerThread(1) + + t1.start() + t2.start() + + SubscriberWindows(window_names=['cammy', 'cammy2'], + video_sources=[0,1] + ).loop() + + t1.join() + t1.join() + +#### Run a function on each pixel + from cvpubsubs.webcam_pub import VideoHandlerThread + from cvpubsubs.webcam_pub.callbacks import function_display_callback + img = np.zeros((50, 50, 1)) + img[0:5, 0:5, :] = 1 + + def conway_game_of_life(array, coords, finished): + neighbors = np.sum(array[max(coords[0] - 1, 0):min(coords[0] + 2, 50), + max(coords[1] - 1, 0):min(coords[1] + 2, 50)]) + neighbors = max(neighbors - np.sum(array[coords[0:2]]), 0.0) + if array[coords] == 1.0: + if neighbors < 2 or neighbors > 3: + array[coords] = 0.0 + elif 2 <= neighbors <= 3: + array[coords] = 1.0 + else: + if neighbors == 3: + array[coords] = 1.0 + + VideoHandlerThread(video_source=img, callbacks=function_display_callback(conway_game_of_life)).display() + +## License + +CVPubSubs is distributed under the terms of both + +- `MIT License <https://choosealicense.com/licenses/mit>`_ +- `Apache License, Version 2.0 <https://choosealicense.com/licenses/apache-2.0>`_ + +at your option. + +%package help +Summary: Development documents and examples for CVPubSubs +Provides: python3-CVPubSubs-doc +%description help +# CVPubSubs + +A threaded PubSub OpenCV interfaceREADME.md. Webcam and video feeds to multiple windows is supported. + +## Installation + +CVPubSubs is distributed on `PyPI <https://pypi.org>`_ as a universal +wheel and is available on Linux/macOS and Windows and supports +Python 2.7/3.5+ and PyPy. + + $ pip install CVPubSubs + +## Usage + +### Video Editing and Publishing + +#### Display your webcam + import cvpubsubs.webcam_pub as w + + w.VideoHandlerThread().display() + +#### Change Display Arguments + import cvpubsubs.webcam_pub as w + + video_thread = w.VideoHandlerThread(video_source=0, + callbacks = w.display_callbacks, + request_size=(800, 600), + high_speed = False, + fps_limit = 8 + ) + +#### handle mouse input + import cvpubsubs.webcam_pub as w + from cvpubsubs.input import mouse_loop + + @mouse_loop + def print_mouse(mouse_event): + print(mouse_event) + + w.VideoHandlerThread().display() + +#### take in key input + import cvpubsubs.webcam_pub as w + from cvpubsubs.input import key_loop + + @key_loop + def print_key_thread(key_chr): + print("key pressed: " + str(key_chr)) + + w.VideoHandlerThread().display() + +#### Run your own functions on the frames + import cvpubsubs.webcam_pub as w + + def redden_frame_print_spam(frame, cam_id): + frame[:, :, 0] = 0 + frame[:, :, 1] = 0 + print("Spam!") + + w.VideoHandlerThread(callbacks=[redden_frame_print_spam] + w.display_callbacks).display() + +#### Display a tensor + + def tensor_from_image(frame, cam_id): + ten = tensor_from_pytorch_or_tensorflow(frame) + return ten + + t = wp.VideoHandlerThread(video_source=cam, callbacks=[tensor_from_image] + wp.display_callbacks) + + t.display() + +#### Display multiple windows from one source + import cvpubsubs.webcam_pub as w + from cvpubsubs.window_sub import SubscriberWindows + + def cam_handler(frame, cam_id): + SubscriberWindows.set_global_frame_dict(cam_id, frame, frame) + + t = w.VideoHandlerThread(0, [cam_handler], + request_size=(1280, 720), + high_speed=True, + fps_limit=240 + ) + + t.start() + + SubscriberWindows(window_names=['cammy', 'cammy2'], + video_sources=[str(0)] + ).loop() + + t.join() + +#### Display multiple windows from multiple sources + iport cvpubsubs.webcam_pub as w + from cvpubsubs.window_sub import SubscriberWindows + + t1 = w.VideoHandlerThread(0) + t2 = w.VideoHandlerThread(1) + + t1.start() + t2.start() + + SubscriberWindows(window_names=['cammy', 'cammy2'], + video_sources=[0,1] + ).loop() + + t1.join() + t1.join() + +#### Run a function on each pixel + from cvpubsubs.webcam_pub import VideoHandlerThread + from cvpubsubs.webcam_pub.callbacks import function_display_callback + img = np.zeros((50, 50, 1)) + img[0:5, 0:5, :] = 1 + + def conway_game_of_life(array, coords, finished): + neighbors = np.sum(array[max(coords[0] - 1, 0):min(coords[0] + 2, 50), + max(coords[1] - 1, 0):min(coords[1] + 2, 50)]) + neighbors = max(neighbors - np.sum(array[coords[0:2]]), 0.0) + if array[coords] == 1.0: + if neighbors < 2 or neighbors > 3: + array[coords] = 0.0 + elif 2 <= neighbors <= 3: + array[coords] = 1.0 + else: + if neighbors == 3: + array[coords] = 1.0 + + VideoHandlerThread(video_source=img, callbacks=function_display_callback(conway_game_of_life)).display() + +## License + +CVPubSubs is distributed under the terms of both + +- `MIT License <https://choosealicense.com/licenses/mit>`_ +- `Apache License, Version 2.0 <https://choosealicense.com/licenses/apache-2.0>`_ + +at your option. + +%prep +%autosetup -n CVPubSubs-0.6.5 + +%build +%py3_build + +%install +%py3_install +install -d -m755 %{buildroot}/%{_pkgdocdir} +if [ -d doc ]; then cp -arf doc %{buildroot}/%{_pkgdocdir}; fi +if [ -d docs ]; then cp -arf docs %{buildroot}/%{_pkgdocdir}; fi +if [ -d example ]; then cp -arf example %{buildroot}/%{_pkgdocdir}; fi +if [ -d examples ]; then cp -arf examples %{buildroot}/%{_pkgdocdir}; fi +pushd %{buildroot} +if [ -d usr/lib ]; then + find usr/lib -type f -printf "/%h/%f\n" >> filelist.lst +fi +if [ -d usr/lib64 ]; then + find usr/lib64 -type f -printf "/%h/%f\n" >> filelist.lst +fi +if [ -d usr/bin ]; then + find usr/bin -type f -printf "/%h/%f\n" >> filelist.lst +fi +if [ -d usr/sbin ]; then + find usr/sbin -type f -printf "/%h/%f\n" >> filelist.lst +fi +touch doclist.lst +if [ -d usr/share/man ]; then + find usr/share/man -type f -printf "/%h/%f.gz\n" >> doclist.lst +fi +popd +mv %{buildroot}/filelist.lst . +mv %{buildroot}/doclist.lst . + +%files -n python3-CVPubSubs -f filelist.lst +%dir %{python3_sitelib}/* + +%files help -f doclist.lst +%{_docdir}/* + +%changelog +* Mon May 29 2023 Python_Bot <Python_Bot@openeuler.org> - 0.6.5-1 +- Package Spec generated @@ -0,0 +1 @@ +deb5ff2c4dcf4c293b29f491a06be316 CVPubSubs-0.6.5.tar.gz |