發布時間:2022-06-28 文章來源:xp下載站 瀏覽:
Windows 10是美國微軟公司研發的跨平臺及設備應用的操作系統。是微軟發布的最后一個獨立Windows版本。Windows 10共有7個發行版本,分別面向不同用戶和設備。截止至2018年3月7日,Windows 10正式版已更新至秋季創意者10.0.16299.309版本,預覽版已更新至春季創意者10.0.17120版本
Windows10 IoT Core的視頻錄制移動應用程序,是一個展示如何在Windows10 IoT Core上創建視頻捕獲移動應用程序的實例,同時也支持在拍攝過程中預覽視頻。
需求組件:
1個USB攝像頭
1個USB鼠標
1個HDMI顯示器和HDMI線
1個樹莓派2開發板
建立示例移動應用程序:
連接USB攝像頭,USB鼠標,HDMI顯示器,以太網電纜(或者WiFi無線網絡)到樹莓派2,然后打開它
下載示例,構建并部署到樹莓派2上
查看如何在樹莓派2上運行
移動應用程序建立核心步驟:
1、 打開VS2015,創建一個新的Windows通用空白應用程序:
2、啟用package.appxmanifest功能,確保麥克風和視頻庫(用于保存音頻文件)以及網絡攝像頭功能被選中:
在MainPage.xaml中,添加按鈕“開始捕捉”,“結束捕捉”,“播放拍攝的視頻”,增加一個“捕捉元件”用于視頻預覽和一個“媒體元件”用于視頻播放
<Button x:Name="btn1" Content="Start Capturing" Click="startCapture" Margin="10,50,0,0"></Button> <Button x:Name="btn2" Content="End Capturing" Click="stopCapture" Margin="10, 20,0,0"/> <Button x:Name="btn3" Content="Play Captured Video" Click="playVideo" Margin="10, 20, 0,20"/> <TextBox Text="Video Preview Window:" Margin="10,10,0,5" TextAlignment="Center" BorderThickness="0"/> <CaptureElement Name="capturePreview" Height="300" Margin="10,10,0,10" Width="300"/> <TextBox Text="Video Review Window" Margin="10,10,0,5" TextAlignment="Center" BorderThickness="0"/> <MediaElement Name="media" AutoPlay="True" AreTransportControlsEnabled="False" Height="300" Width="300" Margin="10,10,0,10" > </MediaElement>
在MainPage.xaml.cs中,你將需要枚舉找到錄像機設備:
var devices = await Windows.Devices.Enumeration.DeviceInformation.FindAllAsync(Windows.Devices.Enumeration.DeviceClass.VideoCapture);
設置“捕獲設置”:
captureInitSettings = new Windows.Media.Capture.MediaCaptureInitializationSettings();captureInitSettings.StreamingCaptureMode = Windows.Media.Capture.StreamingCaptureMode.AudioAndVideo;captureInitSettings.PhotoCaptureSource = Windows.Media.Capture.PhotoCaptureSource.VideoPreview;
初始化“媒體捕捉”:
mediaCapture = new Windows.Media.Capture.MediaCapture();await mediaCapture.InitializeAsync(captureInitSettings);
創建文件:
profile = Windows.Media.MediaProperties.MediaEncodingProfile.CreateMp4(Windows.Media.MediaProperties.VideoEncodingQuality.Qvga);
開始錄制:
var storageFile = await Windows.Storage.KnownFolders.VideosLibrary.CreateFileAsync("cameraCapture.wmv", Windows.Storage.CreationCollisionOption.GenerateUniqueName); await mediaCapture.StartRecordToStorageFileAsync(profile, storageFile);
也可以在拍攝過程中啟動預覽:
// start the preview capturePreview.Source=mediaCapture; await mediaCapture.StartPreviewAsync();
停止錄制和預覽:
private async void StopMediaCaptureSession() { await mediaCapture.StopRecordAsync(); recording = false; (App.Current as App).IsRecording = false; //stop the preview await mediaCapture.StopPreviewAsync(); }
播放錄像:
private async void playVideo(object sender, RoutedEventArgs e) { Windows.Storage.StorageFile storageFile = await Windows.Storage.KnownFolders.VideosLibrary.GetFileAsync(fileName); var stream = await storageFile.OpenAsync(Windows.Storage.FileAccessMode.Read); // mediaControl is a MediaElement defined in XAML if (null != stream) { media.Visibility = Visibility.Visible; media.SetSource(stream, storageFile.ContentType); media.Play(); } }
新技術融合:在易用性、安全性等方面進行了深入的改進與優化。針對云服務、智能移動設備、自然人機交互等新技術進行融合。Windows 10所新增的Windows Hello功能將帶來一系列對于生物識別技術的支持。除了常見的指紋掃描之外,系統還能通過面部或虹膜掃描來讓你進行登入。當然,你需要使用新的3D紅外攝像頭來獲取到這些新功能。 |