Ask Your Question
-1

How can I wait unitl the image is done writing?

asked 2016-09-19 12:36:42 -0600

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?

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted
3

answered 2016-09-20 04:02:03 -0600

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.

edit flag offensive delete link more

Question Tools

1 follower

Stats

Asked: 2016-09-19 12:36:42 -0600

Seen: 3,507 times

Last updated: Sep 19 '16