bugGNU Octave - Bugs: bug #63560, [octave forge] (image) imresize...

 
 

bug #63560: [octave forge] (image) imresize gives inaccurate result

Submitter:  Raghavan <ragsubra>
Submitted:  Thu 22 Dec 2022 11:16:26 AM UTC
 
Category:  Octave Forge Package Severity:  3 - Normal
Priority:  5 - Normal Item Group:  Inaccurate Result
Status:  Confirmed Assigned to:  None
Originator Name:  Open/Closed:  * Open
Release:  * other Operating System:  * Any
Fixed Release:  None Planned Release:  None
* Mandatory Fields

Add a New Comment (Rich Markup)
   

Comment Type & Canned Response:
       

 

( Jump to the original submission )

Thu 02 Feb 2023 05:33:05 AM UTC, comment #8: 

comment #7:

> Thanks, Raghavan
> I will be glad if you can try to help fix this bug.
> If I will find out how to fix it, I will ask you to check the fix.


Sure. Absolutely.

Raghavan <ragsubra>
Wed 25 Jan 2023 09:11:51 PM UTC, comment #7: 

Thanks, Raghavan
I will be glad if you can try to help fix this bug.
If I will find out how to fix it, I will ask you to check the fix.

Avinoam Kalma <avinoam>
Project Member
Tue 24 Jan 2023 01:56:05 PM UTC, comment #6: 

Yes, your understanding of the difference in 33 gray levels is correct. I understand the reason behind this change.
Apologies if I caused any confusion.  Let me know if I can be of any further help.

Raghavan <ragsubra>
Sun 22 Jan 2023 09:13:39 PM UTC, comment #5: 

Thanks for checking.

If I understand correctly, the difference of 33 gray levels is between the current version image package and the previous version.
This is because there was a change in imresize, in order to make it more MATLAB compatible.

This bug with anti-aliasing was not reported.
Bug #61760 related  to "imresize - antialiasing is not implemented"

Avinoam Kalma <avinoam>
Project Member
Sun 22 Jan 2023 04:48:00 PM UTC, comment #4: 

I verified that the problem is not visible by setting "antialiasing" as false.  I was not able to compare pixel values numerically with an earlier version since this option is not available in a previous version (octave:6.4.0, image:2.12.0).

Since antialiasing is used only when down-sizing, I tried resizing to [200,200] (up-sizing) instead of [100,100].  The stripe artifact was not seen in both the older and newer (octave: 7.3.0, image: 2.14.0) versions.
In 7.3.0, I also verified that for [200,200] output size, the output was the same with and without setting the "antialiasing" option as false.  This is as expected.

One note however: While no visual difference was found between outputs for 6.4.0 and 7.3.0 for output size [200,200], there was a difference of up to 33 in pixel values when I took an image difference.  This may or may not be another problem with bilinear interpolation.

Overall, I would agree that the original problem that I reported is due to a bug in anti-aliasing, which seems to be reported already.

Raghavan <ragsubra>
Thu 19 Jan 2023 06:46:10 PM UTC, comment #3: 

The problem seems to be related to antialising (see bug #61760)

With

im1 = imresize (im, [100,100], 'method', 'bilinear', 'antialiasing', false);

I do not see this problem.

Avinoam Kalma <avinoam>
Project Member
Thu 22 Dec 2022 10:42:24 PM UTC, comment #2: 

I have also checked the (adapted) sample code from comment #0 with current (online) Matlab, and it does NOT produce these stripes. So this seems to be wrong and incompatible behavior of our function imresize.

Hartmut <hardy>
Thu 22 Dec 2022 10:35:52 PM UTC, comment #1: 

Thank you for your bug report. I add the image package maintainers to cc for now.

I can reproduce this behavior with the current image 2.14 under linux with Octave 7.3.

Hartmut <hardy>
Thu 22 Dec 2022 11:16:26 AM UTC, original submission:  

When an image is resized using imresize, for some images some artifacts/distortions are introduced.  This issue is observed from version 7.2 onwards (version 6.4 does not have the issue).
To reproduce the problem, download the attached image (image.jpg) and run the following lines of code:

pkg load image
im = imread("image.jpg");
im1 = imresize(im, [100,100], 'Linear');
figure(1); subplot(2,1,1) ; imshow(im, [])
subplot(2,1,2) ; imshow(im1, [])
imwrite(im1, "image_resized.jpg", 'Quality',95)

Note the grey stripes created in the flat regions of the resized image.
If imresize method is changed to "Cubic", the artifacts do reduce for this image, but I have seen other images where it gets worse.  I tried smoothing the image to prevent aliasing, but didn't work.  Also note that this problem is not seen in older versions of Octave (6.4.0), nor with opencv

Raghavan <ragsubra>

 

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

Attach Files:
   
   
Comment:
   

Attached Files
file #54137:  image.jpg added by ragsubra (5KiB - image/jpeg - Test image to reproduce the problem along with the result image)
file #54138:  image_resized.jpg added by ragsubra (4KiB - image/jpeg - Test image to reproduce the problem along with the result image)

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by avinoam
  • -email is unavailable- added by avinoam (Updated the item)
  • -email is unavailable- added by hardy (Posted a comment)
  • -email is unavailable- added by ragsubra (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 project members can vote.

     

     

     

     

    Follow 8 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2023-01-19 avinoam Carbon-Copy- Added christofkaufmann
    2023-01-14 avinoam StatusNone Confirmed
        Release7.3.0 other
        Operating SystemMicrosoft Windows Any
    2022-12-22 ragsubra Attached File- Added image.jpg, #54137
        Attached File- Added image_resized.jpg, #54138
    2022-12-22 mmuetzel Carbon-CopyRemoved 102357 -
    2022-12-22 mmuetzel Summaryimresize gives inaccurate result [octave forge] (image) imresize gives inaccurate result

    Back to the top

    Powered by Savane 3.10