{ "cells": [ { "cell_type": "markdown", "metadata": { "nbpresent": { "id": "588ee1fa-64b5-453b-ade7-8e6b2515821c" } }, "source": [ "#
استفاده از CCTV در OpenCV
" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "https://www.wowza.com/developer/rtsp-stream-test" ] }, { "cell_type": "code", "execution_count": 1, "metadata": {}, "outputs": [], "source": [ "import cv2 \n", "\n", "# Our Free Test RSTP Link\n", "# You can configure your CCTV IPTV Cameras to output a RSTP Stream\n", "cap = cv2.VideoCapture(\"rtsp://wowzaec2demo.streamlock.net/vod/mp4:BigBuckBunny_115k.mp4\")\n", "\n", "while True:\n", " ret, frame = cap.read()\n", "\n", " cv2.imshow('CCTV', frame)\n", " \n", " if cv2.waitKey(1) == 27:\n", " break\n", " \n", "# Release camera and close windows\n", "cap.release()\n", "cv2.destroyAllWindows() " ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "
اگر دنبال جایگزینی هستید که همزمان چند دوربین مداربسته را در پایتون کنترل کنید:
" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "https://github.com/jeffbass/imagezmq#introduction" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "import cv2\n", "import imagezmq\n", "\n", "image_hub = imagezmq.ImageHub()\n", "\n", "while True: # show streamed images until Ctrl-C\n", " rpi_name, image = image_hub.recv_image()\n", " cv2.imshow(rpi_name, image) # 1 window for each RPi\n", " cv2.waitKey(1)\n", " image_hub.send_reply(b'OK')" ] } ], "metadata": { "anaconda-cloud": {}, "kernelspec": { "display_name": "vision-class", "language": "python", "name": "tensorflow_25" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.8.10" }, "nbpresent": { "slides": { "300ee14f-a043-486e-b274-7ff253907cd7": { "id": "300ee14f-a043-486e-b274-7ff253907cd7", "prev": "cb74e0bc-4513-4d13-b7f1-14c3078a7927", "regions": { "26dc3f39-a230-447c-af4c-f5e5b2fb7835": { "attrs": { "height": 0.8, "width": 0.8, "x": 0.1, "y": 0.1 }, "content": { "cell": "c58440a5-3f8f-4f37-9c79-6bf766209406", "part": "whole" }, "id": "26dc3f39-a230-447c-af4c-f5e5b2fb7835" } } }, "878aa53a-1444-4100-8f50-7a408191c579": { "id": "878aa53a-1444-4100-8f50-7a408191c579", "prev": null, "regions": { "a6c6843a-5ea6-4fbc-b890-3b4b8ae475b3": { "attrs": { "height": 0.8, "width": 0.8, "x": 0.1, "y": 0.1 }, "content": { "cell": "588ee1fa-64b5-453b-ade7-8e6b2515821c", "part": "whole" }, "id": "a6c6843a-5ea6-4fbc-b890-3b4b8ae475b3" } } }, "96ffe88e-7b50-43de-afdd-942e564f4e3e": { "id": "96ffe88e-7b50-43de-afdd-942e564f4e3e", "prev": "878aa53a-1444-4100-8f50-7a408191c579", "regions": { "b7e52e12-489a-468d-b10c-af2024fd2856": { "attrs": { "height": 0.8, "width": 0.8, "x": 0.1, "y": 0.1 }, "content": { "cell": "de829a92-1fb6-44ad-a2c6-fc1001e1f6e1", "part": "whole" }, "id": "b7e52e12-489a-468d-b10c-af2024fd2856" } } }, "cb74e0bc-4513-4d13-b7f1-14c3078a7927": { "id": "cb74e0bc-4513-4d13-b7f1-14c3078a7927", "prev": "96ffe88e-7b50-43de-afdd-942e564f4e3e", "regions": { "444878ee-68f3-4abb-acff-a7079b21e86d": { "attrs": { "height": 0.8, "width": 0.8, "x": 0.1, "y": 0.1 }, "content": { "cell": "25f3f538-1ee8-4d98-a6bb-14cbeb7a702d", "part": "whole" }, "id": "444878ee-68f3-4abb-acff-a7079b21e86d" } } } }, "themes": {} } }, "nbformat": 4, "nbformat_minor": 4 }