AndroidOpenCV摄像头预览旋转90度问题

将下图文件中的 deliverAndDrawFrame 方法
AndroidOpenCV摄像头预览旋转90度问题
修改为:

    protected void deliverAndDrawFrame(CvCameraViewFrame frame) {
        Mat modified;

        if (mListener != null) {
            modified = mListener.onCameraFrame(frame);
        } else {
            modified = frame.rgba();
        }

        boolean bmpValid = true;
        if (modified != null) {
            try {
                Utils.matToBitmap(modified, mCacheBitmap);
            } catch(Exception e) {
                Log.e(TAG, "Mat type: " + modified);
                Log.e(TAG, "Bitmap type: " + mCacheBitmap.getWidth() + "*" + mCacheBitmap.getHeight());
                Log.e(TAG, "Utils.matToBitmap() throws an exception: " + e.getMessage());
                bmpValid = false;
            }
        }

        if (bmpValid && mCacheBitmap != null) {
            Canvas canvas = getHolder().lockCanvas();

            if (canvas != null) {
                /*----------------------------修改预览旋转90度问题--------------------------------*/
                canvas.rotate(90,0,0);
                float scale= canvas.getWidth() / (float)mCacheBitmap.getHeight();
                float scale2= canvas.getHeight() / (float)mCacheBitmap.getWidth();
                if(scale2> scale)
                {
                    scale = scale2;
                }
                if (scale!= 0)
                {
                    canvas.scale(scale,scale,0,0);
                }
                canvas.drawBitmap(mCacheBitmap, 0, -mCacheBitmap.getHeight(), null);
                /*----------------------------修改预览旋转90度问题--------------------------------*/
                if (mFpsMeter != null) {
                    mFpsMeter.measure();
                    mFpsMeter.draw(canvas, 20, 30);
                }
                getHolder().unlockCanvasAndPost(canvas);
            }
        }
    }