使用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只會看到單個圖像,但相機看起來像是在實時掃描。

請注意即時影片流掃描並不支持開箱即用。 當前需要在應用層實現實時掃描。

Curtis Chau
技術作家

Curtis Chau擁有Carleton大學的電腦科學學士學位,專精於前端開發,擁有Node.js、TypeScript、JavaScript和React的專業知識。Curtis熱衷於建立直觀且美觀的使用者介面,喜愛使用現代框架並建立結構良好、視覺吸引力的手冊。

除了開發,Curtis對物聯網(IoT)有濃厚的興趣,探索創新的方法來整合硬體和軟體。在空閒時間,他喜歡玩遊戲和建立Discord機器人,結合他對技術的熱愛與創造力。

準備好開始了嗎?
Nuget 下載 70,398 | 版本: 2026.7 剛剛發布
Still Scrolling Icon

還在滾動?

想要快速證明嗎? PM > Install-Package IronQR
執行一個範例 觀看您的URL變成QR碼。