IronQRでライブビデオストリームをスキャンする
携帯電話のカメラからリアルタイムでQRコードを読み取りたいですが、IronQRにはライブビデオストリームスキャン用の組み込みメソッドはありません。 回避策として、カメラから個別のフレームを一度にデコーダーに渡します。
解決策
IronQRは高い精度のQRコード認識に焦点を当てています。 リアルタイムのビデオデコーディングは、OpenCVやプラットフォームネイティブのカメラSDKのようなコンピュータビジョンフレームワークの領域です。 ライブスキャンの効果を得るために、フレームをキャプチャし、それぞれを静止画像としてデコードします。
1. デバイスのカメラフィードにアクセスします
プラットフォームネイティブAPIを通じてカメラを開きます:Xamarin.Essentials、MAUI Camera、またはAndroid/iOS SDKを直接使用します。
2. フレームを継続的にキャプチャします
例えば100msごとにフレームを取得し、それをビットマップに変換します。
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)
各コールは1つの静止フレームを解析します。 フレームを次々にデコードすることで、カメラはライブでスキャンしているように見えますが、IronQRは個々の画像しか扱いません。

