我目前正在MATLAB中爲衛星圖像添加註釋。由於每個文本字段下方的顏色可能會有很大差異,因此我希望在文本下方使用背景顏色,以便於查看和閱讀。使圖像中的註釋框背景半透明
但是,當我這樣做時,很多地形變得模糊。我雖然試圖讓每個文本框的背景顏色都是半透明的,但卻試圖想出一個解決方案。
任何想法?我希望有一些UI元素,我可以將「facealpha」設置爲0.5。我還需要文本來支持被旋轉(如下面的例子所示)。
下面是一些示例代碼和生成的圖像。與衛星數據的工作空間,也可以在鏈接中找到: Example workspace
figure(1);clf
imagesc(xx,yy,Map);
hold on
plot(xInspection,yInspection,'g.-')
% # Two ways of making a rotated text annotation.
% # Cant make background semi-transparent
testAnno= annotation('textarrow',[0.5 0.5],[0.5 0.5], ...
'string','textarrow annotation', ...
'HeadStyle','none','LineStyle', 'none',...
'TextRotation',asin(directionVec(1))*180/pi,...
'TextBackgroundColor',[0.7 0.7 0.7]);
testText = text(mean(xInspection),mean(yInspection),'text annotation', ...
'rotation',asin(directionVec(1))*180/pi, ...
'HorizontalAlignment','right', ...
'color',[0 0 0], ...
'backgroundcolor',[0.7 0.7 0.7], ...
'fontsize',8);
謝謝!看起來很有前途,儘管補丁和文本對象在旋轉後放置在稍微不同的地方。我懷疑他們可能使用不同的樞軸點。 – Vidar