octave-patch-tracker
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Octave-patch-tracker] [patch #9365] image package: new function deconvw


From: Hartmut
Subject: [Octave-patch-tracker] [patch #9365] image package: new function deconvwnr.m
Date: Wed, 31 May 2017 16:20:52 -0400 (EDT)
User-agent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:53.0) Gecko/20100101 Firefox/53.0

Follow-up Comment #2, patch #9365 (project octave):

Yes, I was aware of patch #8571, but I haven't had a close look at it before.
Now I have looked at the deconvWiener function there:

* Their default value for K is 500, mine (and Matlab's) is 0. But 0 gives
nearly allways useless results.

* I haven't compared theirs and mine input checking...

* Their core algorithm is:

Fpsf = fft2 (padpsf);
Fimage = fft2 (padimage);

f = ifft2 (Fimage.*conj (Fpsf)./(k+(Fpsf.*conj (Fpsf))));
f = fftshift (real (f));


* my core algorithm is:

## (Variables names in capital letters are ment in Fourier space.)
##   IM_OUT = [ conj(PSF) /  ( |PSF|^ 2 + K )  ] * IM

PSF = psf2otf (psf, size (im)); 
PSF_abs_sq = PSF .* conj (PSF);
K(K==0) = eps;            # make sure the denominator is non-zero (PSF_abs_sq
is non-negative)
FILTER = conj(PSF) ./ (PSF_abs_sq + K );
im_out = ifftn (FILTER .* fftn (im));
im_out = real (im_out);


* So the core algorithm is IDENTICAL. Which is no wonder, we both took it from
the Gonzalez-Woods book, that is mentioned in the Matlab help. They do a bit
more padding and fftshift-ing around. I do some more avoiding to divide by
zero.

* I have tested my function to be Matlab compatible. At least for the given
test cases. I don't know how Matlab compatible their's is. But they are
probably not doing too bad in this respect.

* I've already built in Nd image support.

* My tests are properly included in the function code as %!test lines. But my
test data are just some dumb number arrays. Not very instructive to read. But
making sure the code will still properly work in a couple of years.

* They have a nice test image included, it's also an instructive demo. I'd
like to include some more test images into Octave somewhere, as well (as
brought to the maintainers mailinglist by Avinoam lately.) But currently I do
not know how to include nice test images into a contributed Octave function.

In this case (just one hand full of code lines for the core algorithm), it was
easier for me to do a fresh implementation of deconvwnr, than trying to adapt
other people's code.

Mercurial note: Carnë , does it increase your workload if I create new
"branches" for each new function in my own bitbucket repo in the future? This
repo is really only for this only purpose of making reviewing easier. I think
this "commit with bookmark" feature is just not implemented in my
TortoiseHG...


    _______________________________________________________

Reply to this item at:

  <http://savannah.gnu.org/patch/?9365>

_______________________________________________
  Message sent via/by Savannah
  http://savannah.gnu.org/




reply via email to

[Prev in Thread] Current Thread [Next in Thread]