Ask Your Question

Problem using imwrite fastly

asked 2013-06-26 03:24:45 -0500

Lucas gravatar image

updated 2018-09-14 18:06:20 -0500


I'm currently facing a problem using imwrite function to save frames from a camera (in .tiff format).

My application needs to save 20 frames per second. Everything works fine for the 50 000 first images but after my FPS decrease drastically and increase again around 100 000 images saved.

Here is an image showing the behaviour : image description

The problem is exactly reproducible (same shape, decrease at 50 000 and increase again at 100 000), and I try my application on a different HDD (with a different size) with the same issue. By putting timers in my code I know that's the imwrite function which is slower during some periods but I don't know why.

I really can't figure out why I get this behaviour. Then if you've got some ideas or solutions to offer...

Thanks for your help


edit retag flag offensive close merge delete



What OS and file system do you use?

SR gravatar imageSR ( 2013-06-26 04:25:30 -0500 )edit

I'm using Windows XP SP3 with a NTFS HDD and the second HDD i tried was an external storage (also in NTFS)

Lucas gravatar imageLucas ( 2013-06-26 04:42:29 -0500 )edit

How do you store your files? One big directory or several nested sub-directories?

SR gravatar imageSR ( 2013-06-26 06:07:00 -0500 )edit

in one big directory, each file is named frame_n.tiff where n is the number of the frame

Lucas gravatar imageLucas ( 2013-06-26 06:12:41 -0500 )edit

+1 for a nicely-documented problem!

sammy gravatar imagesammy ( 2013-06-26 07:03:42 -0500 )edit


I tried to store my files in several directories (I switch directory every 25 000 frames) and it works now! Thanks a lot for the idea SR, but do you know from where this issue comes from ? It's a problem to save files in a flooded folder?

Lucas gravatar imageLucas ( 2013-06-26 09:39:37 -0500 )edit

1 answer

Sort by ยป oldest newest most voted

answered 2013-06-26 10:32:13 -0500

SR gravatar image

Yes it is - at least on NTFS, but I saw people having similar problems on linux file systems as well. However, it does not explain why after 100K files performance improves again.

edit flag offensive delete link more

Question Tools

1 follower


Asked: 2013-06-26 03:24:45 -0500

Seen: 1,090 times

Last updated: Jun 26 '13