bugGNU Octave - Bugs: bug #44385, image package: empty out range...

 
 

bug #44385: image package: empty out range does not use default value

Submitter:  Hartmut <hardy>
Submitted:  Fri 27 Feb 2015 07:35:52 PM UTC
   
 
Category:  Octave Package Severity:  3 - Normal
Priority:  5 - Normal Item Group:  Incorrect Result
Status:  Fixed Assigned to:  None
Originator Name:  Open/Closed:  * Closed
Release:  * other Operating System:  * Any
Fixed Release:  None Planned Release:  None
* Mandatory Fields

Add a New Comment Rich Markup
   

Sat 28 Feb 2015 06:41:49 PM UTC, comment #4: 

Thanks for this amazingly fast fix. It works for me :)

Hartmut <hardy>
Sat 28 Feb 2015 05:10:55 PM UTC, comment #3: 

Thank you for the report and fix. I have pushed the cset by Avinoam

http://hg.code.sf.net/p/octave/image/rev/9c932ea474dd

Carnë Draug <carandraug>
Group Member
Sat 28 Feb 2015 09:17:30 AM UTC, comment #2: 

changeset attached


(file #33208)

Avinoam Kalma <avinoam>
Group Member
Sat 28 Feb 2015 08:23:10 AM UTC, comment #1: 


Checking with debugger, it fails in line 143

     if( !isvector(in) || length(in)!=2 || !isvector(out) || length(out)!=2 || !isscalar(gamma) || (gamma<0) || (gamma==Inf) )

the conditions that are true are

!isvector(out)
length(out)!=2

because out is empty.
I think that the solution is to add the lines

  if (isempty (out))
    out=[0;1];               ## default out
  endif

after line 114


Avinoam Kalma <avinoam>
Group Member
Fri 27 Feb 2015 07:35:52 PM UTC, original submission:  

Here is a small script to show the behavior:


close, clear all;
I = [0 0.5; 0.3 1];
gamma = 3;
J = imadjust(I, [], [], gamma);


With Octave 3.8.2 and the image package in version 2.2.2 the last command results in an error message.

With Matlab this kind of easy gamma correction works fine, as you can see here for example: http://de.mathworks.com/help/images/contrast-adjustment.html

In the Octave help text of the function imadjust.n it is stated, that the second argument, as well as the third argument, default to [0 1] if not specified. But in this case this seems NOT to happen. The correct result as produced by

J = imadjust (I, [0 1], [0 1], gamma)

is not returned.

Further tests show, that the second argument of imadjust properly defaults to [0 1] if not given, but the third argument does NOT.

Hartmut <hardy>

 

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

Attach Files:
   
   
Comment:
   

Attached Files
file #33208:  imadjust.diff added by avinoam (705B - 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 avinoam (Posted a comment)
  • -email is unavailable- added by hardy (Submitted the item)
  •  

    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 group members can vote.

     

    Follow 5 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2015-02-28 carandraug StatusNone Fixed
        Open/ClosedOpen Closed
        Release3.8.2 other
        Summaryimage package: simple gamma correction with imadjust fails image package: empty out range does not use default value
    2015-02-28 avinoam Attached File- Added imadjust.diff, #33208

    Back to the top

    Powered by Savane 3.13-02a9.
    Corresponding source code