コード例 #1
0
ファイル: Image.cs プロジェクト: Forpatril/Diploma
        public Image(double[,] values)
        {
            Array = new ImageArray(values);
            Height = Array.Array.GetLength(0);
            Width = Array.Array.GetLength(1);
            GetBitmap();
            
            /*
            string tp = "C:\\" + GetRandomName()+".bmp";

            Bitmap.Save(tp,);
            Loader tmp = new Loader();
            image = tmp.loadimage(new MWCharArray(tp));
            tmp.Dispose();
            File.Delete(tp);
            */
            MWNumericArray tmp = new MWNumericArray(values);
            image = (MWArray)tmp;

            tmp = null;
            GC.Collect();
        }
コード例 #2
0
ファイル: Image.cs プロジェクト: Forpatril/Diploma
        public Image(string path)
        {
            MWNumericArray descriptor = null;
            MWCharArray mw_path;
            try
            {
                mw_path = new MWCharArray(path);
            }
            catch (System.Exception ex)
            {
                System.Windows.Forms.MessageBox.Show(ex.ToString());
                return;
            }
            
            Loader Loader = new Loader();
            image = Loader.loadimage(mw_path);
            descriptor = (MWNumericArray)image;
            try
            {
                Array = new ImageArray((double[,])descriptor.ToArray(MWArrayComponent.Real));
            }
            catch (InvalidCastException exc)
            {
                descriptor = null;
                mw_path = null;
                Loader = null;
                GC.Collect();
                return;
            }

            Height = Array.Array.GetLength(0);
            Width = Array.Array.GetLength(1);
            GetBitmap();

            descriptor = null;
            mw_path = null;
            Loader = null;
            GC.Collect();
        }