Transform image or a set of point from the direction of eigenvector

3 ビュー (過去 30 日間)
Maia2022
Maia2022 2022 年 7 月 28 日
回答済み: Hari 2023 年 9 月 4 日
Hi,
I'm using the function:
[outIm,whatScale,Direction] = FrangiFilter2D(I, options) in
where Direction is a matrix from computing the direction of the minor eigenvector:
% Calculate (abs sorted) eigenvalues and vectors
[Lambda2,Lambda1,Ix,Iy]=eig2image(Dxx,Dxy,Dyy);
% Compute the direction of the minor eigenvector
angles = atan2(Ix,Iy)
I'd like to use Direction to transform the original image (or a set of original points) in order to correct the warping.
How could I do this without using imtransform or imwarp ?
Thank you,
Best

回答 (1 件)

Hari
Hari 2023 年 9 月 4 日
Hi Maia,
As per my understanding, you want to use the Direction matrix to transform the original image without using the built-in imtransform or imwarp functions in MATLAB.
You can do so by manually applying the transformation using interpolation techniques. You can follow the below steps:
  1. Obtain the size of the original image.
[height, width] = size(I);
2. Create a grid of coordinates representing the pixel locations in the original image.
[X, Y] = meshgrid(1:width, 1:height);
3. Calculate the displacement vectors using the Direction matrix.
displacementX = Direction(:,:,1);
displacementY = Direction(:,:,2);
4. Apply the displacement vectors to the grid of coordinates.
newX = X + displacementX;
newY = Y + displacementY;
5. Perform interpolation to obtain the transformed image or transformed set of points.
transformedIm = interp2(X, Y, I, newX, newY, 'linear', 0);
% For transforming a set of points represented by pointsX and pointsY:
transformedPointsX = interp2(X, Y, pointsX, newX, newY, 'linear', 0);
transformedPointsY = interp2(X, Y, pointsY, newX, newY, 'linear', 0);
Refer the below documentation to learn more about interp2 function in MATLAB.

カテゴリ

Help Center および File ExchangeGeometric Transformation and Image Registration についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by