open front camera using camera API - Java for Android App Development

how to open front, camera using camera API in android.

Code:
private Camera trythis ;
trythis = Camera.open (CameraInfo.CAMERA_FACING_FRONT);

Related

Drawing on top of a camera view

Hi there. I'm making an AR app and I couldn't figure out a way to draw on top of a camera view. I've created a custom SurfaceView class which uses Camera.startPreview and Camera.setPreviewDisplay to draw the real time feed from the camera upon it. Now I'm trying to render something on it. I have another SurfaceView which has a painter thread which is running with 30 fps and is drawing every frame on a Canvas obtained by SurfaceHolder.lockCanvas(). I put the two views in a FrameLayout like this
Code:
Preview cv = new Preview(
this.getApplicationContext());
Pano mGameView = new Pano(this.getApplicationContext());
FrameLayout rl = new FrameLayout(
this.getApplicationContext());
setContentView(rl);
rl.addView(cv);
rl.addView(mGameView);
And sadly it doesn't work. It shows only the camera feed. If I switch the order like this
Code:
rl.addView(mGameView);
rl.addView(cv);
The camera feed dissipates and only the painter is visible...
How should I make it work
Phew. Just to tell you I found a solution. You add this line
Code:
getHolder().setFormat(PixelFormat.TRANSLUCENT);
in the initialization of your overlay view

samsung galaxy s 4g front cam app help

Hello,
I'm trying to make a simple app where it uses the front cam to take a pic. The problem is that I just want see the preview or view finder (what ever you call it), also to make it smaller.
can any one help?
here what i got so far
Code:
Camera camera = Camera.open();
Camera.Parameters parameters = camera.getParameters();
parameters.set("camera-id", 2);
camera.setParameters(parameters);
any help? it do not have to be with SGS4G it can be for any phone!

Decompiled Camera APK

