Giter Site home page Giter Site logo

naveenrobo / dahua-ip-cam-sdk Goto Github PK

View Code? Open in Web Editor NEW
46.0 3.0 24.0 12 KB

SDK for Dahua IP Cameras to extract Plate Numbers, Event notifications and more.

Home Page: https://naveen.codes

License: MIT License

Python 100.00%
dahua anpr anpr-sdk python dahua-sdk dahua-anpr-cameras extract-plate-numbers sdk

dahua-ip-cam-sdk's Introduction

Dahua SDK

SDK for Dahua IP Cameras to extract Plate Numbers and listening of events like Video Motion, Camera Tampering which are support by camera.

Info

API's are extracted by reverse engineering the JavaScript in Web UI.

Example Snippet

Login to camera

from dahua_rpc import DahuaRpc

# Initialize the object
dahua = DahuaRpc(host="192.168.1.10", username="admin", password="password")

# Login to create session
dahua.login()

Some basic functions

# Get the current time on the device
print(dahua.current_time())

# Set display to 4 grids with first view group
dahua.set_split(mode=4, view=1)

# Make a raw RPC request to get serial number
print(dahua.request(method="magicBox.getSerialNo"))

Get ANPR details

# Get the ANPR Plate Numbers by using the following
# Get the object id
object_id = dahua.get_traffic_info() 

# Use the object id to find the Plate Numbers
dahua.start_find(object_id=object_id) 

# Find and dump the Plate Numbers
response = json.dumps(dahua.do_find(object_id=object_id)) 

Listening for event's like video motion, tamper detection

# Attach an event. 
# NOTE : Check your camera model for possible events.
# Detaching an event is not yet supported.
print(dahua.attach_event(["VideoMotion"]))


# Create a callback to receive the data
def callback(data):
    print("Data = {}".format(data))

print(dahua.listen_events(callback))

# NOTE: Currently everything happens in a main thread. Will be moved to a thread in later update

Credits

Forked from this gist and added ANPR and event listeners. Thanks G.X.F. for your contribution.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.