1 | initial version |
I found a solution for this.
Tested - working fine. :)
Just added few lines of code to OpenCV Library JavaCameraView class.
Step 1. Go to OpenCVLibrary > Java > org.opencv > android > JavaCameraView
Step 2. Add this method anywhere in the JavaCameraView class
private void setDisplayOrientation(Camera mCamera, int angle) {
Method downPolymorphic;
try
{
downPolymorphic = mCamera.getClass().getMethod("setDisplayOrientation", new Class[] { int.class });
if (downPolymorphic != null)
downPolymorphic.invoke(mCamera, new Object[] { angle });
}
catch (Exception e1)
{
}
}
Step 3. Search for mCamera.startPreview();
in the class and paste this code just above this.
setDisplayOrientation(mCamera, 90);
mCamera.setPreviewDisplay(getHolder());
Just like this.
Run your code.
Happy Coding!