2.0.9
This commit is contained in:
@@ -30,29 +30,29 @@ namespace Lindt.Candybox.Demo
|
||||
_recipe.ProcessImage(original);
|
||||
|
||||
Mat matContours2;
|
||||
if (_recipe.LearnedParameters.CandyParameters.Count==0)
|
||||
if (_recipe.LearnedParameters.CandyParameters.Count == 0)
|
||||
{
|
||||
Mat matContours = new Mat(new OpenCvSharp.Size(512, 512), MatType.CV_8UC3, Scalar.Black);
|
||||
Cv2.DrawContours(matContours, _recipe.LastContours, -1, Scalar.White, -1);
|
||||
|
||||
|
||||
matContours2 = matContours.Resize(new OpenCvSharp.Size(1800, 1408));
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
|
||||
Mat matContours = new Mat(new OpenCvSharp.Size(512, 512), MatType.CV_8UC3, Scalar.Black);
|
||||
Cv2.DrawContours(matContours, _recipe.LastContours, -1, Scalar.White, -1);
|
||||
|
||||
|
||||
matContours2 = matContours.Resize(new OpenCvSharp.Size(1800, 1408));
|
||||
|
||||
}
|
||||
|
||||
udMemoryBuffer.Value = _recipe.LearnedParameters.Configuration.MemoryBuffer;
|
||||
|
||||
|
||||
|
||||
maskControl1.Mask = matContours2.ToBitmap();
|
||||
maskControl1.Original = original.Clone().ToBitmap();
|
||||
maskControl1.VectorLines = _recipe.LearnedParameters.Cuts.Select(x=>x.Scale(1800f/512f, 1408f/512f)).ToList();
|
||||
maskControl1.VectorLines = _recipe.LearnedParameters.Cuts.Select(x => x.Translate(_recipe.BlisterCenter).Scale(1800f / 512f, 1408f / 512f)).ToList();
|
||||
// Set default mode to Brush
|
||||
SetMode(EditMode.Brush);
|
||||
}
|
||||
@@ -62,11 +62,11 @@ namespace Lindt.Candybox.Demo
|
||||
maskControl1.CurrentMode = mode;
|
||||
|
||||
// Reset button colors
|
||||
btnBrush.Primary = mode==EditMode.Brush;
|
||||
btnDrawLine.Primary = mode==EditMode.DrawLine;
|
||||
btnRemoveLine.Primary = mode==EditMode.RemoveLine;
|
||||
btnMoveLine.Primary = mode==EditMode.MoveLine;
|
||||
btnMoveVertices.Primary = mode==EditMode.MoveVertices;
|
||||
btnBrush.Primary = mode == EditMode.Brush;
|
||||
btnDrawLine.Primary = mode == EditMode.DrawLine;
|
||||
btnRemoveLine.Primary = mode == EditMode.RemoveLine;
|
||||
btnMoveLine.Primary = mode == EditMode.MoveLine;
|
||||
btnMoveVertices.Primary = mode == EditMode.MoveVertices;
|
||||
btnBrush.Invalidate();
|
||||
btnDrawLine.Invalidate();
|
||||
btnRemoveLine.Invalidate();
|
||||
@@ -106,18 +106,32 @@ namespace Lindt.Candybox.Demo
|
||||
List<Point[]> contours = new List<Point[]>();
|
||||
foreach (Point[] contour in maskControl1.LastContours)
|
||||
{
|
||||
contours.Add(contour.Select(x => new Point(x.X/1800f*512f, x.Y / 1408f * 512f)).ToArray());
|
||||
contours.Add(contour.Select(x => new Point(x.X / 1800f * 512f, x.Y / 1408f * 512f)).ToArray());
|
||||
}
|
||||
|
||||
_recipe.LearnedParameters.Configuration.MemoryBuffer = (int)udMemoryBuffer.Value;
|
||||
_recipe.LearnContours(contours.ToArray(), _original,maskControl1.VectorLines.Select(x=>x.Scale(512f/1800f, 512f/1408f)).ToList());
|
||||
_recipe.LearnContours(contours.ToArray(), _original, maskControl1.VectorLines.Select(x => x.Scale(512f / 1800f, 512f / 1408f).Sub(_recipe.BlisterCenter)).ToList(), relearn: false);
|
||||
|
||||
DialogResult = DialogResult.OK;
|
||||
}
|
||||
private void btnRelearnPositions_Click(object sender, EventArgs e)
|
||||
{
|
||||
List<Point[]> contours = new List<Point[]>();
|
||||
foreach (Point[] contour in maskControl1.LastContours)
|
||||
{
|
||||
contours.Add(contour.Select(x => new Point(x.X / 1800f * 512f, x.Y / 1408f * 512f)).ToArray());
|
||||
}
|
||||
|
||||
_recipe.LearnedParameters.Configuration.MemoryBuffer = (int)udMemoryBuffer.Value;
|
||||
_recipe.LearnContours(contours.ToArray(), _original, maskControl1.VectorLines.Select(x => x.Scale(512f / 1800f, 512f / 1408f).Sub(_recipe.BlisterCenter)).ToList(),relearn:true);
|
||||
|
||||
DialogResult = DialogResult.OK;
|
||||
}
|
||||
private void materialRaisedButton1_Click(object sender, EventArgs e)
|
||||
{
|
||||
DialogResult = DialogResult.Cancel;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user