I tried to modify the FacePreview.java sample provided for Android and since that code always open your camera in landscape mode, I added orientation logic in Preview.java, once we opens the camera:
mCamera.setDisplayOrientation(90);
When I ran the program I found always the Object detection i.e. cvHaarDetectObjects only works if the phone is in landscape mode, in other modes mainly in portrait, it's not at all detecting any face. What is the reason behind this?
faces = cvHaarDetectObjects(
grayImage,
classifier,
storage,
1.1,
3,
CV_HAAR_FEATURE_MAX
| CV_HAAR_SCALE_IMAGE
| CV_HAAR_FIND_BIGGEST_OBJECT
| CV_HAAR_DO_ROUGH_SEARCH
| CV_HAAR_DO_CANNY_PRUNING);
faces.total always returns 0 when the phone is in portrait mode or orientation is different that landscape.
I tried modifying places but didn't find the expected.