Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

opencv c++ equivalent for arraylist in java

Whats the equivalent of the following lines in open cv c++? The first lines have written with java language.

  1. ArrayList<integer> x = new ArrayList<integer>(); is this its correct equivalent? std::vector< int > x = std::vector<int>();

  2. x.add(i); is this its correct equivalent? x.push_back(i);

  3. Mat[] m = new Mat[mCount]; is this its correct equivalent? std::vector<cv::mat> m = std::vector<cv::mat> (mCount);

  4. float[] fl = new float[flLength]; is this its correct equivalent? std::vector< float > fl = std::vector< float >(flLength);

  5. A.get(0, 0, ALists); is this its correct equivalent? ALists.push_back((float)A.at< float >(0,0));

  6. cv::Mat cropped = rotated.submat(offset, offset + cropSize, offset, offset + cropSize); is this its correct equivalent?
    cv::Mat tmpMat0 = rotated.rowRange(offset,offset + cropSize).colRange(offset,offset + cropSize); cv::Mat cropped; tmpMat0.copyTo(cropped);

Thanks for your help