3
我正在開發適用於Android OS的應用程序,它可以幫助您使用相機進行繪製。應用程序的工作方式是從相機槽onPreviewFrame(byte[] data, Camera camera)
中捕獲幀,並從這裏將圖片轉換爲二進制黑/白。在一般的應用程序的作品,但我有以下問題:當我移動手機時的圖像穩定 - Android
捕獲圖像槽onPreviewFrame真的很慢。現在我跳過幀但方法仍然很慢。
YuvImage yuvImage = new YuvImage(data, ImageFormat.NV21, width, height, null); ByteArrayOutputStream baos = new ByteArrayOutputStream(); yuvImage.compressToJpeg(new Rect(0,0,width, height), 100, baos); byte [] imageData = baos.toByteArray(); Bitmap bmp = BitmapFactory.decodeByteArray(imageData , 0, imageData .length); bmp = Bitmap.createScaledBitmap(bmp, surfaceView.getMeasuredHeight(), surfaceView.getMeasuredWidth(), false); Bitmap bmps = ImageHelper.rotate(bmp, kot);
有什麼辦法讓圖片更快?
我也注意到,雖然手機完全靜止而且光線相同,但我還是發現每個幀的picutre都不一樣(不同的直方圖)。
相關問題:-http://stackoverflow.com/questions/5634053/processing-android-camera-frames-in-real-time –
是的,但不一樣... –
我是你在'onPreviewFrame()'方法中做了很多操作,你的手機在測試它的規格是什麼? –