Wolfram Computation Meets Knowledge

Image Processing

Education & Academic

Serial Interface Control of Astronomical Telescopes

As an amateur astronomer, I'm always interested in ways to use Mathematica in my hobby. In earlier blog posts, I've written about how Mathematica can be used to process and improve images taken of planets and nebulae. However, I'd like to be able to control my astronomical hardware directly with the Wolfram Language. In particular, I've been curious about using the Wolfram Language as a way to drive my telescope mount, for the purpose of automating an observing session. There is precedent for this because some amateurs use their computerized telescopes to hunt down transient phenomena like supernovas. Software already exists for performing many of the tasks that astronomers engage in—locating objects, managing data, and performing image processing. However, it would be quite cool to automate all the different tasks associated with an observing session from one notebook. Mathematica is highly useful because it can perform many of these operations in a unified manner. For example, Mathematica incorporates a vast amount of useful astronomical data, including the celestial coordinates of hundreds of thousands of stars, nebula, galaxies, asteroids, and planets. In addition to this, Mathematica's image processing and data handling functionality are extremely useful when processing astronomical data.
Best of Blog

Extending Van Gogh’s Starry Night with Inpainting

Can computers learn to paint like Van Gogh? To some extent---definitely yes! For that, akin to human imitation artists, an algorithm should first be fed the original artists' creations, and then it will be able to generate a machine take on them. How well? Please judge for yourself. Second prize in the ZEISS photography competition Recently the Department of Engineering at the University of Cambridge announced the winners of the annual photography competition, "The Art of Engineering: Images from the Frontiers of Technology." The second prize went to Yarin Gal, a PhD student in the Machine Learning group, for his extrapolation of Van Gogh's painting Starry Night, shown above. Readers can view this and similar computer-extended images at Gal's website Extrapolated Art. An inpainting algorithm called PatchMatch was used to create the machine art, and in this post I will show how one can obtain similar effects using the Wolfram Language.
Computation & Analysis

Removing Haze from a Color Photo Image Using the Near Infrared with the Wolfram Language

For most of us, taking bad pictures is incredibly easy. Band-Aid or remedy, digital post-processing can involve altering the photographed scene itself. Say you're trekking through the mountains taking photos of the horizon, or you're walking down the street and catch a beautiful perspective of the city, or it's finally the right time to put the new, expensive phone camera to good use and capture the magic of this riverside... Just why do all the pictures look so bad? They're all foggy! It's not that you're a bad photographer---OK, maybe you are---but that you've stumbled on a characteristic problem in outdoor photography: haze. What is haze? Technically, haze is scattered light, photons bumped around by the molecules in the air and deprived of their original color, which they got by bouncing off the objects you are trying to see. The problem gets worse with distance: the more the light has to travel, the more it gets scattered around, and the more the scene takes that foggy appearance. What can we do? What can possibly help our poor photographer? Science, of course. Wolfram recently attended and sponsored the 2014 IEEE International Conference on Image Processing (ICIP), which ended October 30 in Paris. It was a good occasion to review the previous years' best papers at the conference, and we noticed an interesting take on the haze problem proposed by Chen Feng, Shaojie Zhuo, Xiaopeng Zhang, Liang Shen, and Sabine Süsstrunk [1]. Let's give their method a try and implement their "dehazing" algorithm. The core idea behind the paper is to leverage the different susceptibilities of the light being scattered, which depend on the wavelength of the light. Light with a larger wavelength, such as red light, is more likely to travel around the dust, the smog, and all the other particles present in the air than shorter wavelength colors, like green or blue. Therefore, the red channel in an image carries better information about the non-hazy content of the scene. But what if we could go even further? What prevents us from using the part of the spectrum slightly beyond the visible light? Nothing really---save for the fact we need an infrared camera. Provided we are well equipped, we can then use the four channels of data (near infrared, red, green, and blue) to estimate the haze color and distribution and proceed to remove it from our image.
Computation & Analysis

Solving the Knight’s Tour on and off the Chess Board

I first came across the knight's tour problem in the early '80s when a performer on the BBC's The Paul Daniels Magic Show demonstrated that he could find a route for a knight to visit every square on the chess board, once and only once, from a random start point chosen by the audience. Of course, the act was mostly showmanship, but it was a few years before I realized that he had simply memorized a closed (or reentrant) tour (one that ended back where he started), so whatever the audience chose, he could continue the same sequence from that point. In college a few years later, I spent some hours trying, and failing, to find any knight's tour, using pencil and paper in various systematic and haphazard ways. And for no particular reason, this memory came to me while I was driving to work today, along with the realization that the problem can be reduced to finding a Hamiltonian cycle—a closed path that visits every vertex—of the graph of possible knight moves. Something that is easy to do in Mathematica. Here is how.
Education & Academic

Fixing Bad Astrophotography II: Imaging Mars with Mathematica

The planet Mars comes into opposition, the point closest to the Earth, about every 780 days, or a bit over two years. The Martian opposition this year was on April 9. This past May, on a rare clear, warm night, I attempted to capture some images of the red planet. Unfortunately once I had my telescope set up, Mars had passed behind a large tree, so the images I captured were distorted by tree branches. Nevertheless, I did manage to capture a set of frames, and hoped that image processing with Mathematica could produce something usable.
Design & Visualization

SlideOScope and Wolfram Language Magically Transform Your Photos and Art

Donald Barnhart is a self-proclaimed mad optical scientist and independent business owner. He’s been developing optical design and analysis software in Mathematica since 1991, he’s the creator of the popular Optica software package, and he’s the developer of the first successful high-resolution holographic instrument that measures three-dimensional velocity fields in fluids. Now Barnhart has another invention to add to his list of accomplishments: a totally new kind of photo album called the SlideOScope.
Computation & Analysis

Even More Formulas… for Everything—From Filled Algebraic Curves to the Twitter Bird, the American Flag, Chocolate Easter Bunnies, and the Superman Solid

This blog post is the continuation of my last two posts (1, 2) about formulas for curves. So far, we have discussed how to make plane curves that are sketches of animals, faces, fictional characters, and more. In this post, we will discuss the constructions of some filled curves (laminae).
Best of Blog

Using Formulas… for Everything—From a Complex Analysis Class to Political Cartoons to Music Album Covers

In my last blog post, I discussed how to construct closed-form trigonometric formulas for sketches of people’s faces. Using similar techniques, Wolfram|Alpha has recently added a collection of hundreds of such closed-form curves for faces, shapes, animals, logos and signatures. In today’s post, I want to show some of the entertaining things one can do with these parametrized curves. Although these are just simple curves, a large variety of fun images (and animations) can be constructed from them. These can then be used, for example, in political cartoons, talk shows, posters, music album covers or just to spice up an advanced calculus or first-year theoretical mechanics class. I will first discuss the fun applications, and then the more mathematical ones.
Computation & Analysis

Random and Optimal Mathematica Walks on IMDb’s Top Films

Or: How I Learned to Watch the Best Movies in the Best Way I remember when I lived across the street from an art movie theater called Le Club, looking at the movie posters on my way back home was often enough to get me in the ticket line. The director or main actors would ring a bell, or a close friend had recommended the title. Sometimes the poster alone would be appealing enough to lure me in. Even today there are still occasions when I make decisions from limited visual information, like when flipping through movie kiosks, TV guides, or a stack of DVDs written in languages I can't read. So how can Mathematica help? We'll take a look at the top 250 movies rated on IMDb. Based on their posters and genres, how can one create a program that suggests which movies to see? What is the best way to see the most popular movies in sequence?