test code to control hikcamera using onvif
- python-onvif-zeep
- opencv-python
pip install onvif_zeep
pip install opencv-python
The move.py can achieve move function like absolute move and relate move (including up,down,left and right four axises), meanwhile, it uses functional language. And the ptz_control.py can achieve get configurations, move, goto presets, etc. It uses oop(Object Oriented Programming). You can chooses the style you like.
For move.py, you need to change this line as your ip, passwd and username. Then you can run
python move.py
and see camera move successfully if connecting. And for ptz_control.py, your should replace this line 's ip, username, passwd ans port as yours, and you can write your own main function like this :
if __name__ == '__main__':
ptz = ptzControl()
ptz.goto_preset()
ptz.zoom_relative(0.5,0.4)
Then run like this :
pyhton ptz_control.py
enjoy it!