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)); 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>(); //List<Point> points = new List<Point>();
MatOfPoint2f points = new MatOfPoint2f(); MatOfPoint2f points = new MatOfPoint2f();
points.alloc(16); 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 cur_level = 0;
int index = 0; int index = 0;
for (int x = 0; x < 8; x++) 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 }) foreach (int y in new List<int> { 150, 315 })
{ {
//points.put(index, 0, cur_level, y); points.put(index, 0, cur_level, y);
//index += 1; index += 1;
Imgproc.circle(outputMat, new Point(cur_level, y), 50, new Scalar(255, 0, 0), -1); //Imgproc.circle(outputMat, new Point(cur_level, y), 50, new Scalar(255, 0, 0), -1);
} }
} }
//Core.perspectiveTransform(points, transformedPoints, homography.inv()); MatOfPoint2f dstPoints = new MatOfPoint2f();
Core.perspectiveTransform(points, dstPoints, homography.inv());
//for (int i = 0; i < 16; i++) List<Point> transformedPoints = dstPoints.toList();
//{
// Imgproc.circle(loadedImage, transformedPoints.get(i, 0), 5, new Scalar(255, 0, 0), -1);
//}
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) if (displayWarped)
{ {
camImgCopy = loadedImage.clone(); camImgCopy = loadedImage.clone();
@ -180,6 +189,7 @@ public class python_test : MonoBehaviour
MatDisplay.DisplayMat(outputMat, MatDisplaySettings.FULL_BACKGROUND); MatDisplay.DisplayMat(outputMat, MatDisplaySettings.FULL_BACKGROUND);
} }
*/
} }