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

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

[Octave-bug-tracker] [bug #54974] [octave forge] (image) incompatible re


From: Hartmut
Subject: [Octave-bug-tracker] [bug #54974] [octave forge] (image) incompatible results of entropy.m
Date: Thu, 8 Nov 2018 17:11:11 -0500 (EST)
User-agent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:63.0) Gecko/20100101 Firefox/63.0

Follow-up Comment #6, bug #54974 (project octave):

This was a good idea to imcast float images to uint8, it made our function
Matlab compatible for all the float images I tested :)

Here is a new patch file (V2). It:
* uses im2uint8 on all input images except for logicals (as Matlab claims to
do)
* uses imhist instead of hist, because Matlab does it (according to its help
page)
* it removes the zero elements in the histogram p properly. (I double checked
the previous code line "P += (P == 0);". It puts a 1 at all 0 positions, which
excludes those histogram bins from the entropy calculation because log2(1)=0.
But the resulting histogram p cannot easily be normalized to a sum of 1
afterwards, because there are all those surplus 1s in it.)
* it normalizes the histogram p to a sum of 1 (this is how I understand the
word "normalized histogram counts" in the Matlab help page. And it works
fine.)
* it adds a bunch of Matlab compatible tests with float images.

Any comments on this new patch? Do you any objections to push this patch?

(file #45388)
    _______________________________________________________

Additional Item Attachment:

File name: entropy_compatibility_V2.patch Size:2 KB


    _______________________________________________________

Reply to this item at:

  <https://savannah.gnu.org/bugs/?54974>

_______________________________________________
  Message sent via Savannah
  https://savannah.gnu.org/




reply via email to

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