Is it possible to overlay a transparent image over a live camera view, such that it is overlayed over the captured photo as well?
The transparent image I want to overlay is just the boundary of a polygon in black color, the rest of the image is transparent. Like this:
Using OpenCV4Android, I want to overlay it over live camera preview, such that it is overlayed on the image captured as well (i.e. the polygon is blended over the image captured, I mean the polygon should become a part of the image captured.)
How can I achieve that?
ADDENDUM:
I would simply add the polygon to the live camera preview by overlaying the JavaCameraView
(which is the widget which displays live camera preview/frames) with an ImageView
(Android's image container widget) containing the transparent image to overlay; by placing them both sequentially in a FrameLayout
, which automatically Z-orders widgets added to it. Then I would separately add the image to overlay into to captured photo.
But the challenge here is:
The polygon in the live camera preview/frames is a guide. Just like the following image has a guide for positioning the face before taking the picture.
Then when the photo is captured, I want the polygon to be overlayed at EXACTLY the position on which it was when the photo was captured.
So how do I achieve this?
it's probably far easier to draw a polygon, using lines, than mixing 2 images with transparency
@berak I want the polygon to be at the exact same place in the captured image as it was in the live camera preview. For example, say the overlayed image was the boundary of a closed shape like a human's face (like in this image.), and in the live camera preview it is used to to guide a user where to place their face in the camera frame. Now in the image captured, I would want to merge that boundary lines into the captured image, and I would want them to be exactly where they were in the camera preview; I would not want the captured image having the face on one position, and the overlayed face-boundary displaced to somewhere else.
@berak So if I wanted to draw it separately on the captured image, I wouldn't know the exact and precise locations of points and may be sizeas well.