Draw a rectangleBox on CameraX preview and capture only that area - android

I want to open the camera with a rectangle border over it. And capture only the rectangle area image. The rectangle border can resize as per the user's choice.
Tried with many SO link but still no answer.
Below is the SO link that I want to achieve.
Display a rectangular bounding box (overlay) on custom Camera2 API so only the image inside the box is captured

Related

how can i detect image in transparent image?

As you can see in the picture, a drawing has been made on a transparent canvas, I want to scan the line on the canvas I want to make in pixels and find out its location and size, how can I do this?
Click to see the picture

Draw frame while Screenshare to show captured content height width using media projection (webrtc)

I want to draw a rectangle to show that content inside rectangle will be captured and used as screenshare content. Somewhat like a red frame drawn on below picture. Screenshare is already implemented using media projection with webrtc.

Recognize text and draw a rectangle over text on camera preview

In Camera preview i want to detect text & draw a rectangle overlay on Paragraph/complete text similar to camScanner.
I have used opencv Library but in this i am able to detect object but not able to draw a border/rectangle over complete visible text. I have also used android-Camera2Basic.(https://github.com/googlearchive/android-Camera2Basic).
.

Display camera preview in a circle

I want to display a camera preview in a circular shape using the camera2 api. I want to display the preview in a circular shape, but I dont't want the image to be captured in a circular shape.
The captured image would be a face( later want to implement face detection and auto capture). I did have a look at few questions already asked, but none of them are with the new camera2 api's and most of them talk about having an overlay image cropped with a transparent circle. But this will not work in a case where I need to auto detect a face(as the face may appear out side the cropped circular image).
Is there any way I can implement this ? I did try an example with TextureView and set it to a LinearLayout with fixed width and height, but the preview appeared a bit squeezed and in a square shape.
I don't see why face detection matters here - if you enable the camera API's face detector, it'll run on the full image no matter what you do in drawing it inside a circle.
You can either use a circle overlay on top of a correctly-shaped TextureView or SurfaceView, or do your own OpenGL rendering of a circle with the camera preview as a EGL texture.
The latter you'll probably want a GLSurfaceView for the OpenGL drawing context, and a SurfaceTexture to send camera data to and expose it as a EGL texture.
JPEGs captured will still be full-FOV, and the camera API will know nothing about your circular preview drawing, so face detection and everything else will work on the full field of view.

Android camera preview with fixed bounding box

I want to take a picture of a rectangle shaped object. If the camera preview have a bounding rectangle i can take the picture by placing the object inside the bounding box. I need only that specified(inside the box) area of the image.Now I have developed a Camera App(Using Camera API Not INTENT) which can take pictures and store the pic like the inbuilt camera App.
How to draw a rectangle on the camera preview? and how to crop before saving?
I am using android 2.2
You have to add an camera overlay to achieve this. Take a look at the Samples at samples/ApiDemos/src/com/example/android/apis/graphics/CameraPreview. You can have your own layout over the preview area and add your graphic to it.
Check: http://android-er.blogspot.in/2010/12/add-overlay-on-camera-preview.html
and Android: Crop an Image after Taking it With Camera with a Fixed Aspect Ratio for more samples.

Categories

Resources