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")
2 | No.2 Revision |
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
3 | No.3 Revision |
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