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.
Related
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.
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
I am trying to create and android application that allows the user to draw a circle or other shape on a video feed to highlight a region of interest. Is it possible to draw directly on the video view or even overlay a canvas on top of the video view? I am using Eclipse.
Maybe you could start from creating some bitmap (transparent background) over the video and draw on it? Another idea is to create transparent fragment, it will be probably easier to do and you will have more control over it.
Please search here:
How do you create a transparent demo screen for an Android app?
So, I'm trying to create a Augmented reality app on android (client/server).
My question is if i can overlay images and text boxes over the camera in real time or only if i have the capture to display it on the screen and add the extra information
If the first version can be implemented can someone help me with some starting code or links with suggestions
I did something similar for one of my apps,
And the way i did it is by placing an empty View on top of camera surfaceView using FrameLayout, then used onDraw method in the View class, to play with canvas and put anything i wanted on top of the camera view, you can practically do everything with Canvas, and since literally your view is overlaying the camera surfaceView, will do exactly the trick you are trying to accomplish here...
Regards!
in my application I want to have a frame (with a hole in the middle) and an image under it. I want to be able to drag and zoom the image to fit (the face in the picture) it in the frame. Then Crop the image (could I find the pixel x,y that are in the border of the screen?) and then save the zoomed image so that I can put the frame over it then.
Any suggestions? If possible please tell me the classes I will have to use.
Thanks!!
It is possible to do all the functionalities (What you have discussed above) using Android View class with onDraw method and canvas Object.
Refer the link:
http://developer.android.com/reference/android/graphics/Canvas.html