Surface View # Rotate camera - Vuzix

I`m developing OCR app on Vuzix. I need to create rectangular bound in Surface view. My problem is image from camera was rotated 90 degree when using “Surface View”( It has no problem when use this app on Android Phone )

# Questions

  1. Can I rotate image from Surface View ?
  2. Can I download Surface view extension as Java file ? (Is it open source ?)

Testing

  1. Use “Save Preview As File” then rotate it with Image Block in “SurfaceView.GotPreview”, then show it in Canvas.
    -> Failed: It`s look like the Image was rotated only Image block. Canvas was not updated.
  2. When I show image from “Surface.GotPreview”, Image was rotated 90 degree again. That’s mean the image was rotated 180 degree from original.
    myappvuzix.aia (16.6 KB) blocks
2 Likes

there is two methods to rotate a view.

  1. Use setRotation()(For all Views) method
    For more details -
    https://developer.android.com/reference/android/view/View.html#setRotation(float)

  2. Use Animation like this

    // Locate view
    ImageView diskView = (ImageView) findViewById(R.id.imageView3);

    // Create an animation instance
    Animation an = new RotateAnimation(0.0f, 360.0f, pivotX, pivotY);

    // Set the animation's parameters
    an.setDuration(10000);               // duration in ms
    an.setRepeatCount(0);                // -1 = infinite repeated
    an.setRepeatMode(Animation.REVERSE); // reverses each repeat
    an.setFillAfter(true);               // keep rotation after animation

    // Aply animation to image view
    diskView.setAnimation(an);

No, it is not open source. you can’t download it