accord-net / framework

Machine learning, computer vision, statistics and general scientific computing for .NET
http://accord-framework.net
GNU Lesser General Public License v2.1
4.46k stars 2k forks source link

Exception User-Unhandled at LockBits #1931

Open MartinStokelj opened 4 years ago

MartinStokelj commented 4 years ago

What would you like to submit? (put an 'x' inside the bracket that applies)

Issue description Hello, I have updated accord-net from realy old version made somewhere in 2017 to last version avaible over github. I am using computer HD camera to show video but after I start to see the video image, error occures at function LockBits (Accord.Imaging.Tools.cs) called from BitmapData imageData = image.LockBits(ImageLockMode.WriteOnly); (Accord.Video.DirectShow.VideoCaptureDevice.cs)

Untitled1 Untitled2 System.ArgumentException HResult=0x80070057 Message=Parameter is not valid. Source=System.Drawing

Any idea what is wrong?

I am also haveing problems with changing usage of ffmpeg version, currently is used ffmpeg-3.2.2 but if I try to change to use ffmpeg-4.2 i get build errors for missing "includes", what needs to be changed in project to use different ffmpeg version?

justingruenberg commented 4 years ago

Is there any chance you’re accessing the bitmap across threads? That’s a common cause.

This is probably an error reported from GDI. Take a look at the HResult and google it. A lot of GDI errors will give this exception, which is very opaque.