bugGNU Octave - Bugs: bug #43846, image: imresize does not accept...

 
 

bug #43846: image: imresize does not accept floating point outside the [0 1] range

Submitter:  Avinoam Kalma <avinoam>
Submitted:  Thu 18 Dec 2014 02:54:45 PM UTC
   
 
Category:  Octave Package Severity:  3 - Normal
Priority:  5 - Normal Item Group:  Matlab Compatibility
Status:  Fixed Assigned to:  None
Originator Name:  Avinoam Open/Closed:  * Closed
Release:  * other Operating System:  * Any
Fixed Release:  None Planned Release:  None
* Mandatory Fields

Add a New Comment Rich Markup
   

Jump to the original submission

Thu 12 Nov 2015 04:39:22 PM UTC, comment #6: 

I have pushed

http://hg.code.sf.net/p/octave/image/rev/17ed4752a081

Instead of a local isrgb and isgray, I just dropped those functions.  This not only adds support for values outside the [0 1] range, it also allows the image to have any number of dimensions (although the function that actually performs the resize simple loops over each plane).

Carnë Draug <carandraug>
Group Member
Wed 11 Nov 2015 05:18:20 PM UTC, comment #5: 

I've been bitten by this bug as well, any problems with the suggested patch?

Matthew Berginski <mbergins>
Fri 23 Jan 2015 03:09:13 PM UTC, comment #4: 

Can you review the submitted patch?

Avinoam Kalma <avinoam>
Group Member
Sun 21 Dec 2014 08:20:20 PM UTC, comment #3: 

Hi,

In order to fix this problem, isgray should be changed im imresize.
Changing isgray outside resize would cause problems in Matlab compatibility, so I have changed isgray to local_isgray, and in local_isgray
I have removed the is_double_image condition.

Please review the follwoing patch.

attached: imresize.diff & imresize.m

Thanks,

Avinoam


(file #32699, file #32700)

Avinoam Kalma <avinoam>
Group Member
Fri 19 Dec 2014 10:03:40 PM UTC, comment #2: 

Hi,

Thanks,
I will check which of the tests should be remove,
and try to provide a patch.

Avinoam

Avinoam Kalma <avinoam>
Group Member
Thu 18 Dec 2014 07:25:33 PM UTC, comment #1: 

The problem is not the negative values, the problem are values outside the range [0 1].

The function uses isrgb() and isgray() (two functions which were part of Matlab but removed recently) to check for valid input. Those functions return false if input is floating point but there is a value outside the [0 1] range (seems Matlab is dropping this but those were not valid images before).

Can you provide a patch that fixes this and adds tests for this situation?

  http://www.gnu.org/software/octave/doc/interpreter/Basics-of-Generating-a-Changeset.html#Basics-of-Generating-a-Changeset

Just replace the URL for the repository with the one for the image package, the rest of the instructions are the same.

I think you will need to remove the check but please make sure there's no assumption anywhere else that values are on that range.

Carnë Draug <carandraug>
Group Member
Thu 18 Dec 2014 02:54:45 PM UTC, original submission:  


Hi,


In = ones(6,6);
In(3,3) = -1;
Out = imresize (In, 2);
error: imresize: IM must be a grayscale or RGB image.
error: called from:
error:   C:\Octave\Octave-3.8.2\share\octave\packages\image-2.2.2\imresize.m at line 66, column 5

while Matlab computes the result of imresize.

Thanks,

Avinoam

Avinoam Kalma <avinoam>
Group Member

 

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

Attach Files:
   
   
Comment:
   

Attached Files
file #32699:  imresize.diff added by avinoam (2KiB - application/octet-stream)
file #32700:  imresize.m added by avinoam (13KiB - 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 mbergins (Posted a comment)
  • -email is unavailable- added by avinoam (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 6 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2015-11-12 carandraug StatusNone Fixed
        Open/ClosedOpen Closed
        Release3.8.2 other
    2014-12-21 avinoam Attached File- Added imresize.diff, #32699
        Attached File- Added imresize.m, #32700
    2014-12-18 carandraug Summaryimresize does not work with negative images image: imresize does not accept floating point outside the [0 1] range

    Back to the top

    Powered by Savane 3.13-3230.
    Corresponding source code