Search code examples
cmatlabfopenfreadimread

How can I use fopen() and fread() to substitute imread() within MATLAB?


I want to replace imread with fopen and fread so that I can create C code from my MATLAB file.

While using the MATLAB coder utility, imread cannot be used (since it is an extrinsic function). Therefore I am looking to substitute imread1 which is currently reading *.JPG*s with the combination offopenandfread`. My assertions at the start of the program are:

assert(isa(IM, 'uint8'));
assert(size(IM, 1) < 100);
assert(size(IM, 2) < 100);
assert(size(IM, 3) == 3);

Help will be much appreciated!


Solution

  • As Rollen D'Souza has commented on the question - using coder.ceval and an implemented JPEG decoder would be the best option here.