Reading an image in MATLAB [duplicate] - matlab

This question already has answers here:
How to read images from folders in matlab
(3 answers)
Closed 6 years ago.
I want to load an image in MATLAB :
f=imread('fulldirectory');
m=size(f);
printf('m');
MATLAB shows me this error when I attempt to run it:
"Error using imread (line 349)"
Can anyone help me?

Imread function needs a file format, e.g., jpg.
You can use one of the following MATLAB codes.
f = imread('ngc6543a.jpg');
f = imread('ngc6543a', 'jpg');
Also, just omit the semicolon (;) from your second line of your codes, if you want to know the dimension of the image. MATLAB will display the size of the image.
m=size(f)
MATLAB has some test images such as ngc6543a.jpg and you can try my code in your MATLAB.

Related

How to read multiple images using a loop in MATLAB? [duplicate]

This question already has answers here:
How to read mutliple images in a for loop in MATLAB?
(2 answers)
Closed 6 years ago.
I have a folder with the images that I want to read into MATLAB and perform various built-in functions and matrix operations to those input images.
Could anyone possibly help me figure it out?
assuming your images are .jpg:
files = dir('directory*.jpg');
for i=1:length(files)
images{i} = imread(files(i).name);
end
reads all images in current directory into cell array images
this one reads from directory:
directory = 'path to your directory';
files = dir([directory '/*.jpg']);
for i=1:length(files)
images{i} = imread([directory '/' files(i).name]);
end

How to Load a .txt file into an matrix of matlab [duplicate]

This question already has an answer here:
read from a text file and load it into a matrix in matlab [duplicate]
(1 answer)
Closed 7 years ago.
Good day.
I would like to know how to load a .txt file in matlab. What I want is to work with text classification and guess the first thing to do is load devo my data in matlab .... but when I try to generate many files .my I just want an array containing my text.
Greetings and thanks in advance.
There's multiple functions that do that: importdata,textscan,fopen,dlmread etc.
I do not understand much from your question, but begin by reading through these documentation pages and try them to see which works best for you.

imwrite matlab "You may not have write permission." [duplicate]

This question already has an answer here:
I am encountering an error while using imwrite
(1 answer)
Closed 7 years ago.
I have this with imwrite in matlab it says: "You may not have write permission." I tried to change the format of the image but It doesn't work.
Check to see if that file already exists and is open somewhere outside MATLAB. It will fail if it is.

Reading .ply files in matlab

How do I read a mesh file (.ply) and display it in Matlab?
Also, how can I change the camera viewpoint of said model?
Thanks
Go to this link : http://people.sc.fsu.edu/~jburkardt/m_src/ply_display/ply_display.m
and save this file.
The ply_display.m is a Matlab function (as opposed to a Matlab script). A Matlab function will usually need an input. You can call the ply_display function by being in the same folder as the .m file. You call it this way :
ply_display('file.ply')
%where
%'file.ply' is the name of the file
I see that this question was raised 2 years ago. But MATLAB R2015a seems to have what you wanted:
ptCloud = pcread(filename)
http://www.mathworks.com/help/vision/ref/pcread.html

Can matlab read an image file stored in *.raw format [duplicate]

This question already has answers here:
Closed 10 years ago.
Possible Duplicate:
Is there a function in MATLAB that converts a .raw file into a matrix?
I have a image stored in .raw format. I would like to read it with matlab. Is it possible?
If not, what shld i do such that matlab can read .raw format?
There is a SO topic you can check out. Is there a function in MATLAB that converts a .raw file into a matrix? .
Also you can check multibandread.