1

私はこれまで画像処理を行ったことがありません。

これらの非常に暗い(ほぼ黒の)画像を破棄するには、カメラからの多くのjpeg画像を調べる必要があります。

使用できる無料のライブラリ(.NET)はありますか?ありがとう。

4

2 に答える 2

3

Aforgeは優れた画像処理ライブラリです。具体的にはAforge.Imagingアセンブリ。しきい値フィルターを適用して、エリアまたはブロブ演算子を使用して、そこから比較を行うことができます。

于 2012-08-18T08:26:12.267 に答える
1

私は同じことをする必要がありました。ほとんどが黒い画像にフラグを付けるために、このソリューションを思いつきました。それは魅力のように機能します。ファイルを削除または移動するように拡張できます。

// 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();
于 2012-08-30T02:06:08.947 に答える