I'm working with Android Mobile SDK. How can I set Tilt value for default current position indicator (green circle), so when user change tilt for entire map (by doing two fingers swipe), position indicator follows as well.
Or (if it can't be done with default marker), how can I achive it with custom marker resource)? // I can illustrate it by following screens. On second image circle stays the same, instead of transformed into isometric view itself.
You probably want to use a 3d object model and create a LocalMesh + MapLocalModel Object to display it in 3d.
Either create a flat rectangle and alter the pitch / yaw / roll according to the camera which may look awkward or use a 3d mesh and to follow the camera pitch / yaw /roll to make it look like there is depth to the object.
Related
I was inspired by Pokemon GO and wanted to make a simple prototype for learning purposes. I am a total beginner in image processing.
I did a little research on the subject. Here is what I came up with. In order to place any 3D model in the real world, I must know the orientation. Say if I am placing a cube on a table:
1) I need to know the angles $\theta$, $\phi$ and $\alpha$ where $\theta$ is the rotation along the global UP vector, $\phi$ is the rotation along the camera's FORWARD vector and $\alpha$ is rotation along camera's RIGHT vector.
2) Then I have to multiply these three rotation matrices with the object's transform using these Euler angles.
3) The object's position would be at the center point of the surface for protyping.
4) I can find the distance of the surface using android's camera's inbuilt distance estimation using focal length. Then I can scale the object accordingly.
Is there any more straight forward way to do this using OpenCV or am I going in the right track?
It's a simple question, but I could not find the information online.
In Street Level, ARController can be used to achieve downwards representation. This is the so called CAMERA view.
My question is: How can I make the map view pitched downwards in MAP View (not in CAMERA view)? The view should be from up to down with an angle around the x-axis.
Thanks for your help.
To set the tilt (pitch) of the Map you can use the Map#setTilt(float) method.
There are also compound operations available for changing the state of the Map such as Map#setCenter(PointF newCenter, Animation animation, double zoomLevel,float orientation, float tilt)
The StreetLevel (i.e. StreetView) feature is controlled using the StreetLevelModel object. To change the pitch of a StreetLevel scene, use the StreetLevelModel#setPitch(float) function.
When using the LiveSight (Augmented Reality) feature, by default the Map state is controlled automatically using device sensor information. In this case, tilt (pitch) will be adjusted automatically. To disable the default behaviour and allow calls to Map#setTilt() to work, call ARController#DownViewParams#setAutoPitchEnabled(false, false)
see also: HERE Maps Android Developer Guide
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'm very new to using GL, so please, bear with me!
I have a plane with a cube resting on top of it. I have 3 SeekBars in the Activity which allow the user to rotate along the x and z axis (aka tilt and rotate), and one to "zoom-in" (aka translate on z-axis). What I'd like to do is allow the user to go into a "bird's-eye view" of the plane and drag their finger along to place a "marker" which will just be a semi-transparent circle.
When the player releases their finger, I'd like the marker to stay where the user has left it. Now, I'd like to be able to rotate the 3D scene and see that the marker is not just a flat circle, but almost like a spotlight - it interacts with other objects (ie the cube).
How would this be done? Do I need to look into something like lighting?
Look into projective texturing.
Whats the best way to create a dart board game on Android. Is it possible to determine where a dart hit and in which area it is using a canvas or do I need to use a diffenrent approach?
Edit
Sorry I dont think I have explained my problem very well.
In svg in html5 I can create a dart board using shapes and assign an id to each shape. When a dart lands on a shape the code knows which shape it has landed on, gets its id and calculates the score. e.g id="20" id="60" id="40" for all 20 areas on a dart board.
How would I do this on the Android?
You've got the right idea. A simple approach would be to display a custom DartBoardView in an activity. The view would use an overridden onDraw to draw a dart board image and any darts the user has "thrown." The view would then use View.onTouchEvent to handle user touch events and translate those into new darts.
New answer based on your update:
You're going to have to do the hit detection manually. A touch event will give you an x-y coordinate with the upper left of the view as origin. Calculating points would go as follows:
Offset the given coords so they line up with the center of your board (i.e. touching the middle of your board would give (100, 150), translate that to (0,0)).
Get the angle of the touch to find which numbered section of the board was hit. Something like double touchAngle = Math.atan2(y,x). Might need to convert from radians to degrees here.
Map the angle to a base point value (if angle > 9 && angle < 27, base points = 7)
Multiply the base point value by 2 or 3 if the distance of the touch (distance = Math.sqrt(x^2 + y^2)) from center is a particular length away to account for the multiplier rings.