Skip to content

Problems to detect face in mode portrait using opencv Android sdk #5058

@opencv-pushbot

Description

@opencv-pushbot

Transferred from http://code.opencv.org/issues/4463

|| Fabian Hoyos on 2015-07-03 21:49
|| Priority: Normal
|| Affected: 2.4.9 (latest release)
|| Category: None
|| Tracker: Bug
|| Difficulty: Medium
|| PR: 
|| Platform: ARM / Android

Problems to detect face in mode portrait using opencv Android sdk

I am working in detect faces using the opencv Android SDK 2.4.11. The  application shows the video preview in portrait mode, I modified the opencv Android SDK to adapt to the video preview in a portrait mode, this change was done in the onCameraFrame method and It consists in rotate 90 degree the inputFrame.rgba() 




        public void onCameraViewStarted(int width, int height) {
        //mGray = new Mat();
        // mRgba = new Mat();
        mRgba = new Mat(height, width, CvType.CV_8UC4);
        mRgbaF = new Mat(height, width, CvType.CV_8UC4);
        mRgbaT = new Mat(width, width, CvType.CV_8UC4);
        }


       public Mat onCameraFrame(CameraBridgeViewBase.CvCameraViewFrame inputFrame) {
        mRgba = inputFrame.rgba();
        mGray = inputFrame.gray();

        //rotate 90 degree 
        Core.transpose(mRgba, mRgbaT);
        Imgproc.resize(mRgbaT, mRgbaF, mRgbaF.size(), 0, 0, 0);
        Core.flip(mRgbaF, mRgba,1);





      }

The video preview adapts to the phone orientation. But the face detection only works in right landscape orientation. Also I look at the stored pictures and they aren't rotated to portrait, no matter the phone rotation.

History

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions