Support reading/writing 16-bit images #226
Labels
enhancement
New feature or request
OpenCV bindings
A bug or something that wontfix if the OpenCV bindings are not modified
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: #224)
The text was updated successfully, but these errors were encountered: