More snaz

This commit is contained in:
Alexander Munch-Hansen 2019-04-23 13:32:57 +02:00
parent be7dc71647
commit 99cceb77bb

View File

@ -131,17 +131,21 @@ public class python_test : MonoBehaviour
Imgproc.warpPerspective(camImgCopy, outputMat, homography, new Size(baselineWidth, baselineHeight));
foreach (var row in homographyAndState.board) {
foreach (var lel in row) {
print(lel);
}
}
//List<Point> points = new List<Point>();
MatOfPoint2f points = new MatOfPoint2f();
points.alloc(16);
for (int i = 0; i < 64; i++)
{
int x = ((i+1) % 8) * 165;
int y = (int)(i/8);
}
int cur_level = 0;
int index = 0;
for (int x = 0; x < 8; x++)
@ -150,22 +154,27 @@ public class python_test : MonoBehaviour
foreach (int y in new List<int> { 150, 315 })
{
//points.put(index, 0, cur_level, y);
//index += 1;
Imgproc.circle(outputMat, new Point(cur_level, y), 50, new Scalar(255, 0, 0), -1);
points.put(index, 0, cur_level, y);
index += 1;
//Imgproc.circle(outputMat, new Point(cur_level, y), 50, new Scalar(255, 0, 0), -1);
}
}
}
MatOfPoint2f dstPoints = new MatOfPoint2f();
//Core.perspectiveTransform(points, transformedPoints, homography.inv());
//for (int i = 0; i < 16; i++)
//{
// Imgproc.circle(loadedImage, transformedPoints.get(i, 0), 5, new Scalar(255, 0, 0), -1);
//}
Core.perspectiveTransform(points, dstPoints, homography.inv());
List<Point> transformedPoints = dstPoints.toList();
foreach (Point point in transformedPoints)
{
Imgproc.circle(loadedImage, point, 10, new Scalar(255, 0, 0), -1);
}
MatDisplay.DisplayMat(loadedImage, MatDisplaySettings.FULL_BACKGROUND);
displayWarped = true;
/*
if (displayWarped)
{
camImgCopy = loadedImage.clone();
@ -179,7 +188,8 @@ public class python_test : MonoBehaviour
displayWarped = true;
MatDisplay.DisplayMat(outputMat, MatDisplaySettings.FULL_BACKGROUND);
}
}
*/
}