On 06 Feb 2012, Luis Argerich wrote:
> I have a photo of the full moon in very large resolution that I took with a
> telescope and I would like to know if there's a way to present it in a
> different way.
> What I would like to do is to map the border of the circle (moon) to a straight
> line to show the peaks, craters and mountains the lunar edge as a panoramic image.
>
> In other words convert the perimeter of a circle into a straight line.
One of the easiest ways to map a circle into a straight line is to use
the complex logarithm. This function maps the unit circle into the line
x = 0. If you then multiply by i, you get an horizontal line (y = 0)
instead, with the inside of the moon below (y < O) and the sky above. A
benefit of the logarithm over other possible mappings is that it is a
conformal transformation, which means that the shapes of small objects
(craters...) are preserved. Conformality is good if you want remapped
images to look somewhat natural.
Now, since you have to write the mapping backwards, from the output
image pixel coordinates to the input image coordinates, you need to
write the reverse mapping, something like:
input_coords = exp(-i * output_coords)
with the proper scaling of both input and output coordinates to fit the
useful range of the images. For scaling the output, you have to choose
how much of the moon border you want to see in the image width. 2*pi is
the full border, but you may want to map slightly more than this, in
order to have some overlap and make sure that a crater that is cut by
(say) the left border is visible in full on the right side. For scaling
the input coordinates, you just need the moon edge to be mapped to the
unit circle.
I let you do the coding as an exercise (actually, I don't have MathMap
available nor the time to code right now). It should not be too
difficult, as MathMap knows about complex numbers, and it's exp()
function works as expected on complex arguments.
Regards,
Edgar.
Send me a link to a low-res version of your image and I'll take a
crack at it for you.
Regards,
Tom
--
-- Tom Rathborne ----------------------------- Independent Science Architect --
The real voyage of discovery consists not in seeking new lands,
but in seeing with new eyes.
-- Marcel Proust
It's almost that, except that it's “filter” instead of “function”. ;-)
I don't know whether Tom sent you some script or not, but here is my
try
at it:
*** The script:
filter moon2panorama(
image in,
bool center_help (0),
float center_x: -20-20 (0),
float center_y: -20-20 (0),
float span: 270-450 (360),
float shift_x: -200-200 (0),
float shift_y: -200-200 (0)
)
scaled = ri:[x, y/(1+9*center_help)]/W*span;
shifted = (scaled - ri:[shift_x, shift_y])*pi/180;
remapped = I*exp(-I*shifted);
centered = (remapped*0.8+ri:[center_x, center_y]/100)*min(X, Y);
if center_help && abs(y/Y) < 0.01 then
rgbColor(1, 1, 0)
else
in(xy:[centered[0], centered[1]])
end
end
*** The manual:
1.- Horizontally resize the canvas to make room for the panoramic view
- menu: Image / Canvas Size...
- disconnect Width from Height (small chain)
- set a comfortable width, around 3.5 times the Moon's diameter
- click on Center, then Resize
Ideally, I would like the Moon's perimeter to be rendered at the
same resolution as in the original image. Then I would set the
canvas width to pi*moon_diameter_in_px*span/360, where span is the
horizontal span (in degrees) of the panorama you want to make. You
probably want to have a span of more than 360 deg in order to get
some overlap of the ends.
2.- Resize the working layer to the canvas size
- first make sure the selected background color in the toolbox is
black
- menu: Layer / Layer to Image Size
3.- Load the above code in MathMap
- menu: Filters / Generic / MathMap / MathMap
- paste the code into the Expression tab
- click on the Preview button
- click on the User Values tab to bring up the controls
4.- If the horizon is wavy, fix it with the center_* controls
- vertically center the horizon with the shift_y control
- check center_help: this will amplify the vertical variations
and give you a reference horizontal line
- use center_x and center_y to remove the waviness
- uncheck center_help when done
This waviness comes from the fact that the Moon was not perfectly
centered in the original image. If it was centered, then you don't
need this step. You will get a more accurate (but slower)
correction
if you uncheck Fast Preview in the Settings tab. If some residual
waviness persists, it's probably due to the Moon not being
perfectly
round (or perfectly full).
5.- Tune to taste
- the span slider controls how much of the Moon perimeter you will
have in the panorama, in degrees.
- shift_x controls what is in the center of the panorama. By
default
(when set to 0 degrees) it will be whatever was at the top of the
original image.
- shift_y controls the ratio of land/sky in the image. Beware that
only the area close to the limb will be rendered with adequate
resolution, features far from the limb have to be upscaled and
will show degraded resolution.
6.- Click on OK, crop as needed and enjoy
Hope this helps you get a nice panorama,
Edgar.
Yes, sure!
> 2) Can I have your full name to credit you if I put a photo somewhere
> with this used? (If you don't want just let me know)
Edgar Bonet. You may link to edgar-bonet.org, but you don't need to.
Regards,
Edgar.
--
You received this message because you are subscribed to the Google Groups "MathMap" group.To post to this group, send email to mat...@googlegroups.com.
To unsubscribe from this group, send email to mathmap+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/mathmap?hl=en.