public void TestDeepCopyCOns() { ImageInfo from = new ImageInfo(PATH_160_120_RGB); from.getHist(); from.getImb(); from.getImF(); ImageInfo to = new ImageInfo(from); from.Dispose(); from = null; Debug.WriteLine("B:{0},F:{1}, W:{2}, H:{3}, HISTMEAN:{4}, P:{5}", to.getImb().Length, to.getImF().Length, to.Width, to.Height, to.getHist().Mean, to.getPath()); }
/// <summary> /// DeepCopy Constructor /// </summary> /// <param name="from">Copied Source</param> public ImageInfo(ImageInfo from) { _disposed = false; // copy path _path = from.getPath(); // copy gray image _imGray = new Bitmap(from.getIm()); // copy histogram _hist = from.getHist() == null ? null : copyHist(from.getHist()); // copy _imf if (from.getImF() != null) { _imf = new float[from.getImF().Length]; from.getImF().CopyTo(_imf, 0); } else { _imf = null; } // copy _imb if (from.getImF() != null) { _imb = new byte[from.getImb().Length]; from.getImb().CopyTo(_imb, 0); } else { _imb = null; } // copy size _width = from.Width; _height = from.Height; }
public void TestgetImf() { ImageInfo im = new ImageInfo(PATH_160_120_RGB); float[] imf = im.getImF(); Console.WriteLine(" {0} {1} {2} {3}\n", imf.Length, im.getIm().Width * im.getIm().Height, imf.Min(), imf.Max()); Assert.IsTrue(imf.Max() <= 1 && imf.Min() >= 0 && imf.Length == (im.getIm().Width * im.getIm().Height)); }