using BilinearInterpolation in Xamarin android

40 views
Skip to first unread message

vahid.xam...@gmail.com

unread,
Apr 16, 2016, 1:17:42 AM4/16/16
to Fellow Oak DICOM
Hi,
How can I use BilinearInterpolation in xamarin android I used some code follow bellow :


       public static byte[] ToByteArray( Bitmap bmp)
        {
            byte[] bytes = null;
            if (bmp != null)
            {
                using (MemoryStream stream = new MemoryStream())
                {
                    if (bmp.Compress(Bitmap.CompressFormat.Jpeg, 100, stream))
                    {
                        bytes = stream.ToArray();
                    }
                }
            }
            return bytes;
        }

 var newByteArray = ToByteArray(WLBitmap);

  var data =  Dicom.Imaging.Algorithms.BilinearInterpolation.RescaleColor24(newByteArray, bmpWidth, bmpHeight,newW, newH); //bmpWidth=512 , bmpHeight = 512 , newW = 3*512; newH=3*512;

but I have an  error==> error: {System.IndexOutOfRangeException}

I am confuse really what should I do 
Thanks 




Anders Gustafsson Cureos AB

unread,
Apr 17, 2016, 2:05:42 PM4/17/16
to Fellow Oak DICOM
Hi,

Why do you compress the data in the ToByteArray method? The BilinearInterpolation methods expect you to input uncompressed data.

Regards,
Anders @ Cureos

Reply all
Reply to author
Forward
0 new messages