Reputation: 1889
I need to know what are the procedures to saves values extracted using a extraction method. Dear people I really need the help.
I'm using GLCM to extract features from an image, they include :
Autocorrelation, Contrast, Correlation, Cluster Prom. etc.
autoc: 3.900316455696202e+00
contr: 1.091772151898734e+00
corrm: 4.581568547804957e-01
corrp: 4.581568547804950e-01
cprom: 2.281526081422013e+01
cshad: 3.969992738911119e+00
dissi: 6.835443037974684e-01
energ: 1.564853388879987e-01
entro: 2.304539365626317e+00
homom: 7.199367088607593e-01
homop: 6.990506329113924e-01
....
But I don't know the procedures to save these value into database (dataset?).
So that later I can compared these values to input/test image features.
I'm searching over the internet but couldn't afford to solve this mainly because facilitation of the new Image Processing Toolbox
which is not available to my old matlab.
My intepretation for the procedures are:
But right now I don't know how to save these values in a database as the later input to a classifier.
Upvotes: 0
Views: 810
Reputation: 14316
A struct
is well suited to save such data, e.g.
database = struct('autoc', 3.900316455696202, 'contr', 1.091772151898734, ...)
On the help page of struct
, there are more examples on how one can fill data into a struct, depending on how you get your data in the first place.
You could e.g. first create an empty struct with pre-defined fields:
database = struct('autoc',{},'contr',{},'corrm',{}, ...)
and then add data with
database(1).autoc = 3.900316455696202;
database(1).contr = 1.091772151898734;
...
and for the next image:
database(2).autoc = 3.900316455696202;
database(2).contr = 1.091772151898734;
...
So, you'll have one struct array in your workspace, which contains all your data. You can access the data e.g. with
database(1)
,
which returns all features of the first image.
You can directly access features with database(1).autoc
.
Then, you can get the autoc
field of all images with [database(:).autoc]
.
To save this database to a file, you can use the save
function, which is simply
save('your_filename.mat', 'database')
Upvotes: 1