From 5a7b22d3e41b50ce4bd768b70dbb15166dd838c3 Mon Sep 17 00:00:00 2001 From: Pavol Debnar Date: Wed, 15 Feb 2023 14:55:18 +0100 Subject: [PATCH] fixed bug where multiple images were created, now only 1 image; added function for getting edge values --- src/pointbase.cpp | 56 +++++++++++++++++++++++++++++++++++++++-------- 1 file changed, 47 insertions(+), 9 deletions(-) diff --git a/src/pointbase.cpp b/src/pointbase.cpp index fd7413b..c488e79 100644 --- a/src/pointbase.cpp +++ b/src/pointbase.cpp @@ -350,13 +350,48 @@ class PointBase { + /*returns minimum and maximum X and Y values from pointbase + minX,maxX,minY,maxY + */ + std::vector getEdgeValues() + { + double minX=999; + double maxX=0; + double minY=900000; + double maxY=0; + std::vector res(4); + + for (Point2d coords: points) + { + if (coords.x < minX) minX=coords.x; + if (coords.x > maxX) maxX=coords.x; + if (coords.y < minY) minY=coords.y; + if (coords.y > maxY) maxY=coords.y; + } + res[0]=minX; + res[1]=maxX; + res[2]=minY; + res[3]=maxY; + return(res); + } + + + void cumdump(int imgWidth,int imgHeight) { - + std::vector edges; + edges = getEdgeValues(); + double minX=edges[0]; + double maxX=edges[1]; + double minY=edges[2]; + double maxY=edges[3]; + + Mat img = Mat::zeros((int)(maxY*(imgHeight/imgHeightDeg))+imgHeight,(int)((360/imgWidthDeg)*imgWidth) + imgWidth,CV_8UC3); + rectangle(img,Point(3,3),Point(15,15),Scalar(128,128, 0),2,2,0); int imgIdx = 0; //main loop @@ -405,7 +440,7 @@ class PointBase { //stitching // Define object to store the stitched image - + /* a funct was created for this, see getEdgeValues() double minX=999; double maxX=0; double minY=900000; @@ -418,18 +453,19 @@ class PointBase { if (coords.y < minY) minY=coords.y; if (coords.y > maxY) maxY=coords.y; } - + */ int xDiff = (int)round(maxX)-(int)round(minX); int yDiff = (int)round(maxY)-(int)round(minY); cout <