使用IronQR掃描即時影片流
This article was translated from English: Does it need improvement?
Translated
View the article in English
你想從手機的相機實時讀取QR碼,但IronQR沒有內建的方法來進行即時影片流掃描。 解決方法是從相機中逐個幀地輸入讀取器。
解決方案
IronQR專注於高精度的靜態QR碼識別。 實時影片解碼是像OpenCV或平台原生相機SDK的計算機視覺框架的領域。 要想達到即時掃描的效果,自己捕捉幀,並將每個幀解碼為靜止影像。
1. 存取裝置的攝像頭畫面
通過平台原生API打開相機:Xamarin.Essentials、MAUI Camera或者直接使用Android/iOS SDK。
2. 連續獲取幀
每隔一段短間隔(例如每100毫秒)抓取一個幀,並將其轉換為位圖。
3. 將每個幀傳遞給讀取器
將捕獲的位圖包裹在QrReader.Read()。
// Load the asset into QrImageInput
QrImageInput imageInput = new QrImageInput(capturedBitmap);
// Create a QR Reader object
QrReader reader = new QrReader();
// Read the Input an get all embedded QR Codes
IEnumerable<QrResult> results = reader.Read(imageInput);
// Load the asset into QrImageInput
QrImageInput imageInput = new QrImageInput(capturedBitmap);
// Create a QR Reader object
QrReader reader = new QrReader();
// Read the Input an get all embedded QR Codes
IEnumerable<QrResult> results = reader.Read(imageInput);
' Load the asset into QrImageInput
Dim imageInput As New QrImageInput(capturedBitmap)
' Create a QR Reader object
Dim reader As New QrReader()
' Read the Input and get all embedded QR Codes
Dim results As IEnumerable(Of QrResult) = reader.Read(imageInput)
$vbLabelText
$csharpLabel
每次調用分析一個靜止的幀。 一個接一個地解碼它們,儘管IronQR只會看到單個圖像,但相機看起來像是在實時掃描。
請注意即時影片流掃描並不支持開箱即用。 當前需要在應用層實現實時掃描。
準備好開始了嗎?
Nuget 下載 70,398 | 版本: 2026.7 剛剛發布

