When the Android camera opens it fills up the screen in width and height but actually I want the app to open and limit upto certain dimensions on the screen aka BarCode Scanner but here the catch is that the image taken should limit the boundary of the rectangle that the app shows on its surface.
Is this possible?
First: That app is open-source, so feel free to check what they are doing:
Project on google code
If i had a guess I'd say they overlay the camera preview with another view (e.g. via addContentView()) and crop the camera-/previewimage after the image callback.
So this is definitely possible, you have to crop the image manually though (according to the frame).
Related
I have a Samsung Galaxy S6 which allows 8x zoom with its' native camera app. However, CameraCharacteristics.SCALER_AVAILABLE_MAX_DIGITAL_ZOOM returns a value of 4. When capturing a photo in RAW mode and performing the demosaic manually the resulting image definition is as it would be at 8x zoom. However there appears to be no way to achieve the full zoom in our app's viewfinder.
Is there a way I can get an image from a camera preview? The purpose of this would be to overlay an emoji over the face of the camera preview, and I can't overlay the emoji images without first having a Bitmap image as follows:
private void processAndSetImage()
{
mResultsBitmap = OverlayEmoji.detectFacesandOverlayEmoji(this, mResultsBitmap);
mImageView.setImageBitmap(mResultsBitmap);
}
Is there a way that mImageView could have the value of a camera preview? Any links to other SO posts, or articles (in java) would be greatly appreciated!
Is there a way I can get an image from a camera preview?
No.
First, there are thousands of Android device models. These devices will have dozens, if not hundreds, of "android native camera" apps, as many device manufacturers frequently ship a customized camera app.
Second, there is no requirement that all camera apps have an identical user interface. The size and position of the camera preview can vary. Not only will they vary between apps, but even the same app might vary the size and position of the camera preview between versions of that app, as apps can and do get updated.
Third , you have no good way of determining when any of these camera apps happens to be in the foreground.
In a part of an app I'm building the user should take an image / pick one from the gallery. The thing is, the image must be oriented horizontally. I would like to show the user a hint on-screen to flip his device if he is holding it in portarit, like google is doing in their new camera app (only in video mode, though)
Is it possible to do this without creating my own camera activity? I'm currently using ACTION_IMAGE_CAPTURE intent to open the default camera.
Eventually, I've built my own camera application which detects rotation and hints the user to rotate the device if it's in portrait mode.
I am using the custom camera application with preview, using the sdk example on nexus s (2.3)
everything works fine, including taking sharp picture, but the preview does not seem to adjust his level (intensity) like the built in camera does:
when I preview dark objects, the built in camera compensates and increases the intensity, while the custom preview stays in the default intensity, making the preview pretty dark. The images turns out in the correct intensity.
It is not related to white balancing, nor to camera exposure.
I do not want to have a full preview processing chain - just enable the luminance automatic level control - is it possible using the standard API?
Thanks
If you use the autofocus on preview I believe you will get the results you expect.
See Camera.autofocus and Camera.AutoFocusCallback
I believe you'll get one autofocus per call. That is, it's not continuous. You can either implement a way to call it continuously using handlers or simply put a touchlistener on your surfaceview and do autofocus when the user taps the preview.
I changed the zxing code a little bit so in CaptureActivity.java, Bitmap barcode can be returned to my main app through an intent (I encode the bitmap using base64 and pass a string for the intent). Anyways, the problem is that barcode has a very low resolution and I'm trying to figure out if it's possible to return the preview picture (barcode) with a higher resolution (or have the width and height be greater then the preview frame).
Thanks
Sure you can do this if the device supports a preview resolution later than the screen. The app will already do this as of tthe latest version and use a little more resolution this way. Note that the LG Optimus has a notorious bug that will prevent it from working if you do this.
You don't want tto make the reticle larger or it will induce the user to hold the barcode too close to focus.