I need to custom view with live camera. I want my screen is divided into 9 parts, per part is show camera preview as photo below.
You can attach only one SurfaceView to live stream, and you cannot apply different 'effects' to this live preview. You can use OpenGL to resolve both limitations. See examples at https://github.com/google/grafika/blob/master/src/com/android/grafika/TextureFromCameraActivity.java and https://github.com/Sveder/CardboardPassthrough/tree/master/OpenGL%20Version.
Related
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.
i am a beginner on android.
My question is simple, i need to capture a video frame from my device but i need to capture just a part of the entire camera view. For example, if my camera view display my frame on the entire screen i need to cut half frame to display.
I did this with opencv through image processing (image cropping) but i wanna know if this is possible also specifing the layout parameters. I need know if this is possible because i working with a video frame not with simple image and i need to ease the entire processing.
Thank you for all advices.
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).
My app is showing the camera preview on one of my activities. I would like to show the camera preview but not taking the full screen, just inside a small box.
The problem is that right now the image that i get from the camera is smaller that I want. For example, when I open it I can only see there my eyes and nose, but I would like to see my whole face.
It's like my surfeceView is acting like a window in a house that only allows me to see part of the views outside. The idea is that in the surfaceView (that does not take the whole screen space) I get the whole camera output but resized in order to fit the surfaceView.
Is that a problem with the camera preview size? Or should I somehow resize the camera output?
Thanks in advance
You should give us some code to find the problem, at least the layout.xml file and the class that uses SurfaceView and SurfaceHolder.Callbacks. For now, you can try the following if you didn't.
In the onSurfaceChanged method use the two int parameters width and height to calculate the best size for your preview. You do this with setPreviewSize and getSupportedPreviewSize.
If you can't fix the issue in an easy way you can also try to use an ImageView or a TextureView and paint on them the image that you are given from the onPreviewFrame callback.