Skip to content

use gsoap onvif to get images, go to presets and move.

License

Notifications You must be signed in to change notification settings

RichardoMrMu/gsoap-onvif

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Gsoap-Onvif

This repository used gsoap onvif to get images, go to presets and move. It can run in jetson nano 2g version and test on the hikCamera. This repository do the secondary wrap for ssig-onvif, and give a specific instruction to use it.

Step1. Install Ssig-Onvif
  1. Install opnessl
# download openssl from web 
wget https://www.openssl.org/source/old/1.0.2/openssl-1.0.2l.tar.gz
tar -xzvf openssl-1.0.2l.tar.gz
cd openssl-1.0.2l
sudo ./config
sudo make 
sudo make test # you can test it with this line 
sudo make install 
# check openssl version
openssl version
  1. Install libssl1.0
sudo apt-get install libssl1.0-dev
Step2. Build Project Next step is build the project, you should remove the files in build fold,and the rebuild the project by the following lines.
cd gsoap-onvif
cd build 
rm -rf *
cmake ..
make -j 
./zoom_tea

Deployment

From now, gsoap-onvif achieve the functions about absolute move, relative move, goto preset, get preset, get ptz configuration, get meida configuration, get device configuration, stop, zoom in and zoom out. You can use it control the camera and take photos with opencv. The specific test code is in here.

make

cd {project_path}/factory/build
cmake ..
make

You can run the test code to test whether gsoap-onvif can run well on your computer.

Init

You can use the following codes to init the PTZ and Media, to control the camera use ptz and get camera settings by media.

#include <chrono>
#include <iostream>
#include <sstream> 
#include "glog/logging.h"
#include "OnvifClientDevice.hpp"
#include "OnvifClientPTZ.hpp"
#include "OnvifClientMedia.hpp"
std::string url = "192.168.66.64";
std::string name = "admin";
std::string password = "wst123456";
OnvifClientPTZ *PTZ = new OnvifClientPTZ(url, name, password, true);
OnvifClientMedia *Media = new OnvifClientMedia(url, name, password, true);

Get configuration

You can get the Meida configuration

std::vector<_ocp_Profile> get_profilesResponse;
Media->getProfiles(get_profilesResponse);

Goto preset

gotoPreset : the first parm can get from Media->getProfiles. The secondd parm is your setting preset like 1,2,3, type as int. The third parm is speed, between 0 to 1.0, type as float.

PTZ->gotoPreset(get_profilesResponse[0].profileToken,3,0.5);

Absolute move and Relative move

You can control the camera to move.

PTZ->relativeMove(get_profilesResponse[0], 0.0, 0.0, 0.0, 0.0, 0.5, 1);
PTZ->absoluteMove(get_profilesResponse[0], 0.0, 0.0, 0.0, 0.0, 0.5, 1);