フィルターのクリア

Saving data in an array in .mat file

2 ビュー (過去 30 日間)
Nermeen alami
Nermeen alami 2013 年 2 月 24 日
hi I'm working on image classification project using hue, saturation and value histograms. i get the histograms and i can save it into .mat file but i want to retrieve data to send it to nearest neighbor classifier. i can save the hue, saturation and value histograms of six bins as six values for each histogram (for each image). How can i save the 18 values(6 for hue, 6 for saturation , 6 for value) in one raw for each image (i.e for 15 images i want to have (15 * 19) denominational array in a file, the 19th column is for label). but i have no idea how to do that and if is that doable ?..... this is the code i used
%constants
savefile='hists.mat';
numberofbins=6;
status=1; %means plant leave is not infected
rgbImage = imread('c:/seg.jpg');
% Display the original image.
% Convert to HSV color space
hsv = rgb2hsv(rgbImage);
hsv=im2double(hsv);
% Extract out the individual channels.
h = hsv(:,:,1);
s = hsv(:,:,2);
v = hsv(:,:,3);
% Take histograms
hhist=hist(h(:), numberofbins);
shist=hist(s(:), numberofbins);
vhist=hist(v(:), numberofbins);
save(savefile, 'hhist','shist','vhist','status');
% the result of the previous code as following
b=open('hists.mat')
b =
status: 1
hhist: [264762 146522 3420 483 5137 292]
shist: [233127 3829 47680 120489 4495 10996]
vhist: [102904 4912 85358 84347 2252 140843]
what i wish to have is: 264762 146522 3420 483 5137 292 233127 3829 47680 120489 4495 10996 102904 4912 85358 84347 2252 140843 1 in one raw
thanks a lot... waiting for help :)

採用された回答

the cyclist
the cyclist 2013 年 2 月 24 日
If I understand your question correctly, all you need to do is concatenate each of your values into one vector:
oneVectorToRuleThemAll = [hhist, shist, vhist, status];
and then save that vector like you did other ones.
You could also concatenate multiple vectors like that, vertically, into an array:
oneArray = [v1; v2; v3];
to get your 15x19 array.
  1 件のコメント
Nermeen alami
Nermeen alami 2013 年 2 月 24 日
that's what i want thank u a lot

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeHistograms についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by