bugGNU Octave - Bugs: bug #57053, [octave forge] (image 2.10.0)...


bug #57053: [octave forge] (image 2.10.0) possible deconvwnr regression

Submitted by:  None
Submitted on:  Sun 13 Oct 2019 08:33:02 PM UTC  
Category:  Octave Forge Package Severity:  3 - Normal
Priority:  5 - Normal Item Group:  Regression
Status:  None Assigned to:  None
Originator Name:  jy bernier Originator Email:  -email is unavailable-
Open/Closed:  Open Release:  5.1.0
Operating System:  Mac OS

Add a New Comment (Rich Markup)

You are not logged in

Please log in, so followups can be emailed to you.


( Jump to the original submission)

Mon 21 Oct 2019 06:06:41 PM UTC, comment #6: 

Thank your for the feedback.

Then, let's CLOSE this issue.

Hartmut <hardy>
Mon 21 Oct 2019 09:05:23 AM UTC, comment #5: 

1/ Converting to double certainly does better.

2/ Vertical stripes go away when I add the "circular" option to imfilter

Revised example:

clear all;

I = imread("http://www.hlevkin.com/TestImages/cameraman.bmp");
I = im2double(I);

psf = fspecial ("motion", 30, 15);
blurred = imfilter (I, psf, "circular", "conv");

var_noise = 0.0005;
blurred_noisy = imnoise (blurred, "gaussian", 0, var_noise);

estimated_nsr = var_noise / (var(blurred_noisy(:)) - var_noise)
J = deconvwnr (blurred_noisy, psf, estimated_nsr);

figure; clf;

subplot(2,2,1); imshow (I);
title ("Original image");

subplot(2,2,2); imshow (blurred);
title ("Image with added motion blur");

subplot(2,2,3); imshow (blurred_noisy)
title ({"Image with motion blur", "and added Gaussian noise"});

subplot(2,2,4); imshow (J)
title ({"restored image after Wiener deconvolution",
           "with known PSF and estimated NSR"});

See picture "revised_example.jpg".

As for comparing the code i was using before and your implementation, here is a couple of identity test (convolve then deconvolve with same psf) for both gaussian and motion blur : wiener_compare.jpg

Your implementation is obviously superior with no artifacts.

So that's a yes for closing.


About deconvblind : yes I have one and forgot it was in user library. I'm not sure about the license.

Jean-Yves Bernier <jy_bernier>
Sun 20 Oct 2019 07:06:53 PM UTC, comment #4: 

I can fully agree with comment #3.

I tested the following:

  • Running the code from comment #0 in (Online-)Matlab just throws an error. Because Matlab's var function does not accept integer input arrays, Octave's var function does (maybe that is the only bug here...)
  • When I change the input image into class double by using "I=im2double(I)" in the second code line, then I get a reasonable result with Octave's deconvwnr (as suggested by Ricardo in comment #3).
  • When I use the same image, still converted to class double, in (Online-)Matlab, then I also get the same result as in Octave.

So if there are no objections I would tend to close this bug report as "works for me". (@Bernier: If you still see problems, please do not hesitate to still write them into this bug report, I'll respond.)

If you have a good (open source) implementation of deconvblind, then I would also be happy to receive it as a new function for the Octave image package.

Hartmut <hardy>
Sun 20 Oct 2019 06:06:31 PM UTC, comment #3: 


On the example using cameraman, although deconvwnr accepts images in uint8, the calculated nsr is grossly underestimated when calculated using the formula in the example from the image in uint8.

Set estimated_nsr=0.001; manually, and you will get acceptable results; or convert I to double just after reading it.

Btw, you mention "deconvblind working as expected" ... you mean have a version of deconvblind for octave? Have I missed that?

Ricardo S. Carmenes <rscarmenes>
Tue 15 Oct 2019 04:30:15 AM UTC, comment #2: 

Adding people to cc

Avinoam Kalma <avinoam>
Project Member
Mon 14 Oct 2019 10:50:05 AM UTC, comment #1: 

I am wrong labeling this a regression.
deconvwnr did not exits prior to 2.10.0

There was a different deconvwnr.m in my library path.
Examples attached.

Sun 13 Oct 2019 08:33:02 PM UTC, original submission:  

deconvwnr gives wrong result with image 2.10.0.
Scripts were ok with image 2.6.1 and earlier.

Steps to reproduce:

Copy example at
and change phantom to imread

 %I = phantom ();
I = imread("http://www.hlevkin.com/TestImages/cameraman.bmp");
figure, imshow (I);
title ("Original image");
psf = fspecial ("motion", 30, 15);
blurred = imfilter (I, psf, "conv");
figure, imshow (blurred);
title ("Image with added motion blur");
var_noise = 0.00005;
blurred_noisy = imnoise (blurred, "gaussian", 0, var_noise);
figure, imshow (blurred_noisy);
title ("Image with motion blur and added Gaussian noise");
estimated_nsr = var_noise / (var(blurred_noisy(:)) - var_noise);
J = deconvwnr (blurred_noisy, psf, estimated_nsr);
figure, imshow (J)
title ({"restored image after Wiener deconvolution",
           "with known PSF and estimated NSR"});

See attached file deconvwnr_broken.jpg for result.

MacOS X 10.9
octave 5.1.0
image 2.10.0
Macport installation

Note : deconvblind working as expected



(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:

Attached Files
file #47726:  revised_example.jpg added by jy_bernier (85KiB - image/jpeg)
file #47727:  wiener_compare.jpg added by jy_bernier (80KiB - image/jpeg)
file #47665:  octave_deconvwnr.jpg added by None (81KiB - image/jpeg)
file #47666:  library_deconvwnr.jpg added by None (63KiB - image/jpeg)
file #47663:  deconvwnr_broken.jpg added by None (266KiB - image/jpeg)


Depends on the following items: None found

Items that depend on this one: None found


Carbon-Copy List
  • -email is unavailable- added by jy_bernier (Updated the item)
  • -email is unavailable- added by hardy (Posted a comment)
  • -email is unavailable- added by rscarmenes (Posted a comment)
  • -email is unavailable- added by avinoam (Posted a comment)
  • -email is unavailable- added by avinoam
  • -email is unavailable- added by avinoam
  • -email is unavailable- added by None (Submitted the item)

    Do you think this task is very important?
    If so, you can add your encouragement to it.
    This task has 0 encouragements so far.

    Only project members can vote.




    Follow 7 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2019-10-21 jy_bernier Attached File- => Added revised_example.jpg, #47726
        Attached File- => Added wiener_compare.jpg, #47727
    2019-10-15 avinoam Carbon-Copy- => Added carandraug
        Carbon-Copy- => Added hardy
    2019-10-14 None Attached File- => Added octave_deconvwnr.jpg, #47665
        Attached File- => Added library_deconvwnr.jpg, #47666
    2019-10-13 None Attached File- => Added deconvwnr_broken.jpg, #47663

    Back to the top

    Powered by Savane 3.5