octave-bug-tracker
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Octave-bug-tracker] [bug #33317] imwrite and/or imread rounds uint8 val


From: anonymous
Subject: [Octave-bug-tracker] [bug #33317] imwrite and/or imread rounds uint8 values incorrectly
Date: Sun, 15 May 2011 18:51:27 +0000
User-agent: Mozilla/5.0 (Windows NT 6.1; rv:2.0.1) Gecko/20100101 Firefox/4.0.1

URL:
  <http://savannah.gnu.org/bugs/?33317>

                 Summary: imwrite and/or imread rounds uint8 values
incorrectly
                 Project: GNU Octave
            Submitted by: None
            Submitted on: sön 15 maj 2011 18.51.26
                Category: None
                Severity: 3 - Normal
                Priority: 5 - Normal
              Item Group: Incorrect Result
                  Status: None
             Assigned to: None
         Originator Name: Stefan Gustavson
        Originator Email: address@hidden
             Open/Closed: Open
         Discussion Lock: Any
                 Release: 3.2.4
        Operating System: Microsoft Windows

    _______________________________________________________

Details:

When exporting an uint8 array to PNG, TIFF, BMP
or any other lossless 8-bit format by imwrite(),
and then reading it in using imread(), the values
change. Some of the read values, but not all, are
1 smaller than the original. The error accumulates
when the export-import sequence is repeated.
This means that 8-bit image export and/or import
is lossy, even downright destructive.

img1 = uint8(0:255);
imwrite(img1, 'test.png');
img2 = imread('test.png');
figure
subplot(211)
plot(img1, img1-img2); % Difference is 0 or 1
imwrite(img2, 'test.png');
img3 = imread('test.png');
subplot(212)
plot(img1, img1-img3); % Difference is 0, 1 or 2

This looks like a rounding error in the code.
I have not been able to locate it myself.





    _______________________________________________________

Reply to this item at:

  <http://savannah.gnu.org/bugs/?33317>

_______________________________________________
  Meddelandet skickades via/av Savannah
  http://savannah.gnu.org/




reply via email to

[Prev in Thread] Current Thread [Next in Thread]