Extract an elevation profile along at specific azimuth using improfiler

조회 수: 9(최근 30일)
I want to be able to extract an elevation profile that is oriented 050 degrees from north throught the entire matrix. However, I need to do this for hundreds of profiles and therefore I don't want to pick the points interactively using improfiler. I want to just tell improfiler to extract a profile along a certain angle from north (in this case 050 degrees). I can extract a profile using the improfile function but as far as I can tell I have to manually enter the x-y coordinates as vectors in order to define the line as 050 from north as I have done in the example below. How can I tell improfiler to extract the elevation data at 050 degress from north where the profile cuts through the entire matirx rather than just a stated vetora and without using the interactive function?
%Plot Profile
I = DEM.Z; % =153 X 223 single matrix that contains the elevation values I wish to profile
x = [195 218]; % Vector with x and y coordinates. These x and y values define a line that trends 50 degrees from north.
% However, I want to be able to extract the data to make an elevation profile through the whole matirx DEM.Z
% at 050 degress from north rather than using the vectors for x and y
y = [153 125];
n = sqrt((abs(x(1,1)-(x(1,2)))^2)+( abs(y(1,1)-(y(1,2)))^2)); %calcualte distance between x and y
[cx,cy,c] = improfile(I,x,y,n);
Eventaully, I want to be able to extract a profile every one meter oriented 050 degress from north along a set line between two points . However, I haven't even thought about how to do this loop yet and at this point all I want to know is how to get the profile at 050 through the entire matrix.
Any advice is greatly approciated! Thanks

채택된 답변

darova
darova 2019년 10월 29일
Here is simple scheme that should help
321.png
You can find size of an image
[m,n,k] = size(I);
x1 = n/2; % half of width
y1 = 0; % start Y
dx = 100; % width of a line
x2 = x1 + dx; % X2
y2 = y1 + dx*tand(50); % end Y
Use for loop to create a few lines

추가 답변(0개)

Community Treasure Hunt

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

Start Hunting!

Translated by