Ask Your Question
0

face-detect with portrait mode and front-camera

asked 2013-11-14 21:17:03 -0600

Zeo gravatar image

I tried to make my own face detect app on Android. The app should be used in portrait display, using front-camera. Firstly, I made it like below:

image description

knowing that I have to rotate the view or the camera, I looked for help in this forum and found the method "mCamera.setDisplayOriention(90)" cannot make sense in Opencv sample's struction. Then I got my way in link text .The result came out like below:

image description

I had successfully added the face-detection by studying the sample. But I want some improvement because the black border is ugly.

Seeking for advise here.

edit retag flag offensive close merge delete

Comments

The link which you mentioned above id not working... please give me a link i am struggling for one week

Face detection gravatar imageFace detection ( 2014-10-22 05:02:49 -0600 )edit

Hi sir, Because I have the same problems, could you give me a big hands or how can i get link text. many thanks!

Ming-Lang Tai gravatar imageMing-Lang Tai ( 2014-11-29 21:43:05 -0600 )edit

Hello! Could u share again the link? it doesn't work:( I have the same problem...Have u solved the problem of the black border?

diegokrk gravatar imagediegokrk ( 2015-07-22 18:23:08 -0600 )edit

Hello! Could you share the link again ? it doesn't work:( I have the same problem...Have you solved the problem of the black border?

diegokrk gravatar imagediegokrk ( 2015-07-22 18:23:37 -0600 )edit

Hi @Zeo and @diegokrk can you please share with us the code to make the rotation of the image to be in portrait mode?? The thing with the black border seems to be a selection of wrong preview size Can you paste the link for the source code on send it to my email [email protected]? Thanks

David C gravatar imageDavid C ( 2017-11-04 12:56:22 -0600 )edit
supra56 gravatar imagesupra56 ( 2017-11-04 15:23:03 -0600 )edit

1 answer

Sort by ยป oldest newest most voted
0

answered 2018-04-25 09:25:43 -0600

In your public Mat onCameraFrame(CvCameraViewFrame inputFrame) { }

Add following lines:

    Mat rotImage = Imgproc.getRotationMatrix2D(new Point(mRgba.cols() / 2,
            mRgba.rows() / 2), 90, 1.0);

    Imgproc.warpAffine(mRgba, mRgba, rotImage, mRgba.size());

    Imgproc.warpAffine(mGray, mGray, rotImage, mRgba.size());

Then set your activity to portrait in manifest

edit flag offensive delete link more

Question Tools

Stats

Asked: 2013-11-14 21:17:03 -0600

Seen: 2,687 times

Last updated: Nov 04 '17