分享乙個C 採集控制多個UVC攝像頭裝置的原始碼

2021-10-04 21:36:32 字數 2476 閱讀 1802

using system;

using system.collections.generic;

using system.drawing;

using sharpcamera;

using system.windows.forms;

namespace sharpcamerademo

#region 變數

private camera camera2 = null;

private camera camera1 = null;

private cameramgr cameramgr = null;

#endregion

//例項化乙個cameramgr

cameramgr = new cameramgr();

//得到當前計算機的所有已安裝攝像頭

listlstcameranameinstalled = cameramgr.getcameranamelist();

if(lstcameranameinstalled.count < 2)

#region 初始化攝像頭1

//選定該攝像頭,攝像頭索引為0,您也可以用攝像頭名稱的方式來選定

camera1 = cameramgr.choosecamera(0);

//訂閱幀上報的事件

camera1.onvideoframecaptrue += videoframecaptrue1;

//開啟該攝像頭

camera1.open();

//修改當前解析度

camera1.resolution = camera1.allsupportedresolution[0];

#endregion

#region 初始化攝像頭2

//選定該攝像頭,這裡攝像頭索引為1

camera2 = cameramgr.choosecamera(1);

//訂閱幀上報的事件

camera2.onvideoframecaptrue += videoframecaptrue2;

//開啟該攝像頭

camera2.open();

//修改當前解析度

camera2.resolution = camera2.allsupportedresolution[0];

#endregion

}public void videoframecaptrue1(bitmap img)

this.picturebox1.image = temp;

}));

}else

this.picturebox1.image = temp;}}

public void videoframecaptrue2(bitmap img)

this.picturebox2.image = temp;

}));

}else

this.picturebox2.image = temp;}}

private void form2_formclosing(object sender, formclosingeventargs e)

if (camera2 != null)

if (cameramgr != null)

}#endregion

#region 屬性設定面板

private void button1_click(object sender, eventargs e)

}private void button2_click(object sender, eventargs e)

}#endregion

#region 版權

private void button5_click(object sender, eventargs e)

private void button4_click(object sender, eventargs e)

private void button3_click(object sender, eventargs e)

#endregion

#region 亮度

private void btnbrightness1_click(object sender, eventargs e)

}private void btnbrightness2_click(object sender, eventargs e)

}private void btnbrightness3_click(object sender, eventargs e)

}//下邊為第二個攝像頭的亮度控制

private void button11_click(object sender, eventargs e)

}private void button12_click(object sender, eventargs e)

}private void button21_click(object sender, eventargs e)

}#endregion}}

乙個程序控制多個socket

module test tcp compile export all include lib kernel include inet.hrl define tcp options,binary,test pid spawn link module,loop,gen tcp listen 6099,t...

分享乙個天氣歷史資料的採集指令碼

最近乙個專案中需要用到過往的天氣資料,我找到了天氣後報這個 www.tianqihoubao.com 並在ss中完成了相關採集,和大家分享一下.首先分析這個 提供了兩種資訊 1.省市關係 2.天氣記錄 對應的我們建立資料結構 serializable public class province se...

乙個頁面多個input 按鈕 如何回車控制

專案完成了,完善也是乙份重中之重的工作!至於你做的 炫還是不炫?個人認為人性化很重要!尤其是b2c 如何做到專案人性化?只有不斷的去發現和完善了!購物 已做好,目前也在新增一些新功能 seo 及 優化的工作!昨天運營部門同事找到我說 一般 登入 註冊填寫完資訊後,直接回車就可以登入或者註冊了,沒必要...