Ask Your Question
0

problems to detect face and save the image in mode portrait in Android opencv

asked 2015-07-03 12:02:03 -0600

I have a problem to detect face and save the image in mode portrait using Android sdk opencv. I open the camera and recevied the data to detect faces but in mode portrait, I receive the data (mRgba) in the preview appears the image rotated and when the image is saved is equal, please, I need help to rotate the preview and save the image in way correct.

I detect faces and save the photo with data received in this method:

public Mat onCameraFrame(CameraBridgeViewBase.CvCameraViewFrame inputFrame) {
    mRgba = inputFrame.rgba();
    mGray = inputFrame.gray();
 }
edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted
0

answered 2020-07-05 20:18:57 -0600

hamzaKH10 gravatar image

Try this solution, it works for me Mat mRGBat = mRGBA.t(); Core.flip(mRGBat,mRGBat,-1); Imgproc.resize(mRGBat,mRGBat,mRGBA.size());

// Detect faces using mRGBat Imgproc.rectangle(mRGBat, new Point(rect.x, rect.y), new Point(rect.x + rect.width, rect.y + rect.height), new Scalar(255, 0, 0)); return mRGBat ;

Then try to detect faces in mRGBat

edit flag offensive delete link more

Question Tools

1 follower

Stats

Asked: 2015-07-03 12:02:03 -0600

Seen: 139 times

Last updated: Jul 03 '15