Normalize Matrix to 512?
現在この質問をフォロー中です
- フォローしているコンテンツ フィードに更新が表示されます。
- コミュニケーション基本設定に応じて電子メールを受け取ることができます。
エラーが発生しました
ページに変更が加えられたため、アクションを完了できません。ページを再度読み込み、更新された状態を確認してください。
古いコメントを表示
Dearl all, I have to normalize a matrix to some number (512).
Exactly, my question is related to feature descriptor matrix which I want to normalize to 512. Actually, I have to import feature descriptor into another program that only accepts feature descriptors that are normalized to 512. But I don't get how to normalize the feature descriptor matrix or what does it mean by normalized to 512. I found normalize function in matlab but I don't know how can I use it for this purpose.
Below is the exact line what program asked and I have to do.
[Descriptor Data] is a npoint x 128 unsigned char matrix.
Note the feature descriptors are normalized to 512.
採用された回答
Adam Danz
2019 年 5 月 21 日
I know next to nothing about .sift files but if you search for "512" in this link, you'll find the same instructions you shared but it doesn't describe the normalization process.
According to this resource (again, search for "512" on that page), the sift-based descriptors are L2-Normalized and subsequently multiplied by 512, then rounded to the nearest integer. The description also provides a way to verify that normalization was done correctly.
So, what is L2-normalization? It is a regularization method in machine learning that is better described by this site. Previous answers in this forum have shown that L2-Normalization is straightforward to perform in matlab.
Given all of that information, the normalization would look something like this
% v is your vector
vnorm = round(v/norm(v) * 512);
but you'll need to verify that this is correct by diving into the methods on Koen's website (the 2nd link I shared). I want to be clear that this is where I'd start if I were you but by no means am I inserting confidence that this is what your program (which I've never used) requires. Note that this topic was also discussed here and here (search for "512" on those pages) and those reference agree with the above.
10 件のコメント
Hello, thank you for a detailed and helpful answer. Yes you are right I am doing this to import feature points in VisualSfM and copied that line from their website.
I am still reading from the links you shared, though I wanted to share output of the command you mentioned above. It is giving me a strange output which does not look like a sift descriptor. The output vector is a signed interger having both positive and negative interger values.
Here is how I implemented it and please correct me if I did something wrong here.
I = imread('cameraman.tif');
[r, c, p] = size(I);
if p > 1
I = rgb2gray(I);
end
points = detectSURFFeatures(I);
[features, vldPoints] = extractFeatures(I, points, 'FeatureSize', 128,...
'Method', 'SURF');
% imshow(I); hold on;
% plot(points);
for ii = 1:size(features,1)
v = features(ii,:);
normFeatures(ii,:) = round(v/norm(v) * 512);
end
Thank you once again. It was really helpful.
jhz
2019 年 5 月 23 日
Here is what output look like:

and here are the workspace variables.

Adam Danz
2019 年 5 月 23 日
Maybe instead of normalizing each row of features individually you're supposed to normalize the entire matrix together.
round(features/norm(features) * 512);
(I'm just taking stabs in the dark but it seems more likely that the entire matrix should be normalized together).
jhz
2019 年 5 月 23 日
I tried that too but result is almost similar with more zeros and negative values too.
However, I think that each row of the feature descriptor matrix needs to be normalized as it represents the one feature point.
As I see it, the problem is that you're expecting an n-by-128 char matrix that is normalized using some specified method but 1) the normalization method is not clear and 2) it could be that the "features" matrix aren't the correct data to be normalizing in the first place.
Are you sure the method should be set to "Surf"? When I run this code below, the feature matrix is already an unsigned integer but it's normalized to 256 (class uint8).
I = imread('cameraman.tif');
corners = detectHarrisFeatures(I);
[features, valid_corners] = extractFeatures(I, corners);
features.Features(1:10)
ans =
1×10 uint8 row vector
198 49 51 44 253 251 70 197 120 58
jhz
2019 年 5 月 23 日
Yes, its right. Normalization method is not specified and I am not sure about the features matrix (it might be already normalized).
Yes there is no problem in setting method to SURF, by default it is also SURF for SURFPoints.
I tried your code but I got negative values too in the features matrix. How do you get unsigned integer?
Here is the features matrix:
Adam Danz
2019 年 5 月 23 日
Sorry, I provided the wrong example. I just updated my previous comment to provide the correct example of an unsigned matrix output.
Nevertheless, that shows that extractFeatures() provides different types of outputs depending on the inputs. Note that my inputs are also unsigned in the updated example.
I'm staring to thing that 512 normalization means that the data are set to 2^9 (=512) rather than the uint8 (2^8 = 256) values.
I'm affraid I'm not being much help since my ideas are just stabs in the dark. I've never worked with sift files so I don't know if your data are the correct data or if the normalization process is correct.
jhz
2019 年 5 月 28 日
Hello, thank you again. Yes you were right that SURF features are not the right data to be normalized. Actually, I tried the same process to normalize the SIFT feature descriptors found using the original sift binary in MATLAB and it worked (I matched temp.key file provided by Lowe in the sift folder and my features files and both are same). It means the SURF 'features' are not the right data to normalize.
But the questions is how they are different than SIFT descriptors and how can I convert SURF 'features' to SIFT descriptors?
Adam Danz
2019 年 5 月 28 日
I suggest you start a new question on that topic so others might see it. Maybe someone who has experience working with those files can chip in.
その他の回答 (0 件)
カテゴリ
ヘルプ センター および File Exchange で SIFT - Scale Invariant Feature Transform についてさらに検索
参考
Web サイトの選択
Web サイトを選択すると、翻訳されたコンテンツにアクセスし、地域のイベントやサービスを確認できます。現在の位置情報に基づき、次のサイトの選択を推奨します:
また、以下のリストから Web サイトを選択することもできます。
最適なサイトパフォーマンスの取得方法
中国のサイト (中国語または英語) を選択することで、最適なサイトパフォーマンスが得られます。その他の国の MathWorks のサイトは、お客様の地域からのアクセスが最適化されていません。
南北アメリカ
- América Latina (Español)
- Canada (English)
- United States (English)
ヨーロッパ
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)
