public override List <Cloth> Search() { PicParam picParam = (PicParam)param; List <Cloth> clothes = null; if (wrappedSearcher != null) { clothes = wrappedSearcher.Search(); } else if (clothDao != null) { if (picParam.ClothNum > 0) { clothes = clothDao.FindByClothNum(picParam.ClothNum); } else { clothes = clothDao.FindAll(); } } if (null == clothes) { throw new NullReferenceException("Both wrappedSearcher and clothDao are null, or some error happened."); } float[] featureVector = picParam.Feature; SortedDictionary <float, List <Cloth> > sortClothes = new SortedDictionary <float, List <Cloth> >(); foreach (Cloth cloth in clothes) { float md = calcDist(featureVector, GetVector(cloth)); if (md <= limit) { if (!sortClothes.ContainsKey(md)) { sortClothes[md] = new List <Cloth>(); } sortClothes[md].Add(cloth); } } List <Cloth> resultClothes = new List <Cloth>(); foreach (List <Cloth> cs in sortClothes.Values) { resultClothes.AddRange(cs); } if (resultClothes.Count > MaxResult) { return(resultClothes.GetRange(0, MaxResult)); } return(resultClothes); }
public ColorSearcher(PicParam picParam, float limit, DelCalcDist calcDist, IClothDao clothDao, int maxResult) : base(picParam, limit, calcDist, clothDao, maxResult) { }
public ColorSearcher(PicParam picParam, float limit, DelCalcDist calcDist, IBaseSearcher wrappedSearcher, int maxResult) : base(picParam, limit, calcDist, wrappedSearcher, maxResult) { }
public CooccurrenceSearcher(PicParam picParam, float limit, IClothDao clothDao, int maxResult) : this(picParam, limit, ClothUtil.CalcManhattanDistance, clothDao, maxResult) { }
public CooccurrenceSearcher(PicParam picParam, float limit, IBaseSearcher wrappedSearcher, int maxResult) : this(picParam, limit, ClothUtil.CalcManhattanDistance, wrappedSearcher, maxResult) { }
public GaborSearcher(PicParam picParam, float limit, IClothDao clothDao, int maxResult) : this(picParam, limit, ClothUtil.CalcGaborDistance, clothDao, maxResult) { }
public GaborSearcher(PicParam picParam, float limit, IBaseSearcher wrappedSearcher, int maxResult) : this(picParam, limit, ClothUtil.CalcGaborDistance, wrappedSearcher, maxResult) { }
public DaubechiesWaveletSearcher(PicParam picParam, float limit, DelCalcDist calcDist, IClothDao clothDao, int maxResult) : base(picParam, limit, calcDist, clothDao, maxResult) { }
public DaubechiesWaveletSearcher(PicParam picParam, float limit, IClothDao clothDao, int maxResult) : this(picParam, limit, ClothUtil.CalcManhattanDistance, clothDao, maxResult) { }
public DaubechiesWaveletSearcher(PicParam picParam, float limit, DelCalcDist calcDist, IBaseSearcher wrappedSearcher, int maxResult) : base(picParam, limit, calcDist, wrappedSearcher, maxResult) { }
public DaubechiesWaveletSearcher(PicParam picParam, float limit, IBaseSearcher wrappedSearcher, int maxResult) : this(picParam, limit, ClothUtil.CalcManhattanDistance, wrappedSearcher, maxResult) { }
public PicSearcher(PicParam picParam, float limit, DelCalcDist calcDist, IClothDao clothDao, int maxResult) : base(picParam, clothDao, maxResult) { this.limit = limit; this.calcDist = calcDist; }
public PicSearcher(PicParam picParam, float limit, DelCalcDist calcDist, IBaseSearcher wrappedSearcher, int maxResult) : base(picParam, wrappedSearcher, maxResult) { this.limit = limit; this.calcDist = calcDist; }