Exemple #1
0
        public bool ReadFile(String fileName, Mat mat, CvEnum.ImreadModes loadType)
        {
            try
            {
                //try again to load with UIImage
                using (UIImage tmp = UIImage.FromFile(fileName))
                {
                    CGImageExtension.ConvertCGImageToArray(tmp.CGImage, mat, loadType);
                }

                return(true);
            }
            catch (Exception e)
            {
                Debug.WriteLine(e);
                return(false);
            }
        }
Exemple #2
0
 public bool ReadFile(String fileName, Mat mat, CvEnum.ImreadModes loadType)
 {
     try
     {
         using (CGDataProvider provider = new CGDataProvider(fileName))
             using (CGImage tmp = CGImage.FromPNG(provider, null, false, CGColorRenderingIntent.Default))
             {
                 CGImageExtension.ConvertCGImageToArray(tmp, mat, loadType);
             }
         return(true);
     }
     catch (Exception e)
     {
         Debug.WriteLine(e);
         //throw;
         return(false);
     }
 }