如何通过纵向模式人脸检测? [英] How to detect face by portrait mode?
本文介绍了如何通过纵向模式人脸检测?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我最近学习OpenCV的。
I'm studying OpenCV recently.
OpenCV的Android的样本code(2.4.6)进行测试。
OpenCV for Android sample code(2.4.6) is tested.
我有些纳闷。
我可以通过样本code脸检测(OpenCV的样本 - 脸检测)。但是,无法通过Android设备上纵向模式(垂直模式),人脸检测。
I can detect face by sample code(OpenCV Sample - face-detection). but, can't detect face by portrait mode(vertical mode) on android device.
首先,我试图通过纵向模式设置前置摄像头。
First, I try set Front-Camera by portrait mode.
//添加code在onCameraFrame()方法。
//added code in onCameraFrame() method.
Core.flip(mRgba,mRgba,1);
Core.flip(mRgba, mRgba, 1);
还是不认识的脸。
如何通过纵向模式人脸检测?
How to detect face by portrait mode?
感谢您。
推荐答案
您需要做转,然后翻转:
you need to do transpose and then flip:
int height = mGray.rows();
int faceSize = Math.round(height * 0.5F);
Mat temp = mGray.clone();
Core.transpose(mGray, temp);
Core.flip(temp, temp, -1);
MatOfRect rectFaces = new MatOfRect();
// java detector fast
mCascade.detectMultiScale(temp, rectFaces, 1.1, 1, 0, new Size(faceSize, faceSize), new Size());
这篇关于如何通过纵向模式人脸检测?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文