Code Monkey home page Code Monkey logo

Comments (3)

pvasa avatar pvasa commented on May 28, 2024

@petermolcany I was thinking of replacing the android.media.Image with a custom data class very similar to LegacyImage but for camera2 impl. Can you help me understand your overall use case and how do you currently use the Image output? Would it be more useful to instead have ByteArray output for preview frames with metadata like width, height, and rotation (maybe more)? What are your thoughts?

from cameraview-ex.

pmolcany avatar pmolcany commented on May 28, 2024

@pvasa I am using face recognition (draw overlay on preview) and simultaneous video recording. First, I need to convert preview frame to custom format to perform the detection. Library I am using requires the faces to be upright, sideways faces would not be detected. I need to know the camera sensor orientation to rotate the image and ensure faces are upright. Phone must be therefore held in portrait mode. (If person is lying on side I do not want the image to rotate due to device rotation)

Use case might be similar to one that is demonstrated in the sample. FirebaseVisionImage.fromMediaImage(image, 0).detectBarcodes() has hardcoded value of 0. If detection function was orientation dependent it would require a proper way of passing rotation. Or if preview overlay was required.

I think the cleanest solution might be extension of the API with a getter for cameraSensorOrientation

In cases where detection should be device orientation aware cameraSensorOrientation in combination with OrientationEventListener could be used.

In most cases exposing outputOrientation would be sufficient but for my case where I just need the camera sensor orientation, this is not sufficient.

from cameraview-ex.

pvasa avatar pvasa commented on May 28, 2024

Orientation can now be accessed as below from version 3.2.0

// Inside picture taken listener and preview frame listener
outputImage.exifInterface.rotationDegrees // 0, 90, 180, 270

See com.priyankvasa.android.cameraviewex.Image for more information

from cameraview-ex.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.