MATLAB Answers

add jpeg toolbox in matlab 2014a

13 views (last 30 days)
negar zamani
negar zamani on 29 Jul 2019
Commented: Walter Roberson on 18 Nov 2019
hi.please help me to correct these errors.
os :win7 x64
matlab 2014a
>> mex -setup
MEX configured to use 'Microsoft Visual C++ 2010 Professional (C)' for C language compilation.
Warning: The MATLAB C and Fortran API has changed to support MATLAB
variables with more than 2^32-1 elements. In the near future
you will be required to update your code to utilize the
new API. You can find more information about this at:
http://www.mathworks.com/help/matlab/matlab_external/upgrading-mex-files-to-use-64-bit-api.html.
To choose a different C compiler, select one from the following:
lcc-win32 mex -setup:'C:\Program Files (x86)\MATLAB\R2014a\bin\win32\mexopts\lcc-win32.xml' C
Microsoft Visual C++ 2010 Professional (C) mex -setup:C:\Users\#NeGaR\AppData\Roaming\MathWorks\MATLAB\R2014a\mex_C_win32.xml C
Microsoft Windows SDK 7.1 (C) mex -setup:'C:\Program Files (x86)\MATLAB\R2014a\bin\win32\mexopts\winsdk-7.1_c.xml' C
To choose a different language, select one from the following:
mex -setup C++
mex -setup FORTRAN
>> mex -I'C:\Program Files (x86)\MATLAB\R2014a\bin\jpegprj' jpeg_write.c 'C:\Program Files (x86)\MATLAB\R2014a\bin\jpegprj\libjpeg.lib'
Building with 'Microsoft Visual C++ 2010 Professional (C)'.
Error using mex
Creating library jpeg_write.lib and object jpeg_write.exp
jpeg_write.obj : error LNK2019: unresolved external symbol _jpeg_finish_compress referenced in
function _mexFunction
jpeg_write.obj : error LNK2019: unresolved external symbol _jpeg_write_marker referenced in
function _mexFunction
jpeg_write.obj : error LNK2019: unresolved external symbol _jpeg_alloc_huff_table referenced in
function _mexFunction
jpeg_write.obj : error LNK2019: unresolved external symbol _jpeg_alloc_quant_table referenced in
function _mexFunction
jpeg_write.obj : error LNK2019: unresolved external symbol _jpeg_write_coefficients referenced
in function _mexFunction
jpeg_write.obj : error LNK2019: unresolved external symbol _jround_up referenced in function
_mexFunction
jpeg_write.obj : error LNK2019: unresolved external symbol _jpeg_simple_progression referenced
in function _mexFunction
jpeg_write.obj : error LNK2019: unresolved external symbol _jpeg_set_defaults referenced in
function _mexFunction
jpeg_write.obj : error LNK2019: unresolved external symbol _jpeg_stdio_dest referenced in
function _mexFunction
jpeg_write.obj : error LNK2019: unresolved external symbol _jpeg_CreateCompress referenced in
function _mexFunction
jpeg_write.obj : error LNK2019: unresolved external symbol _jpeg_destroy_compress referenced in
function _mexFunction
jpeg_write.obj : error LNK2019: unresolved external symbol _jpeg_std_error referenced in
function _mexFunction
jpeg_write.mexw32 : fatal error LNK1120: 12 unresolved externals
>> mex -I'C:\Program Files (x86)\MATLAB\R2014a\bin\jpegprj' jpeg_read.c 'C:\Program Files (x86)\MATLAB\R2014a\bin\jpegprj\libjpeg.lib'
Building with 'Microsoft Visual C++ 2010 Professional (C)'.
Error using mex
Creating library jpeg_read.lib and object jpeg_read.exp
jpeg_read.obj : error LNK2019: unresolved external symbol _jpeg_finish_decompress referenced
in function _mexFunction
jpeg_read.obj : error LNK2019: unresolved external symbol _jpeg_read_coefficients referenced
in function _mexFunction
jpeg_read.obj : error LNK2019: unresolved external symbol _jpeg_read_header referenced in
function _mexFunction
jpeg_read.obj : error LNK2019: unresolved external symbol _jpeg_save_markers referenced in
function _mexFunction
jpeg_read.obj : error LNK2019: unresolved external symbol _jpeg_stdio_src referenced in
function _mexFunction
jpeg_read.obj : error LNK2019: unresolved external symbol _jpeg_CreateDecompress referenced in
function _mexFunction
jpeg_read.obj : error LNK2019: unresolved external symbol _jpeg_destroy_decompress referenced
in function _mexFunction
jpeg_read.obj : error LNK2019: unresolved external symbol _jpeg_std_error referenced in
function _mexFunction
jpeg_read.mexw32 : fatal error LNK1120: 8 unresolved externals
>>

  1 Comment

