/// <summary> /// 使用参考图像和对比图像的文件信息初始化 <see cref="ImagePair"/> 类的新实例。 /// </summary> /// <param name="sourceFile">参考图像的文件信息。</param> /// <param name="compareFile">对比图像的文件信息。</param> public ImagePair(FileInfo sourceFile, FileInfo compareFile) { this.SourceFile = sourceFile; this.CompareFile = compareFile; this.SourceBitmapCache = new AutoReloadCache <Bitmap>( () => this.TryLoadBitmap(this.SourceFile.FullName)); this.CompareBitmapCache = new AutoReloadCache <Bitmap>( () => this.TryLoadBitmap(this.CompareFile.FullName)); this.LazyPsnr = new Lazy <double>(this.ComputePsnr); this.LazySsim = new Lazy <double>(this.ComputeSsim); }
/// <summary> /// 使用参考图像和对比图像的路径初始化 <see cref="ImagePair"/> 类的新实例。 /// </summary> /// <param name="sourcePath">参考图像文件的路径。</param> /// <param name="comparePath">对比图像文件的路径。</param> public ImagePair(string sourcePath, string comparePath) { this.SourceFile = this.TryLoadFile(sourcePath); this.CompareFile = this.TryLoadFile(comparePath); this.SourceBitmapCache = new AutoReloadCache <Bitmap>( () => this.TryLoadBitmap(this.SourceFile.FullName)); this.CompareBitmapCache = new AutoReloadCache <Bitmap>( () => this.TryLoadBitmap(this.CompareFile.FullName)); this.LazyPsnr = new Lazy <double>(this.ComputePsnr); this.LazySsim = new Lazy <double>(this.ComputeSsim); }