Skip to content

Instantly share code, notes, and snippets.

View raiever's full-sized avatar

SungHwan Kim raiever

  • New Malden, UK
View GitHub Profile
@raiever
raiever / streaming_ipcamera.py
Last active December 27, 2019 15:33
[OpenCV] Streaming video from IP camera
# opencv-python: 4.1.1.26
# python: 3.7.3
import cv2
source = 'rtsp://admin:password@192.168.2.196/profile2/media.smp'
cap = cv2.VideoCapture(source)
if cap.isOpened():
cv2.namedWindow("ip camera demo", cv2.WINDOW_AUTOSIZE)
@raiever
raiever / webstreaming.py
Last active December 10, 2019 14:10
[OpenCV] Web Streaming from IP camera with Flask
# import the necessary packages
from pyimagesearch.motion_detection import SingleMotionDetector
from imutils.video import VideoStream
from flask import Response, Flask, render_template
import threading
import argparse
import datetime, time
import imutils
import cv2
@raiever
raiever / index.html
Last active April 2, 2024 15:09
[OpenCV] Web Streaming from IP camera with Flask
/* Under directory 'templates' */
<html>
<head>
<title>RTSP web streaming</title>
</head>
<body>
<h1>RTSP web streaming</h1>
<h3>XND-6080RV (ip:192.168.2.196)</h3>
<h4>python webstreaming.py --ip <host ip> --port <host port></h4>
<img src="{{ url_for('video_feed') }}">
@raiever
raiever / zeep_onvif_test.py
Last active March 10, 2020 13:37
ONVIF test using zeep
from zeep.client import Client, CachingClient, Settings
from zeep.wsse.username import UsernameToken
import zeep.helpers
import logging.config
# Put Zeep into verbose mode
logging.config.dictConfig({
'version': 1,
'formatters': {
'verbose': {
@raiever
raiever / json_SUNAPI.py
Created March 30, 2021 18:30
Get JSON response of SUNAPI
import requests
from requests.auth import HTTPDigestAuth
def get_json(cgi, user, password, headers={'Accept': 'application/json'}):
response = requests.get(cgi, auth=HTTPDigestAuth(user, password), headers)
response_json = response.json()
return response
# in the case of Heatmap, if want to get key values,
# heatmap_response_json['HeatMap'][0].keys()