fixed bug where multiple images were created, now only 1 image; added function for getting edge values

main
Pavol Debnar 2 years ago
parent 248899c4b8
commit 5a7b22d3e4

@ -350,13 +350,48 @@ class PointBase {
/*returns minimum and maximum X and Y values from pointbase
minX,maxX,minY,maxY
*/
std::vector <double> getEdgeValues()
{
double minX=999;
double maxX=0;
double minY=900000;
double maxY=0;
std::vector <double> 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 <double> 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,17 +453,18 @@ 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 <<xDiff <<"\n";
cout <<yDiff <<"\n";
//img creation put to beginning of funcion
/*
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);
*/
//open stream for logging
@ -466,8 +502,10 @@ class PointBase {
}
logFile.close();
string resultName = "result" + to_string(imgIdx) +".png";
imwrite(resultName, img);
imgIdx++;
//imshow("fag",img);
//waitKey(0);
//imwrite(resultName, img);
//imgIdx++;
//stitching
/*
@ -498,7 +536,7 @@ class PointBase {
}
imwrite("result0GIOJSDFI.png", img);
}

Loading…
Cancel
Save