海康SDK整合,PTZ控制

2021-10-23 14:59:56 字數 1861 閱讀 1044

@apioperation

(value =

"設定海康攝像頭ptz引數"

, notes =

"設定海康攝像頭ptz引數"

)@log

(action =

"設定海康攝像頭ptz引數"

, tag =

"/sethkcameraptzvalue")(

"/sethkcameraptzvalue"

)public jsonobject sethkcameraptzvalue

(string ip,string username,string password,

int iport,integer wtiltpos,integer wpanpos,integer wzoompos,integer direction)

else

}else

if(direction == direction_down)

else

}else

if(direction == direction_left)

else

}else

if(direction == direction_right)

else

}else

if(direction == direction_enlarge)

else

}else

if(direction == direction_narrow)

else

} m_ptzposcurrent.

write()

; jsonobject current =

newjsonobject()

; current.

put(

"wzoompos"

,integer.

tohexstring

(m_ptzposcurrent.wzoompos));

current.

put(

"wpanpos"

,integer.

tohexstring

(m_ptzposcurrent.wpanpos));

current.

put(

"wtiltpos"

,integer.

tohexstring

(m_ptzposcurrent.wtiltpos));

hcnetsdk.

net_dvr_init()

; hcnetsdk.

net_dvr_setdvrconfig

(luserid, hcnetsdk.net_dvr_set_ptzpos,

newnativelong(0

), m_ptzposcurrent.

getpointer()

,m_ptzposcurrent.

size()

);hcnetsdk.

net_dvr_getlasterror()

; jsonobject result =

newjsonobject()

;;if(hcnetsdk.

net_dvr_getlasterror()

==0)else

hcnetsdk.

net_dvr_cleanup()

;return result;

}

實際顯示的ptz值是獲取到的十六進製制值的十分之一,如獲取的水平引數p的值是0x1750,實際顯示的p值為175度;獲取到的垂直引數t的值是0x0789,實際顯示的t值為78.9度;獲取到的變倍引數z的值是0x1100,實際顯示的z值為110倍。

海康相機SDK

獲取sdk版本號。static uint mv cc getsdkversion net 列舉支援的裝置型別 傳輸層型別 static intmv cc enumeratetls net 列舉子網內指定的傳輸協議對應的所有裝置。static intmv cc enumdevice net uint ...

C 呼叫海康SDK

最近在學習用c 呼叫海康攝像機的sdk進行二次開發,真可謂是問題多多 網上找的方法如下 方法一 dllimport hcnetsdk.dll charset charset.ansi,callingconvention callingconvention.stdcall exactspelling ...

海康SDK開發筆記(一)

開發環境 ubuntu14.04 lts。qt4.8 sdk版本 ch hcnetsdk v5.2.7.3 build20170118 linux64 1.先將lib下所有so檔案拷貝到qtdemo linux64 lib,用qtcreator開啟qtclientdemo.pro,編譯時注意選擇qt...