Files
opencv-MIRROR/modules
XieFuwei e4c14c5c4f imgcodecs: fix SunRaster IMREAD_GRAYSCALE returning black image
SunRasterDecoder::readData() only called CvtPaletteToGray() when the
file contained a color palette (m_maptype == RMT_EQUAL_RGB). But
SunRasterEncoder always writes RMT_NONE (no palette), so gray_palette[]
stayed zero-initialized and FillGrayRow8() mapped every pixel to 0.

Fix: call CvtPaletteToGray() whenever reading as grayscale, regardless
of palette type. readHeader() already fills m_palette correctly via
FillGrayPalette() for the RMT_NONE case.

Add regression test Imgcodecs_SunRaster.imread_grayscale_roundtrip
that writes a full 0-255 ramp, reads it back with IMREAD_GRAYSCALE,
and checks NORM_INF == 0. Without the fix, NORM_INF == 255 (all black).
Remove the "broken (black result)" skip for ras in read_write_GRAYSCALE.
2026-08-26 12:07:46 +03:00
..
2026-04-28 12:30:06 +02:00