The Nightbulb
The Nightbulb

Reputation: 1

Bitmap reference issue: ... is defined in an assembly that is not referenced

Im making a script to compare two images, using the Accord.Imaging package. but i get these errors when i try to use it (this happens multiple times)

Severity    Code    Description Project File    Line    Suppression State   Details
Error   CS0012  The type 'Bitmap' is defined in an assembly that is not referenced. You must add a reference to assembly 'CoreCompat.System.Drawing, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null'.    Machine learning test   C:\Users\Night\source\repos\Machine learning test\Machine learning test\ImageComparer.cs    9   Active  

Severity    Code    Description Project File    Line    Suppression State   Details
Error   CS0012  The type 'BitmapData' is defined in an assembly that is not referenced. You must add a reference to assembly 'CoreCompat.System.Drawing, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null'.    Machine learning test   C:\Users\Night\source\repos\Machine learning test\Machine learning test\ImageComparer.cs    15  Active  

when I add CoreCompat.System.Drawing (using nuget), I get a bunch more errors from other parts of my code

public static float CompareImages(Bitmap image1, Bitmap image2)
{
    UnmanagedImage img1 = UnmanagedImage.FromManagedImage(image1);
    UnmanagedImage img2 = UnmanagedImage.FromManagedImage(image2);
    // Create a new ExhaustiveTemplateMatching
    Accord.Imaging.ExhaustiveTemplateMatching tm = new Accord.Imaging.ExhaustiveTemplateMatching(0.9f);

    // Compare
    Accord.Imaging.TemplateMatch[] matchings = tm.ProcessImage(img1, img2);

    // Check the similarity level
    if (matchings.Length > 0)
    {
        return matchings[0].Similarity;
    }

    return 0;
}

Upvotes: 0

Views: 192

Answers (0)

Related Questions