Question: Determine a process where you can acquire an image and use Matlab commands to get that image into Matlab. Make sure you can read in
Determine a process where you can acquire an image and use Matlab commands to get that image into Matlab. Make sure you can read in gray-scale images. See if you can use the command imread. You can always use the following for reading and writing .raw images, those without a header. Below is the code for reading in a 400H x 200V image in .raw format named image.raw. Note that a, .raw, .bin, or no extension may be used, but the extension must match the file. The variable a contains the image. Note that the last line transposes the image. If you created a file image using Matlab, the last line may be needed because of the way the data is stored. fid=fopen('image.raw'); a=fread(fid,[400,200],'type'); fclose(fid); a=a'; Where type is a variable type such as: schar - 8-bit signed character, uchar - 8-bit unsigned character, uint16 - 16-bit unsigned integer, int16 - 16-bit signed integer, float - 32-bit floating point. You can write an image to a file in a format without a header. It is the same as the .raw format. (or .bin) The following code puts the contents of the variable result into a file named file. The data can be stored as different types. fid=fopen('file','wb'); fwrite(fid,result,'type');
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
