camera2 | camera2 API的使用,camera1API的使用,连拍的实现,拍照预览,录像等等 | Camera library
kandi X-RAY | camera2 Summary
kandi X-RAY | camera2 Summary
camera2 API的使用,camera1API的使用,连拍的实现,拍照预览,录像等等 app下为camera2的使用 ,camera1下为camera1的使用,radio下为录像的实现和连拍的使用。其中连拍的实现采用获取视频帧画面的方式
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
- Initialize the list
- Initialize activity
- Initialize ImageView
- Initializes the activity
- Invoked when the activity is created
- Creates and initializes the listener
- Initialize the activity
- Sets the activity to be created
- Create the MagicEngine
- Handles the click event
- Handle click event
- Handle button click events
- Re - preview request
- Re - preview request
- Initialize surface encoder
- Find all contacts
- On accessibility events
- Diagnose bitmap
- Invoked when the scene is initialized
- Set view on view
- Initialize the surface texture
- Fanning bitmap
- Start control view
- Initialize the drawable
- Helper method to set control mode
- Get pre - view preview
- Initialize the draw
- Initializes the drawable
- Draw a bitmap to a bitmap
- Initialize the touch curve
- Take a preview request
camera2 Key Features
camera2 Examples and Code Snippets
Community Discussions
Trending Discussions on camera2
QUESTION
I am developing a basic custom camera app These are my dependency
...ANSWER
Answered 2021-May-28 at 14:26As Morrison Chang already helped you with current issue. I just wanted to add a few pointers to that whenever you get any such error in future for any of the android's library.
- Search google's maven repo https://maven.google.com/ to see if the version you are looking for is even the correct one or what is the latest version of the library exists. like in your case https://maven.google.com/web/index.html?q=camera#androidx.camera:camera-view
- Few of the library is still available at https://mvnrepository.com/ where you can check the version of your library
QUESTION
I was trying to make a simple CameraX app. I'm uploading the github link for my app: https://github.com/srivastavapoorv/GithubPracticeAndroid/tree/master/CameraX
When I try to run it, the app crashes And AndroidStudio gives this error in logcat: https://i2.paste.pics/c77714ec26373276884c6d490f3bbe40.png
This is AndroidManifest.xml `
...ANSWER
Answered 2021-May-14 at 01:12Here's the code where you're getting the crash
QUESTION
I'm trying to save data to my realtime database using the setValue() methods but it's not saving my object.
I tried with a simple String and still didn't worked.
My code :
...ANSWER
Answered 2021-May-14 at 15:03Check this article on medium where there is explanation for why setValue would fail. https://medium.com/@valokafor/firebase-realtime-database-by-example-with-android-1e597819e24b . You might want to check Firebase rules
QUESTION
The deprecated createCaptureSession()
method is used in an old code in the following way:
ANSWER
Answered 2021-Apr-14 at 00:49There's no reason you can't keep using the deprecated version of createCaptureSession - it works just as well as it did before. You'll just have to ignore the Android Studio deprecation warnings.
Basically, over time, we kept having to add more overloads of createCaptureSession with more and more variations of parameters and optional parameters, and it was getting excessive.
So we created SessionConfiguration as a configuration object that's more flexible over time (easier to add new parameters to it), set up one more createCaptureSession that accepts that, and deprecated all the prior versions to direct folks to the one we'd add today if we were designing the API again.
If you want to use the newest option, then you can take a look at OutputConfiguration (it just wraps the list of output Surfaces plus some other optional settings) - you can build one with just the surface
you put in the Arrays.asList()
call in your sample code.
But you can just keep using what you have - we won't actually break the old methods.
QUESTION
I'm taking images using the Camera2 API
.
As far as I understand, if the device is rotated during image capturing, you can set the corresponding rotation to the jpg file using the exifinterface. However, I do not store the image to a file, but rather send the image buffer - which I receive from the capture request - directly to a remote client via LAN:
...ANSWER
Answered 2021-May-11 at 09:32After testing around a bunch I found the following answer to my question.
For JPEG images:
Use the CaptureRequest
directly and set the value for the tag JPEG_ORIENTATION
according to the devices orientation.
I simply used the display rotation, since only values of 0, 90, 180, 270 are allowed anyway:
QUESTION
I have an app which records videos, it has about 80K current installations (more than 100K downloads), Crashlytics statistics seems to be good - Crash-free users 99.66% and rating on Google Play is also OK - 4.5
But still for some of my users can happen the next errors (it may happened for such user once or a couple of times by now, so not often, but still happens from time to time):
android.hardware.camera2.CameraAccessException: CAMERA_DISABLED (1): connectHelper:1578: Camera "0" disabled by policy
android.hardware.camera2.CameraAccessException: CAMERA_DISCONNECTED (2): Camera service is currently unavailable
java.lang.IllegalArgumentException: supportsCameraApi:2096: Unknown camera ID 0
android.hardware.camera2.CameraAccessException: CAMERA_DISABLED (1): validateClientPermissionsLocked:1066: Caller "com.MY_APP_PACKAGE" (PID 10237, UID 21433) cannot open camera "1" when sensor privacy is enabled
on opening camera using camera2
API:
ANSWER
Answered 2021-Apr-28 at 23:02android.hardware.camera2.CameraAccessException: CAMERA_DISABLED (1): connectHelper:1578: Camera "0" disabled by policy
QUESTION
Dependencies used:
...ANSWER
Answered 2021-Apr-28 at 21:17The underlying camera2 API has a fairly strictly defined set of rules on how having multiple output resolutions works, in terms of cropping. The docs for the SCALER_CROP_REGION (digital zoom) control have useful diagrams about this; for your case, just assume the CROP_REGION covers the whole active array.
On top of that, CameraX PreviewView applies further cropping to its input, since the camera device itself only supports a few sizes. So PreviewView will pick a supported resolution that has a reasonable aspect ratio, and then crop it if necessary when displaying it to fill your View layout area.
So, the relationship between the ImageAnalysis and Preview use cases and their fields of view depends on both the resolutions CameraX selects for the use cases under the hood, and PreviewView's additional cropping.
What's probably happening here is that your landscape PreviewView is selecting an underlying resolution that's wider than ImageAnalysis is selecting. You could check what's actually selected via adb shell dumpsys media.camera
if you have developer access to a device, while your app is running. That command dumps out a lot of info, including exactly what CameraX has configured the camera device to do.
You could try using the setTargetAspectRatio or the setTargetResolution methods on Preview.Builder to match the aspect ratio of the ImageAnalysis; that should ensure that the PreviewView is only ever a crop of what ImageAnalysis receives.
QUESTION
I am trying to find a way to capture a photo with Camera2, but with Landscape rotation without enabling the rotation option on my device. So what I am trying to do is to take a photo when is rotated to landscape physically, not using the Auto Rotate mode.So what have done is setted up a when function to count up the windowManager to every key value from 0 to 3 to have an effect. It doesn't work correctly and making photos in Portrait orientation and no effect. Here is the code:
...ANSWER
Answered 2021-Apr-22 at 13:06Ok, I found out the solution. So basically within the code there is this:
QUESTION
I currently have an app with a minimum api of 21 that has both a camera1 and a camera2 implementation. Based on the following code I select whether to use camera1 or camera2:
...ANSWER
Answered 2021-Apr-20 at 06:41cameraX does not have a Camera API1 fallback. They rely on camera2 LEGACY support, but yes, the library includes many workarounds for specific problems. Please look at the list of devices they tested: https://developer.android.com/training/camerax/devices.
You don't explain what are "all the cases" you were previously using the camera1 fallback for, but if you have such list, you can go through the release notes to check whether they are addressed by the current version of the library. If they are not, you are welcome to add them to the issues list.
QUESTION
There is this situation where I am trying to use MLKit inside Unity. Naturally I make an Android plugin. Here are the Gradle dependencies:
...ANSWER
Answered 2021-Apr-16 at 19:41As the error message suggests, the same stuff seams to be around in two separate dependencies: once in ":PoseDetector-release:" and once in ":androidx.camera.camera-camera2-1.1.0-alpha02:"
I have run in this issue before, and was able to solve it. Sometimes it takes longer to find out which dependencies to remove.
The solution to this error is to remove one of the duplicate dependencies, in my case I believe it was removing the android plugin folder of some SDK in my Project's Assets Folder, due to the fact that the same dependency was already included by some package I downloaded and imported via the unity package manager.
The two cases I can think of, where my answer is garbage are:
The collision is NOT due to collision between same dependencies, but just between namespaces
You can not remove neither of the two dependencies because they only overlap, but BOTH each contain MORE stuff you need, which is NOT already included in the other one
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install camera2
You can use camera2 like any standard Java library. Please include the the jar files in your classpath. You can also use any IDE and you can run and debug the camera2 component as you would do with any other Java program. Best practice is to use a build tool that supports dependency management such as Maven or Gradle. For Maven installation, please refer maven.apache.org. For Gradle installation, please refer gradle.org .
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page