程序師世界是廣大編程愛好者互助、分享、學習的平台,程序師世界有你更精彩!
首頁
編程語言
C語言|JAVA編程
Python編程
網頁編程
ASP編程|PHP編程
JSP編程
數據庫知識
MYSQL數據庫|SqlServer數據庫
Oracle數據庫|DB2數據庫
 程式師世界 >> 編程語言 >> C語言 >> 關於C語言 >> C#視頻監控系列(10):服務器端 - 驗證、設置畫面質量、字幕疊加、板卡序列號(4)

C#視頻監控系列(10):服務器端 - 驗證、設置畫面質量、字幕疊加、板卡序列號(4)

編輯:關於C語言

三、設置字幕疊 加

一般用於顯示公司LOGO和日期,下圖黃色區域所示

VC ++ Code:

方法OnSettings()

USHORT Format1[40] = {48, 16, 'H','I','K','V', 'I','S','I','O','N', '\0'};
USHORT Format2[40] = {24, 50, _OSD_YEAR4, '-',_OSD_MONTH2,'-',_OSD_DAY,'-',  _OSD_HOUR24, ':', _OSD_MINUTE,':', _OSD_SECOND, '\0'};


//其他代碼

for(i = 0; i < GetTotalDSPs(); i++){
SetOsdDisplayMode(ChannelHandle[i], 255, TRUE, 0, Format1, Format2);
SetOsd(ChannelHandle[i], TRUE);
}

C# Code:         

private const ushort _OSD_BASE = 0x9000;
private const ushort _OSD_YEAR4 = _OSD_BASE + 0;
private const ushort _OSD_YEAR2 = _OSD_BASE + 1;
private const ushort _OSD_MONTH3 = _OSD_BASE + 2;
private const ushort _OSD_MONTH2 = _OSD_BASE + 3;
private const ushort _OSD_DAY = _OSD_BASE + 4;
private const ushort _OSD_WEEK3 = _OSD_BASE + 5;
private const ushort _OSD_CWEEK1 = _OSD_BASE + 6;
private const ushort _OSD_HOUR24 = _OSD_BASE + 7;
private const ushort _OSD_HOUR12 = _OSD_BASE + 8;
private const ushort _OSD_MINUTE = _OSD_BASE + 9;
private const ushort _OSD_SECOND = _OSD_BASE + 10;

/// <summary>
/// 設置Osd
/// </summary>
/// <param name="ChannelHandle"></param>
/// <param name="setValue"></param>
public void SetOsd(IntPtr[] ChannelHandle, bool setValue)
{
if (setValue)
{
ushort[] Format1 = new ushort[]{ 48, 16, 'H', 'I', 'K', 'V', 'I', 'S', 'I', 'O', 'N', '\0' };
ushort[] Format2 = new ushort[]{ 24, 50, _OSD_YEAR4, '-', _OSD_MONTH2, '-', _OSD_DAY, '-', _OSD_HOUR24, ':', _OSD_MINUTE, ':', _OSD_SECOND, '\0' };

for (int i = 0; i < ChannelHandle.Length; i++)
{
HikVisionSDK.SetOsdDisplayMode(ChannelHandle[i], 255, true, 0, Format1, Format2);
HikVisionSDK.SetOsd(ChannelHandle[i], true);
}
}
else
{
for (int i = 0; i < ChannelHandle.Length; i++)
{
HikVisionSDK.SetOsd(ChannelHandle[i], false);
}
}
}

代碼說明:

1.注意設置中文字符有問題,暫時沒有解決。

2.關於時間顯示可以翻閱API文檔,說明得很詳細。

  1. 上一頁:
  2. 下一頁:
Copyright © 程式師世界 All Rights Reserved