public List <DTOs.ImageRecord> QueryImage(string queryImagePath, object argument = null) { List <ImageRecord> rtnImageList = new List <ImageRecord>(); RgbProjections queryProjections; using (Bitmap bitmap = ImageUtility.ResizeBitmap(new Bitmap(queryImagePath), 100, 100)) { queryProjections = new RgbProjections(ImageUtility.GetRgbProjections(bitmap)); } BinaryAlgoRepository <List <RGBProjectionRecord> > repo = new BinaryAlgoRepository <List <RGBProjectionRecord> >(); List <RGBProjectionRecord> AllImage = repo.Load(); foreach (var imgInfo in AllImage) { var dist = imgInfo.RGBProjection.CalculateSimilarity(queryProjections); if (dist > 0.8d) { imgInfo.Distance = dist; rtnImageList.Add(imgInfo); } } rtnImageList = rtnImageList.OrderByDescending(x => x.Distance).ToList(); return(rtnImageList); }
public void IndexFiles(FileInfo[] imageFiles, BackgroundWorker IndexBgWorker, object argument = null) { List<PHashImageRecord> listOfRecords = new List<PHashImageRecord>(); string compressHash = string.Empty; int totalFileCount = imageFiles.Length; for (int i = 0; i < totalFileCount; i++) { var fi = imageFiles[i]; using (Bitmap bmp = new Bitmap(Image.FromFile(fi.FullName))) { compressHash = SimilarImage.GetCompressedImageHashAsString(bmp); } PHashImageRecord record = new PHashImageRecord { Id = i, ImageName = fi.Name, ImagePath = fi.FullName, CompressHash = compressHash }; listOfRecords.Add(record); IndexBgWorker.ReportProgress(i); } BinaryAlgoRepository<List<PHashImageRecord>> repo = new BinaryAlgoRepository<List<PHashImageRecord>>(); repo.Save(listOfRecords); }
public void IndexFiles(FileInfo[] imageFiles, System.ComponentModel.BackgroundWorker IndexBgWorker, object argument = null) { List<RGBProjectionRecord> listOfRecords = new List<RGBProjectionRecord>(); RgbProjections projections = null; int totalFileCount = imageFiles.Length; for (int i = 0; i < totalFileCount; i++) { var fi = imageFiles[i]; using (Bitmap bitmap = ImageUtility.ResizeBitmap(new Bitmap(fi.FullName), 100, 100)) { projections = new RgbProjections(ImageUtility.GetRgbProjections(bitmap)); } RGBProjectionRecord record = new RGBProjectionRecord { Id = i, ImageName = fi.Name, ImagePath = fi.FullName, RGBProjection = projections }; listOfRecords.Add(record); IndexBgWorker.ReportProgress(i); } BinaryAlgoRepository<List<RGBProjectionRecord>> repo = new BinaryAlgoRepository<List<RGBProjectionRecord>>(); repo.Save(listOfRecords); }
public List<ImageRecord> QueryImage(string queryImagePath, object argument = null) { List<ImageRecord> rtnImageList = new List<ImageRecord>(); string queryImageCompressHash; using (Bitmap bmp = new Bitmap(System.Drawing.Image.FromFile(queryImagePath))) { queryImageCompressHash = SimilarImage.GetCompressedImageHashAsString(bmp); } BinaryAlgoRepository<List<PHashImageRecord>> repo = new BinaryAlgoRepository<List<PHashImageRecord>>(); List<PHashImageRecord> AllImage = repo.Load(); foreach (var imgInfo in AllImage) { var dist = SimilarImage.CompareHashes(queryImageCompressHash, imgInfo.CompressHash); if (dist > 0.8) { imgInfo.Distance = dist; rtnImageList.Add(imgInfo); } } rtnImageList = rtnImageList.OrderByDescending(x => x.Distance).ToList(); return rtnImageList; }
public List <ImageRecord> QueryImage(string queryImagePath, object argument = null) { List <ImageRecord> rtnImageList = new List <ImageRecord>(); double[,] queryHistogram; using (Image img = Image.FromFile(queryImagePath)) { queryHistogram = BhattacharyyaCompare.Bhattacharyya.CalculateNormalizedHistogram(img); } BinaryAlgoRepository <List <BhattacharyyaRecord> > repo = new BinaryAlgoRepository <List <BhattacharyyaRecord> >(); List <BhattacharyyaRecord> AllImage = repo.Load(); foreach (var imgInfo in AllImage) { double[,] norHist = SingleToMulti(imgInfo.NormalizedHistogram); var dist = BhattacharyyaCompare.Bhattacharyya.CompareHistogramPercDiff(queryHistogram, norHist); if (dist < 3) { imgInfo.Distance = dist; rtnImageList.Add(imgInfo); } } rtnImageList = rtnImageList.OrderBy(x => x.Distance).ToList(); return(rtnImageList); }
public void IndexFiles(FileInfo[] imageFiles, BackgroundWorker IndexBgWorker, object argument = null) { List <CEDDRecord> listOfRecords = new List <CEDDRecord>(); double[] ceddDiscriptor = null; int totalFileCount = imageFiles.Length; CEDD cedd = new CEDD(); for (int i = 0; i < totalFileCount; i++) { var fi = imageFiles[i]; using (Bitmap bmp = new Bitmap(Image.FromFile(fi.FullName))) { ceddDiscriptor = cedd.Apply(bmp); } CEDDRecord record = new CEDDRecord { Id = i, ImageName = fi.Name, ImagePath = fi.FullName, CEDDDiscriptor = ceddDiscriptor }; listOfRecords.Add(record); IndexBgWorker.ReportProgress(i); } BinaryAlgoRepository <List <CEDDRecord> > repo = new BinaryAlgoRepository <List <CEDDRecord> >(); repo.Save(listOfRecords); }
public void IndexFiles(FileInfo[] imageFiles, BackgroundWorker IndexBgWorker, object argument = null) { List<CEDDRecord> listOfRecords = new List<CEDDRecord>(); double[] ceddDiscriptor = null; int totalFileCount = imageFiles.Length; CEDD cedd = new CEDD(); for (int i = 0; i < totalFileCount; i++) { var fi = imageFiles[i]; using (Bitmap bmp = new Bitmap(Image.FromFile(fi.FullName))) { ceddDiscriptor = cedd.Apply(bmp); } CEDDRecord record = new CEDDRecord { Id = i, ImageName = fi.Name, ImagePath = fi.FullName, CEDDDiscriptor = ceddDiscriptor }; listOfRecords.Add(record); IndexBgWorker.ReportProgress(i); } BinaryAlgoRepository<List<CEDDRecord>> repo = new BinaryAlgoRepository<List<CEDDRecord>>(); repo.Save(listOfRecords); }
public void IndexFiles(FileInfo[] imageFiles, BackgroundWorker IndexBgWorker, object argument = null) { List <PHashImageRecord> listOfRecords = new List <PHashImageRecord>(); string compressHash = string.Empty; int totalFileCount = imageFiles.Length; for (int i = 0; i < totalFileCount; i++) { var fi = imageFiles[i]; using (Bitmap bmp = new Bitmap(Image.FromFile(fi.FullName))) { compressHash = SimilarImage.GetCompressedImageHashAsString(bmp); } PHashImageRecord record = new PHashImageRecord { Id = i, ImageName = fi.Name, ImagePath = fi.FullName, CompressHash = compressHash }; listOfRecords.Add(record); IndexBgWorker.ReportProgress(i); } BinaryAlgoRepository <List <PHashImageRecord> > repo = new BinaryAlgoRepository <List <PHashImageRecord> >(); repo.Save(listOfRecords); }
public List <ImageRecord> QueryImage(string queryImagePath, object argument = null) { List <ImageRecord> rtnImageList = new List <ImageRecord>(); string queryImageCompressHash; using (Bitmap bmp = new Bitmap(System.Drawing.Image.FromFile(queryImagePath))) { queryImageCompressHash = SimilarImage.GetCompressedImageHashAsString(bmp); } BinaryAlgoRepository <List <PHashImageRecord> > repo = new BinaryAlgoRepository <List <PHashImageRecord> >(); List <PHashImageRecord> AllImage = repo.Load(); foreach (var imgInfo in AllImage) { var dist = SimilarImage.CompareHashes(queryImageCompressHash, imgInfo.CompressHash); if (dist > 0.8) { imgInfo.Distance = dist; rtnImageList.Add(imgInfo); } } rtnImageList = rtnImageList.OrderByDescending(x => x.Distance).ToList(); return(rtnImageList); }
public void IndexFiles(FileInfo[] imageFiles, BackgroundWorker IndexBgWorker, object argument = null) { List <BhattacharyyaRecord> listOfRecords = new List <BhattacharyyaRecord>(); Double[,] normalizedHistogram = new double[16, 16]; int totalFileCount = imageFiles.Length; for (int i = 0; i < totalFileCount; i++) { var fi = imageFiles[i]; using (Image img = Image.FromFile(fi.FullName)) { normalizedHistogram = Bhattacharyya.CalculateNormalizedHistogram(img); } BhattacharyyaRecord record = new BhattacharyyaRecord { Id = i, ImageName = fi.Name, ImagePath = fi.FullName, NormalizedHistogram = MultiToSingle(normalizedHistogram) }; listOfRecords.Add(record); IndexBgWorker.ReportProgress(i); } BinaryAlgoRepository <List <BhattacharyyaRecord> > repo = new BinaryAlgoRepository <List <BhattacharyyaRecord> >(); repo.Save(listOfRecords); }
public void IndexFiles(FileInfo[] imageFiles, BackgroundWorker IndexBgWorker, object argument = null) { List<BhattacharyyaRecord> listOfRecords = new List<BhattacharyyaRecord>(); Double[,] normalizedHistogram = new double[16,16]; int totalFileCount = imageFiles.Length; for (int i = 0; i < totalFileCount; i++) { var fi = imageFiles[i]; using (Image img = Image.FromFile(fi.FullName)) { normalizedHistogram = Bhattacharyya.CalculateNormalizedHistogram(img); } BhattacharyyaRecord record = new BhattacharyyaRecord { Id = i, ImageName = fi.Name, ImagePath = fi.FullName, NormalizedHistogram = MultiToSingle(normalizedHistogram) }; listOfRecords.Add(record); IndexBgWorker.ReportProgress(i); } BinaryAlgoRepository<List<BhattacharyyaRecord>> repo = new BinaryAlgoRepository<List<BhattacharyyaRecord>>(); repo.Save(listOfRecords); }
public void IndexFiles(FileInfo[] imageFiles, System.ComponentModel.BackgroundWorker IndexBgWorker, object argument = null) { List <RGBProjectionRecord> listOfRecords = new List <RGBProjectionRecord>(); RgbProjections projections = null; int totalFileCount = imageFiles.Length; for (int i = 0; i < totalFileCount; i++) { var fi = imageFiles[i]; using (Bitmap bitmap = ImageUtility.ResizeBitmap(new Bitmap(fi.FullName), 100, 100)) { projections = new RgbProjections(ImageUtility.GetRgbProjections(bitmap)); } RGBProjectionRecord record = new RGBProjectionRecord { Id = i, ImageName = fi.Name, ImagePath = fi.FullName, RGBProjection = projections }; listOfRecords.Add(record); IndexBgWorker.ReportProgress(i); } BinaryAlgoRepository <List <RGBProjectionRecord> > repo = new BinaryAlgoRepository <List <RGBProjectionRecord> >(); repo.Save(listOfRecords); }
public List <ImageRecord> QueryImage(string queryImagePath, object argument = null) { List <ImageRecord> rtnImageList = new List <ImageRecord>(); CEDD_Descriptor.CEDD cedd = new CEDD_Descriptor.CEDD(); int goodMatchDistance = 35; if (argument != null && argument is Int32) { goodMatchDistance = (int)argument; } double[] queryCeddDiscriptor; using (Bitmap bmp = new Bitmap(Image.FromFile(queryImagePath))) { queryCeddDiscriptor = cedd.Apply(bmp); } Stopwatch sw = Stopwatch.StartNew(); BinaryAlgoRepository <List <CEDDRecord> > repo = new BinaryAlgoRepository <List <CEDDRecord> >(); List <CEDDRecord> AllImage = (List <CEDDRecord>)repo.Load(); sw.Stop(); Debug.WriteLine("Load tooked {0} ms", sw.ElapsedMilliseconds); sw.Reset(); sw.Start(); foreach (var imgInfo in AllImage) { double[] ceddDiscriptor = imgInfo.CEDDDiscriptor; var dist = CEDD_Descriptor.CEDD.Compare(queryCeddDiscriptor, ceddDiscriptor); if (dist < goodMatchDistance) { imgInfo.Distance = dist; rtnImageList.Add(imgInfo); } } sw.Stop(); Debug.WriteLine("Query tooked {0} ms", sw.ElapsedMilliseconds); rtnImageList = rtnImageList.OrderBy(x => x.Distance).ToList(); return(rtnImageList); }
public void IndexFilesAsync(FileInfo[] imageFiles, System.ComponentModel.BackgroundWorker IndexBgWorker, object argument = null) { ConcurrentBag <RGBProjectionRecord> listOfRecords = new ConcurrentBag <RGBProjectionRecord>(); RgbProjections projections = null; int totalFileCount = imageFiles.Length; int i = 0; long nextSequence; //In the class scope: Object lockMe = new Object(); Parallel.ForEach(imageFiles, currentImageFile => { var fi = currentImageFile; using (Bitmap bitmap = ImageUtility.ResizeBitmap(new Bitmap(fi.FullName), 100, 100)) { projections = new RgbProjections(ImageUtility.GetRgbProjections(bitmap)); } lock (lockMe) { nextSequence = i++; } RGBProjectionRecord record = new RGBProjectionRecord { Id = nextSequence, ImageName = fi.Name, ImagePath = fi.FullName, RGBProjection = projections }; listOfRecords.Add(record); IndexBgWorker.ReportProgress(i); }); BinaryAlgoRepository <List <RGBProjectionRecord> > repo = new BinaryAlgoRepository <List <RGBProjectionRecord> >(); repo.Save(listOfRecords.ToList()); }
public void IndexFilesAsync(FileInfo[] imageFiles, BackgroundWorker IndexBgWorker, object argument = null) { ConcurrentBag <BhattacharyyaRecord> listOfRecords = new ConcurrentBag <BhattacharyyaRecord>(); Double[,] normalizedHistogram = new double[16, 16]; int totalFileCount = imageFiles.Length; int i = 0; long nextSequence; //In the class scope: Object lockMe = new Object(); Parallel.ForEach(imageFiles, currentImageFile => { var fi = currentImageFile; using (Image img = Image.FromFile(fi.FullName)) { normalizedHistogram = Bhattacharyya.CalculateNormalizedHistogram(img); } lock (lockMe) { nextSequence = i++; } BhattacharyyaRecord record = new BhattacharyyaRecord { Id = nextSequence, ImageName = fi.Name, ImagePath = fi.FullName, NormalizedHistogram = MultiToSingle(normalizedHistogram) }; listOfRecords.Add(record); IndexBgWorker.ReportProgress(i); }); BinaryAlgoRepository <List <BhattacharyyaRecord> > repo = new BinaryAlgoRepository <List <BhattacharyyaRecord> >(); repo.Save(listOfRecords.ToList()); }
public void IndexFilesAsync(FileInfo[] imageFiles, BackgroundWorker IndexBgWorker, object argument = null) { ConcurrentBag <PHashImageRecord> listOfRecords = new ConcurrentBag <PHashImageRecord>(); string compressHash = string.Empty; int totalFileCount = imageFiles.Length; int i = 0; long nextSequence; //In the class scope: long nextSequence; Object lockMe = new Object(); Parallel.ForEach(imageFiles, currentImageFile => { var fi = currentImageFile; using (Bitmap bmp = new Bitmap(Image.FromFile(fi.FullName))) { compressHash = SimilarImage.GetCompressedImageHashAsString(bmp); } lock (lockMe) { nextSequence = i++; } PHashImageRecord record = new PHashImageRecord { Id = nextSequence, ImageName = fi.Name, ImagePath = fi.FullName, CompressHash = compressHash }; listOfRecords.Add(record); IndexBgWorker.ReportProgress(i); }); BinaryAlgoRepository <List <PHashImageRecord> > repo = new BinaryAlgoRepository <List <PHashImageRecord> >(); repo.Save(listOfRecords.ToList()); }
public void IndexFilesAsync(FileInfo[] imageFiles, System.ComponentModel.BackgroundWorker IndexBgWorker, object argument = null) { ConcurrentBag<RGBProjectionRecord> listOfRecords = new ConcurrentBag<RGBProjectionRecord>(); RgbProjections projections = null; int totalFileCount = imageFiles.Length; int i = 0; long nextSequence; //In the class scope: Object lockMe = new Object(); Parallel.ForEach(imageFiles, currentImageFile => { var fi = currentImageFile; using (Bitmap bitmap = ImageUtility.ResizeBitmap(new Bitmap(fi.FullName), 100, 100)) { projections = new RgbProjections(ImageUtility.GetRgbProjections(bitmap)); } lock (lockMe) { nextSequence = i++; } RGBProjectionRecord record = new RGBProjectionRecord { Id = nextSequence, ImageName = fi.Name, ImagePath = fi.FullName, RGBProjection = projections }; listOfRecords.Add(record); IndexBgWorker.ReportProgress(i); }); BinaryAlgoRepository<List<RGBProjectionRecord>> repo = new BinaryAlgoRepository<List<RGBProjectionRecord>>(); repo.Save(listOfRecords.ToList()); }
public void IndexFilesAsync(FileInfo[] imageFiles, BackgroundWorker IndexBgWorker, object argument = null) { ConcurrentBag <CEDDRecord> listOfRecords = new ConcurrentBag <CEDDRecord>(); double[] ceddDiscriptor = null; int totalFileCount = imageFiles.Length; CEDD cedd = new CEDD(); int i = 0; long nextSequence; //In the class scope: Object lockMe = new Object(); Parallel.ForEach(imageFiles, currentImageFile => { var fi = currentImageFile; using (Bitmap bmp = new Bitmap(Image.FromFile(fi.FullName))) { ceddDiscriptor = cedd.Apply(bmp); } lock (lockMe) { nextSequence = i++; } CEDDRecord record = new CEDDRecord { Id = nextSequence, ImageName = fi.Name, ImagePath = fi.FullName, CEDDDiscriptor = ceddDiscriptor }; listOfRecords.Add(record); IndexBgWorker.ReportProgress(i); }); BinaryAlgoRepository <List <CEDDRecord> > repo = new BinaryAlgoRepository <List <CEDDRecord> >(); repo.Save(listOfRecords.ToList()); }
public void IndexFilesAsync(FileInfo[] imageFiles, BackgroundWorker IndexBgWorker, object argument = null) { ConcurrentBag<PHashImageRecord> listOfRecords = new ConcurrentBag<PHashImageRecord>(); string compressHash = string.Empty; int totalFileCount = imageFiles.Length; int i = 0; long nextSequence; //In the class scope: long nextSequence; Object lockMe = new Object(); Parallel.ForEach(imageFiles, currentImageFile => { var fi = currentImageFile; using (Bitmap bmp = new Bitmap(Image.FromFile(fi.FullName))) { compressHash = SimilarImage.GetCompressedImageHashAsString(bmp); } lock (lockMe) { nextSequence = i++; } PHashImageRecord record = new PHashImageRecord { Id = nextSequence, ImageName = fi.Name, ImagePath = fi.FullName, CompressHash = compressHash }; listOfRecords.Add(record); IndexBgWorker.ReportProgress(i); }); BinaryAlgoRepository<List<PHashImageRecord>> repo = new BinaryAlgoRepository<List<PHashImageRecord>>(); repo.Save(listOfRecords.ToList()); }
public void IndexFilesAsync(FileInfo[] imageFiles, BackgroundWorker IndexBgWorker, object argument = null) { ConcurrentBag<CEDDRecord> listOfRecords = new ConcurrentBag<CEDDRecord>(); double[] ceddDiscriptor = null; int totalFileCount = imageFiles.Length; CEDD cedd = new CEDD(); int i = 0; long nextSequence; //In the class scope: Object lockMe = new Object(); Parallel.ForEach(imageFiles, currentImageFile => { var fi = currentImageFile; using (Bitmap bmp = new Bitmap(Image.FromFile(fi.FullName))) { ceddDiscriptor = cedd.Apply(bmp); } lock (lockMe) { nextSequence = i++; } CEDDRecord record = new CEDDRecord { Id = nextSequence, ImageName = fi.Name, ImagePath = fi.FullName, CEDDDiscriptor = ceddDiscriptor }; listOfRecords.Add(record); IndexBgWorker.ReportProgress(i); }); BinaryAlgoRepository<List<CEDDRecord>> repo = new BinaryAlgoRepository<List<CEDDRecord>>(); repo.Save(listOfRecords.ToList()); }
public List<ImageRecord> QueryImage(string queryImagePath, object argument = null) { List<ImageRecord> rtnImageList = new List<ImageRecord>(); CEDD_Descriptor.CEDD cedd = new CEDD_Descriptor.CEDD(); int goodMatchDistance = 35; if (argument != null && argument is Int32) goodMatchDistance = (int)argument; double[] queryCeddDiscriptor; using (Bitmap bmp = new Bitmap(Image.FromFile(queryImagePath))) { queryCeddDiscriptor = cedd.Apply(bmp); } Stopwatch sw = Stopwatch.StartNew(); BinaryAlgoRepository<List<CEDDRecord>> repo = new BinaryAlgoRepository<List<CEDDRecord>>(); List<CEDDRecord> AllImage = (List<CEDDRecord>)repo.Load(); sw.Stop(); Debug.WriteLine("Load tooked {0} ms", sw.ElapsedMilliseconds); sw.Reset(); sw.Start(); foreach (var imgInfo in AllImage) { double[] ceddDiscriptor = imgInfo.CEDDDiscriptor; var dist = CEDD_Descriptor.CEDD.Compare(queryCeddDiscriptor, ceddDiscriptor); if (dist < goodMatchDistance) { imgInfo.Distance = dist; rtnImageList.Add(imgInfo); } } sw.Stop(); Debug.WriteLine("Query tooked {0} ms", sw.ElapsedMilliseconds); rtnImageList = rtnImageList.OrderBy(x => x.Distance).ToList(); return rtnImageList; }
public void IndexFilesAsync(FileInfo[] imageFiles, BackgroundWorker IndexBgWorker, object argument = null) { ConcurrentBag<BhattacharyyaRecord> listOfRecords = new ConcurrentBag<BhattacharyyaRecord>(); Double[,] normalizedHistogram = new double[16, 16]; int totalFileCount = imageFiles.Length; int i = 0; long nextSequence; //In the class scope: Object lockMe = new Object(); Parallel.ForEach(imageFiles, currentImageFile => { var fi = currentImageFile; using (Image img = Image.FromFile(fi.FullName)) { normalizedHistogram = Bhattacharyya.CalculateNormalizedHistogram(img); } lock (lockMe) { nextSequence = i++; } BhattacharyyaRecord record = new BhattacharyyaRecord { Id = nextSequence, ImageName = fi.Name, ImagePath = fi.FullName, NormalizedHistogram = MultiToSingle(normalizedHistogram) }; listOfRecords.Add(record); IndexBgWorker.ReportProgress(i); }); BinaryAlgoRepository<List<BhattacharyyaRecord>> repo = new BinaryAlgoRepository<List<BhattacharyyaRecord>>(); repo.Save(listOfRecords.ToList()); }
public List<DTOs.ImageRecord> QueryImage(string queryImagePath, object argument = null) { List<ImageRecord> rtnImageList = new List<ImageRecord>(); RgbProjections queryProjections; using (Bitmap bitmap = ImageUtility.ResizeBitmap(new Bitmap(queryImagePath), 100, 100)) { queryProjections = new RgbProjections(ImageUtility.GetRgbProjections(bitmap)); } BinaryAlgoRepository<List<RGBProjectionRecord>> repo = new BinaryAlgoRepository<List<RGBProjectionRecord>>(); List<RGBProjectionRecord> AllImage = repo.Load(); foreach (var imgInfo in AllImage) { var dist = imgInfo.RGBProjection.CalculateSimilarity(queryProjections); if (dist > 0.8d) { imgInfo.Distance = dist; rtnImageList.Add(imgInfo); } } rtnImageList = rtnImageList.OrderByDescending(x => x.Distance).ToList(); return rtnImageList; }
public List<ImageRecord> QueryImage(string queryImagePath, object argument = null) { List<ImageRecord> rtnImageList = new List<ImageRecord>(); double[,] queryHistogram; using (Image img = Image.FromFile(queryImagePath)) { queryHistogram = BhattacharyyaCompare.Bhattacharyya.CalculateNormalizedHistogram(img); } BinaryAlgoRepository<List<BhattacharyyaRecord>> repo = new BinaryAlgoRepository<List<BhattacharyyaRecord>>(); List<BhattacharyyaRecord> AllImage = repo.Load(); foreach (var imgInfo in AllImage) { double[,] norHist = SingleToMulti(imgInfo.NormalizedHistogram); var dist = BhattacharyyaCompare.Bhattacharyya.CompareHistogramPercDiff(queryHistogram, norHist); if (dist < 3) { imgInfo.Distance = dist; rtnImageList.Add(imgInfo); } } rtnImageList = rtnImageList.OrderBy(x => x.Distance).ToList(); return rtnImageList; }