Open DougRogers opened 3 years ago
Yes, you're right. It has been created for usage in Meshroom for photogrammetry and we display grayscale images (depth maps) with a jet color map.
We need to add an additional check here: https://github.com/alicevision/QtOIIO/blob/develop/src/imageIOHandler/QtOIIOHandler.cpp#L65 Maybe just based on the filename as there is no way to have options.
It still does not work if convertGrayscaleToJetColorMap is set to false.
You will need something like this to support grey scale
const oiio::TypeDesc typeDesc = oiio::TypeDesc::UINT8;
oiio::ImageSpec requestedSpec(inSpec.width, inSpec.height, nchannels, typeDesc);
oiio::ROI exportROI = inBuf.roi();
exportROI.chbegin = 0;
exportROI.chend = nchannels;
// qDebug() << "[QtOIIO] fill output QImage";
std::vector<uint8_t> conversionBuffer(inSpec.height * inSpec.scanline_bytes());
inBuf.get_pixels(exportROI, typeDesc, conversionBuffer.data());
auto src = conversionBuffer.data();
auto dst = result.bits();
for (int y = 0; y < inSpec.height; ++y)
{
memcpy(dst, src, inSpec.width);
src += inSpec.scanline_bytes();
dst += result.bytesPerLine();
}
There is also some commented code: https://github.com/alicevision/QtOIIO/blob/develop/src/imageIOHandler/QtOIIOHandler.cpp#L197
Does uncommenting out that code and setting the convertGrayscaleToJetColorMap flag to false, load the test image for you?
I have not tested it.
Attached image does not convert to QImage properly.