简体   繁体   中英

In Android with Opencv, CvCameraViewListener2 class, Display orientation is portrait mode is anything Possible to camera view in Fullscreen

In opencv android, i change display orientation in portrait mode. Camera view is rotated. so i change the code

public Mat onCameraFrame(CvCameraViewFrame inputFrame) {

        mRgba = inputFrame.rgba();
        mGray = inputFrame.gray();
        Core.transpose(mRgba, mRgbaT);
        Imgproc.resize(mRgbaT, mRgbaF, mRgbaF.size(), 0,0, 0);
        Core.flip(mRgbaF, mRgba, 0);
}

above code change to Portrait mode correct view. But camera view is middle of the screen. i need to change full screen view. Is anything possible to change full screen mode in portrait. 在此处输入图片说明 .

使用mCamera.setDisplayOrientation(90);

You can call a setRequestedOrientation with the desired orientation on your onCreate() method :

 public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM