我想在matlab中画一个带有渐变颜色的圆,但我不能。有谁可以帮助我吗?
示例图片可以在这里找到
这是一种方法 -
N = 200; %// this decides the size of image
[X,Y] = meshgrid(-1:1/N:1, -1:1/N:1) ;
nrm = sqrt(X.^2 + Y.^2);
out = uint8(255*(nrm/min(nrm(:,1)))); %// output image
figure, imshow(out) %// show image
Output -
如果您想用白色边界填充输出,如预期输出图像所示,您可以使用padarray -
padsize = 50; %// decides the boundary width
out = padarray(out,[padsize padsize],255);
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)