- Obtain the size of the original image.
Transform image or a set of point from the direction of eigenvector
3 次查看(过去 30 天)
显示 更早的评论
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
0 个评论
回答(1 个)
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:
[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.
0 个评论
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!