Ask Your Question
-1

How can I wait unitl the image is done writing?

asked Sep 19 '16

j0h gravatar image

I have a program, and it takes, and saves a photo at the start of operation. As is, I wait with a sleep, or delay, for an amount of time that Ive observed to be necessary to finish writing the image file completely, before trying to make a read. Surely, this cannot be the best way. unfortunately, I don't see anything that says when the write process is completed.

When writing image files, how can I be certain when the image file is fully saved?

Preview: (hide)

1 answer

Sort by » oldest newest most voted
3

answered Sep 20 '16

kbarni gravatar image

imwrite is a blocking function, so the program won't continue until it's finished.

If you need to communicate with another thread, you can raise a flag after imread returns, so the other thread can access the image.

Preview: (hide)

Question Tools

1 follower

Stats

Asked: Sep 19 '16

Seen: 3,712 times

Last updated: Sep 19 '16