Is there a way to output monochrome TIFF files in OpenCV with group 4 compression?
This is the command to do it with imagemagick/graphicsmagick
'gm convert '.$file.' -type bilevel -monochrome -compress group4 '.$output
OpenCV version 4.5.1
update
# g++ -Wall -O3 -std=c++17 main.cpp -o main `pkg-config opencv4 --cflags --libs` -ltiff
find
doesn't return anything
root@x:/usr/include/opencv4/opencv2# find . -name "*tif*"
code
#include <tiffio.h>
#include <opencv4/opencv2/opencv.hpp>
std::vector<int> params = {cv::IMWRITE_TIFF_COMPRESSION, COMPRESSION_CCITTFAX4};
cv::imwrite(_output, src_bin, params);
error
[ WARN:0] global ../modules/imgcodecs/src/grfmt_tiff.cpp (914) writeLibTiff OpenCV TIFF(line 914): failed TIFFSetField(tif, TIFFTAG_PREDICTOR, predictor) imwrite_('out.tif'): can't write data: OpenCV(4.5.1) ../modules/imgcodecs/src/grfmt_tiff.cpp:914: error: (-2:Unspecified error) OpenCV TIFF: failed TIFFSetField(tif, TIFFTAG_PREDICTOR, predictor) in function 'writeLibTiff'