I'm learning android studio and I'm currently working on a robotics project in which an Android phone is placed on the robot and used as the processor, therefore I can't reach the phone by hand. The phone needs to do some image processing. And it's not a real-time processing so I need to take a photo (Preferably Bitmap) whenever I want, quickly and without preview and confirmation. I've tried some tutorials and they all open the camera app and the user needs to capture and then confirm the photo.
I don't have problem with the processing and I don't need to use openCV etc. I just need help with capturing the photo. Thanks
You can implement your own camera, either via the camera APIs (hard) or by using a library (CameraKit-Android, Fotoapparat, etc.), thank you will have control, you can directly save the image without previewing it
Related
I have an API integrated application that calls the Internal Camera API. The application can then use the camera to capture with the interface inside that application. But now I want to use a previously taken photo, instead of the app taking a photo with the camera, when I press the shutter button on that app, it will record the photo I selected first.
Any ideas for the above problem? I don't want to mention the android virtual machine as that has a rather high requirement for hardware.
I have some ideas like Fake Camera software but it only applies to apps that call Android System Camera apps and not apps that use Internal Camera API. I also have an idea about using my pc to make a device that can pass an image to the Internal Camera API on the android device. But I am not knowledgeable enough or there is no software that can meet that requirement.
I think with the growth of the stackoverflow community, I can get my answer to this problem.
Thank you for reading my question.
I need to take a picture from the mobile phone while its camera is open.
Actually, I need that picture for face recognition. I will take a picture, I will detect a face and then post it to a web API (I am using ayonix webapi 1.3 https://market.mashape.com/felx/ayonix-webapi-1-3)
On my Android application I can invoke a service with images on its storage. So the service part is ok. Now I need to get an image while the camera is open.
Is it possible, and if so how? I could not find any tutorials.
I have a multi platform app - iOS and Android.
One of the features in the app is to capture images. I have a toggle switch in the app settings which allows the user to save the image to the device picture album if the switch is enabled.
This is an issue I can only produce in Android. Even without the toggle switch enabled, the captured photos still save to the device. I have tested this on Android 4.4.2 and 6.0
It does not do this in iOS.
There is nothing in my code to suggest that the photo should still be saved, I have checked it over and over.
Has anyone else come across this? If so what can be done to rectify the issue?
Thanks,
This is simply how FireMonkey captures images on Android. It saves a captured image to a file before handing the pixel data to you. And it does not provide access to the captured image's filename so you can remove the file afterwards.
FireMonkey has an IFMXCameraService interface with a TakePhoto() method, which accepts a NeedSaveToAlbum option:
Taking Pictures Using FireMonkey Interfaces
However, it is currently broken on Android:
RSP-13118: [Android] TTakePhotoFromCameraAction saves Image on Disk unexpectedly
RSP-15820: IFMXCameraService TakePhoto , NeedSaveToAlbum False not working
Until that is fixed, you could use JNI to access Android's camera APIs directly, then you can do whatever you want with the images.
I am developing a Cordova camera plugin. When you open the camera, it allows the user to take the picture (first part) and then it takes the user to preview photo screen, where user can save or discard the image(second part). As per my requirement, I need to know when the user is at second part i.e. he/she is at 'save/discard' screen.
I was able to detect it in iOS via notifications. But I don't have any experience in Android so couldn't figure out a way.
Any help will be appreciated.
I am developing a Cordova camera plugin
According to your comment, you are using an existing Cordova camera plugin. I presume that you mean that you are forking that plugin and making changes to it.
That plugin is using ACTION_IMAGE_CAPTURE on Android to take a picture. This delegates to an external camera application. There are hundreds of possible camera applications that could handle the request. That includes pre-installed camera apps from thousands of Android device models.
I need to know when the user is at second part i.e. he/she is at 'save/discard' screen.
There is no requirement for developers of a camera application to offer the user a "save/discard" screen for ACTION_IMAGE_CAPTURE. Some may, some may not. For those that do, there is no requirement that they somehow tell other apps that the user is now on the "save/discard" screen.
Hence, there is no way for you to accomplish this, using the existing core logic in that plugin.
In a project on Android, I'm trying to capture the video and process it in realtime (like a Kinect). I tried with two method: using OpenCV keep calling mCamera.grab() and capture.retrieve(mRgba,Highgui.CV_CAP_ANDROID_COLOR_FRAME_RGBA); or the Android's Camera by keep capturing image.
I feel that the OpenCV camera's ability to capture image faster than the Android one. But why?
OpenCV uses a hack to get low level access to the Android camera. It allows to avoid several data copyings and transitions between native and managed layers.