Get element's coordinate if having locator - robotframework

How do you get coordinate of the element if you have the locator? That means you can use appium-desktop to get the locator find coordinate by script. If I have A's coordinate because I can guess coordinate of many elements around of A which can't find the element or coordinate.

Appium has a method that allows you to retrieve the screen location of an element using its locator.
http://appium.io/docs/en/commands/element/attributes/location/

Related

Relation between entries in node and children in glTF 2.0

I'm writing a reader for glTF/GLB files in R. Reading through the spec at https://www.khronos.org/registry/glTF/specs/2.0/glTF-2.0.html, the relation between nodes and their children is unclear to me.
A node may have properties defining the transform (matrix, rotation, scale, translation). Do its children inherit this transform? If they specify their own transform, does it replace the parent one, or is it composed with it?
It also may have a camera spec. If the child has one as well, does it replace the parent one, or are they combined somehow?
The child node's transformation is always composed with the parent one. For example, if the parent had a +5 X translation, and the child had a 90deg Y rotation, the resulting child mesh would be positioned at +5 X with the rotated orientation.
Note that matrix is mutually exclusive with the other three (translation, rotation, scale), so a given node must not mix matrix with any of the other forms of transformation. However, a parent could use matrix with children that use the other 3 transforms, or vice versa.
Typically camera appears on a leaf node, although that's not required. If a parent and child both have camera objects, they are considered two separate cameras, although the child's camera will move when the parent is repositioned.
If you get glTF working in R, please let us know with an issue or PR for https://github.com/KhronosGroup/glTF-Project-Explorer, thanks!

Determining the position of a camera based on a trapezoid

I have a camera for which I know every parameter: field of view, etc... (I can basically construct it's frustum).
With that camera, I capture a trapezoid every frame like so:
My question would be, knowing these parameters, what would be the best way to determine the position and orientation of the camera?

Apply projective transformation on plane in 3D

Scenario
I have a 3D environment which contains a 3D scene and a '2D' scene.
The 3D scene contains a cube and a perspective camera.
The '2D' scene contains 4 round objects and an orthographic camera. These round objects can be moved around by the user therefor the orthographic camera is used otherwise the round objects can be moved 'in depth' (along z-axis) and could change in size and i want them to maintain size.
Depending on positioning the round objects, the corners of the cube in the 3D scene should be aligned with the positions of the round objects. And maintaining perspective.
Edit:
What i am trying to accomplish is: Based on an image of a room a user uses those round objects to define the dimensions of the room. Based on those dimensions a hidden cube is positioned to act as a boundery box. The next step would be to add 3d objects to the scene and maintaining perspective of the room.
I tried explaining this scenario in a picture:
Problems
Basically i have no clue where to start.
The round objects are in a '2D' environment because of the orthographic camera, therefor i have no depth value that i think i need.
I think i need some perspective transformation based on camera positions/settings? There are all sorts of matrices that could be produced but don't know how to implement them.
Sources i studied
http://www.graphicsmill.com/docs/gm/affine-and-projective-transformations.htm
below is a similar situation
https://math.stackexchange.com/questions/296794/finding-the-transform-matrix-from-4-projected-points-with-javascript
Cannot post more links because of my reputation
I hope someone can make this clear or point me in the right direction
Counting the real degrees of freedom, I would say that you don't have enough data. Imagine the projetive camera of the 3D scene as an actual pinhole camera. Then the image that camera creates on its film, sensor or whatever is described by at least 9 parameters:
3 parameters for the position of the camera in space,
2 parameters for the direction the camera is looking at and
1 parameter rotating the camera + sensor around their optical axis,
1 parameter determining the distance from pinhole to sensor and
2 parameters translating the sensor in its plane
On the other hand, knowing a projective transformation from one plane to another, e.g. using my answer to the question you already referenced, will only yield 8 geometrically meaningful parameters. So you cannot hope to reconstruct the camera position from that, so you cannot find the image of the 3D scene that would fit your markers. The Wikipedia article on 3D pose estimation writes that
Most implementations of POSIT only work on non-coplanar points (in other words, it won't work with flat objects or planes).[3]
That being said, you gave an example of where someone is actually doing this! So how do they do it? Honestly, I'm not sure, but they would have to make use of some additional knowledge or extra assumptions. For example, if they knew details about their camera (focal length, relative position between lens and sensor, or something like that), that could provide the required data. Since these apps tend to work on mobile devices, I think it rather likely that they might have either an API to request these things or a database where they can be looked up for the more common devices.
Judging from your question, you don't have that. Neither do you have all the vertical edges of the cube depicted vertically parallel to one another, which would have been another possible way to add more information. You have to come up with one more piece of information in order to allow for a hopefully unique solution.
Of course, without more information the system is just underspecified. It's not hard to find any transformation matrix which does what you requested. Actually the answer I references is placed in a setup where a 2D to 2D map is to be modeled using a 3D transformation matrix. You can do the same and be done with it. But your users might become frustrated, since the transformation they obtain might do completely wrong things to the out-of-plane direction, and there is no knob to tune that to the correct behavior.

Simulate turn by turn navigation in qml map component

Basically i made an osm based qml map . i am able to show route on it. Now i need to simulate a point or circle to move along route and whenever it takes a left or right turn a signal needs to be emitted . any pointer to relevant resources is highly appreciated .
Here's a possible approach in QtLocation 5.9:
define a fencing distance threshold to a maneuver.
define a distance threshold from the route.
Then build a QGeoPath using the coordinates from your MapRoute, and set the width of the path to be the second threshold above.
Then, at each gps change (maybe you can rate limit this a bit), you check 2 things:
distance between position and next maneuver less than maneuver threshold. If so, display the maneuver somehow, and then advance to next maneuver.
distance between position and the route (path.contains()). If you exceed this threshold, you may want to kick of another route calculation, because you ended up off route.

QGraphicsView: How to efficiently get the viewport coordinates of QGraphicsItems?

Is there a fast way to get the viewport coordinates of QGraphicsItems in a QGraphicsView? The only way I can think of is to call QGraphicsView::items(), and then QGraphicsItem::pos() followed by QGraphicsView::mapFromScene.
I must be missing something, though, because items are already converted to viewport coordinates to position them correctly on the QGraphicsView, so converting it to viewport coordinates again with mapFromScene seems inefficient--especially because in my case this is occurring often and for many items. Is there a more direct approach?
Probably not. A QGraphicScene can be rendered by more than one QGraphicsView simultaneously. It makes no sense to keep only one set of view port coordinates.
Also. All operation between QGraphicsItems are calculated in scene coordinate directly. Events from view port are convert to scene before processing. Working off view port which is only integer-based can also loose precision. A QGraphicsView is only a representation of the mathematical model of a scene. It's not the actual model.
Maybe you can ask a more specific question on what exactly you are trying to accomplish. There may be a better way to do it in scene coordinate.

Resources