20060113-Synthesizing images using simple equations

本文介绍了如何使用MATLAB中的meshgrid和cart2pol函数合成不同类型的图像,包括同心圆环和基于极坐标的图像,并展示了如何利用这些函数生成特定的图像图案。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

原文:http://blogs.mathworks.com/steve/2006/01/13/synthesizing-images-using-simple-equations/

MATLAB functions featured: meshgridcart2pol

Image Processing Toolbox functions featured: imshow

Concentric rings

x = linspace(-pi, pi, 201);
% If you pass meshgrid only one vector, it uses that vector for both the x
% and the y coordinates.
[xx, yy] = meshgrid(x);
A = 10;
I = sin(A*(xx.^2 + yy.^2));

% Specify the range -1 to 1 when displaying the image.
imshow(I, [-1 1])

Using polar coordinates

If you want to construct an image from a function of polar coordinates, use cart2pol in conjunction with meshgrid.

[xx, yy] = meshgrid(-125:125);
[theta, R] = cart2pol(xx, yy);
I = sin(50*theta);
imshow(I, [-1 1])


函数 cart2pol 是分别把 (xx(1, 1), yy(1, 1)), (xx(1, 2), yy(1, 2)), ..., (xx(n, n), yy(n, n)),为坐标的笛卡尔坐标转换为极坐标。即把对应点的坐标转换为极坐标。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值