Wikipedia:Reference desk/Archives/Mathematics/2020 March 10

= March 10 =

Mapping
I have an engineering task to solve. It is not a homework assignment. I may not be able to formulate it strictly. I have a 2-sphere positioned in the center of Cartesian Coordinate System with the North Pole on vertical axis Z. The radius is 1.0. I also have a rectangle, unrelated to the sphere. The rectangle is real, it is a screen of a webcam, the sphere is virtual. The screen is filled with pixels. There are 320 pixels horizontally and 240 vertically, that is the ratio R = 1.33… I need to map this rectangle on the Northern hemisphere of the 2-sphere in such a way that the center of the rectangle will coincide with the North Pole of the 2-Sphere and all 4 corners of the rectangle would touch a parallel with the angular distance D from the equator. Using a geographic analogy, the parallel might be the lattitude of Cairo, the Capital of Egypt, or so on. I need a formula of mapping, a mathematical correspondence between two surfaces. If I get such a formula, I can use it in C++ programming in direct calculations with the webcam as input. I would appreciate any help.

Thank you AboutFace 22 (talk) 15:19, 10 March 2020 (UTC)


 * There are lots of possible projections, most of which would appear absolutely useless for you. Possibly you should describe some additional properties you need.
 * For example, should the chosen circle of latitude project to a circle on the screen or to the rectagular circumference of the screen?
 * How should distances along meridians behave – should they change linearly on the screen with the distance on the sphere?
 * Are any of gnomonic projections acceptable? For example, will an orthographic projection (a parallel projection from a sphere to a rectangle tangent at the North Pole) do? How about the stereographic projection (a central projection from the South Pole)?
 * CiaPan (talk) 15:43, 10 March 2020 (UTC)
 * Whoops, forgot to ping: --CiaPan (talk) 15:44, 10 March 2020 (UTC)

Thank you. The way I visualize it, the circle of latitude cannot project onto a circle on the screen. My understanding is that projection of the rectangle on the screen, if linear, will touch the circle of latitude only at four points which are corners of the rectangle, and the sides of the rectangle will lie close to the North Pole, although the elevation might not be significant. Could it be this way?

I need to think about other questions before answering. Thank you AboutFace 22 (talk) 18:10, 10 March 2020 (UTC)

Second question. Linearity of the projection is very desirable. It is a computer vision system. The stipulation is that the image on the sphere will be expanded in a series of Spherical Harmonics and rotational invariants computed. Nonlinear distortions are very undesirable. AboutFace 22 (talk) 18:16, 10 March 2020 (UTC)

Gnomonic projections are very interesting. They are almost an answer to my question. Thank you much. As long as they are linear, one of them perhaps could be chosen and implemented. It is nice to have a formula, however, a formula is almost a must. AboutFace 22 (talk) 18:23, 10 March 2020 (UTC)

Stereographic projection is not acceptable. This is why: "The projection is defined on the entire sphere," I must consider only half of the sphere, because I need to preserve an analogy with a human eye. Thank you, AboutFace 22 (talk) 18:27, 10 March 2020 (UTC)


 * Both the orthographic and the stereographic projection have the property that the ordering of distances from the pole is preserved. If P stands for the pole, and A and B are two points on the sphere that are in the domain of the projection, denoted by π(_), then d(P, A) ≤ d(P, B) iff d(π(P), π(A)) ≤ d(π(P), π(B)). Since the corners of the quadrilateral are extremal with respect to their distances from the pole, so are their images on the sphere under the inverse mapping π−1(_). They will lie on the same extremal circle of latitude, and no other points will. As to the second question, can you explain what you mean by "linearity of a projection"? A mapping from the 2-sphere to the 2-plane cannot be a linear map, because the 2-sphere does not admit of a module structure. --Lambiam 20:07, 10 March 2020 (UTC)


 * Given the required analogy with the human eye, you might consider the projection that a pinhole camera would give if the camera has the shape of a hollow sphere, and the rectangle is some distance away from the pinhole. This is actually isomorphic to the stereographic projection. In an idealized "pinhole eye", looking at an infinite screen in front of the eye, you'd see things on the screen that are arbitrarily far. They would also be arbitrarily small. --Lambiam 20:22, 10 March 2020 (UTC)

Thank you. It is important what you said. Then I have to back off. So, the whole projection is not linear then perhaps locally, around the North Pole it may be approximately linear. This is probably what happens in real human eye. I need to read your mathematical notations and think about them. Thank you, AboutFace 22 (talk) 20:26, 10 March 2020 (UTC)

If A,B,C,D are four corners of the rectangle (the screen of the webcam) it seems to follow from your explanation that lines AB, BC, CD, DA will not lie on the great circles of the sphere (or they will?) once projection is done, correct? I am reluctant to name the projection, perhaps it should be gnomic? Thank you, - AboutFace 22 (talk) 20:34, 10 March 2020 (UTC)


 * Above I should have said, "isomorphic to the inverse of the stereographic projection", because we want to go from the plane to the 2-sphere, and the stereographic projection goes the other way around. This projection is approximately linear anywhere because it is a diffeomorphism between metric spaces; it is, moreover, conformal: infinitesimal circles remain circles. I think the stereographic projection will probably serve you better than the gnom on ic projection. Whichever you use, the only lines that are mapped to great circles are the lines through the centre. And only circular arcs around the centre will have constant latitude in the image. You can see this in action in the first pair of images in the section Stereographic projection. --Lambiam 20:44, 10 March 2020 (UTC)

Thank you very much. I think I can even use the formula at the Stereographic projection page. It is something to study and implement. I appreciate your help. AboutFace 22 (talk) 02:07, 11 March 2020 (UTC)