patchGNU Octave - Patches: patch #9235, image package: improve filtering...

 
 

patch #9235: image package: improve filtering functions (stdfilt, entropyfilt) and add tests (also medfilt2, ordfilt2, rangefilt)

Submitter:  Hartmut <hardy>
Submitted:  Mon 23 Jan 2017 08:01:44 PM UTC
   
 
Category:  Forge : other Priority:  5 - Normal
Status:  Done Privacy:  Public
Assigned to:  None Open/Closed:  Closed
* Mandatory Fields

Add a New Comment Rich Markup
   

Jump to the original submission

Tue 04 Dec 2018 05:38:46 AM UTC, comment #6: 

looks fine.
pushe http://hg.code.sf.net/p/octave/image/rev/00782f025725
closing this issue.

Avinoam Kalma <avinoam>
Group Member
Thu 22 Nov 2018 09:01:42 PM UTC, comment #5: 

I have prepared a patch (V4) that includes the following changes to entropyfilt.m

  • the remaining tests (Sorry, I tried hard but did not always succed to express the expected results analytically.)
  • some additional tests with uint8 and uint16 inputs (also sometimes with truncated floats, because I didn't suceed to express it otherwise.)
  • a change to the input type conversion. It now uses im2uint8 instead of the gray value stretching that was used before. This gives different results now. And this was necessary to get Matlab compatible results for the above test cases. (This compatibility change was also done to entropy.m recently.)
  • no note in the NEWS file, because it is already there.


The tests are all Matlab compatible, and eventually they all pass :)

Please REVIEW the patch (V4) and let me know if there is something to change before we can push it and close this issue.

(file #45512)

Hartmut <hardy>
Tue 06 Nov 2018 08:31:38 PM UTC, comment #4: 

Tests for rangefilt & stdfilt were pushed:
http://hg.code.sf.net/p/octave/image/rev/c686e5a75576

entropyfilt will wait to the resolution of bug #54974

Avinoam Kalma <avinoam>
Group Member
Mon 05 Nov 2018 10:26:36 PM UTC, comment #3: 

Sorry, there was a typo in my last patch file, here is a new one (V3).

(file #45364)

Hartmut <hardy>
Mon 05 Nov 2018 10:08:35 PM UTC, comment #2: 

Here is a new patch file (V2) with

  • Matlab compatible and passing tests for STDFILT, now avoiding truncated floating point numbers
  • Matlab compatible and passing tests for RANGEFILT, also without trunctated floats now
  • Matlab compatible but mostly failing tests for ENTROPYFILT. These tests still have truncated floats in them, because I don't have a clue yet how Matlab gets those observed results.


In my opinion those additional tests could now be pushed, and this issue then be closed.

Should we open a new bug report for the mostly wrong results of entropyfilt? This bug might also concern entropy.m because I couldn't reproduce the Matlab results using this function either.


(file #45363)

Hartmut <hardy>
Wed 10 Oct 2018 12:53:49 PM UTC, comment #1: 

The patch adds tests for the functions and fixes the call to spatial_filtering

The fix for the call of spatial_filtering was incorrect.  S is a height for each comparison and so needs to have the same dimensions as the DOMAIN and not the image.  I fixed that with http://hg.code.sf.net/p/octave/image/rev/aecc2d33b0a6

About the tests, I have pushed the ones for ordfilt2 and medfilt2 since those are exact. The others were not but could be. For example, the test for stdfilt could actually be using the expected values instead of rounded to the default matlab display. Like so:


C = [1 1 1; 2 2 2; 3 3 3];
C_out = repmat ([std([1 1 1 1 1 1 2 2 2])
                 std([1 1 1 2 2 2 3 3 3])
                 std([2 2 2 3 3 3 3 3 3])], [1 3]);


So the only missing thing here is to adapt the tests for entropyfilt, rangedilt, and stdfilt to actually compute the expected values.

Carnë Draug <carandraug>
Group Member
Mon 23 Jan 2017 08:01:44 PM UTC, original submission:  

This patch came out of the work on bug #45088. It improves the results of all the filtering functions of the image package and adds Matlab compatible tests to them.

Currently the results of stdfilt.m are not Matlab compatible, this is fixed by this patch. The results of entropyfilt.m are currently also not Matlab compatible, this is improved in some sense by this patch. But mostly this patch adds new tests, that's why I put it into the patch tracker, I hope this is fine.

The patch fixes the call to _spatial_filtering_.cc (as described in bug #45088) in

  • entropyfilt.m
  • stdfilt.m



It additionally adds Matlab compatible tests to

  • entropyfilt.m: tests fail. But they also fails without the fix. This is still an improvement since we now use _spatial_filterin_.cc as it is intended. See details in bug #45088.
  • medfilt2.m: tests pass
  • ordfilt2.m: tests pass
  • rangefilt.m: tests pass
  • stdfilt.m: tests pass


This patch is ment to be applied AFTER the patch from bug #45088 (file #39535). Because that patch fixes the call to _spatial_filtering_.cc in rangefilt.m.

Hartmut <hardy>

 

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

Attach Files:
   
   
Comment:
   

 

Depends on the following items: None found

Items that depend on this one: None found

 

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

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only logged-in users can vote.

     

    Follow 9 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2018-12-04 avinoam StatusIn Progress Done
        Open/ClosedOpen Closed
    2018-11-22 hardy Attached File- Added new_tests_typeconversion_entropyfilt_V4.patch, #45512
    2018-11-06 avinoam StatusNone In Progress
    2018-11-05 hardy Attached File- Added new_tests_for_filtering_functions_V3.patch, #45364
    2018-11-05 hardy Attached File- Added new_tests_for_filtering_functions_V2.patch, #45363
    2017-01-23 hardy Attached File- Added fix_filtering_functions_V1.patch, #39544
        Carbon-Copy- Added avinoam
        Carbon-Copy- Added carandraug

    Back to the top

    Powered by Savane 3.13-cf05.
    Corresponding source code