hi Guys
Ive decompiled the Camera APK from the HONE and found something interesting as below;
Code:
# static fields
.field private static final synthetic $VALUES:[Lcom/android/camera/HTCCameraSensor$Sensor_Type;
.field public static final enum SENSOR_13M:Lcom/android/camera/HTCCameraSensor$Sensor_Type;
.field public static final enum SENSOR_2M:Lcom/android/camera/HTCCameraSensor$Sensor_Type;
.field public static final enum SENSOR_3M:Lcom/android/camera/HTCCameraSensor$Sensor_Type;
.field public static final enum SENSOR_4M:Lcom/android/camera/HTCCameraSensor$Sensor_Type;
.field public static final enum SENSOR_5M:Lcom/android/camera/HTCCameraSensor$Sensor_Type;
.field public static final enum SENSOR_8M:Lcom/android/camera/HTCCameraSensor$Sensor_Type;
.field public static final enum SENSOR_UNDEFINED:Lcom/android/camera/HTCCameraSensor$Sensor_Type;
Notice the different sensor types?
Plus i think ive found that the HTC One maybe able to take higher than 4 MP photos... Dependant on the sensor of course ^__^
Attached are 3 files;
Notepad ++
APKTool Decompiler
HTC One Camera APK.
So u mean that the camera sensor is capable of taking higher res pix ?
Can u share how to decompile the camera apk
Thnx
Sent from my HTC One using xda app-developers app
Perhaps they have a standard cross-platform HTC camera app and it just limits itself dependant on what hardware it finds.
----------------------o('_')o----------------------
Sent from an HTC One with using xda app:
TrickDroid ROM 5.6
Bulletproof 1.10
Can you find jpeg compression somewhere?
sallam5010 said:
So u mean that the camera sensor is capable of taking higher res pix ?
Can u share how to decompile the camera apk
Thnx
Sent from my HTC One using xda app-developers app
Click to expand...
Click to collapse
Tetsumi06 said:
Perhaps they have a standard cross-platform HTC camera app and it just limits itself dependant on what hardware it finds.
----------------------o('_')o----------------------
Sent from an HTC One with using xda app:
TrickDroid ROM 5.6
Bulletproof 1.10
Click to expand...
Click to collapse
vegetaleb said:
Can you find jpeg compression somewhere?
Click to expand...
Click to collapse
There is that possibility , it depends though as mentioned above by Tetsumi06, if the software does not permit them because the sensor is truly a 4MP sensor... But knowing HTC and their history with cameras, i wouldn't be surprised if it was possible. back on earlier models, HTC never enabled 1080p & 720p recording and the community came together to get them enabled.
Im hunting now.... Tools i used to decompress are attached to the first post
fkofilee said:
There is that possibility , it depends though as mentioned above by Tetsumi06, if the software does not permit them because the sensor is truly a 4MP sensor... But knowing HTC and their history with cameras, i wouldn't be surprised if it was possible. back on earlier models, HTC never enabled 1080p & 720p recording and the community came together to get them enabled.
Im hunting now.... Tools i used to decompress are attached to the first post
Click to expand...
Click to collapse
EDIT:
Tetsumi06 said basically the same thing! Doh!
It could also be that the code is generic to all device types and models and so has a function to pickup the sensor size based on the hardware it sees. So there might be functions for other sensor sizes but they never get enabled because physically our phones are only 4M.
I would love to be wrong though! Good find!:laugh:
HTC is working with one !!! source base. So there are often parts inside a app which are handled differently regarding some build settings.
And same here for the camera sensor strings. The same camera.apk (build number will differ) will run on other devices like Butterfly, One X, One XL, ...
So there must be some checking in the source how to handle different sensors :laugh:
chrisch1974 said:
HTC is working with one !!! source base. So there are often parts inside a app which are handled differently regarding some build settings.
And same here for the camera sensor strings. The same camera.apk (build number will differ) will run on other devices like Butterfly, One X, One XL, ...
So there must be some checking in the source how to handle different sensors :laugh:
Click to expand...
Click to collapse
See what you say is very true, one source of android 4.2.2 for example, for all 2013 devices but they add and remove what is necessary to make those devices work... They develop one load of sense based firmware to then place with drivers for the individual devices ):
You can edit the media_profiles.xml to change the image compression, and video recording bitrate. Need to make the same changes in the camera apk and compile it again
cool worth keeping an eye on
HTC Uses a single base for all its phones so they all have the same encodings. This Apk would work on a phone with 8mpx camera and vice versa. You Cant Have More Pixelsssss.
I think our sensor has more abilities and functions but we need someone to hunt and edit it
Have a look here it's kinda long but interesting
BACK CAMERA (4.1 megapixel)
Ae Bracket Hdr: Off
Ae Bracket Hdr Values: Off, HDR, AE Bracket
Antibanding: Off
Antibanding Values: Off, 50hz, 60hz, Auto
Auto Exposure: Smart Metering
Auto Exposure Lock: False
Auto Exposure Lock Supported: True
Auto Exposure Values: Frame Average, Center Weighted, Spot Metering, Smart Metering
Auto Whitebalance Lock: False
Auto Whitebalance Lock Supported: True
Awb Calibration Check: Success
Camera Mode: 0
Camera Mode Values: 0, 1
Capture Burst Captures Values: 1
Capture Burst Exposures:
Capture Burst Exposures Values: 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12
Capture Burst Interval: 1
Capture Burst Interval Max: 10
Capture Burst Interval Min: 1
Capture Burst Interval Supported: True
Capture Burst Retroactive: 0
Capture Burst Retroactive Max: 1
Capture Burst Timeinterval: 0
Capture Burst Timeinterval Max: 1000
Capture Burst Timeinterval Min: 0
Capture Burst Timeinterval Supported: True
Capture Mode Values: Normal, Contiburst, Contiburst One Shot, Hdr, Panorama, Zoe, Contizoe
Contrast: 5
Contrast Max: 10
Contrast Min: 0
Denoise: Denoise Off
Denoise Values: Denoise Off, Denoise On
Effect: None
Effect Values: None, Mono, Negative, Solarize, Sepia, Posterize, Whiteboard, Blackboard, Aqua, Emboss, Sketch, Neon
Exposure Compensation: 0
Exposure Compensation Step: 0.166667
Face Detection: Off
Face Detection Values: Off, On
Flash Calibration Check: Success
Flash Mode: Off
Flash Mode Values: Off, Auto, On, Torch
Focal Length: 3.82
Focus Areas: (0, 0, 0, 0, 0)
Focus Distances: 0.100000, 0.150000, 0.170000
Focus Mode: Auto
Focus Mode Values: Auto, Infinity, Normal, Macro, Continuous Picture, Continuous Video
Hdr Supported: True
Hfr Size Values: 800x480, 640x480
Histogram: Disable
Histogram Values: Enable, Disable
Horizontal View Angle: 69.6
Iso: Auto
Iso Values: Auto, ISO_HJR, ISO100, ISO200, ISO400, ISO800, ISO1600
Jpeg Quality: 85
Jpeg Thumbnail Height: 384
Jpeg Thumbnail Quality: 90
Jpeg Thumbnail Size Values: 512x288, 480x288, 432x288, 512x384, 352x288, 0x0
Jpeg Thumbnail Width: 512
Lensshade: Enable
Lensshade Values: Enable, Disable
Lsc Calibration Check: Success
Luma Adaptation: 3
Max Exposure Compensation: 12
Max Num Detected Faces Hw: 10
Max Num Detected Faces Sw: 0
Max Num Focus Areas: 1
Max Num Metering Areas: 1
Max Zoom: 59
Mce: Enable
Mce Values: Enable, Disable
Metering Areas: (0, 0, 0, 0, 0)
Min Exposure Compensation: 12
No Display Mode: 0
Num Jpegs Per Shutter: 1
Num Queue Depth: 2
Num Snaps Per Shutter: 1
Ois Setting: True
Ois_support: True
Orientation: 90
Overlay Format: 265
Picture Format: Jpeg
Picture Format Values: Jpeg, Raw
Picture Size: 640x480
Picture Size Values: 2688x1520, 2592x1456, 2048x1520, 2048x1216, 2048x1152, 1920x1088, 1600x1200, 1600x896, 1520x1520, 1456x1088, 1456x880, 1456x832, 1440x1088, 1280x960, 1280x768, 1280x720, 1024x768, 1088x1088, 800x600, 800x480, 720x720, 640x480, 640x384, 640x368, 352x288, 320x240, 176x144
Power Mode: Normal_Power
Power Mode Supported: True
Preview Format: Yuv420sp
Preview Format Values: Yuv420sp, Yuv420sp Adreno, Yuv420p, Yuv420p, Nv12
Preview Fps Range: 1, 200000
Preview Fps Range Values: (1, 200000)
Preview Frame Rate: 120
Preview Frame Rate Mode: Frame Rate Auto
Preview Frame Rate Modes: Frame Rate Auto, Frame Rate Fixed
Preview Frame Rate Values: 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120
Preview Size: 640x480
Preview Size Values: 1920x1088, 1440x1088, 1280x720, 1088x1088, 960x720, 960x544, 800x480, 768x464, 768x432, 720x720, 720x480, 640x480, 640x384, 640x368, 576x432, 480x320, 384x288, 352x288, 320x240, 240x160, 176x144
Recording Hint: False
Redeye Reduction: Disable
Redeye Reduction Values: Enable, Disable
Saturation: 5
Saturation Max: 10
Saturation Min: 0
Scene Detect: Off
Scene Detect Values: Off, On
Scene Mode: Auto
Scene Mode Values: Off, Auto, Action, Portrait, Landscape, Night, Night Portrait, Theatre, Beach, Snow, Sunset, Steadyphoto, Fireworks, Sports, Party, Candlelight, Backlight, Flowers, AR, Text
Selectable Zone Af: Auto
Selectable Zone Af Values: Auto, Spot Metering, Center Weighted, Frame Average
Sharpness: 10
Sharpness Max: 30
Sharpness Min: 0
Single Isp Output Enabled: False
SkinToneEnhancement: 0
SkinToneEnhancement Values: Enable, Disable
Slow Motion Res: 768x432
Slow Motion X: 4
Strtextures: OFF
Time Cons Post Processing: Enable
Touch Af Aec: Touch Off
Touch Af Aec Values: Touch Off, Touch On
TouchAfAec Dx: 100
TouchAfAec Dy: 100
Vertical View Angle: 43
Video 720p60fps Supported: True
Video Frame Format: Yuv420sp
Video Hdr: False
Video Hdr Supported: True
Video Hfr: Off
Video Hfr Values: Off, 60
Video Mode: 0
Video Slow Motion Supported: True
Video Snapshot Supported: False
Video Stabilization: False
Video Stabilization Supported: True
Video Zoom Support: True
Whitebalance: Auto
Whitebalance Values: Auto, Incandescent, Fluorescent, Daylight, Cloudy Daylight
Zoom: 0
Zoom Ratios: 100, 102, 104, 107, 109, 112, 114, 117, 120, 123, 125, 128, 131, 135, 138, 141, 144, 148, 151, 155, 158, 162, 166, 170, 174, 178, 182, 186, 190, 195, 200, 204, 209, 214, 219, 224, 229, 235, 240, 246, 251, 257, 263, 270, 276, 282, 289, 296, 303, 310, 317, 324, 332, 340, 348, 356, 364, 373, 381, 390
Zoom Supported: True
Zsl: Off
Zsl Values: Off, On
Sent from my HTC One using xda app-developers app
They might make all their apps compatible with various hardware to allow easier updating of each device's Android version.
Sent from my HTC One using xda premium
I kinda doubt what u sayin cuz look at picture size values u will notice that it's limited to max 4mp which is for HTC one
Anyways am not looking to increase the megapixels there's much more options like jpeg quality is 85% ! I can see higher video frames ! More scenes !
Maybe we can increase the quality if slow motion video ! Or make it even slower than 4x
Am I right !
Sent from my HTC One using xda app-developers app
The one thing that caught my eye was the different metering options. Being able to choose different types of metering would be awesome, along with changing the jpeg compression
Galactus said:
The one thing that caught my eye was the different metering options. Being able to choose different types of metering would be awesome, along with changing the jpeg compression
Click to expand...
Click to collapse
Yeah it would be awesome if we could control that !
Sent from my HTC One using xda app-developers app
Ugh, the bane of having TMI.
Now scumbag brain wants.
Can someone tell me how to decomplile and re-compile the APK? I will play around with the settings and see what happens
eRajesh said:
Can someone tell me how to decomplile and re-compile the APK? I will play around with the settings and see what happens
Click to expand...
Click to collapse
Use virtuous studio.
Anyway from the code we can pretty much change anything the only issue is we don't know the sensor capabilities, what is max that it can do.
For example max exposure is 12 if I remember right from the code, so if the sensor is capable of doing 16 and we set it to 14 we would get better low light photos.
We could change metering distance but again we need to know sensor capabilities for example if minimum is 5 cm we could add 3 cm which would allows us closer macro shots.
We could boost the flash as well, Make the duration longer = more time for sensor to pick up the light = better pic.
Or we could increase zoom distance as well since we can assume HTC gave us short zoom since our pixel count sux , tho I'm sure 20/30% won't ruin that much the quality ( anyway not like anyone is ever using zoom lol)
Best of all would be adding touch focus flash @ night since we lack that option. Then set it to lock focus for let's say 4 sec and take a pic.
We could even add 60 fps1080p recording tho that would make 1 min clip 300 mb + lol.
We have sh1t load opportunities here all we need is either to test on blind some stuff or somehow get the hardware specs of our sensor
Sent from my HTC One using xda premium
anyone know how to enable the histogram?

