I\'m making a virtual reality application where the camera should detect faces, locate them and show their location on the camera preview.
I know of 3 ways to do it,
I could said,
It's not about a Thread.
It not because of this line that make error either.
canvas.drawPoint(leftEye.x, leftEye.y, red);
It because of the canvas still using and can't lock it
If you carefully check, you will see this canvas you get is == null
canvas = canvasHolder.lockCanvas();
if (canvas == null) Log.i("Error", "Canvas == null!");
You might have question then where is it already use?
It already use to display to show what's going on to you! That is
camera.setPreviewDisplay(previewHolder);
So, I suggest, If you want to draw Point over your eye, you might need to have another SurfaceView / SurfaceHolder over you SurfaceView for preview camera :]