bugGNU Octave - Bugs: bug #53309, [octave forge] (image) imrotate of...


bug #53309: [octave forge] (image) imrotate of +/-90 degrees results in black image when 'crop' and RGB image as input

Submitted by:  Tis Veugen <tis>
Submitted on:  Fri 09 Mar 2018 03:08:17 PM UTC  
Category:  Octave Forge 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:  Microsoft Windows

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 15 May 2018 06:16:37 AM UTC, comment #6:

Thank you for the debugging and fix.

There's no need for the special handling if image is RGB. We can just add an extra ':' for the third dimension and it will work even if that dimension is not there. I have pushed http://hg.code.sf.net/p/octave/image/rev/70c74897a69c to fix the issue and also added some tests for the future.

Carnë Draug <carandraug>
Project Member
Mon 12 Mar 2018 09:57:53 PM UTC, comment #5:

Thanks for reporting. Checking again, and indeed there is a bug, when the image is RGB image.

Actually there are few bug in lines 126-131 if imrotate:

1. The class of the output image is not the same as the inputimage
2. The calculation of the parameter hw is not correct for RGB image
3. There is no treatment of RGB image

a fix could be:

Avinoam Kalma <avinoam>
Project Member
Sun 11 Mar 2018 10:14:54 PM UTC, comment #4:

Using: Octave 4.2.1
image *| 2.6.1 | C:\Octave\OCTAVE~1.1\share\octave\packages\image-2.6.1

Bug happens when input image is not square:
pkg load image
rim = imrotate( im, 90, 'nearest', 'crop' );

Tis Veugen <tis>
Sun 11 Mar 2018 06:34:11 PM UTC, comment #3:

I have tried this command, but it worked for me.
Which version of image package and Octave do you use?

Avinoam Kalma <avinoam>
Project Member
Sat 10 Mar 2018 06:29:41 PM UTC, comment #2:

Adding relevant people

Avinoam Kalma <avinoam>
Project Member
Fri 09 Mar 2018 04:00:21 PM UTC, comment #1:

Changing category to Octave Forge because imrotate is not a core Octave function, but part of the image package.

Rik <rik5>
Project Administrator
Fri 09 Mar 2018 03:08:17 PM UTC, original submission:

The following command fails:
rotated_image = imrotate( input_image, 90, 'nearest', 'crop' );
For an input RGB image the result is a black image with a 3x3 red dot in the middle.
I checked the failure for several type of input_image's: uint16 or double; 1 channel or 3 channels.
The problem also occurs when rotation angle is -90 degrees.
No problem happens when command is without the 'crop':
rotated_image = imrotate( input_image, 90, 'nearest' );

Probably, there is an optimization for +/-90 degrees that sucks.

Tis Veugen <tis>


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

Attach Files:

No files currently attached


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 avinoam
  • -email is unavailable- added by avinoam
  • -email is unavailable- added by mtmiller (Updated the item)
  • -email is unavailable- added by tis (Submitted the item)

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




    Follow 12 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2018-05-15 carandraug StatusIn Progress => Fixed
        Open/ClosedOpen => Closed
        Release4.2.1 => other
    2018-03-12 avinoam StatusWorks For Me => In Progress
        Summary[octave forge] (image) imrotate of +/-90 degrees results in black image when 'crop' => [octave forge] (image) imrotate of +/-90 degrees results in black image when 'crop' and RGB image as input
    2018-03-11 avinoam StatusNone => Works For Me
    2018-03-10 avinoam Carbon-Copy- => Added carandraug
        Carbon-Copy- => Added hardy
    2018-03-09 mtmiller SummaryOctave_Forge: imrotate of +/-90 degrees results in black image when 'crop' => [octave forge] (image) imrotate of +/-90 degrees results in black image when 'crop'
    2018-03-09 rik5 Carbon-CopyRemoved 72865 => -
    2018-03-09 rik5 CategoryOctave Function => Octave Forge Package
        Summaryimrotate of +/-90 degrees results in black image when 'crop' => Octave_Forge: imrotate of +/-90 degrees results in black image when 'crop'

    Back to the top

    Powered by Savane 3.4