Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

vector initialize error? #2

Open
bbbrian94 opened this issue Apr 29, 2018 · 3 comments
Open

vector initialize error? #2

bbbrian94 opened this issue Apr 29, 2018 · 3 comments

Comments

@bbbrian94
Copy link

in the line of 82 and 155 of your vpdetection.cpp you i got error below:

error: no matching function for call to ‘std::vector<std::vector<cv::Point3_ > >::_M_fill_initialize and so on.

@bbbrian94
Copy link
Author

plz merge this one to the issue 1 i am sorry

@slowlythinking
Copy link

//vpHypo = std::vector<std::vector<cv::Point3d>> ( it * numVp2, 3 );
vpHypo = std::vector<std::vector<cv::Point3d> > ( it * numVp2, std::vector<cv::Point3d>(3) );

Change like this.

@amc-nu
Copy link

amc-nu commented Aug 27, 2018

A quick fix:

diff --git a/src/VPDetection.cpp b/src/VPDetection.cpp
index b2c1e9b..ae59b31 100644
--- a/src/VPDetection.cpp
+++ b/src/VPDetection.cpp
@@ -79,7 +79,8 @@ void VPDetection::getVPHypVia2Lines( std::vector<std::vector<cv::Point3d> > &vpH
 	}
 
 	// get vp hypothesis for each iteration
-	vpHypo = std::vector<std::vector<cv::Point3d> > ( it * numVp2, 3 );
+	//vpHypo = std::vector<std::vector<cv::Point3d> > ( it * numVp2, 3 );
+	vpHypo = std::vector<std::vector<cv::Point3d> > ( it * numVp2, std::vector<cv::Point3d>(3) );
 	int count = 0;
 	srand((unsigned)time(NULL));  
 	for ( int i = 0; i < it; ++ i )
@@ -152,7 +153,8 @@ void VPDetection::getSphereGrids( std::vector<std::vector<double> > &sphereGrid
 	int gridLA = angleSpanLA / angelAccuracy;
 	int gridLO = angleSpanLO / angelAccuracy;
 
-	sphereGrid = std::vector<std::vector<double> >( gridLA, gridLO );
+	//sphereGrid = std::vector<std::vector<double> >( gridLA, gridLO );
+	sphereGrid = std::vector< std::vector<double> >( gridLA, std::vector<double>(gridLO) );
 	for ( int i=0; i<gridLA; ++i )
 	{
 		for ( int j=0; j<gridLO; ++j )
@@ -221,7 +223,7 @@ void VPDetection::getSphereGrids( std::vector<std::vector<double> > &sphereGrid
 	int neighNum = winSize * winSize;
 
 	// get the weighted line length of each grid
-	std::vector<std::vector<double> > sphereGridNew( gridLA, gridLO );
+	std::vector< std::vector<double> > sphereGridNew = std::vector< std::vector<double> >( gridLA, std::vector<double>(gridLO) );
 	for ( int i=halfSize; i<gridLA-halfSize; ++i )
 	{
 		for ( int j=halfSize; j<gridLO-halfSize; ++j )
@@ -358,4 +360,4 @@ void VPDetection::lines2Vps( double thAngle, std::vector<cv::Point3d> &vps, std:
 			clusters[bestIdx].push_back( i );
 		}
 	}
-}
\ No newline at end of file
+}
diff --git a/src/main.cpp b/src/main.cpp
index 0470b8b..c3dd0ef 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -94,9 +94,9 @@ void drawClusters( cv::Mat &img, std::vector<std::vector<double> > &lines, std::
 	}
 }
 
-void main()
+int main()
 {
-	string inPutImage = "D:\\DevelopCenter\\VanishingPoints\\datasets\\YorkUrbanDB\\P1020171\\P1020171.jpg";
+	string inPutImage = "/PATH/TO/IMAGE.ext";
 
 	cv::Mat image= cv::imread( inPutImage );
 	if ( image.empty() )
@@ -110,8 +110,8 @@ void main()
 	LineDetect( image, thLength, lines );
 
 	// Camera internal parameters
-	cv::Point2d pp( 307, 251 );        // Principle point (in pixel)
-	double f = 6.053 / 0.009;          // Focal length (in pixel)
+	cv::Point2d pp( image.cols/2, image.rows/2 );        // Principle point (in pixel)
+	double f = 1.2*(std::max(image.cols, image.rows));          // Focal length (in pixel)
 
 	// Vanishing point detection
 	std::vector<cv::Point3d> vps;              // Detected vanishing points (in pixel)
@@ -122,4 +122,5 @@ void main()
 	drawClusters( image, lines, clusters );
 	imshow("",image);
 	cv::waitKey( 0 );
+	return 0;
 }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants