Open mstenta opened 1 month ago
This provides a good explanation why 16-bit is important for editing: https://photographylife.com/8-bit-vs-16-bit-images
Even though 16 bits may sound like overkill, we saw here that it finds its use in post-processing images. But 8-bit per channel images take up much less file space, so it’s worth exporting your images, especially for the web, to 8-bit per channel to save space.
Thanks for reporting! This might be a wontfix since I'm not sure if this can be solved within stitching alone but would need changes in the stitching module of opencv as well..
Problem: Stitching 16-bit TIFF images results in an 8-bit output image.
If
stitching
is the last step of an editing workflow before saving a file for web/print, then that's OK because 8-bit is enough for web/print. But it means that stitched images lose a lot of the data that is useful during editing. Ifstitching
supported exporting 16-bit images, and maintained the color data of the input images (to the best of its ability), then it could be used as the first step of an editing workflow. As you can imagine, editing a whole stitched image is easier than editing individual pieces of it. :-)Currently,
stitching
uses OpenCV'simread()
to read input image files.Source: https://stackoverflow.com/a/18461475 (I can't find this officially documented in https://docs.opencv.org/4.10.0/d4/da8/group__imgcodecs.html, but it appears to be true.)
This means that all processing is performed on 8-bit image data, which is then passed to
imwrite()
, so the output image is 8-bit.The
imread()
function accepts anIMREAD_UNCHANGED
flag, which ensures that it is not converted to 8-bit: https://docs.opencv.org/4.10.0/d8/d6a/group__imgcodecs__flags.html#gga61d9b0126a3e57d9277ac48327799c80aeddd67043ed0df14f9d9a4e66d2b0708However, simply adding that flag to
stitching
'simread()
call (by changing line 113 of images.py from img = cv.imread(img_name) to img = cv.imread(img_name, cv.IMREAD_UNCHANGED)`) causes an error.The error depends on the
--detector
option that is used:orb:
sift:
brisk:
akaze:
(Originally discovered in this discussion: https://github.com/OpenStitching/stitching/discussions/224)