Michael Michael - 6 months ago 90
ASP.NET (C#) Question

Emgu.CV.CvInvoke exception in iisexpress.exe

I use the library Emgu.CV.World and a set of classes x86 in web solution ASP.NET MVC5. Version EMGU:

For a while it worked, then I made a copy of the project in the same directory and changed the name of the folder, then began to appear the error:

An exception is thrown at 0x2AF630B1 (cvextern.dll) in iisexpress.exe: 0xC0000005: Access violation reading location 0x00000000.

This same functionality is implemented in the Win Forms application of the same libraries, it works without problems.
But web application all the time breaks down, on this method : CvInvoke.Threshold ().

Used x86, x64 catalogs, copy all the libraries in a separate directory, change the type of application to any CPU , x86 to x64 and nothing.
Tried on other systems (64-bit) is the same. Most interesting is that initially it worked, ie, the error my code is not.

I used, IIS Express 10, vs 2015 community.

I would be grateful for some advice, thanks


The answer was found. The reason for the error has become not noticed during the last refactoring line: imgGray.Dispose();

imageRotate = imgGray.Rotate(-avg, new Gray(255));
            imageRotate = imgGray;

        //return imageRotate.Bitmap;
        return BlackFilterImage(imageRotate);

    private static Bitmap BlackFilterImage(Image<Gray, byte> img)
        UMat resultImg = new UMat();
        CvInvoke.Threshold(img, resultImg, 105, 255, ThresholdType.BinaryInv); //Error is here

Unfortunately, the nature of the error to muddle me.