を取得するプロジェクトに取り組んでおり、画像内の平均カウントを計算する必要がありますImages
。カメラPreview Images
から画像をすばやく取得しました ( )。画像形式は(実際には画像形式の専門家ではないので、なぜそれを使用するのかわかりません)Camera
Blue
As Preview Images
NV21
これが私がから画像を読む方法ですCamera Preview Callback
public void onPreviewFrame(byte[] data, Camera camera) {
Camera.Parameters parameters = camera.getParameters();
Size size = parameters.getPreviewSize();
YuvImage image = new YuvImage(data, ImageFormat.NV21, size.width,
size.height, null);
Rect rectangle = new Rect();
rectangle.bottom = size.height;
rectangle.top = 0;
rectangle.left = 0;
rectangle.right = size.width;
ByteArrayOutputStream out2 = new ByteArrayOutputStream();
image.compressToJpeg(rectangle, 100, out2);
byte[] d = out2.toByteArray();
Bitmap bitmap = BitmapFactory.decodeByteArray(d, 0, d.length);
}
そして、ご覧のとおり、ピクセルをBitmap
読み取って画像の青色を決定し、処理することを計画していましたが、同僚は、その方法は重くて遅く、場合によって は正確ではないと言い、取得する必要があります。ハードウェア自体からのマトリックスとしての画像の青の色で、どこから始めればよいかわかりません(私の同僚は iOS バージョンで動作しています)。Bitmap
Pixel by Pixel