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 TestgetHist() { ImageInfo imInf = new ImageInfo(PATH_160_120_RGB); AForge.Math.Histogram hist = imInf.getHist(); Console.WriteLine("{0} {1} {2} {3} {4} {5}\n", hist.Max, hist.Min, hist.Mean, hist.StdDev, hist.TotalCount, hist.Median); int[] histVal = hist.Values; for (int i = 0; i < histVal.Length; i++) { Console.Write("{0} ", histVal[i]); } }