capture a live image from camera using python, uiautomator - android

My application requires to capture a picture from the Android Camera.
from you Automatorviewer, the click softbutton of the camera is not being indentified, it is only displaying the View and the relative layout.
Please can someone help with this.

Thank you guys, I found the answer using the below
rowcount = d(textStartsWith="XXX").count
print rowcount
This returns the exact number of rows starting with same letters/characters

Related

How one can use 'Wide-angle lense' or 'Telephoto lense' using camera2 api?

As per my understanding manager.getCameraIdList() returns the possible number of logical camera id's we can use.Is there any way to determine which camera Id is an Id for 'Wide-angle lense' or 'Telephoto-lense' using manager.getCameraCharacteristics()?
Try using LENS_INFO_AVAILABLE_FOCAL_LENGTHS. If the cameras don't have optical zoom, then the numbers they will provide can straightforwardly be used to tell the difference between a wide-angle lens(low number) and a telephoto lens(high number).

How can i set rotation of camera capture request?

I'm using ndk to create application that captures through camera and displays the images. I succeed to capture and display images but the rotation of images is not normal. So, i tried to change the rotation of images by using ACaptureRequest_setEntry_u8 function. But it returns this error message in logcat(E/ACameraMetadata: Error: tag 917518 is not writable!). I tried to check whether ACAMERA_SENSOR_ORIENTATION is included in ACameraMetadata and it is.
Below is the code. I used two days to correct this problem. Please help me.
ACameraDevice_createCaptureRequest(mainCameraDevice, TEMPLATE_STILL_CAPTURE,
&mainCaptureRequest);
uint8_t degree = 90;
ACaptureRequest_setEntry_u8(mainCaptureRequest, ACAMERA_SENSOR_ORIENTATION, 1, &degree);
And i'm using ACameraCaptureSession_setRepeatingRequest to capture sequentially.
I'm not using NDK to take a picture but I've done the following to correctly rotate the output image:
https://stackoverflow.com/a/51892093/10159898
Given code are both in Kotlin and Java.
Hope It can help you

Camera2 api preview is not same with capture

I am using camera2Basic example and I fixed exposure time, iso, white balance and etc.
mPreviewBuilder.set(CaptureRequest.CONTROL_AF_MODE,CaptureRequest.CONTROL_AF_MODE_CONTINUOUS_PICTURE);
//mPreviewBuilder.set(CaptureRequest.LENS_FOCUS_DISTANCE, DEFAULT_FOCUS_DISTANCE);
mPreviewBuilder.set(CaptureRequest.CONTROL_AE_MODE, CameraMetadata.CONTROL_AE_MODE_OFF);
mPreviewBuilder.set(CaptureRequest.NOISE_REDUCTION_MODE, CameraMetadata.NOISE_REDUCTION_MODE_FAST);
mPreviewBuilder.set(CaptureRequest.EDGE_MODE, CameraMetadata.EDGE_MODE_FAST);
mPreviewBuilder.set(CaptureRequest.CONTROL_AE_PRECAPTURE_TRIGGER, CaptureRequest.CONTROL_AE_PRECAPTURE_TRIGGER_CANCEL);
mPreviewBuilder.set(CaptureRequest.CONTROL_AWB_MODE, wbMode);
mPreviewBuilder.set(CaptureRequest.CONTROL_AWB_LOCK, wbLock);
mPreviewBuilder.set(CaptureRequest.SENSOR_SENSITIVITY, isoValue);
mPreviewBuilder.set(CaptureRequest.SENSOR_EXPOSURE_TIME, exposureValue);
I am taking several photos by rotating my phone for stitching.
While taking photos the preview looks fine, but captured results are totally different in terms of brightness
When I checked the images exif data, they have same exposure time and iso (not on Nexus)
I don't know what I am missing.
Any suggestion why it is happening? Thank you
My problem was not using session.setRepeatingRequest() and session.capture() properly. Please check this answer

Unable to change FOV of the google card board camera

