File Exchange Pick of the Week

Our best user submissions

This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English version of the page.

Two Amigos: The contest is over, and the results are in! 4

Posted by Brett Shoelson,

Contents

Recap

Last month, in the wake of Bob's departure from MathWorks, I challenged readers to alter our picture of the Three Amigos--Brett, Bob, and Jiro--to create a Bob-free image usable for this blog. That competition is officially over, and I would like to recap the entries.

Five Entries

We received official entries from five readers: Corey Hahn, Gajendra Katuwal, Igor, Richard Cotton, and Sean de Wolski (listed alphabetically by first name). Let's look the results of their submissions in turn :

Corey

Corey's code calculated in a series of lines the "extent" of Bob, and erased him line-by-line. Here's the image Corey's code produces:

Corey wrote that he first implemented this using point-by-point deletion, "but that took way too long." So he resubmitted using the line-by-line approach, with which he saw a significant speedup.

Gajendra

Gajendra came up with a clever approach to the problem only a week after his introduction to MATLAB(!). First, he cropped Bob column-by-column. But as we've seen, that leaves a portion of Bob's torso visible. However, Gajendra cleverly masked and filled in the torso region with a "tiled stamp" sampled from the background trees. His result is shown here:

Impressive, especially considering that Gajendra is a newbie!

Igor

Igor provided a late entry, basically cropping and concatenating the left and right halves of the image. He suggested that erasing Bob completely is impossible; that we cannot get rid of the hole (the "ice of separation") left by simply cropping out the middle of the image. He also postulated that fixing the resulting discontinuity (step) in the background is not possible. Here's Igor's image:

Richard

Richard took a different tack: he blurred the image in the rectangular region over Bob. The resulting image suggests that Bob is fading from our memory. Not so! Nonetheless, here is Richard's image:

Sean

Sean first did a crop-and-concatenation to eliminate most of Bob. But then he went further. Using his own "ShrinkWrap" helper function (you should consider sharing that on the File Exchange, Sean!), he created a binary map of large, bright objects, and manually determined which one corresponded to Bob's torso. With a neat bit of code, he replaced Bob's torso with a snip of trees. To hide some of the discontinuity lines, he then executed an overall median filter to slightly blur the image. Here is the result:

Prizes

I promised to award two prizes for this competition: "one for the person whose code results in the best usable Bob-free image, and one for the person with the most creative approach to solving the problem." I'm going to say that Sean wins the grand prize for best re-usable image. His approach, and his mastery of image processing, are impressive. Congratulations, Sean! For most creative approach, I like the tiled stamp method that Gajendra used to fill in the void left by deleting Bob's torso. (Richard's masking of Bob was creative, too, but didn't really result in a "Bob-free" image.) Congratulations, Gajendra! And what the heck: everyone who played will be receiving a small token of our appreciation! Thanks, guys, for making this competition fun and successful!

Brett's Solution on Steve's Image Processing Blog

My own solution is presented today as a guest post on Steve on Image Processing. Steve's blog, by the way, always makes for interesting reading, and is highly recommended for anyone interested in the topic. Subscribe via email here, of follow the blog as a feed by subscribing here.

Comments?


Get the MATLAB code

Published with MATLAB® 7.11

Note

Comments are closed.

4 CommentsOldest to Newest

gajendra jung replied on : 1 of 4
It was great experience to take part in this contest...I m very happy to come with the Best Creative Approach....There r 2 reasons behind my success...one is that...I m a newbie in MATLAB...so I just use simple approach...which was described as "clever approach"..hehehe...lol...and the other one is that ...the no.of participants was small...anyway...it has fuelled my interest on MATLAB
Brett replied on : 4 of 4
Hi Mero, Yes, seam carving makes good sense for this task. MATLABber Rafael Fernandes de Oliviera provided an entry to the Two Amigos competition based on that approach that unfortunately came in too late to be considered, or discussed, in the “Results” post. Nonetheless, it bears special mention. Rafael found his way to a File Exchange submission: https://www.mathworks.com/matlabcentral/fileexchange/16123-seam-carving-for-content-aware-image-resizing, by Aslak Grinsted, https://www.mathworks.com/matlabcentral/fileexchange/authors/7652 . The seam carving approach removes "low-energy" pixels along a calculated, not-necessarily-straight seam. It allows one to specify areas (or objects) that should be removed, and areas (or objects) that shouldn't be. It's fairly easy to use, and yielded remarkable results! Interested readers should take a look at these File Exchange submissions on the topic: https://www.mathworks.com/matlabcentral/fileexchange/?term=seam+carving on the topic, and at this video: http://www.youtube.com/watch?v=vIFCV2spKtg --truly stunning!