question

Afrrcyn avatar image
0 Votes"
Afrrcyn asked RobCaplan edited

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

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 (:



dotnet-csharpdotnet-xamarin
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

0 Answers