[Q] Activate continuous auto-focus on Samsung sm-c105

Hi everyone,
I am currently developing a camera application for the Samsung galaxy s4 zoom (sm-c105). I would like to activate the continuous auto-focus.
Here is what I do. It's working on my galaxy s5:
Code:
mCamera = Camera.open(defaultCameraId);
Camera.Parameters params = mCamera.getParameters();
if (params.getSupportedFocusModes().contains(
Camera.Parameters.FOCUS_MODE_CONTINUOUS_PICTURE )) {
params.setFocusMode(Camera.Parameters.FOCUS_MODE_CONTINUOUS_PICTURE);
}
I have tried all the other focus mode, but nothing is working. Even when i request focus with a callback, nothing is happening.
The galaxy s4 zoom use a special camera lens. I think this the source of my issue. I searched for a special camera api from Samsung but I didn't found nothing.
Would you have any leads?
Thanks.

Adb command to use the tele lens from 4x in the official Samsung camera app

Hi, we know the camera app won't use the 4x tele zoom until we zoom at 10x, even when lighting conditions are good enough and the zoom camera would give much better results (we know that from comparison with GCam).
While looking at the output of adb shell dumpsys media.camera, I noticed a suspicious samsung.android.scaler.zoomMapRatio variable with a value of 10.
With the command adb shell am start -a android.media.action.IMAGE_CAPTURE --ei samsung.android.scaler.zoomMapRatio 0 I can start the camera app and force this variable to zero... And suddenly the app switches between the main and the zoom cameras between 4x and 5x (depending on your lighting conditions) !
Now I need to find a way to start the camera on the phone with this command line - the setting is lost when closing the app.
Video demonstation - I run the adb command at 5s:
Please be aware that the Themes/Apps section is ONLY for releasing themes and apps.
Discussions like this go in the General section.
Thread moved.
V0latyle said:
Please be aware that the Themes/Apps section is ONLY for releasing themes and apps.
Discussions like this go in the General section.
Thread moved.
Click to expand...
Click to collapse
My bad, thx for the cleanup
I'm not sure what's the best way to launch the camera while forcing this setting...
I can write a launcher app, but the following code does work except we only get to take a photo - we cannot change mode (photo/video/portrait/etc.)
Code:
val takePictureIntent = Intent1(MediaStore.ACTION_IMAGE_CAPTURE)
takePictureIntent.putExtra("samsung.android.scaler.zoomMapRatio", 0) // <== Magic !
try {
startActivityForResult(takePictureIntent, pic_id);
} catch (e: Exception) {
// display error state to the user
}
The result in video:

Categories

Resources