I am developing a sniper game for android using Google card board unity SDK. Now there is the need to tweak the camera's FOV which leads me to interact a variable named 'mockFieldOfView' in CardBoard.cs. Tweaking that value in the Unity editor is fine but as soon as I make a build for Android it doesn't take effect at all. I'm unable to figure out the issue. Any idea or suggestion would be highly appreciated.
Apologize for the late reply, so ouflak you can see complete Cardboard.cs here Cardboard.cs
You don't want to change "mockFieldOfView". That only affects the in-editor FOV. The value you want to change is "matchMonoFOV" on the StereoController. You also have to set a "CenterOfInterest" game object on the StereoController. It makes the stereo FOV attempt to match the FOV on the Main Camera (or whichever camera has the StereoController script).
See StereoController.cs
Update: v0.4.5 of Cardboard SDK supports your use case. Use "matchByZoom" and set the FOV you want on the StereoController's camera. No center of interest is needed.
I had the same issue and in my case it helped to put the MainCamera closer to the object which was the Cockpit of a car in my case.
In order to put the MainCamera closer than 1 real-world-meter to the object you must change the default-minimum-value in Cardboard.cs - I use the following setting:
private readonly Vector2 defaultComfortableViewingRange = new Vector2(0.0f, 100000.0f);

Android Camera.takePicture - Possible to disable shutter sound and preview surface?

I am working on an app that will allow a user to take quick click and forget snapshots. Most of the app is done except for the camera working that way I would like. Right now I have the camera working but I can't seem to find a way to disable the shutter sound and I cant find a way to disable displaying the preview. I was able to cover the preview up with a control but I would rather just not have it displayed if possible.
To sum things up, these are the items that I would like to disable while utilizing the built in Camera controls.
Shutter sound
Camera screen display
Image preview onPictureTaken
Does anyone know of a resource that could point me in the right direction, I would greatly appreciate it. I have been following CommonsWare's example from this sample fairly closely.
Thank you.
This is actually a property in the build.prop of a phone. I'm unsure if its possible to change this. Unless you completely override it and use your own camera code. Using what you can that is available in the SDK.
Take a look at this:
CameraService.cpp
. . .
CameraService::Client::Client(const sp<CameraService>& cameraService,
const sp<ICameraClient>& cameraClient,
const sp<CameraHardwareInterface>& hardware,
int cameraId, int cameraFacing, int clientPid) {
mPreviewCallbackFlag = FRAME_CALLBACK_FLAG_NOOP;
mOrientation = getOrientation(0, mCameraFacing == CAMERA_FACING_FRONT);
mOrientationChanged = false;
cameraService->setCameraBusy(cameraId);
cameraService->loadSound();
LOG1("Client::Client X (pid %d)", callingPid)
}
void CameraService::loadSound() {
Mutex::Autolock lock(mSoundLock);
LOG1("CameraService::loadSound ref=%d", mSoundRef);
if (mSoundRef++) return;
mSoundPlayer[SOUND_SHUTTER] = newMediaPlayer("/system/media/audio/ui/camera_click.ogg");
mSoundPlayer[SOUND_RECORDING] = newMediaPlayer("/system/media/audio/ui/VideoRecord.ogg");
}
As can be noted, the click sound is started without your interaction.
This is the service used in the Gingerbread Source code.
The reason they DON'T allow this is because it is illegal is some countries. Only way to achieve what you want is to have a custom ROM.
Update
If what being said here: http://androidforums.com/t-mobile-g1/6371-camera-shutter-sound-effect-off.html
still applies, then you could write a timer that turns off the sound (Silent Mode) for a couple of seconds and then turn it back on each time you take a picture.
You may use the data from the preview callback using a function to save it at a picture on some type of trigger such as a button, using onclick listener. you could compress the image to jpeg or png. In this way, there no shutterCallback to be implemented. and therefore you can play any sound you want or none when taking a picture.
You can effectively hide the preview surface by giving it dimensions of 1p in the xml file (I found an example the said 0p but for some reason that was giving me errors).
It may be illegal to have a silent shutter in some places, but it doesn't appear that the US is such a place, as my HTC One gives me an option to silence it, and in fact, since Android 4.2 you can do this:
Camera.CameraInfo info=new Camera.CameraInfo();
if (info.canDisableShutterSound) {
camera.enableShutterSound(false);
}

Categories

Resources