patchGNU Octave - Patches: patch #9360, image package: new function...


patch #9360: image package: new function otsuthresh.m

Submitted by:  Avinoam Kalma <avinoam>
Submitted on:  Thu 25 May 2017 05:32:59 PM UTC  
Category:  Forge : new function Priority:  5 - Normal
Status:  None Privacy:  Public
Assigned to:  None Open/Closed:  Open

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)

Tue 06 Jun 2017 09:00:33 PM UTC, comment #6:

Matlab otsuthresh can get a column or a raw vector, but not
a matrix.

Attached a better version, with more tests.
All the tests will pass, after fixing two bugs in graythresh, see bug #45333.

There is still a "divide by zero" warning. It can be fixed
also in graythresh.

(file #40868)

Avinoam Kalma <avinoam>
Project Member
Mon 05 Jun 2017 11:04:44 AM UTC, comment #5:

Could you also confirm whether Matlab requires a column or array vector? And what happens if you pass a matrix? Would be nice to pass a matrix, one histogram per column, and get back an array of threshold values. This would allow to threshold an array of images in one go.

Carnë Draug <carandraug>
Project Member
Sun 04 Jun 2017 04:44:08 PM UTC, comment #4:

Thanks for reviewing.
I will add more test, as you suggested.

Avinoam Kalma <avinoam>
Project Member
Sun 04 Jun 2017 11:54:35 AM UTC, comment #3:

I have made some changes to it:

When it comes to tests, since the point of this function is to use on processed histograms and to control the number of bins, can you use histograms that are not already used in the graythresh? Things like histograms with 10 bins, all bins with a value of zero, an histogram of length 0 and one, an histogram with values of class integer, an histogram with an Inf, etc?

At the moment, Octave comes with penny.mat which could be used for testing purposes and is very unlikely to change.

Carnë Draug <carandraug>
Project Member
Sat 27 May 2017 07:22:13 AM UTC, comment #2:

Thanks for reviewing, Hartmut.

A few answers:

  • I will check Matlab results on the test images
  • I have copied the demo from your demo in wiener2 ....
  • Indeed we need more images in Octave for tests and demos. I raise this issue in the maintainers list and quoted you.
Avinoam Kalma <avinoam>
Project Member
Fri 26 May 2017 04:56:19 PM UTC, comment #1:

Thanks for your contribution!

I've had a look at this new function:

  • This is a wrapper around the already existing functionality of Otsu's threshhold in Octave's graythresh function. So any wrong output values wouldn't be due to this new otsuthresh function anyways. But it would still be nice to have the outputs Matlab compatible. I have not checked the results of the included tests in Matlab, have you? Do they give the same results in Matlab?
  • The included tests all pass.
  • Nice demo included :)

(general remark: It would help to have some simple image files distributed along with the image package. Those could be used for tests and demos more easily. Or are there already some of those, in addition to phantom.m, that I just don't know of?)

I would like to see this new function added to the image package. (To keep up with Matlab changes, this was only introduced in R2016a...)

Hartmut <hardy>
Thu 25 May 2017 05:32:59 PM UTC, original submission:

Implementing otsuthresh using graythresh.

Please review.

Avinoam Kalma <avinoam>
Project Member


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

Attach Files:

Attached Files
file #40868:  otsuthresh.m added by avinoam (5KiB - application/octet-stream)
file #40790:  otsuthresh.m added by avinoam (11KiB - application/octet-stream)


Depends on the following items: None found

Items that depend on this one: None found


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

    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 logged-in users can vote.




    Follow 4 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2017-06-06 avinoam Attached File- => Added otsuthresh.m, #40868
    2017-05-25 avinoam Attached File- => Added otsuthresh.m, #40790
        Carbon-Copy- => Added -email is unavailable-
        Carbon-Copy- => Added -email is unavailable-

    Back to the top

    Powered by Savane 3.3