使用OpenCV Android单击后图像旋转问题

时间:2019-07-08 08:52:55

标签: android opencv rotation orientation

我已经用opencv单击了图像并将其存储到本地,但是当我以正确的方向加载该图像时,它仍然保持单击状态,就像我想将图像从纵向旋转到横向一样。

尝试了ExifInterface,但返回0作为方向evrytime

int orientation = ExifInterface.ORIENTATION_NORMAL;
        try {
            orientation = rotateImageIfRequired();
        } catch (IOException e) {
            e.printStackTrace();
        }


        Bitmap rotatedBitmap = null;
        switch (orientation) {

            case ExifInterface.ORIENTATION_ROTATE_90:
                rotatedBitmap = rotateImage(bitmap, 90);
                break;

            case ExifInterface.ORIENTATION_ROTATE_180:
                rotatedBitmap = rotateImage(bitmap, 180);
                break;

            case ExifInterface.ORIENTATION_ROTATE_270:
                rotatedBitmap = rotateImage(bitmap, 270);
                break;

            case ExifInterface.ORIENTATION_NORMAL:
                rotatedBitmap = rotateImage(bitmap, 0f);
                break;
            default:
                rotatedBitmap = bitmap;
        }

0 个答案:

没有答案