How to get the pixel vales along a line?
조회 수: 10 (최근 30일)
이전 댓글 표시
Let's say i want the pixel values along a line that connects two points
lat11 = 72;
lat21 = 81;
long12 = -150;
long22 = -180;
If i do the following i get the pixels for the entire area instead, How to get the pixels just along the line
[i1,j1] = find((lat1>=lat11 & lat1<=lat21) &(long1 >=long22 & long1<=long12));
댓글 수: 0
답변 (2개)
Walter Roberson
2017년 10월 27일
However, you appear to be using a map.
If your georeference just happens to be rectangular linear, then you can use improfile() by matching lat and long to array indices.
However, your latitudes are much too high for you to be able to meaningfully use a rectangular linear georeference: there is very significant compression of the lines that far north.
At this point you need to start asking yourself which "line" you are talking about: Great Cicle? Small Circle? Geodesic taking into account the oblateness of the Earth? You appear to be looking up in the Beaufort Sea or the Arctic Ocean, where there might possibly have been significant scraping or depression due to glaciers, so you might need a more detailed shape model. There might perhaps be a Mapping Toolbox tool that is usable for this purpose; I am not familiar enough with that toolbox to say.
댓글 수: 2
Walter Roberson
2017년 10월 27일
m_map appears to be a third-party package https://www.eoas.ubc.ca/~rich/map.html . I am not familiar with that package.
Jan
2017년 10월 27일
It depends on what "the pixels" are. You can get n points on the line from [lat11, long12] to [lat21, long22] (by the way: strange names!):
n = 100;
latPos = linspace(lat11, lat21, n);
longPos = linspace(long21, long22, n);
In your question the variables "lat1" and long1" appear, but you did not explain any details. Perhaps they are matrices and you want to get the pixels nearest to the line? Or all pixels, which are touched by this line? This must be clarified at first.
참고 항목
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!