无法编译具有12位libjpeg支持的OpenCV

时间:2019-01-23 23:31:42

标签: opencv compilation libjpeg

我正在尝试通过opencv 4.0.1启用12位JPEG支持。我从源头编译了libjpeg 9c (ver 90)并提供12位支持。当我编译OpenCV时,它失败并显示错误消息

/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 );

这类似于之前在OpenCV questions中看到的错误。有什么建议可以解决我的兼容性问题吗?看起来它无法转换为正确的数据类型。使用libjpeg-turbo时也遇到相同的问题。

感谢您的帮助。

谢谢

0 个答案:

没有答案