I've tested the source (I've adapted to opencv) and it works perfect.
Answers on your questions:
1.Yes kernel size in this case is 3.
2.In the source on your link convolution is applied to image region reduced by half kernel side on each side.
Image size is equal to your souce image (all green and blue areas).
But your work area is less than whole image and marked green.
It reduced relative to source image by half kernel size (blue border).
3.No, you have not.
It seems that you have appled box filter with kernel size larger than 3.
Here is my results:
Blurred image (box filter 3x3):
Deblurred image:
You can download my source here: https://www.dropbox.com/s/u11qo8o3q1a8j5f/stochastic_deconvolution_opencv.zip
You'll get ringing on high frequency (hard edges) when using large kernels.
It can be reduced by increasing regularization coefficient (it will add some "flattnes" to image).
Here is my result for kernel from initial source:
Blurred image:
Deblurred image:
Try for your image parameters:
const double reg_weight = 0.0002; // regularizer weight
const double sigma = 9.0; // mutation standard deviation
const double reset_prob = 0.005f; // russian roulette chain reset probability
const int num_iterations = 400; // number of 'iterations', mostly for output
double ed = 0.025; // starting deposition energy
For PSF:
const int psf_cnt = 9;
const double psf_v[] = { 1.0/9.0, 1.0/9.0, 1.0/9.0, 1.0/9.0, 1.0/9.0, 1.0/9.0, 1.0/9.0, 1.0/9.0, 1.0/9.0 };
const int psf_x[] = { -4, -3, -2, -1, 0, 1, 2, 3, 4 };
const int psf_y[] = { -4, -3, -2, -1, 0, 1, 2, 3, 4 };
I've got the result as I post below: