How to extract patch of 4*4 size on the extracted SIFT features Keypoint (for eg: SIFT feature of an image 961*128)?

4 ビュー (過去 30 日間)
Extraction a patch size of 4*4 on the keypoints extracted from the SIFT feature extraction. example for an image I have got SIFT feature as 650*128.

回答 (1 件)

Gautam
Gautam 2025 年 1 月 9 日
Hello Dheer,
You can modify the code below to extract patches from the SIFT Features key points
for i = 1:length(valid_points)
% Get the position of the keypoint
x = round(valid_points(i).Location(1));
y = round(valid_points(i).Location(2));
% Define the patch boundaries
x_start = max(1, x - half_patch);
x_end = min(size(img, 2), x + half_patch - 1);
y_start = max(1, y - half_patch);
y_end = min(size(img, 1), y + half_patch - 1);
% Extract the patch
patch = img(y_start:y_end, x_start:x_end);
% Ensure the patch is 4x4 by padding if necessary
if size(patch, 1) < patch_size || size(patch, 2) < patch_size
patch = padarray(patch, [patch_size - size(patch, 1), patch_size - size(patch, 2)], 'post');
end
% Display or process the patch as needed
% imshow(patch); pause(0.1); % Uncomment to display each patch
end

カテゴリ

Help Center および File ExchangeFeature Detection and Extraction についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by