Ask Your Question

Issues in Reading set of images

asked 2013-06-15 06:04:15 -0500

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

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

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

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

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
Login/Signup to Answer

Question Tools


Asked: 2013-06-15 06:04:15 -0500

Seen: 98 times

Last updated: Jun 15 '13