How can I store 10 strongest points of surf features of multiple images in one variable using matlab?

1 次查看(过去 30 天)
i have 40 images i extract the surf features 10 strongest points in a loop but the variable where i stored the values, it gives me the values of last image i.e. 10x2 values. i want to save the values for all 40 images in that single variable.how can i get for all images?? for 40 images my desired result is 40x 2. any help will be really appreciated.thanks
  2 个评论
Farman Shah
Farman Shah 2018-8-9
编辑:Stephen23 2018-8-9
this is my code
srcFiles = dir('mypath\*.jpg');
for i = 1 : length(srcFiles)
filename = strcat('mypath',srcFiles(i).name);
input_images = imread(filename);
I2=rgb2gray(input_images);
points1 = detectSURFFeatures(input_images)
strongest = points1.selectStrongest(10);
%
plot(strongest);
strong= round(strongest.Location);
end
Stephen23
Stephen23 2018-8-9
Farman Shah's "Answer" moved here:
the code is working fine but stores only the 10 strongest points of the last image ..i want it to sotre for multiple images in a single variable.so then i can label it for further classification..any hope???

请先登录,再进行评论。

采纳的回答

Stephen23
Stephen23 2018-8-9
编辑:Stephen23 2018-8-9
Just use a cell array and indexing:
D = 'mypath';
S = dir(fullfile(D,'*.jpg'));
N = numel(S);
C = cell(1,N);
for kk = 1:N
filename = fullfile(D,S(kk).name);
...
strongest = points1.selectStrongest(10);
C{kk} = strongest;
end
Then the strongest values for each loop iteration are stored in the cell array C.
It is recommended to use fullfile rather than concatenating strings and messing about with file separactor characters.
  10 个评论
Farman Shah
Farman Shah 2018-8-9
编辑:Farman Shah 2018-8-9
okay thank you so much stephen Cobeldick sir..your idea was great and helpful...i asked another question. please have a look of that question too..

请先登录,再进行评论。

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Matrix Indexing 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by