私はこれまで画像処理を行ったことがありません。
これらの非常に暗い(ほぼ黒の)画像を破棄するには、カメラからの多くのjpeg画像を調べる必要があります。
使用できる無料のライブラリ(.NET)はありますか?ありがとう。
私はこれまで画像処理を行ったことがありません。
これらの非常に暗い(ほぼ黒の)画像を破棄するには、カメラからの多くのjpeg画像を調べる必要があります。
使用できる無料のライブラリ(.NET)はありますか?ありがとう。
Aforgeは優れた画像処理ライブラリです。具体的にはAforge.Imaging
アセンブリ。しきい値フィルターを適用して、エリアまたはブロブ演算子を使用して、そこから比較を行うことができます。
私は同じことをする必要がありました。ほとんどが黒い画像にフラグを付けるために、このソリューションを思いつきました。それは魅力のように機能します。ファイルを削除または移動するように拡張できます。
// set limit
const double limit = 90;
foreach (var img in Directory.EnumerateFiles(@"E:\", "*.jpg", SearchOption.AllDirectories))
{
// load image
var sourceImage = (Bitmap)Image.FromFile(img);
// format image
var filteredImage = AForge.Imaging.Image.Clone(sourceImage);
// free source image
sourceImage.Dispose();
// get grayscale image
filteredImage = Grayscale.CommonAlgorithms.RMY.Apply(filteredImage);
// apply threshold filter
new Threshold().ApplyInPlace(filteredImage);
// gather statistics
var stat = new ImageStatistics(filteredImage);
var percentBlack = (1 - stat.PixelsCountWithoutBlack / (double)stat.PixelsCount) * 100;
if (percentBlack >= limit)
Console.WriteLine(img + " (" + Math.Round(percentBlack, 2) + "% Black)");
filteredImage.Dispose();
}
Console.WriteLine("Done.");
Console.ReadLine();