DanielV wrote:
> I've recently stumbled upon mathmap. I'm not really into mathematics
> and so I need some help. I've got a square map in the mercator
> projection which I ultimately want to transform into winkel tripel or
> robinson projection. I though mathmap might be a solution. But as a
> start I don't understand how the original mercator formulas
> http://mathworld.wolfram.com/MercatorProjection.html
> including latitudes and longitudes can be converted into this:
>
> filter mercator (image in)
> in(xy * xy:[ cos(pi/2*y + t*2*pi), 1])
> end
>
> [...] Could anyone point me in the right direction, or shed some light on
> the subject for me?
I don't know about the mathmap code you are talking about. I think it
may just be some demo code just intended to look like a Mercator map,
not necessarily be a real one. However, I wrote a mathmap filter to
convert fisheye images (from my Nikon equisolid angle 10.5 DX fisheye)
into panoramic Mercator projections. C.f.
http://groups.google.com/group/mathmap/browse_thread/thread/f5a2f60aa0bc7830
I don't use this filter anymore since I switched to a better one (look
for "Lambert conformal conic projection" in the list) that can output a
Mercator projection as a limit case.
Anyway, just to give an example, here is my old fish2mercator() filter:
----------------------------------------------------------------
filter fish2mercator(image in, float zoom: 0.7-1 (0.94))
f = 10.5/23.6*W;
long = x/f/zoom;
lat = atan(sinh(y/f/zoom));
xx = cos(lat) * sin(long);
yy = sin(lat);
phi = atan(yy, xx);
theta = asin(sqrt(xx*xx+yy*yy));
in(ra:[2*f*sin(theta/2), phi])
end
----------------------------------------------------------------
Here f is the lens' focal length converted to image units, long and lat
are the latitude and longitude, xx, yy and zz the cartesian coordinates
projected into the unit sphere (zz unused), theta and phi the spherical
coordinates relative to the optical axis, and 2*f*sin(theta/2) the
standard projection formula for an equisolid angle fisheye.
The formulas above that convert x and y into lat and long should look
familiar to you after lookin at the Wolfram site. Remember that you have
to go backwards: from the (x, y) coordinates on the final image, to the
coordinates on the initial image.
Hope this helps,
Edgar.
I have explained why the mapping needs to be "inverse" in this thread:
http://groups.google.com/group/mathmap/browse_thread/thread/e55d227544bc213c/0a1ff4a0b151b6e4
Mark