public static double GetPosThreshold( this ImgIdxPos src) { return(src.Match() .With(s => s == ImgIdxPos.TM, 244) .With(s => s == ImgIdxPos.BM, 244) .Else(170) .Do()); }
public static T SetImgPos2GridPos <T>( this T src , ImgIdxPos pos) where T : Control { var rowcol = pos.Match() .With(x => x == ImgIdxPos.TL, new int[] { 0, 0 }) .With(x => x == ImgIdxPos.TM, new int[] { 0, 1 }) .With(x => x == ImgIdxPos.TR, new int[] { 0, 2 }) .With(x => x == ImgIdxPos.BL, new int[] { 1, 0 }) .With(x => x == ImgIdxPos.BM, new int[] { 1, 1 }) .With(x => x == ImgIdxPos.BR, new int[] { 1, 2 }) .Else(new int[2]) .Do(); return(src.SetGridPos(rowcol [0], rowcol [1])); }
public static List <DefectData> ShiftDefectData( this List <DefectData> src , Dictionary <OffsetPos, int> offset , ImgIdxPos pos , int resol) { return(pos.Match() .With(x => x == ImgIdxPos.TM, src.ShiftDefect (0, offset[OffsetPos.Col1], resol)) .With(x => x == ImgIdxPos.TR, src.ShiftDefect (0, offset[OffsetPos.Col2], resol)) .With(x => x == ImgIdxPos.BL, src.ShiftDefect (offset [OffsetPos.Row1], 0, resol)) .With(x => x == ImgIdxPos.BM, src.ShiftDefect (offset [OffsetPos.Row1], offset[OffsetPos.Col1], resol)) .With(x => x == ImgIdxPos.BR, src.ShiftDefect (offset [OffsetPos.Row1], offset[OffsetPos.Col2], resol)) .Else(src) .Do()); }