[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Octave-bug-tracker] [bug #53309] [octave forge] (image) imrotate of +/-
From: |
Avinoam Kalma |
Subject: |
[Octave-bug-tracker] [bug #53309] [octave forge] (image) imrotate of +/-90 degrees results in black image when 'crop' and RGB image as input |
Date: |
Mon, 12 Mar 2018 17:57:54 -0400 (EDT) |
User-agent: |
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/64.0.3282.186 Safari/537.36 |
Update of bug #53309 (project octave):
Status: Works 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
_______________________________________________________
Follow-up 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:
imgPost = zeros(sizePre);
hw = min(sizePre) / 2 - 0.5;
imgPost (round(oPost(2) - hw) : round(oPost(2) + hw),
round(oPost(1) - hw) : round(oPost(1) + hw) ) = ...
imgRot(round(oPost(1) - hw) : round(oPost(1) + hw),
round(oPost(2) - hw) : round(oPost(2) + hw) );
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:
imgPost = zeros(sizePre, class (imgPre));
hw = min(sizePre(1:2)) / 2 - 0.5;
if (isgray(imgPre))
imgPost (round(oPost(2) - hw) : round(oPost(2) + hw),
round(oPost(1) - hw) : round(oPost(1) + hw) ) = ...
imgRot(round(oPost(1) - hw) : round(oPost(1) + hw),
round(oPost(2) - hw) : round(oPost(2) + hw) );
else
imgPost (round(oPost(2) - hw) : round(oPost(2) + hw),
round(oPost(1) - hw) : round(oPost(1) + hw), :) = ...
imgRot(round(oPost(1) - hw) : round(oPost(1) + hw),
round(oPost(2) - hw) : round(oPost(2) + hw), :);
end
_______________________________________________________
Reply to this item at:
<http://savannah.gnu.org/bugs/?53309>
_______________________________________________
Message sent via/by Savannah
http://savannah.gnu.org/