How to store SURF features of multiple images

조회 수: 3 (최근 30일)
KDR
KDR 2017년 1월 12일
댓글: lebed toufik 2022년 2월 19일
Hello all, I'm using SURF descriptor for feature extraction from folder of images. The result i.e. surf features are of different dimension for different image i.e. N*64, N varies with each image. These features are to be classified using knn classifier,one image with all of its features as one class. But KNN classifier takes each row wise features as one class. So how to classify this varying row size features or how to store this in a format that is passed as input to KNN classifier. Below is the code where "features1{i}" contains all the surf features.
srcFiles = dir('C:\Users\nmamit\Documents\MATLAB\photos\*.jpg'); % the folder in which ur images exists
for i = 1 : length(srcFiles)
filename = strcat('C:\Users\nmamit\Documents\MATLAB\photos\',srcFiles(i).name);
I1 = rgb2gray(imread(filename));
points1 = detectSURFFeatures(I1);
feature = zeros(1, length(srcFiles))
[features1{i}, valid_points1{i}] = extractFeatures(I1, points1);
figure; imshow(I1);hold on;
plot(valid_points1{i}.selectStrongest(10),'showOrientation',true);
end
  댓글 수: 1
KS
KS 2017년 8월 14일
Hi, I am having the same problem. Can you please tell me if you came up with a solution?
Thanks.

댓글을 달려면 로그인하십시오.

답변 (1개)

KSSV
KSSV 2017년 1월 12일
Store them into cells.
srcFiles = dir('C:\Users\nmamit\Documents\MATLAB\photos\*.jpg'); % the folder in which ur images exists
Features = cell(length(srcFiles),1) ;
Valid_points = cell(length(srcFiles),1) ;
for i = 1 : length(srcFiles)
filename = strcat('C:\Users\nmamit\Documents\MATLAB\photos\',srcFiles(i).name);
I1 = rgb2gray(imread(filename));
points1 = detectSURFFeatures(I1);
[features1, valid_points1] = extractFeatures(I1, points1);
Features{i} = features1 ;
Valid_points{i} = valid_points1 ;
figure; imshow(I1);hold on;
plot(valid_points1{i}.selectStrongest(10),'showOrientation',true);
end
Features
Valid_points
  댓글 수: 3
KSSV
KSSV 2017년 1월 12일
YOu can access the feature you want using Features{i}
lebed toufik
lebed toufik 2022년 2월 19일
@KSSV I used the features {i} but still the same problem.

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Image and Video Ground Truth Labeling에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by