combing dem and edge detected image

4 次查看(过去 30 天)
Hi everybody,
I want to combine a dem file (or slope) with an edge detected image? I want to identify some areas in edge detected image using dem or slope.
I think if I could combine them and add the elevation as a new band so that every pixel could have a elevation this problem could be solved but as I am new in matlab I do not know how can I do that.

回答(1 个)

Aishwarya
Aishwarya 2023-10-11
Hi Sedigheh,
I understand you want to combine elevation data from DEM file and edge detected image so that elevation data is available at each pixel of image. One approach could be to add elevation as another dimension to the image.
Below I have provided an example implementation for the same.
% Read the DEM file and the edge detected image
[A,R, cmap] = readgeoraster('boston.dem');
img = imread("edge_detection.jpg");
% Elevation at each point
elevation_data = A;
% Resize image to match size of elevation_data
img_resized = imresize(img, size(elevation_data));
% Concatenate image and elevation data along new dimension
image_with_elevation = cat(3, img, elevation_data);
Please refer to the following link for more information:
Hope this helps!
Regards,
Aishwarya

产品


版本

R2022a

Community Treasure Hunt

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

Start Hunting!

Translated by