Ask Your Question
-1

An array of Images

asked 2017-10-16 09:45:02 -0600

Digital Design gravatar image

updated 2017-10-16 10:18:23 -0600

berak gravatar image

Hi there, I know how to read and process a single image using Mat variables. Recently, I´ve a nightmare about arranging multiple images. For example, suppose I want to read a 5x5 array of RGB images and another 8x8 array of RGB images. Please keep in mind that the number of horizontal and vertical images are not known in advanced and they should be set on the run time. Should I define multiple Mat variables to store 5x5 or 8x8 RGB images? How can I access/modify each image? Thank you for your help.

edit retag flag offensive close merge delete

Comments

either you did not read the answer here, or you did not understand it.

berak gravatar imageberak ( 2017-10-16 09:53:33 -0600 )edit

I used this page, but it sounds like the dimensions of the array should be known in advanced and it can't be changed on the run time. This error is issued by visual C++: Severity Code Description Project File Line Suppression State Error (active) E0349 no operator "[]" matches these operands ConsoleApplication1

Digital Design gravatar imageDigital Design ( 2017-10-16 10:03:50 -0600 )edit
1

ever hear of push_back() ?

seriously, you have to know your c++ (and how to use dynamic containers), before doing this.

imho, your question is entirely off-topic (it's about c++ in general, not about opencv at all)

berak gravatar imageberak ( 2017-10-16 10:13:51 -0600 )edit

1 answer

Sort by » oldest newest most voted
0

answered 2017-10-17 00:40:58 -0600

berak gravatar image

updated 2017-10-17 00:41:31 -0600

again, learn to use dynamic c++ containers:

int main(int argc, char **argv) {
     vector<Mat> images;
     for (int i=1; i<argc; i++) {
           Mat im = imread(argv[i]);
           if (im.empty()) continue;
           images.push_back(im);
     }
     cout << "read " << images.size() << " images." << endl;
     ...
}
edit flag offensive delete link more

Question Tools

1 follower

Stats

Asked: 2017-10-16 09:45:02 -0600

Seen: 503 times

Last updated: Oct 17 '17