次のコードがあります。
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using ZXing;
namespace SeparatorPageSplit.framework
{
class QRCodeScanner
{
BarcodeReader reader;
public QRCodeScanner()
{
try
{
this.reader = new BarcodeReader { AutoRotate = true, TryInverted = true };
this.reader = new BarcodeReader();
this.reader.Options.PossibleFormats = new List<BarcodeFormat>();
this.reader.Options.PossibleFormats.Add(BarcodeFormat.QR_CODE);
// this.reader.Options.TryHarder = true;
}
catch (Exception ex)
{
Program.WriteToLogFile(ex.ToString());
}
}
public Boolean IsQRCodeFound(string ImagePath)
{
string decoded = "";
Bitmap bitmap = new Bitmap(ImagePath);
try
{
Result result = this.reader.Decode(bitmap);
if (result != null)
{
decoded = result.ToString().Trim();
}
}
catch (Exception ex)
{
Program.WriteToLogFile(ex.ToString());
}
finally
{
bitmap.Dispose();
}
if (decoded == "CCA001")
{
return true;
}
else
{
return false;
}
}
}
}
そして、次の画像を読み取ろうとしました:
カラーまたはグレースケールでスキャンすると、このコードは正常に機能します。白黒でスキャンするとうまくいきません。
これをスキャンできるようにするZXingの設定はありますか?
小さなドットをスクラブする簡単な方法はありますか?
[編集] Visual Studio の Nuget からインストールされた ZXing.Net v0.16.5 を使用しています。Nuget は、利用可能な最新バージョンでそれを示しています。