Reading and processing Images

Hello I have images saved in a mat file and I'm trying to read and extract feautures from the images. I need help please. Here is my codes reading the txt file
fid = fopen('file.txt');
for i = 1: 100
x = textscan(fid,'%s\n');
fn{i,1};
fn{i,1} = x{1,1};
end
save filenames fn
% My code to read the image I need help with
for i = 1:100
I = imread([fn{i,1}]);

3 件のコメント

Naman Bhaia
Naman Bhaia 2019 年 2 月 26 日
Hey Chidiebere,
The question is not very clear. Can you please explain
  1. The purpose of reading the text file?
  2. Where you want to fit the "code to read the image" ?
  3. What error you are getting?
  4. Your overall aim for the code
Chidiebere Orisakwe
Chidiebere Orisakwe 2019 年 2 月 26 日
編集済み: Chidiebere Orisakwe 2019 年 2 月 26 日
Hello thanks for having a look I deciced to do it differently I'm getting this error :
Error using imread>get _full_ filename(line 565)
Cannot open file 'C :\users\chidiebere \onedrive\documents\project'' . for reading.You might not have read permission.
Error in Imread (line 337)
fullname=get_full_filename(filename);
Here is my code
file_list = dir('C:\Users\Chidiebere\OneDrive\Documents\PROJECT');
nfiles = length(file_list);
mydataGLCM = [];
for k = 1 : nfiles
I = imread(strcat('C:\Users\Chidiebere\OneDrive\Documents\PROJECT',file_list(k).name));
end
GLCM_values = graycomatrix(I);
stats = graycoprops(GLCM_values{'contrast','homogeneity','Correlation','Energy'});
Contrast = stats.Contrast;
Correlation = stats.Correlation;
Energy = stats.Energy;
Homogeneity = stats.Homogeneity;
feat = [Contrast,Correlation,Energy,Homogeneity];
mydataGLCM = [mydataGLCM, feat(:)];
if k == 1
save('newMethod.mat','mydataGLCM');
else
save('newMethod.mat','mydataGLCM','-append');
end
end
Bjorn Gustavsson
Bjorn Gustavsson 2019 年 2 月 27 日
Well, first read the error-message. Then check if it is giving you information of value. In this case:
  1. Does the directory "C :\users\chidiebere \onedrive\documents\project" exist? (Should there be a white-space between the C and the :?, between chidiebere and \onedrive?)
  2. Do you have read-permissions in that directory?
Once youve checked that then you can proceed with further questions.
HTH

サインインしてコメントする。

回答 (0 件)

カテゴリ

タグ

質問済み:

2019 年 2 月 22 日

コメント済み:

2019 年 2 月 27 日

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by