Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

To resolve issues starting MATLAB on Mac OS X 10.10 (Yosemite) visit: http://www.mathworks.com/matlabcentral/answers/159016

how can i run this program?

Asked by high on 25 May 2013

actually i'm beginner in using matlab image processing, i have code for secret sharing image, when i run this code i got this error:

??? Error using ==> fread
Invalid file identifier.  Use fopen to generate a valid
file identifier.
Error in ==> Rabin>ReadImage at 133
Im_data = fread(Im_fp,'uint8');
Error in ==> Rabin at 32
[Im_linear, Im_Square] =
ReadImage(Im_Name,Height,Width);

and also i do not know what the lena.bin

please help me.

how can i run this program?

0 Comments

high

3 Answers

Answer by Matt J on 25 May 2013

lm_fp is not pointing to an open file. Use FOPEN to open it.

0 Comments

Matt J
Answer by Walter Roberson on 25 May 2013

The name you passed as Im_Name is not the name of a file anywhere on the MATLAB path.

You probably do not have any image with the name "lena": it is not supplied with MATLAB. See http://www.cs.cmu.edu/~chuck/lennapg/lenna.shtml

0 Comments

Walter Roberson
Answer by Image Analyst on 26 May 2013

I don't know what you mean when you say lena.bin - usually the lena image is a bmp, or tif, or some normal image format, in which case you can use imread() to read it in instead of fread() like you tried to do. Do you know what the format is? Apparently not and it seems like you don't even know anything at all about it so I doubt you can answer our questions. Anyway, maybe try imread instead of fread - it's worth a shot. If you know it's a 2D grayscale or 3D color image, you might try passing in the size of the 2D array so that you get an image.

image2D = fread(fileHandle, [x_size y_size], '*uint8');

This will get you the gray scale image, or one of the color channels if it's a 3 channel RGB color image. The way you're doing it with fread(), you'd get a 1D vector.

2 Comments

high on 26 May 2013

thankyou so much for your replaying, actually you are right, i do not have good idea about matlab. as well, i have not written this program, i found it in: http://www.mathworks.com/matlabcentral/fileexchange/39660-secret-image-sharing-scheme/content/Secret%20Image%20Sharing%20Schemes/ImageSharing.m

but when i try to run it i got that error, however i apply your advise. pleas can you help me to run this code?

Image Analyst on 26 May 2013

Because it's not my File Exchange submission, I suggest you contact the author.

Image Analyst

Contact us