Wed 11 Feb 2015 05:52:41 PM UTC, comment #8:
I have pushed
http://hg.savannah.gnu.org/hgweb/octave/rev/c334e4af3a1b
and
http://hg.savannah.gnu.org/hgweb/octave/rev/a4f6fbd1af77
|
Wed 11 Feb 2015 05:48:37 PM UTC, comment #7:
Correct: the bug is not fixed in the current default system:
line 1107:
for (octave_idx_type col = 0; col < nCols; col++)
{
for (octave_idx_type row = 0; row < nRows; row++)
{
Magick::Color c;
c.redQuantum (double (*img_fvec) / divisor);
pix[GM_idx] = c;
img_fvec++;
GM_idx += nCols;
}
GM_idx -= nCols * nRows - 1;
}
|
Wed 11 Feb 2015 05:42:23 PM UTC, comment #6:
I just gave it a go on the default branch and despite comment #2, this is indeed not fixed.
Answering comment #4
yes it is a wonder because this works fine for other formats. I can't find it on the documentation at the moment but if I remember correctly (it has been almost 2 years), you should be able to create grayscale images by setting the red channel. And that is why 10 lines above the snippet you show, the image is created with type Magick::GrayscaleType
What is happening then? Is the mean of the 3 channels being used on the new image? Why does this not happen for the other coders/formats?
|
Wed 11 Feb 2015 05:20:52 PM UTC, comment #5:
What are you commenting on? Is this bug not fixed yet?
|
Wed 11 Feb 2015 06:13:14 AM UTC, comment #4:
at "libinterp/dldfcn/__magick_read__.cc"
No wonder that image is red:
for (octave_idx_type row = 0; row < nRows; row++)
{
Magick::Color c;
c.redQuantum (double (*img_fvec) / divisor);
pix[GM_idx] = c;
Fix:
for (octave_idx_type row = 0; row < nRows; row++)
{
double grey = double (*img_fvec) / divisor;
Magick::Color c (grey, grey, grey);
pix[GM_idx] = c;
|
Tue 11 Mar 2014 07:16:51 PM UTC, comment #3:
For future reference, what fixed this will most likely be e0cc67d5a462 (although it was a side effect of fixing a different bug).
Alternatively, it may have been fixed by e0cc67d5a462.
|
Tue 11 Mar 2014 04:11:15 PM UTC, comment #2:
With the latest version of MXE Octave for Windows 3.8.1 from http://mxeoctave.osuv.de/, this bug seem to corrected. Selecting .bmp or .jpg seems to produces the correct result.
a = repmat (uint8 (0:255), 100, 1);
imshow (a)
imwrite (a, "test.bmp");
b = imread ("test.bmp");
figure;
imshow (b)
|
Sun 23 Feb 2014 05:11:25 PM UTC, comment #1:
I can replicate this problem with the more simple case:
The example above shows that the problem happens during imwrite since the jpg file created is already wrong.
We can also see that the problem happens only with grayscale images since writing an RGB image creates the image file correctly:
But I'm unsure if this is a problem in Octave. The reason to believe this is that Octave does not have format specific code, the code is all the same, independent of the format chosen. However, if we write the image to a tif or bmp file, everything is correct. By the way, using imread() to read the RGB image where all 3 channels are the same, will read a grayscale image. This is again, because GraphicsMagick will recognize it as such and report a grayscale image to save memory.
Still, I'm marking this as a regression because apparently (according to the OP on the mailing list)) Octave was saving the file correctly in 3.2.4 and 3.6.0.
|
Sat 22 Feb 2014 11:03:14 PM UTC, original submission:
if you write out an array using imwrite in bmp and jpg format, the output is not correct. If you use tif format the ouput looks ok.
I have attahed a smalll sample. test.bmp and test.jpg are corrupt compared to the input.jpg. The background should be off white. test.bmp has a red background and test.jpg is dark gray. test.tif appears to be correct.
The problem exists in 3.8.1rc
|