How to set flags specific to libjpeg-turbo?

Hi there,

I am wondering if it is possible to set flags specific to libjpeg-turbo when calling cv::imdecode? Specifically, I would like to replace TJFLAG_FASTDCT with TJFLAG_ACCURATEDCT flag.

Thanks

AFAIK there’s no direct access to the options of the underlying libraries in image/video reading/writing. This can be more annoying with TIFF images, as OpenCV doesn’t handle multispectral, GeoTIFF etc. data.
The solution would be to use the library directly to read the image (see this example), then convert the result to OpenCV Mat:

/* Step 9: Transform image to OpenCV Mat */
Mat img(cinfo->output_height, cinfo->output_width, CV_8UC3, buffer);
//...process image...
1 Like