This commit is contained in:
Alexander Munch-Hansen 2019-04-24 09:41:11 +02:00
parent 29e4a7a733
commit 6fc555f8d8

View File

@ -96,15 +96,15 @@ public class python_test : MonoBehaviour
if (Input.GetKeyDown("space"))
{
// TODO: We should clone camImageMat again, instead of the loadedImage I use now
/*
var camImgCopy = camImageMat.clone();
outputMat = camImageMat.clone();
*/
print("------------------------------------");
print(loadedImage.size());
outputMat = camImgCopy.clone();
print(loadedImage.size());
camImageMat = loadedImage.clone();
print("------------------------------------");
@ -128,11 +128,6 @@ public class python_test : MonoBehaviour
}
}
Imgproc.warpPerspective(camImgCopy, outputMat, homography, new Size(baselineWidth, baselineHeight));
//List<Point> points = new List<Point>();
MatOfPoint2f points = new MatOfPoint2f();
points.alloc(64);
@ -143,27 +138,12 @@ public class python_test : MonoBehaviour
for (int x = 1; x < 9; x++)
{
var cur_pos = board[x - 1][y - 1];
points.put(indexer, 0, (cur_pos != 6 ? 1 : 0) * y * 165, (cur_pos != 6 ? 1 : 0) * x * 165);
points.put(indexer, 0, (cur_pos != 6 ? 1 : -200) * y * 165, (cur_pos != 6 ? 1 : -200) * x * 165);
indexer += 1;
}
}
/*
int cur_level = 0;
int index = 0;
for (int x = 0; x < 8; x++)
{
cur_level += 165;
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);
}
}*/
MatOfPoint2f dstPoints = new MatOfPoint2f();
Core.perspectiveTransform(points, dstPoints, homography.inv());
@ -178,23 +158,6 @@ public class python_test : MonoBehaviour
MatDisplay.DisplayMat(loadedImage, MatDisplaySettings.FULL_BACKGROUND);
displayWarped = true;
/*
if (displayWarped)
{
camImgCopy = loadedImage.clone();
Mat tmpCopy = camImgCopy.clone();
Imgproc.warpPerspective(outputMat,tmpCopy, homography.inv(), camImgCopy.size());
Core.addWeighted(tmpCopy, 0.80f, camImgCopy, 0.7f, 0.0f, camImgCopy);
displayWarped = false;
}
else
{
displayWarped = true;
MatDisplay.DisplayMat(outputMat, MatDisplaySettings.FULL_BACKGROUND);
}
*/
}
if (!displayWarped)