Merging two Images (imageOne from Drawables & imageTwo from camera) - android

I am developing an app which uses surface.callback to initialize the front camera when the app is started. I have done overlayering on the camera and added some buttons along with some funny images.
Now there are three ways to do this as far as my knowledge goes (and I am a newbie so if there's another method that would also be appreciable.)
Capture image: The problem is that if I capture the image from
camera, I won't get the funny images which are added on the top of
the camera preview.
Screenshot: As I have done this through overlayering, hence taking a
screenshot through code of a selected portion isn't yielding any
result also. Because it only takes the screenshot of the layer with
buttons and funny image but not the screenshot of the camera preview
as it is behind the layout containing above mentioned items.
Now the only resort is that I merge two images. One from my drawables
folder (funny images) and second obtained at runtime from front
camera.
Anyone who can kindly help me merge two images. I have seen some tutorials/codes but they take both images from drawables folder while my second image is obtained at runtime through camera.

You can capture the camera image and edit it (overlay with funny images) before writing it to file.

Related

Android draw shapes on images and save

I have an application that gets image (from gallery or camera) and then I open this image in some Activity. Then I want to draw shapes on this image on tap, these shapes (once drawn) can also be dragged around over the image and removed. After drawing user can save this image with shapes so it can access them later from the application at any time.
I have managed to make image import form gallery or camera to my activity.
My question is I just want a summary of how would this need to be constructed in order to work? How would I save images with shapes and their positions so they are accessible later? I would also have an activity (I guess?) in my app which would show thumbnails of all images edited so far. I have attached some images for reference (first image is image edit screen, second image is showing thumbnails edited for far, each can be accessible for edit again).
I am a beginner so please bear in mind.

How to take images only within the bounding box in android custom camera

Recently, I found a app that captures only the images within the boxes like the image below. Should I use a SurfaceView ? or are there some other technique to do this ? I made a camera app with surfaceview and thinking about implementing a blue box like the image below so that I can take the images within the 2 blue boxes.
You can captures the whole image, but just crop the target area after capturing. :)

how to set the image on CWAC-Camera Fragment

I am using the CWAC camera library in my application. I tried this and this is working fine showing the camera preview in the relevent Fregment.
Now all I want to past a picture on that camera preview and whenever I click button to take picture it should take picture with that image. I want image in forground and the camera preview in background of it . So is there any way to do that . Here is the sample code that I am using to take picture
This has nothing to do with the CWAC-Camera library. If you want to merge multiple image files together, you are welcome to do so, but you would do that after taking the picture.

Android camera embedded in a frame

I want to take a picture with my app, but I want to run the camera inside a fragment in a frame. Is it possible to accomplish that?
Any help appreciated..
It is Possible to Write your Own Camera Module using SurfaceView see the Android Documentation
for Building a Camera App, Example
If you want to add a frame to the picture taken, you must post-process the captured image, whatever method you choose - be it via intent, or Camera.takePicture().
If you want the preview to appear inside a rectangular frame, you simply create an xml layout to your liking, frame included, and a surfaceView positioned where you need it.
If your frame has some curls or curves on the inside, your preview surface should be z-ordered under this frame (which will include transparent areas).

Saving a camera's preview to a bitmap

I need a little help with getting my camera to work right.
What I'm trying to do is have the user take a picture that will then be used in another activity as the view's background. It is important not to have any skewing, and ideally the image would fill the entire background with the highest resolution possible.
I've been having a heck of a time trying to get the outputted picture of my camera to be oriented properly and be the same aspect of the display. So I took some time to think of exactly what I needed to do, and I don't think I need the normal saved image at all.
What I came up with is that I need a surface view to display the preview, and an overlay for some text and a capture button. When the user "takes the picture" it should autofocus, and then I need to capture the preview (under the screen overlays) to a bitmap to use in the other activity.
*Should I extend a SurfaceView for my preview and add it to a XML layout that contains the overlays?
*How do I save the SurfaceView's image to a bitmap?
Thanks.
Matt,
One basic question ,and excuse my naivety, wouldnt it just be easier to use the built in camera to the Android through an Intent? It is doable, I've done it before.
Apparently, there is no good way to convert the image format of the preview frames to a jpeg, so I ended up selecting the size for the camera to take by going through each of the camera's supported resolutions and getting the closest match the the screen aspect with the highest resolution.
Because the camera.setRotation method doesn't seem to do anything, I just rotate the image 90 with a matrix before saving it to the card if I am in portrait mode.

Categories

Resources