void AutoFindBeads(Int2 beadCornerPos) { int roi = GetROI(); beadCornerPos.Clamp(image.w - roi, image.h - roi); Cursor.Current = Cursors.WaitCursor; Int2[] beadpos = QTrkUtil.FindBeads(image, beadCornerPos, ROISize, AutoFindMinDist, AutoFindAcceptance); Cursor.Current = Cursors.Default; MessageBox.Show("beads: " + beadpos.Length); roiPositions.AddRange(Array.ConvertAll(beadpos, corner => new Int2(corner.x + roi / 2, corner.y + roi / 2))); SwitchAutoFind(); }
protected override IEnumerable <Int2> GetPartitionPoints(IntRect rect) { Int2 bl = rect.BottomLeft / partitionSize; Int2 tr = rect.TopRight / partitionSize; bl = bl.Clamp(min, max); tr = tr.Clamp(min, max); for (int y = bl.y; y <= tr.y; y++) { for (int x = bl.x; x <= tr.x; x++) { yield return(new Int2(x, y)); } } }