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

 
 

bug #56796: [octave forge] (image) imtransform changes the contrast of image when using bilinear interpolation

Submitted by:  None
Submitted on:  Thu 22 Aug 2019 11:09:55 PM UTC  
 
Category:  Octave Forge Package Severity:  3 - Normal
Priority:  5 - Normal Item Group:  Incorrect Result
Status:  Need Info Assigned to:  None
Originator Name:  Originator Email:  -email is unavailable-
Open/Closed:  Closed Release:  5.1.0
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 14 Sep 2021 06:16:35 PM UTC, comment #8: 

@Avinoam: Here are the source files for my short tests leading to my comment #6:

1. the image file "raw_image.jpg". This file is made with the Gimp image manipulation software by cutting out the upper left corner of the OP and removing the colored "a" label.

2. The following Octave code:

clear, close all

im = imread('raw_image.jpg');
imshow(im)

in_p = [0, 0; 1, 0; 0, 1];
factor = 2.4      % you can use also different values here, this one is random
out_p = factor.*in_p;

T = cp2tform(in_p, out_p, 'affine');  %% uses interp2 from core Octave for interpolation

im2 = imtransform(im, T);
figure
subplot(2,2,1)
imshow(im)
subplot(2,2,2)
imshow(im2)

im3 = imtransform(im, T, 'bicubic');
subplot(2,2,4)
imshow(im3)
                             % -> results with image 2.12.0 release
mean_orig = mean(im(:))      % -> 224.8
mean_bilinear = mean(im2(:)) % -> 229.9 = too bright
mean_bicubic = mean(im3(:))  % -> 224.6

This could point to a bug on core Octave's interp2 function. Or it could just mean nothing at all, because nobody claims that interpolation preserves mean values (or am I wrong with this assumption?)


Hartmut <hardy>
Tue 14 Sep 2021 05:08:16 PM UTC, comment #7: 

@Hartmut: Thanks for checking.
Could you please attach the code you used to get the results?

Avinoam Kalma <avinoam>
Project Member
Sun 12 Sep 2021 06:19:57 PM UTC, comment #6: 

Using a grayscale version of the attached image file in comment #0, I can reproduce a brightness difference when resacling this image with imtransform. The input image has an average brigthnessof 225, the rescaled image with bicubic interpolation has also 225 mean brightness, but the rescaled image with the (default) bilinear interpolation method has 230 mean brightness in my case. (It is amazing how slight brightness differences the human eye can still percive.)

This might hint to a problem in the bilinear interpolation method used by imtransform. But imtransform uses the interp2 function from core Octave for interpolation. And without further information I don't see a good way forward to further point down this behavior.

So I agree, let's CLOSE this bug report for now.

Hartmut <hardy>
Sun 29 Aug 2021 07:04:43 PM UTC, comment #5: 

Closing. No answer from OP.
If there is still a problem, please reopen this bug report

Avinoam Kalma <avinoam>
Project Member
Sat 16 Nov 2019 09:49:07 PM UTC, comment #4: 

to OP:
please see comment #2 and comment #3.
Thanks,

Avinoam Kalma <avinoam>
Project Member
Sat 31 Aug 2019 06:49:49 PM UTC, comment #3: 

Could you also please explain what problem you see in your result image (b), generated with Octave's 'bilinear' interpolation method?

Hartmut <hardy>
Sat 31 Aug 2019 05:49:45 PM UTC, comment #2: 

To OP:
Can upload the image you haver used, your implementation of bilinear and the calling sequence to imtransform?

Thanks.

Avinoam Kalma <avinoam>
Project Member
Sat 31 Aug 2019 11:09:48 AM UTC, comment #1: 

Adding pkg maintainers

Avinoam Kalma <avinoam>
Project Member
Thu 22 Aug 2019 11:09:55 PM UTC, original submission:  

When transforming images with "imtransform" I noticed that the result with bilinear interpolation did not give the expected result, but a brighter image.
The attached image shows the transformed image with interpolation set to:
a) nearest neighbor ('nearest')
b) bilinear (default)
c) my own implementation of bilinear
d) bicubic
The interpolation option was the only parameter varied, and Octave's bilinear result seems wrong.

Anonymous

 

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

Attach Files:
   
   
Comment:
   

Attached Files
file #51911:  raw_image.jpg added by hardy (37KiB - image/jpeg)
file #47384:  interpolation.jpg added by None (57KiB - image/jpeg)

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by hardy (Posted a comment)
  • -email is unavailable- added by avinoam (Posted a comment)
  • -email is unavailable- added by avinoam
  • -email is unavailable- added by avinoam
  •  

    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 8 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2021-09-14 hardy Attached File- => Added raw_image.jpg, #51911
    2021-08-29 avinoam Open/ClosedOpen => Closed
    2019-09-09 avinoam StatusNone => Need Info
    2019-08-31 avinoam Carbon-Copy- => Added carandraug
        Carbon-Copy- => Added hardy
    2019-08-23 mtmiller CategoryOctave Function => Octave Forge Package
        Summaryimtransform changes the contrast of image when using bilinear interpolation => [octave forge] (image) imtransform changes the contrast of image when using bilinear interpolation
    2019-08-22 None Attached File- => Added interpolation.jpg, #47384

    Back to the top


    Powered by Savane 3.7