the arrays size grows a lot.
(pt1.x/y are points i am using via opencv)
the larger picture ie the outside "()" represent an object
the second set of "()" represent the iterations
and the individual elements of the iterations (the points) are points
if you help me i will love you forever
EDIT: the array increases by each of the above (marked with "[]")
Last edited by breakerbyte; April 9th, 2009 at 01:49 PM.
Reason: oops
could I combine both methods and store each "Point"
lets say that (Point(iteration 0),Point(iteration 1),Point(iteration 2) is the equivalence of object
they are either doubles or CvRect if they would work
Well, I don't really understand you, actually. I felt that Lindley made a good stab at an answer, but it seems like there is a communication breakdown somewhere. Let's do this step by step.
Do a breakdown of it. You say that "pt1.x/y are points i am using via opencv". What do you mean by "the second set of "()" represent the iterations"? Perhaps you want to create a class here, and then objects of this class would then be members of another class, and then the dynamic array would contain objects of this second class?
Also, you should state how does Lindley's example not work.
C + C++ Compiler: MinGW port of GCC
Build + Version Control System: SCons + Bazaar
<vector<vector<CvRect>>foo;
Changing everything to CvRect.
need foo to grow 5 rows and 1 column on demand. thats the real issue
It's easier if you use typedef.
Code:
#include <vector>
typedef std::vector<CvRect> CvRectArray;
typedef std::vector<CvRectArray> CvRectArray2D;
//...
int main()
{
// Assuming that CVRect is default constructible.
CVRectArray2D foo(5, CVRectArray(10)); A 5x10 array of CVRect
// resize to 10x20
// first, resize the existing rows
for (CVRectArray2D::size_type i = 0; i < foo.size(); ++i )
foo[i].resize(20);
// now add on new rows
foo.resize(10, CVRectArray(20));
}
Bookmarks