Steven Lord
Steven Lord on 18 Nov 2019
I'm coming to this a bit late, but is there a reason you're not just using the imwrite function included in MATLAB? I checked the documentation in release R2014a and it can write JPEG files (either "8-bit, 12-bit, and 16-bit Baseline JPEG images" or "1-bit, 8-bit, and 16-bit JPEG 2000 images" depending on the fmt input you pass into imwrite.)

Sign in to comment.

Answers (2)

Guillaume
Guillaume on 29 Jul 2019
I know nothing about that toolbox but all these missing symbols looks like symbols from libjpeg. I assume it's a dependency of that toolbox, perhaps the 404 file from step 2. So, have you done that step 2? If you've skipped step 2 or 3, it's no suprise that the installation doesn't work.
Note: libjpeg can be downloaded from a number of places, including sourceforge.

  15 Comments

negar zamani
negar zamani on 8 Aug 2019
before your answer, i had changed my matlab from 2014b(32 bit) to 2018a(64 bit). my computer is 64 bit. in matlab 2018a, when type 'mex -setup' (withot qoute) it's forced me to dowload and install MinGW64 compiler (c) for it's basic compiler. is it true that mex become 32 or 64 if matlab be 32 or 64? if it's true so my compiled libjpeg and mex are both 64. about replacing " bt ', i did.
now i write for you, i use matlab 2018a 64 bit.
after all, i can run jpeg_read correctly and recieve a structure that the one of it's member is array of DCT coeficiets. (coef_arrays)
after i run my algorithm on it, i should run jpeg_write. but happen this error:
write error.JPG
i need to solve it immediately . :(
Royi Avital
Royi Avital on 18 Nov 2019
Does anyone knows which JPEG library MATLAB uses?
Walter Roberson
Walter Roberson on 18 Nov 2019
MATLAB uses a number of different jpeg related libraries (for reasons that are not clear.)
On Mac, the most obvious libraries it uses are version 0.0.0.0 (which is to say no version has been assigned.) Those are probably Mathworks library.
/Applications/MATLAB_R2019b.app/sys/java/jre/maci64/jre/lib/libjpeg.dylib is marked as version 1.0.0.0

Sign in to comment.


negar zamani
negar zamani on 3 Aug 2019
Edited: negar zamani on 3 Aug 2019
see pics please. i did convert ' to " in jpeg_read.m and jpeg_write.m
in 2014a but errors didn't refine.

  8 Comments

Show 5 older comments
negar zamani
negar zamani on 7 Aug 2019
new error :(((((((((((((((((((((((
i can jpeg_read and it return a structure but jpeg_write don't work .
write error.JPG
Walter Roberson
Walter Roberson on 7 Aug 2019
Do you have write access to stg.jpg in the current directory ? For example you would expect problems if your current directory is under the MATLAB installation folders.
negar zamani
negar zamani on 8 Aug 2019
stg.jpg or every jpg filename that use in jpeg_write create in directory as same as directory that run the program(.m file) . it is necessary to create .m file in same directory by toolbox directory.
i changed the directory of my program and tried again.
no change. The error is exist yet

Sign in to comment.

Sign in to answer this question.