Image sampling

Discussion related to the implementation of new features & algorithms to the Core Engine.

Moderators: jromang, tomb, zcott, coordinators

Image sampling

Postby kephrenz » Wed May 28, 2008 1:49 pm

Hi,

Lastweek I was doing some experimets on monte-carlo and variance reduction techniques. Importance sampling especially.

I did come up with an idea, so I have tried ( this could have been done before of course )

So what I did was,

1) I got an image, greyscaled it (intensitiy value), then i took a kernel size of NxN,
2) then for every pixel on the image I calculated the variance in kernel (where pixel is in the middle) and put that value on pixel.
3) Then I have normalized the image bu dividing the sum of all pixels. Now I have a normalized space, that looks like a 2D, discrete, probability density function
4) I have calculated marginal along -x- side, and calculated the marginal. Then cumulative sum. Voila. I have a distribution function.
5) I took uniform random numbers and sampled from the dist function find place on -x-.
6) I took the x,x+1 columns of image, and summed them, and divided by sum. This is the conditional probablity function. Then the same operation on 5, and took I found the -y- position.

I wrote a matlab code, and tested it, I have the results below.

test_image.jpg
Test Image

variance_image.jpg
Variance Image

sampled_image.jpg
Sampled Image



I haven't did any research for it yet. But I could get more samples where frequencies seem higher.

Ahmet,
User avatar
kephrenz
 
Posts: 13
Joined: Thu May 22, 2008 6:47 am

Re: Image sampling

Postby jeanphi » Wed May 28, 2008 3:52 pm

Hi,

I seem to remember this is how the infinitesample light works (using the intensity instead of the variance of course), or using a similar scheme.

Jeanphi
jeanphi
Developer
 
Posts: 6573
Joined: Mon Jan 14, 2008 7:21 am

Re: Image sampling

Postby Radiance » Thu May 29, 2008 8:51 am

Hey,

i moved this post to 'architecture and design' as there's usually all discussion regarding algorithms etc...

on a side note, karlvb has already provided some interesting information regarding these techniques (including interesting papers),
i've asked him to comment here too :)

greetz,
radiance
User avatar
Radiance
 
Posts: 3968
Joined: Wed Sep 19, 2007 2:13 am

Re: Image sampling

Postby Karl vom Berge » Thu May 29, 2008 8:58 am

I'm very happy there is growing interest in the forum regarding variance reduction techniques such as important sampling.

I thnink we should go in the direction of adaptive sampling combined with a perceptual framework: this could vastly improve rendertimes.

See my post in this thread for more technical info:http://www.luxrender.net/forum/viewtopic.php?f=8&t=451#p3037

But adaptive sampling can also introduce bias, if not implemented carefully, see my post in this thread: http://www.luxrender.net/forum/viewtopic.php?f=8&t=692#p5195

Karl
Last edited by Karl vom Berge on Thu May 29, 2008 9:42 am, edited 2 times in total.
User avatar
Karl vom Berge
 
Posts: 81
Joined: Mon Jan 14, 2008 7:11 am
Location: Antwerp, Belgium

Re: Image sampling

Postby jeanphi » Thu May 29, 2008 9:09 am

Hi,

As noticed with the usevariance feature of the MLT sampler, a minimum sampling probability should be ensured so that the coverage of the image plane is not too slow. In order to go further, the Film class should have a new method to return a given pixel intensity and number of samples so that samplers could compute a proper estimate of the variance for the value to be added.

Jeanphi
jeanphi
Developer
 
Posts: 6573
Joined: Mon Jan 14, 2008 7:21 am

Re: Image sampling

Postby Karl vom Berge » Thu May 29, 2008 9:54 am

kephrenz wrote:I haven't did any research for it yet. But I could get more samples where frequencies seem higher.


Actually this is not always what you want. A human will notice less noise on a high frequent texture than on a smooth low frequent texture. So during rendering, you can allow for more noise, or variance (or less computation time) in areas that have e.g. high frequent textures.

An example is the persian mat in the examples in the paper of Mahesh Ramasubramanian.

Page 8 in the paper, fig 7 (d) visualizes the sample density that was used to compute the image. You clearly see that less samples are used on highfrequent areas than on smooth regions, especially shadowed regions.

I included these images for convenience.

persian_reference.png
Persian mat scene computed using path tracing, reference image.

persian_sample_density.png
Persian mat scene sample density used in the perceptual adaptive sampler.

persian_adaptive.png
Persian mat scene computed using path tracing with the perceptual adaptive sampler, using only 5%-10% of the samples that where used in the reference image: huge speed increase!


Karl
User avatar
Karl vom Berge
 
Posts: 81
Joined: Mon Jan 14, 2008 7:11 am
Location: Antwerp, Belgium

Re: Image sampling

Postby kephrenz » Thu May 29, 2008 12:27 pm

Hi,

I am researching BRDF, global illumination ( infinite lights in this condition ). First I thought this example to be used in multiple importance sampling (MIS) of BRDF and global light. In the MIS you try to find a good probability densitiy function (pdf) for brdf and the image. But my example forgets about the intensity, where there could be variance but colors may be darker. As in this cat example.

But I would try some variances of this only using this, intensitiy added, multiplied, or some other operation. ( Just to see I am wrong :) )

Thanks for the papers and interest.

Ahmet,
User avatar
kephrenz
 
Posts: 13
Joined: Thu May 22, 2008 6:47 am

Re: Image sampling

Postby Karl vom Berge » Fri May 30, 2008 8:44 am

kephrenz wrote:I am researching BRDF, global illumination ( infinite lights in this condition )


I though you where thinking in the direction of adaptive sampling using the variance, so that's why I added my comments. Any ideas are of course useful!

Specific techniques must always be used depending on the signal that you want to sample.

Ameth, this technique that have source code included could also be useful to experiment with, when you are interested in Importance sampling:
http://www.iro.umontreal.ca/~ostrom/ImportanceSampling/

The above technique is not very efficient in generating large amounts of well distributed points with constant density. For doing this, look at this paper:

http://www.cs.virginia.edu/~gfx/pubs/antimony/

Importance sampling is however not easy in this last technique.

Karl
Last edited by Karl vom Berge on Sat May 31, 2008 8:56 am, edited 1 time in total.
User avatar
Karl vom Berge
 
Posts: 81
Joined: Mon Jan 14, 2008 7:11 am
Location: Antwerp, Belgium

Re: Image sampling

Postby kephrenz » Fri May 30, 2008 9:44 am

Hi,

I haven't seen those papers before. I am on my way , downloaded and ready to dig :)

Thanks Karl,

Ahmet
User avatar
kephrenz
 
Posts: 13
Joined: Thu May 22, 2008 6:47 am


Return to Architecture & Design

Who is online

Users browsing this forum: No registered users and 1 guest