gpt4 book ai didi

matlab - 如何在 Matlab polaraxes 上链接数据图像?

转载 作者:行者123 更新时间:2023-12-03 21:36:46 25 4
gpt4 key购买 nike

我正在尝试 linkdata极轴上的图像,很好地描述了plot/area/... 作为 linkdata 中的笛卡尔坐标系文档 here .第一段使用基于 alpha 值的剪切生成两个图像的代码。第二部分循环并在极轴上绘制这些图像。第一次迭代后,linkdata on激活但我收到不提供的通知 Fix it选项通常在图 1 中。我认为错误在于我无法显式定义 linkdata 的数据源。作为图像,请参见尝试 1。代码

close all; clear all; clc;
af = figure('Name', 'Do Not Touch');
%% Data generation
f = figure;
hax = axes(f);
rgb = 'peppers.png';
% http://blogs.mathworks.com/steve/2009/02/18/image-overlay-using-transparency/
rgb = imread('peppers.png');
I = rgb2gray(rgb);
h = imagesc(I, 'Parent', hax);
[M,N] = size(I);
block_size = 50;
P = ceil(M / block_size);
Q = ceil(N / block_size);
alpha_data = checkerboard(block_size, P, Q) > 0;
alpha_data = alpha_data(1:M, 1:N);
set(h, 'AlphaData', alpha_data.^2);
zeroFigureDecorations(hax);
images{1} = getframe(hax);

[M,N] = size(I);
block_size = 50*2;
P = ceil(M / block_size);
Q = ceil(N / block_size);
alpha_data = checkerboard(block_size, P, Q) > 0;
alpha_data = alpha_data(1:M, 1:N);
set(h, 'AlphaData', alpha_data.^2);
images{2} = getframe(hax);

close all;
clearvars -except images;

%% Polar
% http://stackoverflow.com/a/40063951/54964
fp=figure('Name', 'Test', ...
'Position',[200 200 851 404],'Resize','off'); % only half circle on polaraxes although warp can do eclipses
ThetaTicks = 0*pi:pi/10:1*pi;
pax = polaraxes( 'ThetaAxisUnits', 'radians', ...
'ThetaLim',[min(ThetaTicks) max(ThetaTicks)],...
'Color','none',...
'GridAlpha',1,...
'GridColor',[1 1 1],...
'ThetaTick', ThetaTicks, ...
'ThetaDir', 'counterclockwise', ...
'Parent', fp);
imax = axes('Parent', fp, 'Visible', 'off');
zeroFigureDecorations(imax);

for image=images
h = imagesc(image{1}.cdata, 'Parent', imax);

zeroFigureDecorations(imax);

linkdata on;

angleRadians=-pi;
I = getframe(pax);
I = I.cdata;
[x, y, z]=makePolar(I, angleRadians);
imax.Children = warp(x, y, z, I);
set(imax,'view',[-180 -90],'Visible','off');
axis(imax,'tight')
pause(0.5);
end

function zeroFigureDecorations(ax)
axis(ax, 'tight');
set(ax, 'yTickLabel', []);
set(ax, 'xTickLabel', []);
set(ax, 'Ticklength', [0 0]); % http://stackoverflow.com/a/15529630/54964
colormap(ax, gray(1024));
box(ax, 'off');
axis(ax, 'off');
end

图。 1 单幅图像在极轴上是正确的,这里是在第二次迭代之后;顶部栏显示失败的 linkdata尝试但不提供 Fix it像往常一样的选项

enter image description here

尝试 1

显式设置guihandlesdatasources但没有效果可能是因为没有明确应用 linkdata以图像为数据源

...
myhandles = guihandles(fp);
for image=images
h = imagesc(image{1}.cdata, 'Parent', imax);
myhandles.output = h;
myhandles.yData = [];
myhandles.xData = [];
set(get(myhandles.xData, 'Children'), 'XDataSource', myhandles.xData);
set(get(myhandles.yData, 'Children'), 'YDataSource', myhandles.yData);
...
end

MathWorks 的联系人

MATLAB 反馈论坛回答

The short answer is that polaraxes does support data linking, however it looks like you are using warp, which is creating a type of surface object that does not support data linking. There are workarounds for this, for example you might be able to modify the warp.m file to use surf rather than surface.

我正在处理有关该主题的服务请求。

MATLAB:2016b
操作系统:Debian 8.5
MathWorks 服务请求:#02229120

最佳答案

MATLAB support answer是当前的,因为没有关于修复的开发计划

The short answer is that polaraxes does support data linking, however it looks like you are using warp, which is creating a type of surface object that does not support data linking. There are workarounds for this, for example you might be able to modify the warp.m file to use surf rather than surface.

关于matlab - 如何在 Matlab polaraxes 上链接数据图像?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40096995/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com