Adding text at the specified coordinates on the geoglobe and filling the space between the lines geoplot3

7 ビュー (過去 30 日間)
Warm welcome,
Based on the coordinates of the international space station and the selected location, I created a figure as in the uploaded photo.
I have scrolled through the documentation 2 times and can't find there whether it is possible to add text at specific coordinates (e.g. "ISS(1)" in place of the first coordinates), also I can't find information on how to fill the space between the red, green and yellow lines. To create something like image #2.
I have tried using textm(Lat,Long,h,'ISS(1)') and fill() comments, but these only work on a 2-D map.
I would appreciate your help in solving this puzzle.
Kind regards,

回答 (1 件)

Apeksha Bagrecha
Apeksha Bagrecha 2022 年 9 月 21 日
If you have the Computer Vision System Toolbox, you can use the "insertText" function:
For example:
I = imread('peppers.png');
J = insertText(I, [100 315 ], 'Peppers are good for you!');
"insertText" supports unicode format. Please refer the following link for more information:
If the Computer Vision Toolbox is not available, you can use the following workaround:
You can display a text and use the GETFRAME function to capture the text as an image first. Then you replace the image pixels with the pixels from the text. The code below demonstrates the suggested steps above. Make sure that the image and axes objects are visible within the figure window when executing the GETFRAME command.
% Read example image
im = uint8(255*ind2rgb(X,map));
%% Create the text mask
% Make an image the same size and put text in it
hf = figure('color','white','units','normalized','position',[.1 .1 .8 .8]);
set(gca,'units','pixels','position',[5 5 size(im,2)-1 size(im,1)-1],'visible','off')
% Text at arbitrary position
text('units','pixels','position',[100 100],'fontsize',30,'string','some text')
% Capture the text image
% Note that the size will have changed by about 1 pixel
tim = getframe(gca);
% Extract the cdata
tim2 = tim.cdata;
% Make a mask with the negative of the text
tmask = tim2==0;
% Place white text
% Replace mask pixels with UINT8 max
im(tmask) = uint8(255);
axis off




Community Treasure Hunt

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

Start Hunting!

Translated by