airockchip / rknn-toolkit2

Other
996 stars 104 forks source link

rknn_yolov5_android_apk_demo modifying the flip parameter does not take effect #198

Open Starkguava opened 1 month ago

Starkguava commented 1 month ago

public class CameraPreviewActivity extends Activity implements Camera.PreviewCallback {

private final String TAG = "rkyolo";
private static final int MAGIC_TEXTURE_ID = 10;

TSurfaceHolderCallback mSurfaceHolderCallback = null;

private Camera mCamera0 = null;
private SurfaceView mSurfaceView = null;
public SurfaceTexture mSurfaceTexture = null;
private SurfaceHolder mSurfaceHolder = null;

public int flip = -1;    // for CAMERA_FACING_BACK(camera comes with RK3588 using this mode),
                         // we do not need flip, using -1, or we need using
                         // IM_HAL_TRANSFORM_FLIP_H

When I run this demo with an external USB camera on the 3588 board, the image is mirrored. I have tried modifying the parameter to -1, 0, 1, and IM_HAL_TRANSFORM_FLIP_H (public static final int IM_HAL_TRANSFORM_FLIP_H = (1 << 3); // 0x08), but none of these changes have any effect; the image remains mirrored. This includes the startCamera() method where the condition if (Camera.CameraInfo.CAMERA_FACING_FRONT == camInfo.facing) { this.flip = IM_HAL_TRANSFORM_FLIP_H; }

does not work even when commented out.