Как исправить UnsupportedImageFormatException PixelFormat Format32bppArgb?

Accord.NET PointsMarker.cs, похоже, поддерживает PixelFormat Формат32bppArgb. Почему это вызывает исключение UnsupportedImageFormatException?

private void Harris()
{
    try
    {
        img1 = new Bitmap(pictureBox1A.Image);
        img2 = new Bitmap(pictureBox1B.Image);
        var harris = new HarrisCornersDetector(0.04f, 1000f);
        harrisPoints1 = harris.ProcessImage(img1).ToArray();
        harrisPoints2 = harris.ProcessImage(img2).ToArray();
        // Show the marked points in the original images
        var img1mark = new PointsMarker(harrisPoints1).Apply(img1);
        var img2mark = new PointsMarker(harrisPoints2).Apply(img2);
        // Concatenate the two images together in a single image
        var concatenate = new Concatenate(img1mark);
        pictureBox.Image = concatenate.Apply(img2mark);
    }
    catch (UnsupportedImageFormatException)
    {
        const string S = "UnsupportedImageFormatException PixelFormat ";
        Console.WriteLine(S + img1.PixelFormat);
        Console.WriteLine(S + img2.PixelFormat);
    }
}

Console.WriteLine — это

UnsupportedImageFormatException PixelFormat Format32bppArgb UnsupportedImageFormatException PixelFormat Format32bppArgb


person jacknad    schedule 28.12.2011    source источник


Ответы (2)



Другой способ обойти эту проблему — сохранить изображение как System.Drawing.Image (например, xxx.jpg etc). а затем прочитать изображение обратно как изображение и преобразовать его в растровое изображение.
Это сработало для меня.

person Eranjene Sandun    schedule 30.10.2012