C# Accord image library: cannot convert from ‘System.Drawing.Bitmap’ to ‘Accord.Imaging.UnmanagedImage’ while using Accord imaging library

I'm trying to get this sample image processing code to work, but I keep getting :

The type 'Bitmap' is defined in an assembly that is not referenced. You must add a reference to assembly 'CoreCompat.System.Drawing, Version=, Culture=neutral, PublicKeyToken=null'. and cannot convert from 'System.Drawing.Bitmap' to 'Accord.Imaging.UnmanagedImage'

when using blobcounter.ProcessImage(). What am I missing?

using System;
using System.Collections.Generic;
using System.Drawing;
using System.Drawing.Imaging;
using Accord;
using Accord.Imaging;
using Accord.Math.Geometry;
namespace Image.Processor
    public class ShapeFinder
        public ShapeFinder()
            // Open your image
            string path = "test.png";
            Bitmap image = (Bitmap)Bitmap.FromFile(path);

            // locating objects
            BlobCounter blobCounter = new BlobCounter();

            blobCounter.FilterBlobs = true;
            blobCounter.MinHeight = 5;
            blobCounter.MinWidth = 5;

            Blob[] blobs = blobCounter.GetObjectsInformation();

Read more here: https://stackoverflow.com/questions/64395329/c-sharp-accord-image-library-cannot-convert-from-system-drawing-bitmap-to-ac

Content Attribution

This content was originally published by Les Woodland at Recent Questions - Stack Overflow, and is syndicated here via their RSS feed. You can read the original post over there.

%d bloggers like this: