私は自分の活動で前と後ろの両方のカメラ解像度を使用したいので、画像を区別することができます。アクティビティ内のデバイスのカメラ解像度を取得する方法は? (アンドロイド)
0
A
答えて
0
Camera camera=Camera.open(0); // For Back Camera
android.hardware.Camera.Parameters params = camera.getParameters();
List sizes = params.getSupportedPictureSizes();
Camera.Size result = null;
ArrayList<Integer> arrayListForWidth = new ArrayList<Integer>();
ArrayList<Integer> arrayListForHeight = new ArrayList<Integer>();
for (int i=0;i<sizes.size();i++){
result = (Size) sizes.get(i);
arrayListForWidth.add(result.width);
arrayListForHeight.add(result.height);
Log.debug("PictureSize", "Supported Size: " + result.width + "height : " + result.height);
System.out.println("BACK PictureSize Supported Size: " + result.width + "height : " + result.height);
}
if(arrayListForWidth.size() != 0 && arrayListForHeight.size() != 0){
System.out.println("Back max W :"+Collections.max(arrayListForWidth)); // Gives Maximum Width
System.out.println("Back max H :"+Collections.max(arrayListForHeight)); // Gives Maximum Height
System.out.println("Back Megapixel :"+(((Collections.max(arrayListForWidth)) * (Collections.max(arrayListForHeight)))/1024000));
}
camera.release();
arrayListForWidth.clear();
arrayListForHeight.clear();
camera=Camera.open(1); // For Front Camera
android.hardware.Camera.Parameters params1 = camera.getParameters();
List sizes1 = params1.getSupportedPictureSizes();
Camera.Size result1 = null;
for (int i=0;i<sizes1.size();i++){
result1 = (Size) sizes1.get(i);
arrayListForWidth.add(result1.width);
arrayListForHeight.add(result1.height);
Log.debug("PictureSize", "Supported Size: " + result1.width + "height : " + result1.height);
System.out.println("FRONT PictureSize Supported Size: " + result1.width + "height : " + result1.height);
}
if(arrayListForWidth.size() != 0 && arrayListForHeight.size() != 0){
System.out.println("FRONT max W :"+Collections.max(arrayListForWidth));
System.out.println("FRONT max H :"+Collections.max(arrayListForHeight));
System.out.println("FRONT Megapixel :"+(((Collections.max(arrayListForWidth)) * (Collections.max(arrayListForHeight)))/1024000));
}
camera.release();
+0
カメラのオブジェクトが減価償却されていることを示しています。「残念なことにアクティビティが機能しなくなりました。」 –
+0
https://developer.android.com/reference/android/hardware/camera2/package-summary.html – MonkeyEdict
+0
これを見てください – MonkeyEdict
関連する問題
- 1. カメラの解像度を取得する方法
- 2. ARCore:カメラの解像度を取得
- 3. Accord.Video.DirectShowを使用してカメラの解像度を取得する
- 4. Vuforiaカメラ低デバイスのカメラ解像度とユニティ
- 5. OpenCVでAndroidのカメラ解像度を設定する方法は?
- 6. Androidカメラでフル解像度と非圧縮の画像データを取得する方法
- 7. Android - 640 x 480のカメラ解像度をロックする方法
- 8. Arcoreカメラの解像度
- 9. アンドロイドで、カメラから取得した画像の画像IDを取得する
- 10. onvifを使用してカメラから解像度を取得
- 11. 二重解像度でスクリーンキャプチャを取得する方法は?
- 12. Android:カメラ:最大解像度
- 13. ライブブラウザの画面解像度を取得する方法
- 14. windows-golangの画面解像度を取得する方法
- 15. アンドロイドでデバイスのベースバンドバージョンを取得する方法は?
- 16. カメラの動きのベクトルの角度を取得する方法
- 17. AndroidカメラSurfaceView。画像の解像度を変更するには?
- 18. 画面の解像度を取得する方法は? WinRTアプリケーションの場合は?
- 19. アンドロイドを取得する方法:特定のアクティビティのラベル?
- 20. ソフトキーボードのサイズを含む画面の解像度を取得する方法は?
- 21. アクティビティの背景の画像解像度
- 22. アンドロイドでアクティビティ間で配列サイズを取得する方法は?
- 23. DirectX 9 - カメラの解像度を取得していますか? (C++)
- 24. OL3のアニメーションの後で 'end'解像度を取得する方法は?
- 25. デルファイ10.1アンドロイドFirebaseデバイスはトークンを取得する方法
- 26. diffのアンドロイド画面サイズと解像度で同じサイズのゲーム要素を取得する方法
- 27. 解決方法内のルートパラメーターを取得する方法角度2
- 28. 同じ電話カメラで異なる解像度の画像内の円の差
- 29. IMAGE_CAPTUREインテントを使用してカメラ解像度を上げる方法
- 30. Android opencvカメラの解像度が低く
これはhttp://stackoverflow.com/questions/19463858/how-to-get-front-and-back-cameras-megapixel-that-is-designed-for-android-deviceあなたを助けることができます。 – katmanco
助けていない........カメラが償却されているためです。 –
カメラの代わりに何か他のものを置いてはいませんか?通常、減価償却されたものは、新しく頑強なものに置き換えられます。 – katmanco