Subscribe to WolfCoder's Kawaii Column        RSS Feed
-----

Laplacian Pyramids of Pictures

Icon Leave Comment
Here's a classic topic that comes up whenever one talks about doing things with digital images. These aren't picture wavelets, but it's a way to take apart an image into different frequencies without destroying the picture. Let's take a picture of Cirno-tan^^

Posted Image

Notice how her dimensions are powers of two. This is important when building the pyramid.

Building one of these is simple, you need to create two methods.

One will blur the image so that each pixel has information from up to two pixels away (use a Gaussian kernel: 0.05, 0.25, 0.4, 0.25, 0.05). Then you take every second pixel so the image is half it's size.

Then you need another method that doubles an image's size, and blurs it in the same way.

So we take the above picture, shrink it and then expand it. You'd imagine the picture was damaged, right? It wouldn't look right. We can take the original picture and subtract this new, damaged picture and get what's called a Laplacian of a difference of Gaussians.. We recorded how the image changed.

Posted Image

The image has lots of gray since gray is actually the value 0. This image is signed, dark parts are negative and light parts are positive. Notice how the edges are highlighted, the Laplacian can also be used to find edges of any particular size.

Then we take the original image, shrink it and repeat. We keep going until the image is a 4x4 pixel image and can't really be divided further:

Posted Image

Posted Image

Posted Image

Posted Image

And the smallest picture of all is the original image shrunken many times, chibi-Cirno~!

Posted Image

It's kind of hard to see, but we have this pyramid with the smallest picture on top. The reason this method was significant is that you have information at all half-resolutions and we can actually put the image back together without damage.

Let's take the microscopic thumbnail and expand it so that it matches the Laplacian image right under it. Here's an enlarged comparison of the two:

Image / Laplacian
Posted Image Posted Image

If we add the Laplacian on the right back (which is the error), we actually get the original picture at a size twice as large as the one below it:

Posted Image

We can just repeat this and the image comes back! The damage is so tiny that when you convert it back into 0-255 integer values, it's indistinguishable. The damage actually comes from the computer's typical loss of resolution when dealing with floating point numbers.

Posted Image

Posted Image

Posted Image

Posted Image

And it looks just like it did at this final step:

Posted Image

Perhaps you can write a program that does this, and if you do, try modifying the Laplacians at each step in different ways to see what happens to the image.

0 Comments On This Entry

 

May 2013

S M T W T F S
      1234
567891011
12131415161718
192021222324 25
262728293031 

Find New MMORPG Games!

Recent Comments

Information


The following permissions for anything that is my original creation are given. Anything known as an 'object' or 'my works' in this notice refers to anything that I have created and therefore have intellectual ownership of, but nothing that is not my original creation even if permission is given to me to post it to this blog. Any computer programs I have written (especially video games) belong under my intellectual ownership.

Program code, algorithms, protocols, or any other computer source code is licensed under the GPL. See bottom of notice.

Ownership
Some 'objects' do not require you to give credit to me, however, in no circumstances do you have permission to claim any of 'my works' for your own. Only the specific rights granted in each case will apply. Any rights granted can only be applied you, and anyone else who adheres to this notice.

Credit
When giving me credit, please cite your source using a link back to the original material. If my work is used in a computer program, place this information in your readme file.

Images
Images of 'my works' such as screen shots, graphics, or any sort of 2-dimensional image (still or moving) can be used as long as you do not gain any profit. This includes direct and indirect profit, such as access fees to resources such as a download fee. You may not, however, use the images if you do not give me credit. If you are granted use of such images, their use is not limited, even in things such as broadcasts and own computer programs, but remember it is important that you give me credit for using them.

Redistribution
Content posted in this log in the form of computer programs that I release can be freely redistributed and re-transmitted in any form as long as the content is unmodified in any way, and you do not claim any ownership of the content. You may not modify the content to inject malicious programming code or your own data, doing so will be a violation of this notice, but you may make additions and modifications using any source code I provide that are not malicious as long as it is clear which parts of the computer program were originally created by myself and which parts of the program are modified and added. Content that is redistributed must be freely available without any charge. If there are any contradictions with this paragraph statement and the Gnu General Public Licence, the GPL has priority and will apply instead of the conflicting statement in this paragraph.

You may post any of my tutorials on your website (this means a copy of the original material) as long as you include a link to the original tutorial on Dream.In.Code and you give credit to me as the author. Giving credit to a "WolfCoder" is sufficient as the link back to Dream.In.Code is also sufficient. Both the link and credit are required and important. If the link to Dream.In.Code and credit to me as the author are given, you may also include the copy of the tutorial in any other form as long as no profit, directly or indirectly (such as download fees, registration fees, or similar methods of profit) are gained. However, either me or Dream.In.Code reserves the right to deny this permission of tutorial redistribution for any reason.

Warranty
Use any of my original works at your own risk. Both myself and Dream.In.Code are not liable for any damages resulting from your use of my computer programs, even from the use of heavily-tested programs. The software and source code is provided as-is, along with any 3rd party source code modifications.


The computer programs and software are subject to the GNU General Public License unless otherwise stated. Please read carefully the GPL if you are not familiar with it at: http://www.gnu.org/copyleft/gpl.html


Comments
If you have any concerns, questions, or disputes of this notice, please contact me. This notice may change without warning.

Copyright © 2005-2010
Updated August 2010