How to normalize the scale of an image to make it scaling invariant?

4 ビュー (過去 30 日間)
Abul Abbas
Abul Abbas 2021 年 2 月 17 日
回答済み: Ayush 2024 年 8 月 12 日
I want to make my image to be scaling invariant by normalizing the scale.

回答 (1 件)

Ayush
Ayush 2024 年 8 月 12 日
Hi Abdul,
scaling invariance can be achieved in the following way through normalization:
  • Normalization : You can normalize the scale of an image by making the highest dimension of the image equal to a given "target size". This way, the image also becomes scaling invariant. Here's a pseudo code for normalization of the image in order to make it scaling invariant.
function normalizedImage = normalizeScale(image, targetSize)
% Get the dimensions of the image
[height, width, ~] = size(image);
% Calculate the scale factor
scaleFactor = targetSize / max(height, width);
% Calculate the new dimensions
newWidth = round(width * scaleFactor);
newHeight = round(height * scaleFactor);
% Resize the image
normalizedImage = imresize(image, [newHeight, newWidth]);
end
BONUS: Another way to achieve scaling-invariance is to use Scale-Invariant Feature Transform (SIFT). You can read more about it in the following documentation : https://in.mathworks.com/help/vision/ref/detectsiftfeatures.html
Hope it Helps!

カテゴリ

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

Community Treasure Hunt

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

Start Hunting!

Translated by