Rotating different parts of the same matrix at different angles using pol2cart and cart2pol.

1 次查看(过去 30 天)
Hi,
I have a code where I can remove a certain region which I am not interested in but in the current configuration, I am using a straight angle however, the path is curved, and that is effecting the results in the optimization part of the code. I executed this part after following discussion in the link. How can I implement the information that I have in terms of "crackline" path to achive removal of that region?
MAT file (File ) is attached which I got from following code:
ysqrtcrackguess = crackline(xsqrtcrackguess);
[Xcrack,Ycrack]=meshgrid(((1:size(verticaldisp,2))-xsqrtcrackguess), ...
ysqrtcrackguess-(1:size(verticaldisp,1)));
inclinangle = atan((previoustipy-ysqrtcrackguess)/...
(previoustipx-xsqrtcrackguess));
[thetang,rhoang] = cart2pol(Xcrack,Ycrack);
if (ysqrtcrackguess-crackline(0))<0
[Xang, Yang] = pol2cart(thetang - inclinangle,rhoang);
else
[Xang, Yang] = pol2cart(thetang + inclinangle,rhoang);
end
crack = Yang<=intradius & Yang>=-intradius & Xang<=sqrt(intradius^2-Yang.^2);
notcrack = Yang<=(intradius+extradius) & Yang>=-(intradius+extradius) &...
Xang<=sqrt((intradius+extradius)^2-(Yang).^2);
% crack= Ycrack<=intradius & Ycrack>=-intradius & ...
% Xcrack<=sqrt(intradius^2-Ycrack.^2);
region= notcrack & ~crack;
% region= Xang.^2+Yang.^2<=extradius^2 & ~crack;
verticaldispregion = verticaldisp(region);
horizontaldispregion = horizontaldisp(region);
%if statement chooses field which has lesser data in case u and v data in
%the region are not equal
if sum(~isnan(horizontaldispregion))< sum(~isnan(verticaldispregion))
dispregion = horizontaldispregion;
else
dispregion = verticaldispregion;
end
verticaldispdata = verticaldispregion(~isnan(dispregion));
horizontaldispdata = horizontaldispregion(~isnan(dispregion));
[theta,rho]=cart2pol(Xang(region), Yang(region));
theta = theta(~isnan(dispregion));
rho = rho(~isnan(dispregion));

回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Geometric 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