I need to pass an image (Image _thresholdedImage
) like byte array... I don\'t know how I can do this. Any idea? Thank you!
_thresholdedImage.Sou
Following code can use to convert image into byte array.Here CrossMedia plugin is used to capture image from camera.
public byte[] imageByte;
Stream imageStream = null;
var file = await CrossMedia.Current.TakePhotoAsync(new Plugin.Media.Abstractions.StoreCameraMediaOptions
{ Name = "pic.jpg"});
if (file == null) return;
imageStream = file.GetStream();
BinaryReader br = new BinaryReader(imageStream);
imageByte = br.ReadBytes((int)imageStream.Length);