フィルターのクリア

Images not performing all functions inside for loop!!

2 ビュー (過去 30 日間)
Tinna Armasamy
Tinna Armasamy 2017 年 5 月 23 日
コメント済み: Tinna Armasamy 2017 年 5 月 23 日
This is my coding done to read all images from a folder and allow each image to perform a list of feature extraction function and then export each value to excel sheet. But unfortunately my coding shoes value of m = 16(no of images in the folder) but only gives values for one image. Only 6 values(6 features extracted) is exported to excel sheet instead of 96 values. How do i fix this?
Dir = 'C:\Users\Administrator\Desktop\Tinna\PROJECT\soil_jpg\DataSet';
images = dir(fullfile(Dir,'*.jpg'));
for m = 1 : length(images)
Img = imread(fullfile(Dir,images(m).name));
Img = imadjust(Img,stretchlim(Img));
Img = imresize(Img,[256,256]);
hsvHist = hsvHistogram(Img);
autoCorrelogram = colorAutoCorrelogram(Img);
color_moments = colorMoments(Img);
% for gabor filters we need gray scale image
img = double(rgb2gray(Img))/255;
[meanAmplitude, msEnergy] = gaborWavelet(img, 4, 6); % 4 = number of scales, 6 = number of orientations
wavelet_moments = waveletTransform(Img);
Feature_Vector = [hsvHist autoCorrelogram color_moments meanAmplitude msEnergy wavelet_moments];
whos Feature_Vector
F1 = mean2(hsvHist(:));
F2 = mean2(autoCorrelogram(:));
F3 = mean2(color_moments(:));
F4 = mean2(meanAmplitude(:));
F5 = mean2(msEnergy(:));
F6 = mean2(wavelet_moments(:));
end
xlswrite('testdata.xlsx',[F1 F2 F3 F4 F5 F6]);

採用された回答

KSSV
KSSV 2017 年 5 月 23 日
編集済み: KSSV 2017 年 5 月 23 日
You are savin gonly the last image features, you need to save all the image features into a cell/matrix.
Dir = 'C:\Users\Administrator\Desktop\Tinna\PROJECT\soil_jpg\DataSet';
images = dir(fullfile(Dir,'*.jpg'));
F1 = cell(length(images),1) ;
F2 = cell(length(images),1) ;
F3 = cell(length(images),1) ;
F4 = cell(length(images),1) ;
F5 = cell(length(images),1) ;
F6 = cell(length(images),1) ;
for m = 1 : length(images)
Img = imread(fullfile(Dir,images(m).name));
Img = imadjust(Img,stretchlim(Img));
Img = imresize(Img,[256,256]);
hsvHist = hsvHistogram(Img);
autoCorrelogram = colorAutoCorrelogram(Img);
color_moments = colorMoments(Img);
% for gabor filters we need gray scale image
img = double(rgb2gray(Img))/255;
[meanAmplitude, msEnergy] = gaborWavelet(img, 4, 6); % 4 = number of scales, 6 = number of orientations
wavelet_moments = waveletTransform(Img);
Feature_Vector = [hsvHist autoCorrelogram color_moments meanAmplitude msEnergy wavelet_moments];
whos Feature_Vector
F1{m} = mean2(hsvHist(:));
F2{m} = mean2(autoCorrelogram(:));
F3{m} = mean2(color_moments(:));
F4{m} = mean2(meanAmplitude(:));
F5{m} = mean2(msEnergy(:));
F6{m} = mean2(wavelet_moments(:));
end
xlswrite('testdata.xlsx',[F1 F2 F3 F4 F5 F6]);
  1 件のコメント
Tinna Armasamy
Tinna Armasamy 2017 年 5 月 23 日
Thank you for the help! It works!

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeDeep Learning for Image Processing についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by