Camera2Sample
Camera2Sample copied to clipboard
判断相机的 Hardware Level 是否大于等于指定的 Level-没有看明白
/**
- 判断相机的 Hardware Level 是否大于等于指定的 Level。 */ fun CameraCharacteristics.isHardwareLevelSupported(requiredLevel: Int): Boolean { val sortedLevels = intArrayOf( CameraCharacteristics.INFO_SUPPORTED_HARDWARE_LEVEL_LEGACY, //2 CameraCharacteristics.INFO_SUPPORTED_HARDWARE_LEVEL_LIMITED,//0 CameraCharacteristics.INFO_SUPPORTED_HARDWARE_LEVEL_FULL, //1 CameraCharacteristics.INFO_SUPPORTED_HARDWARE_LEVEL_3 //3 ) val deviceLevel = this[CameraCharacteristics.INFO_SUPPORTED_HARDWARE_LEVEL] if (requiredLevel == deviceLevel) { return true } for (sortedLevel in sortedLevels) { if (requiredLevel == sortedLevel) { return true } else if (deviceLevel == sortedLevel) { return false } } return false }
代码中
for (sortedLevel in sortedLevels) { if (requiredLevel == sortedLevel) { return true } else if (deviceLevel == sortedLevel) { return false } } 什么意思呢,没有看明白呀。
I have added capture performance metrics in the code as follows: MSG_CAPTURE_IMAGE -> { captureImageTimestamp = System.currentTimeMillis() @WorkerThread override fun onImageAvailable(imageReader: ImageReader) { val image = imageReader.acquireNextImage() val captureResult = captureResults.take() if (image != null && captureResult != null) { Log.d("CaptureDebug:", "onImageAvailable capture costs:${System.currentTimeMillis()-captureImageTimestamp}") but a capture costs approximately 550ms which is more time expensive than Camera 1 costs about 300ms, the same results appeares in CameraView solution, is there a more effective way to do capture operation?