I have written some Android code were I basically only take a picture with the built in camera, save it, and then try to load the saved file to do some stuff with it.
Camera camera = mPreview.getmCameraInstance();
Camera.PictureCallback pictureCallback =
GetPictureCallback(mPreview.getmCameraInstance());
camera.takePicture(null, null, pictureCallback);
Mat image = Highgui.imread(String.valueOf(file)); //Load Image here
However, my application crashes because it will not find a file in the line where i load my image. I do not understand this, because I thought that my code would execute in a sequential manner, and then the takePicture(...)
in which I store my file would already be done.
Can you help me with this?
EDIT
When I put a Thread.sleep(100)
before, I can open the image, as it has been successfully written at that time.