Ask Your Question
0

How to access multiple imagens in a vector of opencv

asked 2015-03-09 13:07:58 -0600

Diego Moreira gravatar image

I need to add multiple images in an image in opencv vector. Can anyone explain me how to access each image in this vector. I need to learn this. Thank you.

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted
1

answered 2015-03-09 14:04:27 -0600

theodore gravatar image

updated 2015-03-09 14:06:53 -0600

if we consider that you have your images into a vector then you just loop through with a for loop, you can also do it more efficiently with iterators but lets keep it simple:

vector<Mat> images;
for(size_t i = 0; i < images.size(); ++i)
{
    Mat img = images[i]; // either this or you can just use the images[i] straight forward, just be aware that this is a copy of the image into the vector, if you do not want that then use the .clone() attribute

    // use the img now for what you want to do
}
edit flag offensive delete link more

Comments

Thank you for help me!

Diego Moreira gravatar imageDiego Moreira ( 2015-03-09 14:16:00 -0600 )edit

you are welcome ;-)

theodore gravatar imagetheodore ( 2015-03-09 14:20:24 -0600 )edit

@Diego Moreira, good for you that Theodore supplied you with the solution, but why are you double posting the same identical questions? I have supplied you with the solution over a week ago, right here ...

StevenPuttemans gravatar imageStevenPuttemans ( 2015-03-10 05:36:39 -0600 )edit

Question Tools

1 follower

Stats

Asked: 2015-03-09 13:07:58 -0600

Seen: 185 times

Last updated: Mar 09 '15