Issue in using imread and imwrite in thread

asked 2019-06-12 00:04:22 -0500

Kira gravatar image

updated 2019-06-12 01:54:04 -0500

Hello All, I have written a program in cpp which takes image form camera and save it in a folder. There is another program which reads the save image form the folder and do some processing on the image. My problem is sometime i get only half image saved and the other is blank. After the above mentioned issue i am not able to fetch any image from the camera and also my thread breaks. I also got an warning message:Premature end of JPEG file

edit retag flag offensive close merge delete

Comments

so, process1 writes to disk(multithreaded), and process2 tries to read from disk, and, not being synchronized at all, eventually reads garbage ?

sounds more like "noobs at work", not an opencv problem.

berak gravatar imageberak ( 2019-06-12 03:56:37 -0500 )edit

@berak: Here i am not referring to same image being written and read For example i have image 1 already saved in the disk. I try to write an image 2 in the disk and simultaneosly read the image 1 using thread. will it create any issue??

Kira gravatar imageKira ( 2019-06-12 04:24:12 -0500 )edit