Vision API Android detect grid on image - android

I'm not sure where to start with this one, I have an image with a repeatable grid pattern and I am trying to detect and create a digital representation of that grid over the camera view.
If I have my rear camera preview hovering over this image, I would like it to detect gridlines and then overlay a digital redline of the grids. Similar to the face/barcode detection but a grid detector.
Any help in the right direction would be greatly appreciated.

Related

Limit detection area of MLKIT of barcode scanner

I am implementing a barcode scanner using MLKIT in my application (Kotlin). I need the barcode to be processed only when it is visible in a transparent rectangle in the center of the screen. as we see in the picture below.
PIC 1
Right now my App detects every barcode visible in the camera view as shown below. Is it possible to limit the detection area so the detection only reads from a rectangle in the middle of the screen?
Besides I would like to create a custom PreviewView for a barcode with cameraX, as shown in PIC 1. Thank you.
PIC 2
ML Kit doesn't support specifying interested area currently, so you have to either crop the preview image or filter out barcode results that not in the specified area. Similar question How do I make the camera focus only inside the rectangle and read the text inside the rectangle only in a flutter?

how to attach overlay to detected object using android and OpenCV

I'm writing an android app using OpenCV for my masters that will be something like a game. The main goal is to a detect a car in selected area. The "prize" will be triggered randomly while detecting cars. When the user will hit the proper car I want to display a 3D object overlay on the screen and attach it to the middle of the car and keep it there so when the user will change the angle of his view on the car, the object will also be seen from diffrent angle.
at the moment I have EVERYTHING beside attaching the object. I've created detection, I'm drawing the 3D overlay, I've created functions that allow me to rotate the camera etc. BUT I do not have any clue how can I attach the overlay to the specific point. Cause I don't have this I have no point to recalculate the renderer to change the overlay perspective.
Please, I really need some help, even a small idea will be fine:
How can I attach the overlay to the specific in real world
(Sorry, I couldn't comment. Need at least 50 points to do that ... :P )
I assume your image of the car is coming from a camera feed and you are drawing 3d car in opengl. If so, then you can try this:
You set the pixel format of the opengl layer as RGBA_8888, so that you can set the background of the opengl camera as a transparent color.
You take a relative layout as layout of your activity.
first you add the opencv camera layout to it as full height and width.
then you add opengl layer as full height and width.
you get the position of the real car from opencv layer as pixel value or something you did.
then scale it to your opengl parameters so that you can draw it on the right spot.
it worked for me. hope it works for you too.

move overlay image on camera preview

I want overlay an image in live camera preview using surface view. There are lot of tutorial in this case and my program run perfectly. Now i want add ability to move overlay image in live camera preview with touch event. I can't find any code or tutorial that explain that. Can somebody help me please?
if you do not use OpenGL and just float your overlay with opacity over surfaceView, you can set your own onDragListener() that handles android DragEvent( http://developer.android.com/reference/android/view/DragEvent.html) that can move the overlay detecting user's finger

Android Camera custom zoom anywhere on the camera view

Is there a way, in which I can select a focus area on the camera preview by touch gesture and zoom into that specific area?
The short answer is: yes, you can.
If your camera supports video resolution higher than the preview area, zoom in can show more details. Often, it's not the case, and zoomed in picture will not look good.

Android : adding transformed overlay on top of camera view

In my android project I want to add an overlay (which is simple image with text on it) on top of the camera view.
The overlay is not simple rectangle but it is transformed at each camera frame.
What I'm looking for is kind of like image below:
I'm getting camera frame with OpenCV library (CvCameraViewListener and CameraBridgeViewBase).
My question is what is the best and fastest way to do this?
How can I transformed the overlay at each frame in the way as figure above shows.
Any help and suggestion is appreciated.

Categories

Resources