Open IKoshelev opened 3 years ago
Update, issue looks to be fixed by
sudo apt install libc6-dev
sudo apt install libgdiplus
as suggested here https://github.com/dotnet/core/issues/2746
Yes, I was going to suggest that, apologies - I thought that was already mentioned in the wiki but possibly not. I would definitely advise cloning the master branch as it features many improvements to the motion detection API, including huge performance improvements.
@techyian Yes, thank you, I cloned and built master on a Win 10 machine, then dropped dlls into project on my Pi, but encountered some strange behavior. When I tried to run a basic video stream, video was in 1280x720 resolution and trying to change it via MMALCameraConfig.Resolution = new Resolution(1920, 1080);
lead to an exception
mmal: mmal_vc_component_enable: failed to enable component: ENOSPC
Unhandled exception. MMALSharp.MMALNoSpaceException: Out of resources. Unable to enable component
at MMALSharp.MMALNativeExceptionHelper.MMALCheck(MMAL_STATUS_T status, String message)
at MMALSharp.MMALComponentBase.EnableComponent()
at MMALSharp.Components.MMALCameraComponent.Initialise(IOutputCaptureHandler stillCaptureHandler, IOutputCaptureHandler videoCaptureHandler)
at MMALSharp.MMALCamera.ConfigureCameraSettings(IOutputCaptureHandler stillCaptureHandler, IOutputCaptureHandler videoCaptureHandler)
at StreamSplitterExperiment.Program.CaptureDifferentStreams(OutputWriterHandlerPipeWriter h264PipeWriter, OutputWriterHandlerPipeWriter mjpegPipeWriter, Symaphore symaphore, CancellationToken token) in /home/pi/raseye-sharp/StreamSplitterExperiment/Program.cs:line 121
at StreamSplitterExperiment.Program.Main(String[] args) in /home/pi/raseye-sharp/StreamSplitterExperiment/Program.cs:line 106
at StreamSplitterExperiment.Program.<Main>(String[] args)
so, I thought Alpha was still at an early stage and went back to V0.6.
P.S. thank you for great lib.
Thanks for the positive feedback. Could you provide an example code snippet? I may be able to see where the issue is.
@techyian I sent out an invitation to the private repo with my Pi surveillance fun-project. Link to particular snapshot: https://github.com/IKoshelev/reseye-sharp/blob/1720383726bf936b6fad17b7f3a94a06aeef9bbd/StreamSplitterExperiment/Program.cs Mind you, this is just a playground repo, so a lot of code is throw-away. I run this project on my PI and connect to stream via vlc with
tcp/h264://{my pi IP}:9010
@techyian I've forked this repo, added a playground project and replicated mmal: mmal_vc_component_enable: failed to enable component: ENOSPC
in it: https://github.com/IKoshelev/MMALSharp/blob/0261549c171cc9b8670f4ae531b6cbc3f8aa32eb/Playground/Program.cs
P.S. Which camera module are you using? I'm getting this issue on OV5647.
@techyian Can you maybe activate discussions for this repo? https://docs.github.com/en/discussions/quickstart
I've done some experiments with
System.Numerics.Vector
https://instil.co/blog/parallelism-on-a-single-core-simd-with-c/
System.Runtime.Intrinsics
https://devblogs.microsoft.com/dotnet/hardware-intrinsics-in-net-core/
and was wondering, if we they can improve frame-diffing speed for motion detection, but they require .NET5 and ARM64 (so, 64bit OS).
@IKoshelev I just ran a quick test and I see that out of resources
error, too. I'm not quite ready to get active on this project again, but very close. I hope all my motion detection changes didn't introduce a regression!
Because motion detection is my focus, I have been very interested in seeing what the overall .NET 5 improvements look like, but I like your thinking about intrinsics, too. That would be a big change for me (I'm running 32 bit at the moment) but probably worthwhile.
Hi @techyian -- hope you're well.
@MV10 I tried intrinsics with Raspbian 64. They worked great, the loop that took 60 ms in plain C# took nole 2 ms with intrinsics. BUT Raspbian 64 is in beta and camera does not work yet at all. Not to mention, I'm guessing MMAL bindings for x64 would be different?
@IKoshelev Any news about the "our of resources" error? I`m using the hq-camera with my pi, but when I change the resolution to more the 2mp I get the "our of resources" error... Would be grate to be able to use the last version with hq-camera...
I have a .NET 5 app, referencing MMALSharp v0.6, building and running on Pi 4 (2Gb) Raspbian Lite, copypasted default motion detection example verbatim from https://github.com/techyian/MMALSharp/wiki/Advanced-Examples/93b717ebbf4502f3a6c1ef99137a6b416dd0c3e6#FrameDiffDetection , getting an exception: