Overriding android default camera/activities - android

I have requirement where in I have to overlay a header and footer over the camera. There is a set of three button which will handle the even of camera like (click/retake).
As of now i create a surface to use as preview and add jpegcallback and picture callback to take picture and store it. I manually handle android camera hardware and parameter configuration. As all of us know there has issues around camera and picture orientation. I have worked around this by setting camera orientation and also by rotating my captured image. Though the approach looks ugly i am able to achieve the end goal.
It would be great if we have a way of overriding the android default camera activity as any of the above steps are not required. I come from a Java/Java EE background and as per my understanding we should be able to create a custom Activity and override the behaviors and properties.
My Question:
Can we override the activities for android.provider.MediaStore.ACTION_IMAGE_CAPTURE and also com.android.camera.action.CROP.
If so which package of android has the java class for this activities.

Hopefully I am not misunderstanding your question but it sounds like you want to use the camera in your app. You want to view what the camera is seeing while having a header and footer above and below the camera preview. Then you want these buttons to do things like take a picture, etc.
If I am wrong I apologize.
Just look at the Camera implementation in the docs.
http://developer.android.com/guide/topics/media/camera.html#custom-camera
You can create your own activity layout with any buttons/text above, below, or on top of a preview view that you use to display the camera feed. Then just use the on click events for the buttons or whatever to do the things you want. Majority of this is in the documentation in the link.

Related

Using default camera application in Android Fragment

I have a fragment which takes up the whole screen. Within this fragment I would like to enable the camera feature using the default camera application, rather than create a custom camera. I only want the camera to take up half the screen, below which I have buttons and other text. How can I do this?
You have to make Custom Camera. As If you use Intent for Camera then you will get a full screen by default. You cannot use it. You want something like facebook uses in Messenger. Try this. This camera is in a Fragment. Replace the Fragment where required. Divide device height of surface view and fragment view.
https://github.com/googlesamples/android-Camera2Basic
Try this sample.You can use default camera app,
http://www.androidhive.info/2013/09/android-working-with-camera-api/
Default android cam app will take full screen cant use half screen for taking images.
For this half screen with cam view and half with your widgets you have to create your own cam view you can use this open source library for this.

How to display multiple camera previews with different effects?

I am trying to achieve this on android.
Any idea on how I can do this? I couldn't find any examples that use multiple camera previews. I am aware of the library "grafika", however from what I understood it uses 1 view (TextureView) if I'm not wrong, and then positions all the previews on it, therefor it remains a single view, which is not what I want. Each camera preview has to be separated in it's own view.

Small frontal camera preview (not fullscreen)?

is there a way to have a small camera preview inside a view? Not the classic fullscreen preview, I mean.
My idea is to create an app that allows the user to take pics of himself with the frontal camera, when it's dark.
Basically, I thought to put a small preview of the camera on the corner of the screen and setting the remaining part to full brightness (to use it like a "self flash").
Well, I don't have problems actually to set a view to a full brightness value, but I don't have any idea how to resize the frontal camera preview.
I hope you understood my intention...
Any help would appreciated!
I don't believe this idea will hold water, because the brightness of the screen may not be enough. But the technical question you ask is not very hard: you can put the ViewSurface for your preview in the main activity's xml with any size you choose (you can use the usual WISIWYG layout editor in ADS or AndroidStudio).

Cropping the Android camera

I'm developing an Android app that uses ZBar as a QR code library, and things are going sweet. Now, however, I'm building the interface for the app, and it requires that I show only a certain portion of the camera's feed at the bottom of the screen, something like this:
The camera view below should be full-sized, i.e. a cropped view and not a resized one. However setting the width and height of the FrameLayout has caused it to resize and squash the entire image into the tiny frame.
Is there a way to crop it? I know I could probably place an overlay over the original image, but how does one create a transparent square in the middle to display what I need?Besides, the QR reader would catch anything the camera captures, so if the user brought the QR code in front of the camera and it captured it "off screen" (by the part that's actually covered by the overlay), it would be extremely confusing.
So I guess what I'm saying is, I can't use an overlay to "crop" the picture. Is there any other way to do it?
As far my knowledge one cannot crop camera view but what you can do is re-size the frame and then capture the image.
Still i would suggest to refer this post
The first thought that comes to mind is to put your CameraPreview in a view inside a FrameLayout. Then add more views on top of the CameraPreview view to hide the parts that you do not want to be visible.
Or Perhaps just one view super-imposing the camera preview view with a PNG which covers everything with "cropped" area set as transparent.

android camera+activity split screen

Is it possible to have a split screen that would have a camera preview and a second activity in the same screen? Would fragments do the job? (I am new to android and never worked with fragments). I am converting the screen colors from RGB into HSV (using OpenCV) and would like to manipulate values of H, S and V using seek bars. At the moment I am doing this in the following way:
1)press button to go to a new activity and set the values using seek bars
2)press button to go back to camera preview and get the HSV values using intents
But this involves a lot of switching between activities and checking whether I achieved the desired effect and I would like to achieve a real time preview so when changing the values I immediately see the changes. Is there any way to do that?
The Camera preview simply writes on a SurfaceView. You can put the preview anywhere you want and any size you want just like any other View object. I do think a current limitation is you can't move the preview once it's set without first disabling the camera (though not 100% sure).
As such, you can put the SurfaceView and your other View in a LinearLayout. Give them both the same weight, and both views will take up half the screen (assuming they're the only two in the layout).

Categories

Resources