I cannot convert a stream into Emgu.CV gray image on Xamarin

Afrrcyn 1 Reputation point
2021-03-21T16:40:26.18+00:00

So I'm using the function:

var result = await MediaPicker.CapturePhotoAsync();

I then, take this and get a stream:

var stream = await result.OpenReadAsync();

This is where the problem occurs, I'm trying to convert this Stream to a Bgr/Gray image that I can use with the EmguCV library, but when I try:

System.Drawing.Image imgMain = System.Drawing.Image.FromStream(stream);
Bitmap imgBit = new Bitmap(stream);
img.Save(System.IO.Path.GetTempPath() + "\myImage.Jpeg",
System.Drawing.Imaging.ImageFormat.Png);

An error occurs:

System.PlatformNotSupportedException: 'Operation is not supported on this platform.'

I think this is because I'm developing this for an Android device but I'm not quite certain, I'm very clearly a beginner and have almost no idea what I'm doing, any help is appreciated, Thanks (:

Xamarin
Xamarin
A Microsoft open-source app platform for building Android and iOS apps with .NET and C#.
5,272 questions
C#
C#
An object-oriented and type-safe programming language that has its roots in the C family of languages and includes support for component-oriented programming.
10,094 questions
0 comments No comments
{count} votes