Compiling features from regionprops with its filename
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
Lim
am 30 Jul. 2015
Kommentiert: Walter Roberson
am 30 Jul. 2015
I am working on extracting features on my images and compiling the features into one file. I want to put the file name under that file too but it only display the name and it's in 'char'.
My code:
files = dir('*_cell.bmp'); %the folder has 5 images with this extension
[m1 n1] = size(files);
Feature = [];
for i = 1:m1
x1 = files(i).name;
[path, name, extension] = fileparts(x1);
OriginalImage = imread(x1);
Blue = OriginalImage(:,:,3);
binaryImage = Blue > 0.1;
CellMeasure = regionprops(binaryImage,'all');
CellArea = CellMeasure.Area;
Feature = [Feature; name CellArea];
end
Output: - on the Workspace, >> Feature 5x10 char
>> Feature
Feature =
0201_cell
0205_cell
0206_cell
0401_cell
4101_cell
Please help.
0 Kommentare
Akzeptierte Antwort
Walter Roberson
am 30 Jul. 2015
Before:
Feature = cell(m1, 2);
In the loop:
Feature(i,:) = {name CellArea};
0 Kommentare
Weitere Antworten (1)
Lim
am 30 Jul. 2015
1 Kommentar
Walter Roberson
am 30 Jul. 2015
Feature(i,:) = [name num2cell(AllFeat)];
This assumes that AllFeat will be strictly a row vector of numeric values. If that is not the case then you would have to construct, for example,
{name RMean CellMeasure.PixelIDList}
Siehe auch
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!