是否有使ImageReader在相机2中返回的Image的ImageView可缩放的功能?

时间:2019-04-10 05:27:21

标签: android android-camera2

我无法在Camera2中将ImageReader检索到的图像ImageReader.OnImageAvailableListener进行缩放,而不会损失图像质量。

 private final ImageReader.OnImageAvailableListener mOnImageAvailableListener = new ImageReader.OnImageAvailableListener() {

        @Override
        public void onImageAvailable(ImageReader reader) {
            Log.d(TAG, "onImageAvailable: called.");

            if (!mIsImageAvailable) {
                mCapturedImage = reader.acquireLatestImage();

                Log.d(TAG, "onImageAvailable: captured image width: " + mCapturedImage.getWidth());
                Log.d(TAG, "onImageAvailable: captured image height: " + mCapturedImage.getHeight());

                mIsImageAvailable=true;   
                final Activity activity = getActivity();
                if (activity != null) {
                    activity.runOnUiThread(new Runnable() {
                        @Override
                        public void run() {
                           Glide.with(activity).load(mCapturedImage).into(ivStillShot);

                            showStillShotContainer();
                        }
                    });
                }
            }

        }
    };

我想在Camera2中将ImageReader检索到的图像放大ImageReader.OnImageAvailableListener,而又不损失图像质量。

0 个答案:

没有答案