Ask Your Question

Imread many image of type Mat

asked 2014-06-30 10:10:39 -0500

abir gravatar image

updated 2014-07-01 02:31:52 -0500

Hello , With my program I can read an image. Now I have many images in my database. How can I do read the image loop! (the type of image is Mat) Please! thank you

int main()
vector<Mat> frames;
char filename[100] ;
    for (int i=1;i<4;i++){
        sprintf(filename,"/home/user/Bureau/Nouveau dossier/sobel-test/uEyeImg000%d.tif",i);
        Mat frame=imread(filename);

     return 0 ;
edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted

answered 2014-06-30 12:56:09 -0500

If the images are named image1.jpg, image2.jpg and so on, you can save them to a vector using the following code:

vector<Mat> frames;    
    for (int i=1;i<K;i++){   
        Mat frame=imread(filename);
edit flag offensive delete link more


I did it as you told me but I have an error " segmentation fault" I've updated the code used

abir gravatar imageabir ( 2014-07-01 02:23:54 -0500 )edit

Question Tools


Asked: 2014-06-30 10:10:39 -0500

Seen: 330 times

Last updated: Jul 01 '14