我需要用 Octave 生成一个黑白棋盘格。我想使用这个虚拟图像将笛卡尔投影转换为极坐标或透视投影。任何人都可以显示脚本?谢谢
我试过这个:
clear all
close all
clc
img = magic(16);
%# convert coordinates from cartesian to polar
[r c] = size(img);
[X Y] = meshgrid(1:c,1:r);
[theta rho] = cart2pol(X, Y);
figure
subplot(121), image(img), axis square
colormap(gray(256))
subplot(122), surf(theta, rho,img),axis square;
view(0,90)