• Subscribe

    Subscribe to This Week In Panospace by eMail.
    Subscribe in a reader
  • License

    Creative Commons License
    This work is © 2008-2012
    by Yuval Levy
    and licensed under a
    Creative Commons License.
  • Entries

    January 2019
    M T W T F S S
    « Dec    
  • Archives

MathMap-20090809 for Linux and Windows

Mark Probst just published a new version of MathMap. I am proud to have contributed the Windows installer.

MathMap for Windows

So you want to do perspective manipulations as shown on this video but you’re stuck with Windows? Now you can say thank you to Mark Probst.

Grab the latest GIMP for Windows installer. Install it (all into default locations).

I have prepared an installer of MathMap (v 1.3.4-alpha2). Grab it and install it. That’s it: start the GIMP and MathMap should be in the menu Filter -> Generic -> Mathmap. Have fun!

Note that Windows support is experimental and some functionalities may not work as they do in Linux. Also I am currently traveling and my notebook only has Ubuntu available. I produced this installer remotely and could not test it. For details, check the MathMap GoogleGroup.

PVsqueezed to be optically pleasant.

Upgrade: 9.04

Today I upgraded my last box to Ubuntu 9.04. It’s my test box and media player, an energy efficient Intel Atom motherboard in an old Mac Quadra box sitting next to a color calibrated 47″ LG LCD TV (the easy way to get an S-IPS flat panel without paying the Apple tax or playing the panel lottery). It was a pleasant surprise: previous versions had issues with the Logitech diNovo Edge keyboard, requiring me to unplug and re-plug the USB-Bluetooth dongle after booting. Now it works like a charm with Kubuntu.

After the glitches I experienced a year ago upgrading to 8.04 my share of time spent in Ubuntu has diminished considerably and for all practical purposes I skipped on 8.10. Kernel upgrades broke VMWare; driver upgrades broke my dual screen display configuration; Wine upgrades broke emulation of Photoshop/Windows. Nothing that can’t be fixed, but every minute spent maintaining the system is a minute of lost productivity. I needed remarkably little effort to keep Windows XP going on my workstation, despite repeated abuse such as booting it from within the VMWare environment.

With 9.04 the glitches seem to be a thing of the past, at least for now. I replaced VMWare with Virtualbox and it has withstood a kernel update, dual screen works like a charm. We’ll see how long I will last this time.

In the end, the choice of system is driven by the use made of it. And for most applications there are solutions on every major platform. I favor platform-agnostic software whose behavior is 80%+ consistent across systems: learn once, use everywhere.

For basic office work, email and web access, OpenOffice, Thunderbird and Firefox feel pretty much the same on Ubuntu and on Windows and are mature, production grade tools. Free software works, and in some cases it can even be the 800 pound gorilla in the pack.

So the choice of system boils down to the infamous “killer apps” – applications that are so desirable that they determine all other choices:

  • Photoshop is a killer app for me. Not because what it does is unique, but because I know it so well that I am now faster than on any image retouching application. I’ve tried to use the GIMP to produce the upcoming group photo for Libre Graphics Meeting and failed miserably. I spent hours trying to figure out how to do things that in Photoshop are instinctive to me. After wasting a weekend trying hard, I realized that the result is more important than the tool.
  • SONY Vegas Platinum has become a killer app for me in the past few months: I love my camcorder but the bundled software is useless. Looking for usable software to edit AVCHD videos (mostly home videos) I found that SONY Vegas Platinum had all I needed with an intuitive user interface and at a reasonable price tag. It’s cool to edit movies rather than fiddle with system libraries and other stuff to try to make something work. The downside is that it is available only for Windows. Bassam’s speech at LGM inspired me to try Blender. Blender’s user interface may seem intimidating at first, but dip the toe in the water and you’ll find that it is very consistent, well thought through, and connects efficiently the user with an extremely broad and complex set of functionalities. And, oh, it’s platform agnostic!
  • And so the killer app that got me onto Ubuntu again? MathMap. Although a Windows alpha version is out there, it is much easier to build and install on Ubuntu. And I was going to use the notebook for a presentation at LGM.

MathMap motivated me to refresh the Ubuntu installs on my workstation and on my notebook and to give myself another chance at trying to make the switch to Ubuntu. And on the server? FreeBSD rules!

LGM Day 3, Day 4, Follow Up

Days went by so quick, so here is a summary.

Day three was intense. The presentations were very interesting, particularly those of Andrew Mihal about Enblend-Enfuse and about GPU stitching. In the evening we had the conference supper, a very pleasant social event at which I learned from about Øyvind’s Now By Then installation and got a chance to purchase one of the last “Architecture Fiver“‘s  that Stani brought along for his talk. He also patiently gave me an insight into the thinking pattern of curators, lifting my morale from the previous day.

