Compiled Matlab MEX function "imread()" cannot open .bmp images.

4 次查看(过去 30 天)
Hi,
the Matlab function "Image = imread('File');" works perfectly fine, if you provide a .bmp image. But when compiled to MEX, I get the following error message:
JPEG library error (8 bit), "Not a JPEG file: starts with 0x89 0x50".
Error in imread (line 65)
coder.internal.errorIf(errWarnType == ERROR_MESSAGE_CODE, ...
Studying the generated c-code, the MEX version of 'imread()' seems to only link to the jpeg-library. The MEX version doesn't even accept a second argument like "imread('file', 'bmp')". It would cause a compiler error.
Is the MEX version of imread() even able to open .bmp files? Btw. I'm compiling under Mac environment.

采纳的回答

Julianna Mather
Julianna Mather 2018-7-19
The imread function currently only supports JPEG files in code generation. We weren't sure which formats would be most useful for codegen customers, but we were pretty sure that JPEG was at the top of the list. :-)
We will consider adding support for additional file formats to imread in future releases of MATLAB and MATLAB Coder.

更多回答(1 个)

Leo103
Leo103 2018-7-19
编辑:Leo103 2018-7-19
Thank you for the answer! I noticed, the documentation of imread() states at the very end of the page:
C/C++ Code Generation - Generate C and C++ code using MATLAB® Coder™.
Usage notes and limitations:
- Supports reading of 8-bit JPEG images only. The input argument filename must be a valid absolute path or relative path.
- This function generates code that uses a precompiled, platform-specific shared library (Image Processing Toolbox).
- In a MATLAB Function block, the input argument filename must be a compile-time constant.

类别

Help CenterFile Exchange 中查找有关 MATLAB Coder 的更多信息

产品


版本

R2018a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by