Ask Your Question
0

Issues in Reading set of images

asked 2013-06-15 06:04:15 -0600

123ezone gravatar image
            for(int i=22; i<24; i++){
            IplImage *img = cvLoadImage("%d.jpg",i);
            }

Please tell me how can I Load set of images from project file.It works for loading one image but when I code it like this it do not work.Please help me for load the set of images in a loop.

edit retag flag offensive close merge delete

2 answers

Sort by ยป oldest newest most voted
1

answered 2013-06-15 07:11:28 -0600

berak gravatar image

format() comes in handy there:

  for(int i=22; i<24; i++){
      cv::Mat m = cv::imread( cv::format("%d.jpg",i) );
  }
edit flag offensive delete link more
0

answered 2013-06-15 07:01:20 -0600

Notas gravatar image

cvLoadImage does not work like printf! If you want to create a string using variables, use a stringstream. Then use the <<-operator to create the string you want.

And don't use the old C interface! Use imread, which expects a string. The stringstream class has a str() method which will give you the string you want.

edit flag offensive delete link more

Question Tools

Stats

Asked: 2013-06-15 06:04:15 -0600

Seen: 208 times

Last updated: Jun 15 '13