Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
Home » Community » Newbie corner » stl question
stl question [message #32796] Fri, 10 June 2011 05:37 Go to previous message
GaroRobe is currently offline  GaroRobe
Messages: 30
Registered: May 2011
Location: Khabarovsk, Russia
Member

So.

I've got a method in OpenCV I need to use. It has parameters with type vector<vector<Point3d>>. It is a data about primitive regular mesh (in model coords) for each frame. Filling it manually feels wrong, so I do it like:
vector<Point2f> checkboardMesh;

for ( int i = 0; i < board_h; i++ )
		for ( int j = 0; j < board_w;i++ )
			checkboardMesh.push_back ( * new Point2f ( j, i ) );

And here I get stuck: will I not get memory leak here? AFAIK std::vector copies element on insert. Should I do it like
for ( int i = 0; i < board_h; i++ )
for ( int j = 0; j < board_w; j++ )
{
	tmpP = new Point2f ( j, i );
	checkboardMesh.push_back ( *tmpP );
	delete tmpP;
}

maybe? If I do, then I'd rather look for a better idea.

Or maybe there is some way of using Upp containers here?

P.S.: The method I mentioned is cv::calibrateCamera btw:
double cv::calibrateCamera( const vector<vector<Point3f> >& objectPoints,
                          const vector<vector<Point2f> >& imagePoints,
                          Size imageSize, Mat& cameraMatrix, Mat& distCoeffs,
                          vector<Mat>& rvecs, vector<Mat>& tvecs, int flags )
 
Read Message
Read Message
Read Message
Previous Topic: Restricting GridCtrl Selection to just One row
Next Topic: Please recommend a scripting language
Goto Forum:
  


Current Time: Mon Jun 17 17:48:27 CEST 2024

Total time taken to generate the page: 0.02955 seconds