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

 
 

bug #51976: [octave forge] (image) graythresh fails with values outside the [0 1] range

Submitted by:  Rafael Laboissiere <rlaboiss>
Submitted on:  Sun 10 Sep 2017 12:32:29 PM UTC  
 
Category: Octave Forge PackageSeverity: 3 - Normal
Priority: 5 - NormalItem Group: Incorrect Result
Status: FixedAssigned to: Carnë Draug <carandraug>
Originator Name: Open/Closed: Closed
Release: otherOperating System: Any

Add a New Comment(Rich Markup)
   

You are not logged in

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

 

Tue 12 Sep 2017 11:36:36 PM UTC, comment #3:

I have pushed this http://hg.code.sf.net/p/octave/image/rev/e94c46afdc96 which will mean that graythresh will now clip those values.

This has the unfortunate side effect of being backwards compatibility since graythresh was dependent on having values higher than 1 to distinguish between a vector image and an histogram. vector images are sometimes used to work around the input check of some functions that require 2d matrices. This was terrible design from my part, I should had made a separate function to handle histograms instead of trying to cram everything into graythresh.

This change went into the default branch.

Carnë Draug <carandraug>
Project MemberIn charge of this item.
Tue 12 Sep 2017 10:43:52 PM UTC, comment #2:

Thank you for the patch and the review.

However, the test where this happens checks if indeed pasisng a name for a threshold algorithm uses the same code path as calling graythresh directly (which should). So the real error is on graythresh, which is failing for values outside the [0 1].

Checking in Matlab R2010b, it seems that graythresh accepts values outside the [0 1] and just clips the values.

Carnë Draug <carandraug>
Project MemberIn charge of this item.
Mon 11 Sep 2017 11:26:08 AM UTC, comment #1:

Indeed, your patch fix the problem.

Change status to 'Patch Reviewed" and add people to CC.

Avinoam Kalma <avinoam>
Project Member
Sun 10 Sep 2017 12:32:29 PM UTC, original submission:

These two unit tests in im2bw.m fail randomly:

The reason is because, sometimes, the values in the matrix im are negative or greater than 1.0, what makes it a non-valid image.

The patch attached below fixes the problem.

Rafael Laboissiere <rlaboiss>

 

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

Attach File(s):
   
   
Comment:
   

Attached Files
file #41774:  im2bw-unit-test.patch added by rlaboiss (822B - text/x-patch)

 

Depends on the following items: None found

Items that depend on this one: None found

 

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

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

    Only project members can vote.

     

    Please enter the title of George Orwell's famous dystopian book (it's a date):

     

     

    Follow 9 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Tue 12 Sep 2017 11:36:43 PM UTCcarandraugOpen/ClosedOpen=>Closed
    Tue 12 Sep 2017 11:36:36 PM UTCcarandraugStatusConfirmed=>Fixed
    Tue 12 Sep 2017 10:43:52 PM UTCcarandraugStatusPatch Reviewed=>Confirmed
      Summary[octave forge] (image) Unit tests for im2bw fail randomly=>[octave forge] (image) graythresh fails with values outside the [0 1] range
    Mon 11 Sep 2017 11:26:08 AM UTCavinoamStatusNone=>Patch Reviewed
      Assigned toNone=>carandraug
      Carbon-Copy-=>Added -unavailable-
      Carbon-Copy-=>Added -unavailable-
    Sun 10 Sep 2017 12:32:29 PM UTCrlaboissAttached File-=>Added im2bw-unit-test.patch, #41774

    Back to the top


    Powered by Savane 3.1-cleanup1