Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

imho, it should work like this:

// signature
CV_EXPORTS_W void read_myJFile(const String& filename, OutputArrayOfArrays img);

// implementation
void read_myJFile(const String& filename, OutputArrayOfArrays img) {
    std::vector<Mat> vec;
    img.getMatVector(vec); // no need to create it

    // now fill data (that's probably a loop ?):
    Mat m = ... // read it from your fs or whatever you have there, process it.
    vec.push_back(m); // add it to the vector.
}

// c++ usage:
vector<Mat> imgs;
read_myJFile("xy.z", imgs);

// python:
imgs = cv2.read_myJFile("xy.z")

imho, it should work like this:

// signature
CV_EXPORTS_W void read_myJFile(const String& filename, OutputArrayOfArrays img);

// implementation
void read_myJFile(const String& filename, OutputArrayOfArrays img) {
    std::vector<Mat> vec;
    img.getMatVector(vec); // no need to create it

    // now fill data (that's probably a loop ?):
    Mat m = ... // read it from your fs or whatever you have there, process it.
    vec.push_back(m); // add it to the vector.
}

// c++ usage:
vector<Mat> imgs;
read_myJFile("xy.z", imgs);

// python:
imgs = cv2.read_myJFile("xy.z")
cv2.read_myJFile("xy.z") # the wrapper code will generate a vector<Mat> to return

imho, it should work like this:

// signature
CV_EXPORTS_W void read_myJFile(const String& filename, OutputArrayOfArrays img);

// implementation
void read_myJFile(const String& filename, OutputArrayOfArrays img) {
    std::vector<Mat> vec;
    img.getMatVector(vec); for (...) { // no need to create it

each item in your filesystem
 // now fill data (that's probably a loop ?):
    Mat m = ... ...; // read it from your fs or whatever you have there, get a Mat and process it.
it
        vec.push_back(m); // add push it to into the vector.
vector
    }
    img.create(vec.size(), 1, vec[0].type());
    img.assign(vec);
}

// c++ usage:
vector<Mat> imgs;
read_myJFile("xy.z", imgs);

// python:
imgs = cv2.read_myJFile("xy.z") # the wrapper code will generate a vector<Mat> to return