Tuesday, January 24, 2012

Red Rose in 3D

Today, we will see how to produce 3D images from normal images.

There are many ways to create  3D images. One of the ancient ways is to shift the colors in the images and used differently colored pair of glasses.

Today I bought a two dollar pair of 3D glasses from Indiglo's childrens' section.
The left glass is red and the right is blue, which means that we have to shift the red channel to the right by a few pixels depending on how far you are sitting from your computer. Can you generate this 5 lines of code in Matlab?

Here is the image that works for my glasses, enjoy:
(You will not see the rose in 3D using the 3D movie glasses where the 3D is obtained using differently polarized light, which I can not do on a computer screen.)

Red rose in 3D
Three 3 is most effective if we have two objects, out of which one is more close to you. In these cases one segments the objects which are closer and apply 3d shift in these objects alone.

Here is an example:

Stars in 3D

Stars in 2D




Sunday, January 22, 2012

Gamma correction: seeing in the darkness!

Here is an example where we can see what is hidden in the background of a picture. The gamma correction in its basic form is: $u=f^{\gamma}$.

The following is an illustration where I used a picture I took in Washington DC, the picture of the World War II memorial, with a $\gamma=0.5$ I got the trees in the background.

Original picture of the world war II memorial

Gamma corrected image with $\gamma=0.5$

Tuesday, December 27, 2011

Wine & Cheese visited again

A while back we talked about the jpeg artifacts in an image give to me by my good friend Justin Lau. Apparently, my solution did not please him very much. So, I am revisiting the poster again. Here is the output I got with my new algorithm. I will revisit the algorithm again as I know Justin's objections in advance.

The code that generated the following output is up for auction. (Minimum bid is $2500)

Meanwhile, I will keep thinking about how to approach the quality of the poster obtained in pdf format.


Output of my new algorithm that corrects jpeg artifacts



Compare the above result to the original image below ...

The original image with severe jpeg artifacts.

Thursday, December 22, 2011

Automatic makeup!

Today, I will post results of my new algorithm called 'automatic make up'.
Below is the original image and the image produced by my automatic make up algorithm.
Original image

Automatic make up!

Saturday, December 10, 2011

Nordstrom

Anisosotropic diffusion may be awesome, but as we have seen, we don't know where to stop. Nordstrom an electrical engineer showed (1992) that if by adding f-u on the right hand of the Perona Malik equation makes its steady state non-trivial. Below is the steady state that was reached at t=1.05.

Non-trivial steady state

Difference between the original and the steady state of Norstrom eq.

Sunday, December 4, 2011

Anisotropic diffusion is awesome

We know that the heat equation diffuses an image isotropically. This is not good, because it destroys the edges too.  Somehow one must find a way for isotropic diffusion, only in a flat region and stop the diffusion near the edges. This is the motivation for Peitro Perona and Jitendra Malik's original formulation of anisotropic diffusion.

The heat equation is $\frac{\partial u}{\partial t}=\Delta u$ i.e. $\frac{\partial u}{\partial t}=\mbox{div}\,(\nabla u)$ with $u(0)=f$.

The idea behind the anisotropic diffusion is to multiply the gradient by a function g that equals 1 when the $\nabla u=0$ i.e. flat regions and goes to 0 as the gradient increases, i.e. near the edges. A typical function that works is $g(x)=\frac{1}{1+(x/b)^2}$. for some constant $b$.

That is $\frac{\partial u}{\partial t}= \mbox{div}\,(g(\Vert\nabla u \Vert^2) \nabla u)$.

Alternatively, this can also be viewed as the gradient descent for the minimization of the energy
$$E(u):=\frac{1}{2}\int_{\Omega} g(\Vert\nabla u\Vert^2).$$
Let us look at some experiments, now.


Here is an experiment with Perona Malik model with b=0.01, at t=4.



Perona Malik at t=4.


There is hardly any loss of visual quality of the image. Compare it to the original below. Notice there is some loss of quality in her hair.



The original




Let us see what happens as we continue to t=10 below. Ok, the image is a bit too smooth, rather artistic.



Perona Malik at t=10


Comparison with heat equation



Compare these results with the heat equation at t=4 below. Very smooth, edges are lost. Not good.



Heat equation at t=4.

Thursday, December 1, 2011

Holiday wine & cheese event is fun

Today, my dear friend Justin Lau, showed me a jpeg poster that he complained was not very good.Of course ! It produces strange artifacts. Below is the poster he showed me:


Original poster

Here is the detail of the artifact:

Details of the artifact





So, I asked him if I could try to correct the image. And this is what I got with the parameters: 0.01, 6 and 8 in my new algorithm, which is also for auction ($1000 minimum bid).


Details of the artifact removal algorithm




Complete poster corrected ... sort of see this post also!