On day four I had a near-death experience. Since Tom Sharpless could not attend, I picked up his slide and hosted the talk. In the morning I prepared my notebook in dual display mode, so that on one display I can run the demonstrations of Panini, MathMap and Hugin, while on the other display I had my notes, which I kept editing until shortly before my talk. Without saving. Disaster strikes when I connect the notebook to the projector. My notebook’s native resolution is 1400×1050, too much for the projector to handle. Must restart X. Lose all presets and notes! I froze on the spot. Had to cut on a few gimmicks such as recording the talk with the catadioptric lens or shooting a stitched panorama during the talk (I made the move with the camera around the tripod, but had no available brain cycles to even think of setting the exposure or pressing the real button. I felt like a zombie and was disappointed at my performance which I felt was terrible, although a look at its recording comforted me: it was not that bad after all, even if I forgot to say half the things I wanted to say, the live demo and the interaction with the public were not that catastrophic.

The good news from day four was that Sébastien and Vincent debugged the flat display in extremis so that people walking out of for the lunch break passed by and could admire Guillaume’s stunning Boulevard Bancel (we’ll gladly admit that once this was on screen and working we pulled the cables on the slide show so that nothing can go wrong. Proper slide show the next time).

Since the cafeteria was closed on Sunday, we had to order pizzas for lunch, which was great as it inspired more exchanges before the last presentations. In the end, I even got the honor of shooting the official group picture, and to offer some of the present teams a panorama inside a panorama in the Cyclorama, while our team helped folding up the exhibit canvases.

After protracted good byes, I drove eastwards with Alexandre and Pablo. Alexandre only joined us for a tour of Québec-City. Pablo continued with us to Boréalie before I drove him back to Montréal for his flight on Wednseday. The rest of the week, and the weekend, I had to catch up with pent up business. Particularly the weekend was difficult, with a few difficulties upgrading servers remotely from FreeBSD 6.3 to FreeBSD 7.2 (the worse thing is that all manipulations worked well on the guinea-pig server in the office that is pretty much an exact mirror of the servers to be upgraded).

I still made time on Sunday evening for another quick hop to Montréal, and I am happy I did. Joergen Geerds was visiting for the weekend with his girlfriend. Interesting people.


Get Ready to MathMap

MathMap is the GIMP Plug-In used to mathematically transform images. It is particularly useful with panoramas. The following is a quick recipe to a working MathMap installation. It is for Ubuntu 9.04, but you can easily adapt it to any recent system. Start a terminal window and hack on the keyboard. No more skills required than basic reading and typing, promised!


To install GIMP in Ubuntu 9.04 is as simple as

sudo apt-get install gimp

However we need a recent version (>2.6.0) of GIMP, so if an older version is included in your distribution (e.g. 8.04 LTS), you’ll need to build GIMP from source. The following worked on my 8.04 LTS:

sudo apt-get build-dep gimp
mkdir src
cd src
wget ftp://ftp.gimp.org/pub/babl/0.0/babl-0.0.22.tar.bz2
tar -jxvf babl-0.0.22.tar.bz2
cd babl-0.0.22
sudo make install
sudo ldconfig
cd ..
cd src
wget ftp://ftp.gimp.org/pub/gegl/0.0/gegl-0.0.22.tar.bz2
tar -jxvf gegl-0.0.22.tar.bz2
cd gegl-0.0.22
sudo make install
sudo ldconfig
cd ..
wget ftp://ftp.gimp.org/pub/gimp/stable/gimp-2.6.6.tar.bz2
tar -jxvf gimp-2.6.6.tar.bz2
cd gimp-2.6.6
sudo make install
sudo ldconfig

This should replace your current (older) GIMP with a standard GIMP 2.6.6. If you want to keep multiple versions of GIMP side by side, or if you have other special needs, or if the above instructions do not work, you may want to look here for configuration options.


Now that we got GIMP working, it is time to get MathMap. Unfortunately it is not yet part of the Ubuntu distribution, so your computer will have to build it for you. Fortunately, it is a straightforward process. Just type:

sudo apt-get install clisp clisp-dev flex bison gsl-bin libgsl0-dev libgimp2.0-dev libgif-dev libjpeg62-dev libpng12-dev libgtksourceview-dev
wget http://www.complang.tuwien.ac.at/schani/mathmap/files/mathmap-1.3.4.tar.gz
tar xvf mathmap-1.3.4.tar.gz
cd mathmap-1.3.4/
sudo make install

You may have to edit the Makefile before executing make. I did not have to do that in Ubuntu.
You’re set. Have fun MathMapping! There is a whole flick group dedicated to it.

Update June 2011

A reader commented that the above instructions no longer work, so I tried again.  This is with Kubuntu 11.10 and a newer MathMap release.  Note the added and changed dependencies in the first line.  This time I did not build Gimp from source, the version delivered with Kubuntu 11.10 was good enough:

sudo apt-get install clisp clisp-dev flex bison gsl-bin libgsl0-dev libgimp2.0-dev libgif-dev libjpeg62-dev libpng12-dev libgtksourceview2.0-dev doxygen
wget http://www.complang.tuwien.ac.at/schani/mathmap/files/mathmap-1.3.5.tar.gz
tar xvf mathmap-1.3.5.tar.gz
cd mathmap-1.3.5/
sudo make install

Bend to Please


equirectangular 360°

Earlier this year I used the above full spherical panorama to test the new projections as they were added to libpano. You can view it from the inside here.

Those new projections devised by Tom, Bruno and Daniel, were not all. In his quest to satisfy our sense of what the world really looks like without being limited by the narrow field of view of the traditional rectilinear perspective, Tom Sharpless asked for permission to modify and use the image. A few weeks later he came up with a real WOW! He is currently working on implementing this and more into his Panini Perspective Tool.

Tom was meant to discuss his work at LGM but prior commitments and the lack of a teleporting facility makes it impossible for him to attend. We agreed that I will present his slides, and host a discussion on Panoramic Perspective Control. The main idea: use of panoramic photography techniques, coupled with computing, to achieve new images that break out of the physical boundaries set by traditional optics and appeal to the human sense of aesthetics.

As part of the talk, I’ll show how I followed into Tom’s footsteps and produced the image below.

PVsqueezed to be optically pleasant.


You will need

  • Tom’s Panini Perspective Tool, or if you want to do this in high resolution a recent (2009) version of Hugin.
  • A recent version of the GIMP. I had to build 2.6.x on my own box until Ubuntu 9.04 came along. Building the GIMP from code is not trivial but relatively well documented around the web.
  • A recent version of MathMap. Unfortunately MathMap is not yet packaged with Ubuntu. The 1.3.4 tarball will do. To my knowledge, nobody has got MathMap to work on Windows yet.
  • Tom’s PVSqueeze.mm script. Put it in the appropriate MathMap folder or copy&paste it into the “Expression” tab.

Process240° x 150° equirectangular pannini

  1. As so often, we start from an equirectangular image, the universal panorama format.
  2. Load the equirectangular in Hugin and extract an Equirectangular Pannini view of the area of interest. The flexibility of extracting an Equirectangular Pannini view is higher in Panini, but Panini’s resolution is limited by the video card’s memory. Hugin can do higher resolutions but has the disadvantage that the eye distance (horizontal compression) in libpano is fixed (patch, anyone?)
  3. Load the perspective into the GIMP.
  4. From the GIMP menu, open the Filter MathMap.
  5. Load the PVSqueeze filter.
  6. Click Preview to see the low-resolution live image.
  7. In MathMap’s User Values tab, adjust the values and see the live image morph until you like it.


From MathMap’s homepage: “MathMap is a GIMP plug-in which allows distortion of images specified in a simple programming language. For each pixel in the generated image, a script is evaluated which returns a color value. The script can either refer to a pixel in the source image or can generate colors completely independent of the source.” MathMap’s is a project of Mark Probst.


Using Tom’s PVSqueeze filter:

  1. Set the horizontal field of view (hfov) and eye distance (eyeDist) sliders roughly right for your input image.
  2. Adjust the vanishing point (VP) position (VPX, VPY), and the slopes of the 4 perspective edges (XXangl) so they line up with the appropriate edges in your image. There aren’t any drawn lines, but the change of image shape is pretty easy to see. Note you have to set the projection center Y identical to the VP Y by hand, or you get a black triangle in the middle (bug; but misaligning them can help you see just where the VP is).
  3. Adjust the shift modifiers for the upper and lower Vees to suit.  Basically these swing the pixel shift direction between straight up and down — which preserves verticals like chair legs — and radial with regard to the VP — which makes most floor patterns look nicer but also creates the curved diverging lines. The shift direction varies with vertical position, from vertical at the VP to radial farther out.  XVlim controls the vertical level at which this transition starts, and XTwid the width of the transition zone.  You can set them for pure vertical or pure radial shift, or some blend.
  4. Hit OK, review the full size result in the Gimp window; save or go back and adjust some more.


So we used some smart math and arbitrary parameters to bend a captured panoramic image to please our taste. In doing this, we connected back to the Renaissance tradition of perspective on a mathematical basis. The resulting high-resolution picture is currently being printed on canvas to be displayed at the Ultra Wide Views exhibition that opens May 6 in Montréal, Canada. At Libre Graphics Meeting I will show more detail and I hope we can discuss how to classify the different projection types and make them more accessible to graphic artists.