[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Octave-bug-tracker] [bug #57504] Scaling error for imresize in Image 2.
From: |
anonymous |
Subject: |
[Octave-bug-tracker] [bug #57504] Scaling error for imresize in Image 2.0.0 |
Date: |
Mon, 30 Dec 2019 08:49:06 -0500 (EST) |
User-agent: |
Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:71.0) Gecko/20100101 Firefox/71.0 |
URL:
<https://savannah.gnu.org/bugs/?57504>
Summary: Scaling error for imresize in Image 2.0.0
Project: GNU Octave
Submitted by: None
Submitted on: Mon 30 Dec 2019 01:49:04 PM UTC
Category: Octave Function
Severity: 3 - Normal
Priority: 5 - Normal
Item Group: Incorrect Result
Status: None
Assigned to: None
Originator Name: Pawel M Stasik
Originator Email: address@hidden
Open/Closed: Open
Discussion Lock: Any
Release: 5.1.0
Operating System: Any
_______________________________________________________
Details:
I've noticed this bug some time ago.
When the function scales the image, it uses the indexes of the pixels as the
coordinates. This is wrong, as the actual approach should be assuming the
points of interest should be in the middle of pixels - so shifted by 0.5. The
way the interpolation is implemented in Image 2.0.0 results in a small zoom.
I've checked the newest release of the image package (2.6.0) and it seems the
error is still in there.
I use the following procedure to resolve the issue for myself (at the basis).
*****
XI = 1:targetWidth;
XI = size(im,2)/targetWidth*(XI-0.5)+0.5;
YI = 1:targetHeight;
YI = size(im,1)/targetHeight*(YI-0.5)+0.5;
im_scaled = imremap(im, XI, YI);
*****
I can't recall it now perfectly, but I might have included some code to ensure
the indexes don't exceed the image. So it's worth taking into account that
border-cases also might need being taken care of. As I've said, I don't recall
perfectly now id imremap requires that.
I have not updated my Octave in some time, but I reckon unless the Image
package was updated, the error is still in it.
_______________________________________________________
Reply to this item at:
<https://savannah.gnu.org/bugs/?57504>
_______________________________________________
Message sent via Savannah
https://savannah.gnu.org/
- [Octave-bug-tracker] [bug #57504] Scaling error for imresize in Image 2.0.0,
anonymous <=