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.
I haven't did any research for it yet. But I could get more samples where frequencies seem higher.