I am trying to create a custom camera application. I am using textureView with Camera2 api. But when I am opening the application, only black screen is shown. When I click on "click picture" button It captures proper image and screen again goes black. I need to get proper image preview in place of black screen.
You give very less information, but you can have a look at this example:
https://github.com/googlesamples/android-Camera2Basic
In the example there is also used a TextureView.
Related
I bumped into a problem that is when I tried to get the bitmap of my FrameLayout which contains a PreviewView, I can only get the black screen for the camera region and some of the overlay I put on PreviewView.
Below are my code of screenshot:
https://gist.github.com/Leo-Hsu-Design-Student/e6d92a0a39c5ed52835ce83d2833a183
I have checked the cameraX and PreviewView can work when I only call the preview.bitmap and save the screenshot image. It is as follow:
I also tried PixelCopy method, it doesn't work either.
Is there any way to take a screenshot of preview and my overlay simultaneously?
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. :)
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.
Which are the best ways to create a Camera Custom activity, using FRONT FACE CAMERA or BACK FACE, and choosing the best sizes of SurfaceView and Camera for each device?
I would want to create an activity like Instagram has, squared and with custom layouts above and below.
If there's any sample that's like this, please It would be very useful.
see https://thenewcircle.com/s/post/39/using__the_camera_api (small) or https://github.com/commonsguy/cwac-camera (with lots of enhancements)
you can try my simple library https://github.com/mistreckless/PortraitCameraSupport
but instagram developers did that by another way. They capture the entire screen image then programmatically cut the square preview you see
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).