I am trying to use BoofCV line detection with this example from the BoofCV Android demo . To do this, I copied the classes and installed everything using the Camera API from Android. Although the demo uses Landscape Orientation, my activity should be in the portrait, but when installed, the camera rotates 90 Β° to the left. When I try to install the camera accordingly, nothing happens. I used:
Camera.setDisplayOrientation(90)Camera.setParameters("orientation", "portrait")
After some time, I realized that it was not connected with the device (it is tested on different devices and API levels), and it has nothing to do with the cameraβs API (since I managed to get it in the portrait when commenting outside the VideoProcessor.init() function VideoProcessor.init() ).
After trying for a while, I still can not understand why VideoProcessor continues to rotate the image to the left ...
Here is my code for VideoProcessor :
public class LineProcessor extends Thread implements VideoProcessing { private final Object lockGui = new Object(); private final Object lockConvert = new Object(); private Paint mPaint; private ImageType<GrayU8> imageType; private GrayU8 image; private GrayU8 image2; private volatile boolean requestStop = false; private volatile boolean running = false; private int outputWidth; private int outputHeight; private View view; private Thread thread; private DetectLine detector; private FastQueue<LineSegment2D_F32> lines = new FastQueue<LineSegment2D_F32>(LineSegment2D_F32.class,true); private Bitmap bitmap; private byte[] storage; private double scale; private double tranX,tranY; public LineProcessor(DetectLine detector) { this.imageType = ImageType.single(GrayU8.class); this.detector = detector; mPaint = new Paint(); mPaint.setColor(Color.RED); mPaint.setStyle(Paint.Style.STROKE); mPaint.setStrokeWidth(2.0f); } @Override public void init(View view, Camera camera) { synchronized (lockGui) { this.view = view; Camera.Size size = camera.getParameters().getPreviewSize(); outputWidth = size.width; outputHeight = size.height; declareImages(size.width,size.height); }
the class I expanded is equal to VideoProcessing.java
Does anyone have any experience with this issue?
source share