public void pictureBox1_Click(object sender, EventArgs e) { //тестирующий код int[] segOut; Bitmap testBitmap = new SegmentImage(0.7, 500, 200).ExecuteEfficientSegmentation(new Bitmap("inputimage2.jpg"), String.Empty, out segOut); Graphics grp = Graphics.FromHwnd(pictureBox1.Handle); grp.DrawImage(testBitmap, 0, 0, testBitmap.Width, testBitmap.Height); }
/// <summary> /// Функция генерирует суперпиксели, используя параметры по умолчанию. /// </summary> private void GenerateSuperpixelsEfficiently(Bitmap bitmap) { double[] scales = { 0.8, 1.6, 5 }; //масштабы суперпикселей (small, middle, large) int width = bitmap.Width; int height = bitmap.Height; //для каждого масштаба for (int j = 0; j < 3; j++) { SegmentImage segmentImageManager = new SegmentImage(Default.Sigma * scales[j], Default.ThresholdFunctionParameter * scales[j], (int)(Default.MinSize * scales[j])); int[] segmentOut; Bitmap output = segmentImageManager.ExecuteEfficientSegmentation(bitmap, _outputFolder, out segmentOut); } }