Hi,
I am trying to enable 12-bit JPEG support with opencv 4.0.1.
I have complied libjpeg 9c (ver 90)
from the source and installed it. When I cmake
Opencv it recognizes it as ver(90)
. But when i start compiling it, it fails. The error message is
/home/akshay/Downloads/opencv-4.0.1/modules/imgcodecs/src/grfmt_jpeg.cpp: In member function ‘virtual bool cv::JpegDecoder::readData(cv::Mat&)’:
/home/akshay/Downloads/opencv-4.0.1/modules/imgcodecs/src/grfmt_jpeg.cpp:456:87: error: cannot convert ‘JSAMPROW {aka short int*}’ to ‘const uchar* {aka const unsigned char*}’ for argument ‘1’ to ‘void cv::icvCvt_BGR2RGB_8u_C3R(const uchar*, int, uchar*, int, cv::Size) icvCvt_RGB2BGR_8u_C3R( buffer[0], 0, data, 0, Size(m_width,1) );
/home/akshay/Downloads/opencv-4.0.1/modules/imgcodecs/src/grfmt_jpeg.cpp:458:90: error: cannot convert ‘JSAMPROW {aka short int*}’ to ‘const uchar* {aka const unsigned char*}’ for argument ‘1’ to ‘void cv::icvCvt_CMYK2BGR_8u_C4C3R(const uchar*, int, uchar*, int, cv::Size)’
icvCvt_CMYK2BGR_8u_C4C3R( buffer[0], 0, data, 0, Size(m_width,1) );
^
/home/akshay/Downloads/opencv-4.0.1/modules/imgcodecs/src/grfmt_jpeg.cpp:465:91: error: cannot convert ‘JSAMPROW {aka short int*}’ to ‘const uchar* {aka const unsigned char*}’ for argument ‘1’ to ‘void cv::icvCvt_CMYK2Gray_8u_C4C1R(const uchar*, int, uchar*, int, cv::Size)’
icvCvt_CMYK2Gray_8u_C4C1R( buffer[0], 0, data, 0, Size(m_width,1) );
^
/home/akshay/Downloads/opencv-4.0.1/modules/imgcodecs/src/grfmt_jpeg.cpp: In member function ‘virtual bool cv::JpegEncoder::write(const cv::Mat&, const std::vector<int>&)’:
/home/akshay/Downloads/opencv-4.0.1/modules/imgcodecs/src/grfmt_jpeg.cpp:701:51: error: cannot convert ‘uchar** {aka unsigned char**}’ to ‘JSAMPARRAY {aka short int**}’ for argument ‘2’ to ‘JDIMENSION jpeg_write_scanlines(j_compress_ptr, JSAMPARRAY, JDIMENSION)’
jpeg_write_scanlines( &cinfo, &ptr, 1 );
I have tried compiling with libjpeg-turbo
as well , but it always fails here. I'm trying to add 12-bit JPEG support to opencv, so any help is greately appretiated.
Edit1: I am seeing the exact same issue as this question. If I compile libjpeg9c without 12 bit support, it complies successfully without any issues.
- Thank You.